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

366 lines
957 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[250,6,7],{"+NIl":function(ft,tt,ie){(function(se){se(ie("VrN/"))})(function(se){"use strict";se.defineMode("stex",function(J,D){"use strict";function $(A,_){A.cmdState.push(_)}function O(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function M(A){var _=A.cmdState.pop();_&&_.closeBracket()}function z(A){for(var _=A.cmdState,E=_.length-1;E>=0;E--){var u=_[E];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function W(A,_,E){return function(){this.name=A,this.bracketNo=0,this.style=_,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var U={};U.importmodule=W("importmodule","tag",["string","builtin"]),U.documentclass=W("documentclass","tag",["","atom"]),U.usepackage=W("usepackage","tag",["atom"]),U.begin=W("begin","tag",["atom"]),U.end=W("end","tag",["atom"]),U.label=W("label","tag",["atom"]),U.ref=W("ref","tag",["atom"]),U.eqref=W("eqref","tag",["atom"]),U.cite=W("cite","tag",["atom"]),U.bibitem=W("bibitem","tag",["atom"]),U.Bibitem=W("Bibitem","tag",["atom"]),U.RBibitem=W("RBibitem","tag",["atom"]),U.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(A,_){A.f=_}function y(A,_){var E;if(A.match(/^\\[a-zA-Z@]+/)){var u=A.current().slice(1);return E=U.hasOwnProperty(u)?U[u]:U.DEFAULT,E=new E,$(_,E),R(_,k),E.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return R(_,function(s,d){return C(s,d,"\\]")}),"keyword";if(A.match("\\("))return R(_,function(s,d){return C(s,d,"\\)")}),"keyword";if(A.match("$$"))return R(_,function(s,d){return C(s,d,"$$")}),"keyword";if(A.match("$"))return R(_,function(s,d){return C(s,d,"$")}),"keyword";var o=A.next();if(o=="%")return A.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=O(_),E)E.closeBracket(o),R(_,k);else return"error";return"bracket"}else return o=="{"||o=="["?(E=U.DEFAULT,E=new E,$(_,E),"bracket"):/\d/.test(o)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),E=z(_),E.name=="begin"&&(E.argument=A.current()),E.styleIdentifier())}function C(A,_,E){if(A.eatSpace())return null;if(E&&A.match(E))return R(_,y),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=A.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(A.skipToEnd(),"comment"):"error"}function k(A,_){var E=A.peek(),u;return E=="{"||E=="["?(u=O(_),u.openBracket(E),A.eat(E),R(_,y),"bracket"):/[ \t\r]/.test(E)?(A.eat(E),null):(R(_,y),M(_),y(A,_))}return{startState:function(){var A=D.inMathMode?function(_,E){return C(_,E)}:y;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,_){return _.f(A,_)},blankLine:function(A){A.f=y,A.cmdState.length=0},lineComment:"%"}}),se.defineMIME("text/x-stex","stex"),se.defineMIME("text/x-latex","stex")})},"19Vz":function(ft,tt,ie){(function(se){se(ie("VrN/"))})(function(se){se.defineOption("placeholder","",function(W,U,R){var y=R&&R!=se.Init;if(U&&!y)W.on("blur",O),W.on("change",M),W.on("swapDoc",M),se.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){$(W)}),M(W);else if(!U&&y){W.off("blur",O),W.off("change",M),W.off("swapDoc",M),se.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),J(W);var C=W.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}U&&!W.hasFocus()&&O(W)});function J(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function D(W){J(W);var U=W.state.placeholder=document.createElement("pre");U.style.cssText="height: 0; overflow: visible",U.style.direction=W.getOption("direction"),U.className="CodeMirror-placeholder CodeMirror-line-like";var R=W.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),U.appendChild(R),W.display.lineSpace.insertBefore(U,W.display.lineSpace.firstChild)}function $(W){setTimeout(function(){var U=!1,R=W.getInputField();R.nodeName=="TEXTAREA"?U=!R.value:W.lineCount()==1&&(U=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),U?D(W):J(W)},20)}function O(W){z(W)&&D(W)}function M(W){var U=W.getWrapperElement(),R=z(W);U.className=U.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?D(W):J(W)}function z(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(ft,tt,ie){(function(se){se(ie("VrN/"))})(function(se){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};se.defineMode("xml",function($,O){var M=$.indentUnit,z={},W=O.htmlMode?J:D;for(var U in W)z[U]=W[U];for(var U in O)z[U]=O[U];var R,y;function C(a,x){function v(F){return x.tokenize=F,F(a,x)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(_("atom","]]>")):null:a.match("--")?v(_("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=_("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",x.tokenize=k,"tag bracket");if(S=="&"){var B;return a.eat("#")?a.eat("x")?B=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):B=a.eatWhile(/[\d]/)&&a.eat(";"):B=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),B?"atom":"error"}else return a.eatWhile(/[^&<]/),null}C.isInText=!0;function k(a,x){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return x.tokenize=C,R=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return R="equals",null;if(v=="<"){x.tokenize=C,x.state=d,x.tagName=x.tagStart=null;var S=x.tokenize(a,x);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(v)?(x.tokenize=A(v),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(a){var x=function(v,S){for(;!v.eol();)if(v.next()==a){S.tokenize=k;break}return"string"};return x.isInAttribute=!0,x}function _(a,x){return function(v,S){for(;!v.eol();){if(v.match(x)){S.tokenize=C;break}v.next()}return a}}function E(a){return function(x,v){for(var S;(S=x.next())!=null;){if(S=="<")return v.tokenize=E(a+1),v.tokenize(x,v);if(S==">")if(a==1){v.tokenize=C;break}else return v.tokenize=E(a-1),v.tokenize(x,v)}return"meta"}}function u(a,x,v){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=v,(z.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,x){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!z.contextGrabbers.hasOwnProperty(v)||!z.contextGrabbers[v].hasOwnProperty(x))return;o(a)}}function d(a,x,v){return a=="openTag"?(v.tagStart=x.column(),w):a=="closeTag"?m:d}function w(a,x,v){return a=="word"?(v.tagName=x.current(),y="tag",b):z.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,x,v)):(y="error",w)}function m(a,x,v){if(a=="word"){var S=x.current();return v.context&&v.context.tagName!=S&&z.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==S||z.matchClosing===!1?(y="tag",g):(y="tag error",L)}else return z.allowMissingTagName&&a=="endTag"?(y="tag bracket",g(a,x,v)):(y="error",L)}function g(a,x,v){return a!="endTag"?(y="error",g):(o(v),d)}function L(a,x,v){return y="error",g(a,x,v)}function b(a,x,v){if(a=="word")return y="attribute",c;if(a=="endTag"||a=="selfcloseTag"){var S=v.tagName,B=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(S)?s(v,S):(s(v,S),v.context=new u(v,S,B==v.indented)),d}return y="error",b}function c(a,x,v){return a=="equals"?p:(z.allowMissing||(y="error"),b(a,x,v))}function p(a,x,v){return a=="string"?h:a=="word"&&z.allowUnquoted?(y="string",b):(y="error",b(a,x,v))}function h(a,x,v){return a=="string"?h:b(a,x,v)}return{startState:function(a){var x={tokenize:C,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;R=null;var v=x.tokenize(a,x);return(v||R)&&v!="comment"&&(y=null,x.state=x.state(R||v,a,x),y&&(v=y=="error"?v+" error":y)),v},indent:function(a,x,v){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(S&&S.noIndent)return se.Pass;if(a.tokenize!=k&&a.tokenize!=C)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return z.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var B=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(B&&B[1])for(;S;)if(S.tagName==B[2]){S=S.prev;break}else if(z.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(B)for(;S;){var F=z.contextGrabbers[S.tagName];if(F&&F.hasOwnProperty(B[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+M: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=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],v=a.context;v;v=v.prev)v.tagName&&x.push(v.tagName);return x.reverse()}}}),se.defineMIME("text/xml","xml"),se.defineMIME("application/xml","xml"),se.mimeModes.hasOwnProperty("text/html")||se.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6f40":function(ft,tt,ie){ft.exports={practicalTraining:"practicalTraining___14zoU",titleWrap:"titleWrap___2awze",title:"title___3BF26",line:"line___wXl6Y",dec:"dec___ZXNkn"}},"7Cbv":function(ft,tt,ie){"use strict";var se=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function D(){if(!se)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return se(J)}var $=/^(?:[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 O(k){return typeof k=="string"&&$.test(k)}for(var M=O,z=[],W=0;W<256;++W)z.push((W+256).toString(16).substr(1));function U(k){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,_=(z[k[A+0]]+z[k[A+1]]+z[k[A+2]]+z[k[A+3]]+"-"+z[k[A+4]]+z[k[A+5]]+"-"+z[k[A+6]]+z[k[A+7]]+"-"+z[k[A+8]]+z[k[A+9]]+"-"+z[k[A+10]]+z[k[A+11]]+z[k[A+12]]+z[k[A+13]]+z[k[A+14]]+z[k[A+15]]).toLowerCase();if(!M(_))throw TypeError("Stringified UUID is invalid");return _}var R=U;function y(k,A,_){k=k||{};var E=k.random||(k.rng||D)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,A){_=_||0;for(var u=0;u<16;++u)A[_+u]=E[u];return A}return R(E)}var C=tt.a=y},"7ahc":function(ft,tt,ie){"use strict";ie.d(tt,"a",function(){return w});var se=ie("k1fw"),J=ie("0Owb"),D=ie("+L6B"),$=ie("2/Rp"),O=ie("y8nQ"),M=ie("Vl3Y"),z=ie("tJVT"),W=ie("OaEy"),U=ie("2fM7"),R=ie("cDcd"),y=ie.n(R),C=ie("VrN/"),k=ie.n(C),A=ie("p77/"),_=ie.n(A),E=ie("c5Ni"),u=ie.n(E),o=U.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};tt.b=function(m){var g=m.callback,L=m.onCancel,b=Object(R.useState)("python"),c=Object(z.a)(b,2),p=c[0],h=c[1];function a(v){h(d[v][1])}function x(v){g(v)}return y.a.createElement(M.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(U.a,{onChange:a},Object.keys(d).map(function(v){return y.a.createElement(o,{key:v,value:v},d[v][0])}))),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(w,{mode:p})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement($.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function w(m){var g=m.value,L=m.onChange,b=m.mode,c=m.options,p=c===void 0?{}:c,h=Object(R.useRef)(),a=Object(R.useState)(),x=Object(z.a)(a,2),v=x[0],S=x[1];return Object(R.useEffect)(function(){if(v){function B(F){var K=F.getValue();L&&L(K)}return v.on("change",B),function(){v.off("change",B)}}},[v,L]),Object(R.useEffect)(function(){v&&v.setOption("mode",b)},[v,b]),Object(R.useEffect)(function(){v&&((g!==v.getValue()||g==="")&&setTimeout(function(){v.setValue(g||" ")},300))},[v,g]),Object(R.useEffect)(function(){if(h.current&&!v){var B=k.a.fromTextArea(h.current,Object(se.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));S(B)}},[h.current,v]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:h}))}},"7ixt":function(ft,tt,ie){"use strict";ie.d(tt,"a",function(){return D});var se={adjustX:1,adjustY:1},J=[0,0],D={left:{points:["cr","cl"],overflow:se,offset:[-4,0],targetOffset:J},right:{points:["cl","cr"],overflow:se,offset:[4,0],targetOffset:J},top:{points:["bc","tc"],overflow:se,offset:[0,-4],targetOffset:J},bottom:{points:["tc","bc"],overflow:se,offset:[0,4],targetOffset:J},topLeft:{points:["bl","tl"],overflow:se,offset:[0,-4],targetOffset:J},leftTop:{points:["tr","tl"],overflow:se,offset:[-4,0],targetOffset:J},topRight:{points:["br","tr"],overflow:se,offset:[0,-4],targetOffset:J},rightTop:{points:["tl","tr"],overflow:se,offset:[4,0],targetOffset:J},bottomRight:{points:["tr","br"],overflow:se,offset:[0,4],targetOffset:J},rightBottom:{points:["bl","br"],overflow:se,offset:[4,0],targetOffset:J},bottomLeft:{points:["tl","bl"],overflow:se,offset:[0,4],targetOffset:J},leftBottom:{points:["br","bl"],overflow:se,offset:[-4,0],targetOffset:J}},$=D},"8EBN":function(ft,tt,ie){(function(se){se(ie("VrN/"))})(function(se){"use strict";se.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J<se.modeInfo.length;J++){var D=se.modeInfo[J];D.mimes&&(D.mime=D.mimes[0])}se.findModeByMIME=function($){$=$.toLowerCase();for(var O=0;O<se.modeInfo.length;O++){var M=se.modeInfo[O];if(M.mime==$)return M;if(M.mimes){for(var z=0;z<M.mimes.length;z++)if(M.mimes[z]==$)return M}}if(/\+xml$/.test($))return se.findModeByMIME("application/xml");if(/\+json$/.test($))return se.findModeByMIME("application/json")},se.findModeByExtension=function($){$=$.toLowerCase();for(var O=0;O<se.modeInfo.length;O++){var M=se.modeInfo[O];if(M.ext){for(var z=0;z<M.ext.length;z++)if(M.ext[z]==$)return M}}},se.findModeByFileName=function($){for(var O=0;O<se.modeInfo.length;O++){var M=se.modeInfo[O];if(M.file&&M.file.test($))return M}var z=$.lastIndexOf("."),W=z>-1&&$.substring(z+1,$.length);if(W)return se.findModeByExtension(W)},se.findModeByName=function($){$=$.toLowerCase();for(var O=0;O<se.modeInfo.length;O++){var M=se.modeInfo[O];if(M.name.toLowerCase()==$)return M;if(M.alias){for(var z=0;z<M.alias.length;z++)if(M.alias[z].toLowerCase()==$)return M}}}})},"8hTe":function(ft,tt,ie){ft.exports={button:"button___1wy9m"}},"9Bee":function(ft,tt,ie){"use strict";var se=ie("DYRE"),J=ie("zeV3"),D=ie("+L6B"),$=ie("2/Rp"),O=ie("k1fw"),M=ie("9og8"),z=ie("tJVT"),W=ie("WmNS"),U=ie.n(W),R=ie("cDcd"),y=ie.n(R),C=ie("vg9a"),k=ie("DlQD"),A=ie.n(k),_=ie("rUJ1");function E(G,l){var f=G.match(/^(\s+)(?:```)/);if(f===null)return l;var N=f[1];return l.split(`
`).map(function(Q){var H=Q.match(/^\s+/);if(H===null)return Q;var ye=Object(z.a)(H,1),He=ye[0];return He.length>=N.length?Q.slice(N.length):Q}).join(`
`)}var u=[],o=["<ul>"],s=new A.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){u.length=0,o=["<ul>"]}var m={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(G,l,f,N){if(l>=G.length||G[l].level<=f)return l;var Q=G[l];N.push("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),l++;var H=[];return l=g(G,l,Q.level,H),H.length>0&&(N.push("<ul>"),H.forEach(function(ye){N.push(ye)}),N.push("</ul>")),N.push("</li>"),l=g(G,l,f,N),l}function L(){return g(u,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(l){var f=d.exec(l);if(f)return{type:"heading",raw:f[0],depth:f[1].length,text:f[2]}},fences:function(l){var f=this.rules.block.fences.exec(l);if(f){var N=f[0],Q=E(N,f[3]||""),H=f[2]?f[2].trim():f[2];if(["latex","katex","math"].indexOf(H)>=0){var ye=h(),He=Q;Q=ye,a[ye]={type:"block",expression:He}}return{type:"code",raw:N,lang:H,text:Q}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,h=function(){return"__special_katext_id_".concat(p++,"__")},a={};function x(){return a}function v(){p=0,a={}}function S(G){return G=G.replace(c,function(l,f){var N=h();return a[N]={type:"inline",expression:f},N}),G}var B=s.listitem;s.listitem=function(G){return B(S(G))};var F=s.paragraph;s.paragraph=function(G){return F(S(G))};var K=s.tablecell;s.tablecell=function(G,l){return K(S(G),l)},s.code=function(G,l,f){var N=(l||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"<p class='editormd-tex'>".concat(G,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(f?G:Object(_.escape)(G,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(f?G:Object(_.escape)(G,!0))+"</code></pre>"},s.heading=function(G,l,f){var N=this.options.headerPrefix+f.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:N,level:l,text:G}),"<h"+l+' id="'+N+'">'+G+"</h"+l+">"},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:b,renderer:s});var V=A.a,P=ie("SJMd"),I=ie("ulZh"),Y=ie.n(I),ee=ie("m3rI"),oe=ie("Oy/b"),pe=ie("p5ED"),Oe=ie("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var xe=function(G,l){return(xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,N){f.__proto__=N}||function(f,N){for(var Q in N)Object.prototype.hasOwnProperty.call(N,Q)&&(f[Q]=N[Q])})(G,l)};function _e(G,l){function f(){this.constructor=G}xe(G,l),G.prototype=l===null?Object.create(l):(f.prototype=l.prototype,new f)}function Te(G,l,f,N){return new(f||(f=Promise))(function(Q,H){function ye(yt){try{qe(N.next(yt))}catch(Ge){H(Ge)}}function He(yt){try{qe(N.throw(yt))}catch(Ge){H(Ge)}}function qe(yt){var Ge;yt.done?Q(yt.value):(Ge=yt.value,Ge instanceof f?Ge:new f(function(St){St(Ge)})).then(ye,He)}qe((N=N.apply(G,l||[])).next())})}function Ce(G,l){var f,N,Q,H,ye={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(qe){return function(yt){return function(Ge){if(f)throw new TypeError("Generator is already executing.");for(;ye;)try{if(f=1,N&&(Q=2&Ge[0]?N.return:Ge[0]?N.throw||((Q=N.return)&&Q.call(N),0):N.next)&&!(Q=Q.call(N,Ge[1])).done)return Q;switch(N=0,Q&&(Ge=[2&Ge[0],Q.value]),Ge[0]){case 0:case 1:Q=Ge;break;case 4:return ye.label++,{value:Ge[1],done:!1};case 5:ye.label++,N=Ge[1],Ge=[0];continue;case 7:Ge=ye.ops.pop(),ye.trys.pop();continue;default:if(!(Q=ye.trys,(Q=Q.length>0&&Q[Q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ye=0;continue}if(Ge[0]===3&&(!Q||Ge[1]>Q[0]&&Ge[1]<Q[3])){ye.label=Ge[1];break}if(Ge[0]===6&&ye.label<Q[1]){ye.label=Q[1],Q=Ge;break}if(Q&&ye.label<Q[2]){ye.label=Q[2],ye.ops.push(Ge);break}Q[2]&&ye.ops.pop(),ye.trys.pop();continue}Ge=l.call(G,ye)}catch(St){Ge=[6,St],N=0}finally{f=Q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([qe,yt])}}}function me(){for(var G=0,l=0,f=arguments.length;l<f;l++)G+=arguments[l].length;var N=Array(G),Q=0;for(l=0;l<f;l++)for(var H=arguments[l],ye=0,He=H.length;ye<He;ye++,Q++)N[Q]=H[ye];return N}var le=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(l,f){for(var N=0,Q=f;N<Q.length;N++){var H=Q[N],ye=H[0],He=H[1];l.setAttribute(ye,He)}},G.createRect=function(l,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",l.toString()),Q.setAttribute("height",f.toString()),N&&G.setAttributes(Q,N),Q},G.createLine=function(l,f,N,Q,H){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",l.toString()),ye.setAttribute("y1",f.toString()),ye.setAttribute("x2",N.toString()),ye.setAttribute("y2",Q.toString()),H&&G.setAttributes(ye,H),ye},G.createPolygon=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",l),f&&G.setAttributes(N,f),N},G.createCircle=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(l/2).toString()),N.setAttribute("cy",(l/2).toString()),N.setAttribute("r",l.toString()),f&&G.setAttributes(N,f),N},G.createEllipse=function(l,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(l/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(l/2).toString()),Q.setAttribute("ry",(f/2).toString()),N&&G.setAttributes(Q,N),Q},G.createGroup=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&G.setAttributes(f,l),f},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(l,f,N,Q,H,ye,He){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(qe,[["id",l],["orient",f],["markerWidth",N.toString()],["markerHeight",Q.toString()],["refX",H.toString()],["refY",ye.toString()]]),qe.appendChild(He),qe},G.createText=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),l&&G.setAttributes(f,l),f},G.createTSpan=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=l,f&&G.setAttributes(N,f),N},G.createImage=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&G.setAttributes(f,l),f},G.createPoint=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=l,N.y=f,N},G.createPath=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",l),f&&G.setAttributes(N,f),N},G}(),te=function(){function G(){}return G.addKey=function(l){G.key=l},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}(),ce=function(){function G(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return G.prototype.rasterize=function(l,f,N){var Q=this;return new Promise(function(H){var ye=N!==void 0?N:document.createElement("canvas");l===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",f.width.baseVal.valueAsString),He.setAttribute("height",f.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),He.innerHTML=f.innerHTML,Q.naturalSize===!0?(He.width.baseVal.value=l.naturalWidth,He.height.baseVal.value=l.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(He.width.baseVal.value=Q.width,He.height.baseVal.value=Q.height),ye.width=He.width.baseVal.value,ye.height=He.height.baseVal.value;var qe=He.outerHTML,yt=ye.getContext("2d");Q.markersOnly!==!0&&yt.drawImage(l,0,0,ye.width,ye.height);var Ge=window.URL,St=new Image(ye.width,ye.height);St.setAttribute("crossOrigin","anonymous");var Ht=new Blob([qe],{type:"image/svg+xml"}),Jt=Ge.createObjectURL(Ht);St.onload=function(){yt.drawImage(St,0,0),Ge.revokeObjectURL(Jt);var Ur=ye.toDataURL(Q.imageType,Q.imageQuality);H(Ur)},St.src=Jt})},G}(),ae=function(){},Le=function(){function G(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}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(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},G.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Se("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Se("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),Re=function(G,l){this.selector=G,this.style=l},Se=function(G,l){this.localName=G,this.style=l},De=function(){function G(l,f,N,Q,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=f,this.markerItems=N,this.uiStyleSettings=Q,this.styles=H,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(l){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var N=document.createElement("div");N.className=this.toolbarBlockStyleClass.name,N.style.whiteSpace="nowrap",this.uiContainer.appendChild(N),this.addActionButton(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(H){var ye=document.createElement("div");ye.className=""+f.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",H.typeName),ye.innerHTML=H.icon,ye.addEventListener("click",function(){f.markerToolbarButtonClicked(ye,H)}),f.buttons.push(ye),f.markerButtons.push(ye)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<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(Q,'<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(l){this.buttonClickListeners.push(l)},G.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<l||f===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},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 l=this;this.buttons.forEach(function(f){f.className=f.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},G.prototype.addActionButton=function(l,f,N){var Q=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=f,H.setAttribute("data-action",N),H.addEventListener("click",function(){Q.actionToolbarButtonClicked(H,N)}),N){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(H),this.buttons.push(H)},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Se("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 Se("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Se("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Se("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 Se("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Se("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Se("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Se("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},G.prototype.markerToolbarButtonClicked=function(l,f){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(l,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},G.prototype.setActiveMarkerButton=function(l){var f=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===l});f&&this.setActiveButton(f)},G.prototype.setCurrentMarker=function(l){var f=this;this.currentMarker=l,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){f.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},G}(),Me=function(){function G(l,f,N,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=f,this.uiStyleSettings=N,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new Se("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 Se("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Se("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Se("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Se("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 Se("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Se("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
padding: `+f+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Se("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Se("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},G.prototype.show=function(l){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(l){var f,N,Q=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var ye;H.uiStyleSettings=Q.uiStyleSettings;var He=document.createElement("div");He.className=Q.toolboxButtonStyleClass.name+" "+((ye=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:Q.toolboxButtonStyleColorsClass.name),He.innerHTML=H.icon,He.title=H.title,He.addEventListener("click",function(){Q.panelButtonClick(H)}),Q.panelButtons.push(He),Q.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(l){var f=this,N=-1;if(l!==this.activePanel){N=this.panels.indexOf(l),this.panelRow.innerHTML="";var Q=l.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,ye){var He,qe;H.className=f.toolboxButtonStyleClass.name+" "+(ye===N?""+((He=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:f.toolboxActiveButtonStyleColorsClass.name):""+((qe=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&qe!==void 0?qe:f.toolboxButtonStyleColorsClass.name))})},G}(),je=function(G,l){this.title=G,this.icon=l},We=function(G){function l(f,N,Q,H){var ye=G.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=N,ye.currentColor=Q,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return _e(l,G),l.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var H=f.getColorBox(Q);N.appendChild(H),f.colorBoxes.push(H)}),N},l.prototype.getColorBox=function(f){var N=this,Q=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-Q,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=H-2+"px",ye.style.height=H-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(H+2)/2+"px",ye.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){N.setCurrentColor(f,ye)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=H-2+"px",He.style.height=H-2+"px",He.style.backgroundColor=f,He.style.borderRadius=H/2+"px",f==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),ye.appendChild(He),ye},l.prototype.setCurrentColor=function(f,N){var Q=this;this.currentColor=f,this.colorBoxes.forEach(function(H){H.style.borderColor=H===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},l}(je),Be=function(){function G(l,f,N){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=f,this.globalSettings=N,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(l){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(l,f){},G.prototype.dblClick=function(l,f){},G.prototype.manipulate=function(l){},G.prototype.pointerUp=function(l){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},G.prototype.scale=function(l,f){},G.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},G.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},G.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},G.typeName="MarkerBase",G}(),Ue=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},G}(),ot=function(){function G(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},G}(),et=function(){function G(){}return G.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},G.toSVGMatrix=function(l,f){return l.a=f.a,l.b=f.b,l.c=f.c,l.d=f.d,l.e=f.e,l.f=f.f,l},G}(),Ze=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(le.createTransform()),H.setupControlBox(),H}return _e(l,G),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var N=le.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(f){return!!G.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(f);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},l.prototype.pointerUp=function(f){var N=this.state;G.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},l.prototype.manipulate=function(f){var N=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(f)},l.prototype.resize=function(f){var N=this.manipulationStartLeft,Q=this.manipulationStartWidth,H=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+f.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+f.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+f.y-this.manipulationStartY}Q>=0?(this.left=N,this.width=Q):(this.left=N+Q,this.width=-Q),ye>=0?(this.top=H,this.height=ye):(this.top=H+ye,this.height=-ye),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var N=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},l.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},l.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var N=this.container.getCTM(),Q=le.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(N)).x,y:Q.y}},l.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var N=this.container.getCTM();N=N.inverse();var Q=le.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(N)).x,y:Q.y}},l.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var f=le.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=le.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=le.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ue,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},l.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},l.prototype.createGrip=function(){var f=new ot;return f.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(f.visual),f},l.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,N=-f/2,Q=N,H=(this.width+this.CB_DISTANCE)/2-f/2,ye=(this.height+this.CB_DISTANCE)/2-f/2,He=this.height+this.CB_DISTANCE-f/2,qe=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,N,Q),this.positionGrip(this.controlGrips.topCenter.visual,H,Q),this.positionGrip(this.controlGrips.topRight.visual,qe,Q),this.positionGrip(this.controlGrips.centerLeft.visual,N,ye),this.positionGrip(this.controlGrips.centerRight.visual,qe,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,N,He),this.positionGrip(this.controlGrips.bottomCenter.visual,H,He),this.positionGrip(this.controlGrips.bottomRight.visual,qe,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,Q-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(f,N,Q){var H=f.transform.baseVal.getItem(0);H.setTranslate(N,Q),f.transform.baseVal.replaceItem(H,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:et.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:et.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},l.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N);var Q=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:Q.x*f,y:Q.y*N});this.left=H.x,this.top=H.y,this.width=this.width*f,this.height=this.height*N,this.adjustControlBox()},l}(Be),Je=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return _e(l,G),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual)},l.prototype.createVisual=function(){this.visual=le.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},l.prototype.manipulate=function(f){G.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){G.prototype.resize.call(this,f),this.setSize()},l.prototype.setSize=function(){G.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(f){G.prototype.pointerUp.call(this,f),this.setSize()},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},l.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this))},l.prototype.restoreState=function(f){var N=f;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),G.prototype.restoreState.call(this,f),this.setSize()},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setSize()},l.title="Rectangle marker",l}(Ze),pt=function(G){function l(f,N,Q,H){var ye=G.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=N,ye.currentWidth=Q,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return _e(l,G),l.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(Q){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=Q===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentWidth(Q,H)}),N.appendChild(H);var ye=document.createElement("div");ye.innerText=Q.toString(),ye.style.marginRight="5px",H.appendChild(ye);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var qe=document.createElement("hr");qe.style.minWidth="20px",qe.style.border="0px",qe.style.borderTop=Q+"px solid "+f.uiStyleSettings.toolboxColor,qe.style.flexGrow="2",He.appendChild(qe),H.appendChild(He),f.widthBoxes.push(H)}),N},l.prototype.setCurrentWidth=function(f,N){var Q=this;this.currentWidth=f,this.widthBoxes.forEach(function(H){H.style.borderColor=H===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(je),st=function(G){function l(f,N,Q,H){var ye=G.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ye.styles=[],ye.styleBoxes=[],ye.styles=N,ye.currentStyle=Q,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return _e(l,G),l.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(Q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/f.styles.length-5+"%",H.style.borderColor=Q===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentStyle(Q,H)}),N.appendChild(H);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
</svg>`;ye.innerHTML=He,H.appendChild(ye),f.styleBoxes.push(H)}),N},l.prototype.setCurrentStyle=function(f,N){var Q=this;this.currentStyle=f,this.styleBoxes.forEach(function(H){H.style.borderColor=H===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(je),rt=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.strokePanel=new We("Line color",Q.defaultColorSet,Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new pt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new st("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return _e(l,G),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(Je),Pe=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},dt=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return _e(l,G),l.prototype.ownsTarget=function(f){return!!G.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},l.prototype.pointerUp=function(f){var N=this.state;G.prototype.pointerUp.call(this,f),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(f),this._state="select",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},l.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var f=new ot;return f.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(f.visual),f},l.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},l.prototype.positionGrip=function(f,N,Q){var H=f.transform.baseVal.getItem(0);H.setTranslate(N,Q),f.transform.baseVal.replaceItem(H,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},l.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.x1=this.x1*f,this.y1=this.y1*N,this.x2=this.x2*f,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},l}(Be),lt=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.strokePanel=new We("Line color",Q.defaultColorSet,Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new pt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new st("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return _e(l,G),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},l.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(dt),Ne=function(G){function l(f,N,Q,H){var ye=G.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ye.fonts=[],ye.fontBoxes=[],ye.fonts=N,ye.currentFont=Q,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return _e(l,G),l.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(Q){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/f.fonts.length-5+"%",H.style.borderColor=Q===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentFont(Q,H)}),N.appendChild(H);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=Q,ye.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",ye.appendChild(He),H.appendChild(ye),f.fontBoxes.push(H)}),N},l.prototype.setCurrentFont=function(f,N){var Q=this;this.currentFont=f,this.fontBoxes.forEach(function(H){H.style.borderColor=H===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(je),Ke=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=Q.defaultColor,H.fontFamily=Q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new We("Color",Q.defaultColorSet,Q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Ne("Font",Q.defaultFontFamilies,Q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return _e(l,G),l.prototype.ownsTarget=function(f){if(G.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(Q){Q===f&&(N=!0)}),N},l.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},l.prototype.renderText=function(){var f=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(N){f.textElement.appendChild(le.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var f=this.textElement.getBBox(),N=1;if(f.width>0&&f.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/f.width,H=(1*this.height-this.height*this.padding*2/100)/f.height;N=Math.min(Q,H)}return N},l.prototype.getTextPosition=function(f){var N=this.textElement.getBBox(),Q=0,H=0;return N.width>0&&N.height>0&&(Q=(this.width-N.width*f)/2,H=this.height/2-N.height*f/2),{x:Q,y:H}},l.prototype.sizeText=function(){var f=this.textElement.getBBox(),N=this.getTextScale(),Q=this.getTextPosition(N);Q.y-=f.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},l.prototype.manipulate=function(f){G.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(f){G.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},l.prototype.pointerUp=function(f){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,f),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var f=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&N>.9;)N-=.1,f.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var Q=N.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(Q)),N.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),H={x:Q.width*f,y:Q.height*f};N.x-=H.x/2,N.y-=H.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(f){this.text=f.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},l.prototype.dblClick=function(f,N){G.prototype.dblClick.call(this,f,N),this.showTextEditor()},l.prototype.setColor=function(f){this.textElement&&le.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},l.prototype.setFont=function(f){this.textElement&&le.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){var N=f;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),G.prototype.restoreState.call(this,f),this.setSize()},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',l}(Ze),Ee=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=Q.defaultColor,H.lineWidth=Q.defaultStrokeWidth,H.pixelRatio=Q.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new We("Color",Q.defaultColorSet,Q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new pt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return _e(l,G),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var f=le.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(f,N){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(f.x,f.y),this.drawing=!0):G.prototype.pointerDown.call(this,f,N)},l.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){G.prototype.resize.call(this,f),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,f)},l.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),G.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=N[0],H=N[1],ye=N[2],He=N[3],qe=!1,yt=0;yt<this.canvasElement.height;yt++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)f.data[yt*this.canvasElement.width*4+4*Ge+3]>0&&(qe=!0,yt<H&&(H=yt),Ge<Q&&(Q=Ge),yt>He&&(He=yt),Ge>ye&&(ye=Ge));if(qe){this.left=Q/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(ye-Q)/this.pixelRatio,this.height=(He-H)/this.pixelRatio;var St=document.createElement("canvas");St.width=ye-Q,St.height=He-H,St.getContext("2d").putImageData(this.canvasContext.getImageData(Q,H,ye-Q,He-H),0,0),this.drawingImgUrl=St.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},l.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},l.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){this.createVisual(),G.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',l}(Ze),ve=function(G){function l(f,N,Q){var H=G.call(this,f,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=N,H.setCurrentType=H.setCurrentType.bind(H),H}return _e(l,G),l.prototype.getUi=function(){var f=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var Q=function(He){var qe="both";switch(He){case 0:qe="both";break;case 1:qe="start";break;case 2:qe="end";break;case 3:qe="none"}var yt=document.createElement("div");if(yt.style.display="flex",yt.style.flexGrow="2",yt.style.alignItems="center",yt.style.justifyContent="space-between",yt.style.padding="5px",yt.style.borderWidth="2px",yt.style.borderStyle="solid",yt.style.borderColor=qe===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",yt.addEventListener("click",function(){f.setCurrentType(qe,yt)}),N.appendChild(yt),qe==="both"||qe==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",yt.appendChild(Ge)}var St=document.createElement("div");St.style.display="flex",St.style.alignItems="center",St.style.minHeight="20px",St.style.flexGrow="2";var Ht=document.createElement("hr");if(Ht.style.minWidth="20px",Ht.style.border="0px",Ht.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),Ht.style.flexGrow="2",St.appendChild(Ht),yt.appendChild(St),qe==="both"||qe==="end"){var Jt=document.createElement("div");Jt.style.display="flex",Jt.style.alignItems="center",Jt.style.minHeight="20px",Jt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Jt.style.marginRight="5px",yt.appendChild(Jt)}H.typeBoxes.push(yt)},H=this,ye=0;ye<4;ye++)Q(ye);return N},l.prototype.setCurrentType=function(f,N){var Q=this;this.currentType=f,this.typeBoxes.forEach(function(H){H.style.borderColor=H===N?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(je),be=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ve("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return _e(l,G),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},l.prototype.getArrowPoints=function(f,N){var Q=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return f-Q/2+","+(N+H/2)+" "+f+","+(N-H/2)+" "+(f+Q/2)+","+(N+H/2)},l.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="creating"&&this.createTips()},l.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",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},l.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.arrowType=N.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(lt),re=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.fillColor=Q.defaultFillColor,H.strokeWidth=0,H.fillPanel=new We("Color",Q.defaultColorSet,Q.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return _e(l,G),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(Je),ne=function(G){function l(f,N,Q,H){var ye=G.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ye.opacities=[],ye.opacityBoxes=[],ye.opacities=N,ye.currentOpacity=Q,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return _e(l,G),l.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(Q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=Q===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentOpacity(Q,H)}),N.appendChild(H);var ye=document.createElement("div");ye.innerText=100*Q+"%",H.appendChild(ye),f.opacityBoxes.push(H)}),N},l.prototype.setCurrentOpacity=function(f,N){var Q=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(je),de=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=Q.defaultHighlightColor,H.strokeWidth=0,H.opacity=Q.defaultHighlightOpacity,H.fillPanel=new We("Color",Q.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ne("Opacity",Q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return _e(l,G),l.prototype.setOpacity=function(f){this.opacity=f,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="HighlightMarker",l.title="Highlight marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',l}(re),ue='<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>',fe=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=Q.defaultStrokeColor,H.bgColor=Q.defaultFillColor,H.fontFamily=Q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new We("Text color",Q.defaultColorSet,H.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new We("Fill color",Q.defaultColorSet,H.bgColor,ue),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Ne("Font",Q.defaultFontFamilies,Q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new ot,H.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return _e(l,G),l.prototype.ownsTarget=function(f){return G.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},l.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},l.prototype.pointerDown=function(f,N){this.state==="new"&&G.prototype.pointerDown.call(this,f,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,f,N)},l.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,f);else{var N=this.state==="creating";G.prototype.pointerUp.call(this,f),this.setTipPoints(N),this.positionTip()}},l.prototype.manipulate=function(f){if(this.tipMoving){var N=this.unrotatePoint(f);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,f)},l.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",f]]),le.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},l.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},l.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var N=Math.min(this.height/2,15),Q=this.height/5;f&&(this.tipPosition={x:N+Q/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:0},this.tipBase2Position={x:N+Q,y:0}):(this.tipBase1Position={x:0,y:N},this.tipBase2Position={x:0,y:N+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Q,y:0},this.tipBase2Position={x:this.width-N,y:0}):(this.tipBase1Position={x:this.width,y:N},this.tipBase2Position={x:this.width,y:N+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Q,y:this.height},this.tipBase2Position={x:this.width-N,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-N-Q},this.tipBase2Position={x:this.width,y:this.height-N}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:this.height},this.tipBase2Position={x:N+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-N},this.tipBase2Position={x:0,y:this.height-N-Q})},l.prototype.resize=function(f){G.prototype.resize.call(this,f),this.positionTip()},l.prototype.positionTip=function(){le.setAttributes(this.tip,[["points",this.getTipPoints()]]);var f=this.tipGrip.visual.transform.baseVal.getItem(0);f.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(f,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),G.prototype.select.call(this)},l.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){var N=f;this.bgColor=N.bgColor,this.tipPosition=N.tipPosition,G.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*N},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',l}(Ke),Ae=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.fillColor=Q.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new We("Line color",me(Q.defaultColorSet,["transparent"]),Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new We("Fill color",me(Q.defaultColorSet,["transparent"]),H.fillColor,ue),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new pt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new st("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ne("Opacity",Q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return _e(l,G),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual)},l.prototype.createVisual=function(){this.visual=le.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},l.prototype.manipulate=function(f){G.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){G.prototype.resize.call(this,f),this.setSize()},l.prototype.setSize=function(){G.prototype.setSize.call(this),le.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},l.prototype.pointerUp=function(f){G.prototype.pointerUp.call(this,f),this.setSize()},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},l.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(f){this.opacity=f,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){var N=f;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),G.prototype.restoreState.call(this,f),this.setSize()},l.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(Ze),Ie=function(G){function l(f,N,Q){return G.call(this,f,N,Q)||this}return _e(l,G),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},l.prototype.createTips=function(){this.tip1=le.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(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.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(le.createTransform()),this.visual.appendChild(this.tip2)},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.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()]]),le.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',l}(lt),Ye=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.strokePanel.colors=Q.defaultColorSet,H.fillColor="transparent",H}return _e(l,G),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(Ae),ht=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(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},G.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},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 l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),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}(),Xe=function(G){function l(f,N,Q){var H=G.call(this,f,N,Q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.strokePanel=new We("Line color",Q.defaultColorSet,Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new pt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new st("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return _e(l,G),l.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(N)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,G.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},l.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),G.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),G.prototype.resize.call(this,f),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},l.prototype.scale=function(f,N){this.curveX=this.curveX*f,this.curveY=this.curveY*N,G.prototype.scale.call(this,f,N)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',l}(dt),gt=function(){function G(l,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=f}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),at=function(G){function l(f,N,Q){var H=G.call(this,f,!1)||this;return H.dataUrl=N,H.state=Q,H}return _e(l,G),l}(gt),Qe=function(G){function l(f,N,Q){Q===void 0&&(Q=!1);var H=G.call(this,f,Q)||this;return H.marker=N,H}return _e(l,G),l}(gt),kt=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(l,f){this[l].push(f)},G.prototype.removeEventListener=function(l,f){var N=this[l].indexOf(f);N>-1&&this[l].splice(N,1)},G}(),Et=function(){function G(l){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Pe,this._isOpen=!1,this.undoRedoManager=new ht,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 kt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new Le(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[rt,Ee,be,Ke,Ye,Ae,de,fe,Ie,re,lt,Xe]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[rt,Ee,be,Ke,Ae,de,fe]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[rt,Ee,be,Ke,de]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var f=this;this._availableMarkerTypes.splice(0),l.forEach(function(N){if(typeof N=="string"){var Q=f.ALL_MARKER_TYPES.find(function(H){return H.typeName===N});Q!==void 0&&f._availableMarkerTypes.push(Q)}else f._availableMarkerTypes.push(N)})},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(l){this._zoomLevel=l,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(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(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},G.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new gt(l))})},G.prototype.render=function(){return Te(this,void 0,void 0,function(){var l;return Ce(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(l=new ce).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},G.prototype.close=function(l){var f=this;if(l===void 0&&(l=!1),this.isOpen){var N=!1;l||this.eventListeners.beforeclose.forEach(function(Q){var H=new gt(f,!0);Q(H),H.defaultPrevented&&(N=!0)}),N||(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(Q){return Q(new gt(f))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var l,f=[],N=0;N<arguments.length;N++)f[N]=arguments[N];(l=this._availableMarkerTypes).push.apply(l,f)},G.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(f){l(f.dataUrl,f.state)})},G.prototype.removeRenderEventListener=function(l){},G.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},G.prototype.removeCloseEventListener=function(l){},G.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,N=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(f,N)},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.resize=function(l,f){this._isResizing=!0;var N=l/this.imageWidth,Q=f/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(f),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(N,Q),this._isResizing=!1},G.prototype.scaleMarkers=function(l,f){var N,Q=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(l,f):(N=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==Q._currentMarker&&H.scale(l,f)}),N!==void 0&&this.setCurrentMarker(N)},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 l=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=l.left-f.left,this.top=l.top-f.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 l,f=[],N=0;N<arguments.length;N++)f[N]=arguments[N];this.defs=le.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,f)},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 l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},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 l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new De(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 Me(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(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.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(l,f){if(l==="marker"&&f!==void 0)this.createNewMarker(f);else if(l==="action")switch(f){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},G.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var H=new Qe(l,l._currentMarker,!0);Q(H),H.defaultPrevented&&(f=!0)}),!f){var N=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(Q){return Q(new Qe(l,N))})}}},G.prototype.clear=function(){var l=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var He=new Qe(l,void 0,!0);ye(He),He.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var N=function(ye){var He=Q.markers[ye];Q.setCurrentMarker(Q.markers[ye]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(qe){return qe(new Qe(l,He))})},Q=this,H=this.markers.length-1;H>=0;H--)N(H);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.prototype.showNotesEditor=function(){var l;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},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 l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===f.width&&N.height===f.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new gt(l))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(H){return H(new gt(l))})}},G.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},G.prototype.undoStep=function(){var l=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new gt(l))}))},G.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},G.prototype.redoStep=function(){var l=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new gt(l))}))},G.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},G.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},G.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var l,f,N=this;return Ce(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return l=Q.sent(),f=this.getState(),this.eventListeners.render.forEach(function(H){return H(new at(N,l,f))}),this.close(!0),[2]}})})},G.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(N){return f.markers.push(N.getState())}),f},G.prototype.restoreState=function(l){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(N){var Q=f._availableMarkerTypes.find(function(ye){return ye.typeName===N.typeName});if(Q!==void 0){var H=f.addNewMarker(Q);H.restoreState(N),f.markers.push(H)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(N){return N(new gt(f))})},G.prototype.addNewMarker=function(l){var f=le.createGroup();return this.markerImage.appendChild(f),new l(f,this.overlayContainer,this.settings)},G.prototype.createNewMarker=function(l){var f,N=this;(f=typeof l=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(f),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(f.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new Qe(N,N._currentMarker))}))},G.prototype.markerCreated=function(l){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(N){return N(new Qe(f,f._currentMarker))})},G.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},G.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},G.prototype.markerStateChanged=function(l){var f=this;this.eventListeners.markerchange.forEach(function(N){return N(new Qe(f,l))})},G.prototype.setCurrentMarker=function(l){var f=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(N){return N(new Qe(f,f._currentMarker))})),this._currentMarker=l,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(N){return N(new Qe(f,f._currentMarker))}))},G.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(N){return N.ownsTarget(l.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},G.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(N){return N.ownsTarget(l.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},G.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},G.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(l,f){var N=this.markerImage.getBoundingClientRect();return{x:(l-N.left)/this.zoomLevel,y:(f-N.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},G.prototype.addLicenseKey=function(l){te.addKey(l)},G.prototype.addEventListener=function(l,f){this.eventListeners.addEventListener(l,f)},G.prototype.removeEventListener=function(l,f){this.eventListeners.removeEventListener(l,f)},G.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new gt(l))}))},G.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new gt(l))}))},G.instanceCounter=0,G}();/* **********************************
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 Dt=function(G,l){return(Dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,N){f.__proto__=N}||function(f,N){for(var Q in N)Object.prototype.hasOwnProperty.call(N,Q)&&(f[Q]=N[Q])})(G,l)};function Ot(G,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function f(){this.constructor=G}Dt(G,l),G.prototype=l===null?Object.create(l):(f.prototype=l.prototype,new f)}function Tt(G,l,f,N){return new(f||(f=Promise))(function(Q,H){function ye(yt){try{qe(N.next(yt))}catch(Ge){H(Ge)}}function He(yt){try{qe(N.throw(yt))}catch(Ge){H(Ge)}}function qe(yt){var Ge;yt.done?Q(yt.value):(Ge=yt.value,Ge instanceof f?Ge:new f(function(St){St(Ge)})).then(ye,He)}qe((N=N.apply(G,l||[])).next())})}function Zt(G,l){var f,N,Q,H,ye={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(qe){return function(yt){return function(Ge){if(f)throw new TypeError("Generator is already executing.");for(;ye;)try{if(f=1,N&&(Q=2&Ge[0]?N.return:Ge[0]?N.throw||((Q=N.return)&&Q.call(N),0):N.next)&&!(Q=Q.call(N,Ge[1])).done)return Q;switch(N=0,Q&&(Ge=[2&Ge[0],Q.value]),Ge[0]){case 0:case 1:Q=Ge;break;case 4:return ye.label++,{value:Ge[1],done:!1};case 5:ye.label++,N=Ge[1],Ge=[0];continue;case 7:Ge=ye.ops.pop(),ye.trys.pop();continue;default:if(!(Q=ye.trys,(Q=Q.length>0&&Q[Q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ye=0;continue}if(Ge[0]===3&&(!Q||Ge[1]>Q[0]&&Ge[1]<Q[3])){ye.label=Ge[1];break}if(Ge[0]===6&&ye.label<Q[1]){ye.label=Q[1],Q=Ge;break}if(Q&&ye.label<Q[2]){ye.label=Q[2],ye.ops.push(Ge);break}Q[2]&&ye.ops.pop(),ye.trys.pop();continue}Ge=l.call(G,ye)}catch(St){Ge=[6,St],N=0}finally{f=Q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([qe,yt])}}}var Qt=function(){function G(){}return G.addKey=function(l){G.key=l},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),vt=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(l,f){for(var N=0,Q=f;N<Q.length;N++){var H=Q[N],ye=H[0],He=H[1];l.setAttribute(ye,He)}},G.createRect=function(l,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",l.toString()),Q.setAttribute("height",f.toString()),N&&G.setAttributes(Q,N),Q},G.createLine=function(l,f,N,Q,H){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",l.toString()),ye.setAttribute("y1",f.toString()),ye.setAttribute("x2",N.toString()),ye.setAttribute("y2",Q.toString()),H&&G.setAttributes(ye,H),ye},G.createPolygon=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",l),f&&G.setAttributes(N,f),N},G.createCircle=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(l/2).toString()),N.setAttribute("cy",(l/2).toString()),N.setAttribute("r",l.toString()),f&&G.setAttributes(N,f),N},G.createEllipse=function(l,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(l/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(l/2).toString()),Q.setAttribute("ry",(f/2).toString()),N&&G.setAttributes(Q,N),Q},G.createGroup=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&G.setAttributes(f,l),f},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(l,f,N,Q,H,ye,He){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(qe,[["id",l],["orient",f],["markerWidth",N.toString()],["markerHeight",Q.toString()],["refX",H.toString()],["refY",ye.toString()]]),qe.appendChild(He),qe},G.createText=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),l&&G.setAttributes(f,l),f},G.createTSpan=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=l,f&&G.setAttributes(N,f),N},G.createImage=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&G.setAttributes(f,l),f},G.createPoint=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=l,N.y=f,N},G.createPath=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",l),f&&G.setAttributes(N,f),N},G.createElement=function(l,f){var N=document.createElementNS("http://www.w3.org/2000/svg",l);return f&&G.setAttributes(N,f),N},G.getHollowRectanglePath=function(l,f,N,Q,H,ye,He,qe){return"M"+l+","+f+"V"+(f+Q)+"H"+(l+N)+"V"+f+"H"+H+"V"+ye+"H"+(H+He)+"V"+(ye+qe)+"H"+H+"V"+f+"Z"},G}(),Lt=function(){function G(l){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}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:"#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(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(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},G.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new jt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ut("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ut("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),jt=function(G,l){this.selector=G,this.style=l},Ut=function(G,l){this.localName=G,this.style=l},qt=function(){function G(){this.blocks=[],this.display=""}return G.prototype.addButtonBlock=function(l){l.className=this.blockClassName,l.buttonClassName=this.buttonClassName,l.buttonColorsClassName=this.buttonColorsClassName,l.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(l)},G.prototype.addElementBlock=function(l){l.className===void 0&&(l.className=this.blockClassName),this.blocks.push(l)},G.prototype.getUI=function(){var l=document.createElement("div");return l.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,l.style.display=this.display,this.blocks.forEach(function(f){return l.appendChild(f.getUI())}),l},G}(),ir=function(){function G(){}return G.prototype.getUI=function(){var l=document.createElement("div");if(l.className=this.className,this.minWidth!==void 0&&(l.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"end":l.style.justifyContent="flex-end"}return l.style.whiteSpace="nowrap",l},G}(),er=function(G){function l(){var f=G!==null&&G.apply(this,arguments)||this;return f.buttons=[],f}return Ot(l,G),l.prototype.addButton=function(f){f.className=this.buttonClassName,f.colorsClassName=this.buttonColorsClassName,f.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(f)},l.prototype.getUI=function(){var f=G.prototype.getUI.call(this);return this.buttons.forEach(function(N){return f.appendChild(N.getUI())}),f},l}(ir),Bt=function(){function G(l,f){this._isActive=!1,this._isHidden=!1,this._icon=l,this.title=f,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(G.prototype,"icon",{get:function(){return this._icon},set:function(l){this._icon=l,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isActive",{get:function(){return this._isActive},set:function(l){this._isActive=l,this.adjustClassName()},enumerable:!1,configurable:!0}),G.prototype.getUI=function(){var l=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return l.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},G.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,"")))},G.prototype.hide=function(){this._isHidden=!0},G}(),ct=function(G){function l(){var f=G!==null&&G.apply(this,arguments)||this;return f.elements=[],f}return Ot(l,G),l.prototype.addElement=function(f){this.elements.push(f)},l.prototype.getUI=function(){var f=G.prototype.getUI.call(this);return this.elements.forEach(function(N){return f.appendChild(N)}),f},l}(ir),Kr=function(){function G(l,f){this.horizontal=l,this.vertical=f}return Object.defineProperty(G.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),G.prototype.getVerticalLength=function(l){return l/this.ratio},G.prototype.getHorizontalLength=function(l){return l*this.ratio},G}(),ti=function(){function G(){}return G.getIcon=function(l,f){if(l>0&&f>0){var N=new Kr(l,f),Q=N.ratio>=1?20:N.getHorizontalLength(20),H=N.ratio<1?20:N.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var He=vt.createDefs();ye.appendChild(He);var qe=vt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(qe);var yt=vt.createPath(vt.getHollowRectanglePath((24-Q)/2,(24-H)/2,Q,H,(24-Q)/2+2,(24-H)/2+2,Q-4,H-4));ye.appendChild(yt);var Ge=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(vt.createTSpan(l+":"+f)),ye.appendChild(Ge);var St=Ge.getBBox();vt.setAttributes(Ge,[["x",((24-St.width)/2).toString()],["y",((24-St.height)/2-St.y).toString()]]);var Ht=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(St.width))/2,(24-Math.ceil(St.height))/2,Math.ceil(St.width),Math.ceil(St.height)));return qe.appendChild(Ht),vt.setAttributes(yt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},G}(),xr=function(G){function l(f,N,Q){var H=G.call(this,f,N)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=Q,H}return Ot(l,G),l.prototype.setupDropdown=function(){var f=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(N){N.className=f.className,N.colorsClassName=f.colorsClassName,f.dropdownBlock.appendChild(N.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},l.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},l.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},l.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},l.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},l.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},l}(Bt),Mt=function(){function G(l,f){this.GRIP_SIZE=10,this.color=l,this.fillColor=f,this.visual=vt.createGroup(),this.visual.appendChild(vt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(vt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},G.prototype.setCenter=function(l,f){this.visual.childNodes.forEach(function(N){return vt.setAttributes(N,[["cx",l.toString()],["cy",f.toString()]])})},G}(),Wr=function(){function G(l,f,N,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=l,this.canvasHeight=f,this.margin=N,this.container=Q,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(G.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(l){this._aspectRatio=l,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(l){this._zoomFactor=l,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),G.prototype.open=function(){var l=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var f=0;f<this.numberOfGridLines;f++)this.horizontalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(N){return l.gridContainer.appendChild(N)}),this.verticalGridLines.forEach(function(N){return l.gridContainer.appendChild(N)}),this.cropRectElement=vt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},G.prototype.setCropRectangle=function(l){this.cropRect=l;var f=Object.assign({},this.cropRect);this.zoomFactor!==1&&(f.width=this.cropRect.width*this.zoomFactor,f.height=this.cropRect.height*this.zoomFactor,f.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-f.width/2,f.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-f.height/2),vt.setAttributes(this.cropRectElement,[["x",f.x.toString()],["y",f.y.toString()],["width",f.width.toString()],["height",f.height.toString()]]);var N=f.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,ye){var He=f.y+N*(ye+1);vt.setAttributes(H,[["x1",""+f.x],["y1",""+He],["x2",""+(f.x+f.width)],["y2",""+He]])});var Q=f.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,ye){var He=f.x+Q*(ye+1);vt.setAttributes(H,[["x1",""+He],["y1",""+f.y],["x2",""+He],["y2",""+(f.y+f.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,f.x,f.y,f.width,f.height)]]),this.topLeftGrip.setCenter(f.x,f.y),this.topRightGrip.setCenter(f.x+f.width,f.y),this.bottomLeftGrip.setCenter(f.x,f.y+f.height),this.bottomRightGrip.setCenter(f.x+f.width,f.y+f.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},G.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)},G.prototype.clientToLocalCoordinates=function(l,f){var N=this.container.getBoundingClientRect();return{x:l-N.left+this.margin,y:f-N.top+this.margin}},G.prototype.onPointerDown=function(l){this.container.setPointerCapture(l.pointerId),this.previousPoint=this.clientToLocalCoordinates(l.clientX,l.clientY),this.cropRectElement===l.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(l.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(l.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(l.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(l.target)&&(this.activeGrip=this.bottomRightGrip)},G.prototype.onPointerMove=function(l){if(this.isMoving)this.move(this.clientToLocalCoordinates(l.clientX,l.clientY));else if(this.activeGrip){var f=this.clientToLocalCoordinates(l.clientX,l.clientY);this.resize(f)}l.preventDefault()},G.prototype.onPointerUp=function(l){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(l.pointerId)},G.prototype.move=function(l){var f=l.x-this.previousPoint.x,N=l.y-this.previousPoint.y;this.zoomFactor!==1&&(f=-f/this.zoomFactor,N=-N/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+f),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=l},G.prototype.resize=function(l){var f=Object.assign({},this.cropRect),N=l.x-this.previousPoint.x,Q=l.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:f.x+N<this.margin&&(N=this.margin-f.x),f.x+=N,f.width=this.cropRect.x+this.cropRect.width-f.x;break;case this.bottomRightGrip:case this.topRightGrip:f.width+N>this.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-f.width),f.width+=N}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(f.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(N),f.height=this.aspectRatio.getVerticalLength(f.width)):(f.y+=Q,f.height=this.cropRect.y+this.cropRect.height-f.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?f.height=this.aspectRatio.getVerticalLength(f.width):f.height+=Q}f.width<10&&(f.x=this.cropRect.x,f.width=10),f.height<10&&(f.y=this.cropRect.y,f.height=10),this.previousPoint=l,f.x>=this.margin&&f.y>=this.margin&&f.x-this.margin+f.width<=this.canvasWidth&&f.y-this.margin+f.height<=this.canvasHeight&&(this.cropRect=f,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},G.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var l=this.cropRect.x+this.cropRect.width/2,f=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);N/this.canvasWidth<Q/this.canvasHeight?this.cropRect.width=N:this.cropRect.height=Q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=l-this.cropRect.width/2,this.cropRect.y=f-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},G.prototype.getRescaledRect=function(l,f,N,Q,H,ye){var He=N/l,qe=Q/f;return{x:(H.x-ye)*He+ye,y:(H.y-ye)*qe+ye,width:H.width*He,height:H.height*qe}},G.prototype.scaleCanvas=function(l,f){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,l,f,this.cropRect,this.margin);this.canvasWidth=l,this.canvasHeight=f,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},G}(),Yr=function(){function G(l){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=l,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(G.prototype,"angle",{get:function(){return this._angle},set:function(l){this._angle=l,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),G.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},G.prototype.onPointerDown=function(l){this.controlContainer.setPointerCapture(l.pointerId),this.isDragging=!0,this.previousPoint={x:l.clientX,y:l.clientY}},G.prototype.onPointerMove=function(l){this.isDragging&&(this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.previousPoint.x=l.clientX)},G.prototype.onPointerUp=function(l){this.isDragging&&this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(l.pointerId)},G.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var l=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-l.width)/2).toString()],["y",(this.height/2).toString()]])}},G.prototype.positionScaleShape=function(){if(this.scaleShape){var l=this.scaleShape.transform.baseVal.getItem(0);l.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(l,0)}},G.prototype.getVisual=function(){var l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("width",this.width+"px"),l.setAttribute("height",this.height+"px"),l.setAttribute("viewBox","0 0 "+this.width+" "+this.height),l.style.flexShrink="0",document.body.appendChild(l);for(var f="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var Q=N%5==0?this.height/3:this.height/6;f+="h4v"+-Q+"h1v"+Q}f+="v1H0Z",this.scaleShape=vt.createPath(f);var H=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),l.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=vt.createTSpan("");return ye.innerHTML="&deg;",this.angleLabelElement.appendChild(ye),l.appendChild(this.angleLabelElement),document.body.removeChild(l),l},G}(),fi=function(){function G(){this.naturalSize=!1,this.imageType="image/png"}return G.prototype.rasterize=function(l,f,N,Q,H,ye,He){var qe=this;return new Promise(function(yt){var Ge=document.createElement("canvas");Ge.width=l.width.baseVal.value-2*Q,Ge.height=l.height.baseVal.value-2*Q;var St=1,Ht=1;qe.naturalSize===!0?(St=f.naturalWidth/(l.width.baseVal.value-2*Q)/ye,Ht=f.naturalHeight/(l.height.baseVal.value-2*Q)/He,Ge.width=f.naturalWidth/ye,Ge.height=f.naturalHeight/He):qe.width!==void 0&&qe.height!==void 0&&(St=qe.width/N.width,Ht=qe.height/N.height,Ge.width*=St,Ge.height*=Ht);var Jt=Ge.getContext("2d");Jt.translate(Ge.width/2,Ge.height/2),Jt.rotate(H*Math.PI/180),Jt.scale(ye,He),Jt.translate(-Ge.width/2,-Ge.height/2),Jt.drawImage(f,0,0,Ge.width,Ge.height);var Ur=document.createElement("canvas");Ur.width=N.width*St,Ur.height=N.height*Ht,Ur.getContext("2d").putImageData(Jt.getImageData((N.x-Q)*St,(N.y-Q)*Ht,N.width*St,N.height*Ht),0,0),yt(Ur.toDataURL(qe.imageType,qe.imageQuality))})},G}(),Ve=function(){function G(l){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=G.instanceCounter++,this.styles=new Lt(this.instanceNo),this.target=l,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(l){this._zoomToCropEnabled=l,l?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"gridLines",{get:function(){return this._gridLines},set:function(l){this._gridLines=l,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(l){this._rotationAngle=l,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"aspectRatio",{get:function(){var l;return(l=this._aspectRatio)!==null&&l!==void 0?l:this.aspectRatios[0]},set:function(l){this._aspectRatio=l},enumerable:!1,configurable:!0}),G.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},G.prototype.show=function(){this.showUI(),this.open()},G.prototype.close=function(l){l===void 0&&(l=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),l||this.closeEventListeners.forEach(function(f){return f()}),this._isOpen=!1)},G.prototype.addRenderEventListener=function(l){this.renderEventListeners.push(l)},G.prototype.removeRenderEventListener=function(l){this.renderEventListeners.indexOf(l)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(l),1)},G.prototype.addCloseEventListener=function(l){this.closeEventListeners.push(l)},G.prototype.removeCloseEventListener=function(l){this.closeEventListeners.indexOf(l)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(l),1)},G.prototype.setupResizeObserver=function(){var l=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var l=1*this.target.clientWidth/this.target.clientHeight,f=this.contentDiv.clientWidth/l>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*l:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=f+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/l;this.resize(f,N)}},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.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",vt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},G.prototype.resize=function(l,f){this.imageWidth=Math.round(l),this.imageHeight=Math.round(f),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},G.prototype.setEditingTarget=function(){var l=document.createElement("canvas");l.width=this.target.naturalWidth,l.height=this.target.naturalHeight,l.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var f=l.toDataURL();vt.setAttributes(this.editingTarget,[["href",f]]),this.setEditingTargetSize()},G.prototype.setTopLeft=function(){var l=this.target.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=l.left-f.left-this.CANVAS_MARGIN,this.top=l.top-f.top-this.CANVAS_MARGIN},G.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=vt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=vt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=vt.createGroup(),this.editingTargetRotationScaleContainer=vt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var l=vt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(l);var f=vt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(f),this.editingTargetContainer=vt.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)},G.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},G.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=vt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Wr(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()},G.prototype.zoomToCrop=function(){if(this.cropRect){var l=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,f=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=l+"px "+f+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-l+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-f+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},G.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)},G.prototype.cropRectChanged=function(l){this.cropRect=l,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},G.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},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.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var l=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,f=this.target.offsetTop>l+this.CANVAS_MARGIN?this.target.offsetTop-(l+this.CANVAS_MARGIN):0;this.coverDiv.style.top=f+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},G.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},G.prototype.addTopToolbar=function(){var l=this;this.topToolbar=new qt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var f=new er;f.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(f);var N=[];this.aspectRatios.forEach(function(Ht){var Jt=new Bt(ti.getIcon(Ht.horizontal,Ht.vertical),Ht.horizontal===0&&Ht.vertical===0?"FREE":Ht.horizontal+":"+Ht.vertical);Jt.onClick=function(){return l.ratioButtonClicked(Ht)},N.push(Jt)}),this.aspectRatioButton=new xr(ti.getIcon(0,0),"Aspect ratio",N),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,f.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new Bt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){l.isGridVisible=!l.isGridVisible,Q.isActive=l.isGridVisible},f.addButton(Q);var H=new Bt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(H.isActive=this.zoomToCropEnabled,H.onClick=function(){l.zoomToCropEnabled=!l.zoomToCropEnabled,H.isActive=l.zoomToCropEnabled},f.addButton(H),!Qt.isLicensed){var ye=new ct;this.topToolbar.addElementBlock(ye);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var qe=document.createElement("a");qe.style.color="currentColor",qe.href="https://markerjs.com/products/cropro",qe.target="_blank",qe.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',He.appendChild(qe),ye.addElement(He)}var yt=new er;yt.minWidth=3*this.toolbarHeight+"px",yt.contentAlign="end",this.topToolbar.addButtonBlock(yt);var Ge=new Bt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,yt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var St=new Bt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");St.onClick=this.close,yt.addButton(St),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(St.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},G.prototype.addBottomToolbar=function(){var l=this;this.bottomToolbar=new qt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var f=new er;f.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(f);var N=new Bt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");N.onClick=this.rotateLeftButtonClicked,f.addButton(N);var Q=new Bt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Q.onClick=this.rotateRightButtonClicked,f.addButton(Q);var H=new ct;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new Yr("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(yt){l.rotateBy(yt),l.straightener.angle=l.rotationAngle},H.addElement(this.straightener.getUI());var ye=new er;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var He=new Bt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");He.onClick=this.flipHorizontallyButtonClicked,ye.addButton(He);var qe=new Bt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");qe.onClick=this.flipVerticallyButtonClicked,ye.addButton(qe)},G.prototype.ratioButtonClicked=function(l){this.aspectRatio=l,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},G.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ti.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},G.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Kr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},G.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},G.prototype.restoreState=function(l){if(l){var f=this.cropLayer.getRescaledRect(l.width,l.height,this.imageWidth,this.imageHeight,l.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(f),this.cropRectChanged(f),this.flippedHorizontally=l.flippedHorizontally,this.flippedVertically=l.flippedVertically,this.applyFlip(),this.rotationAngle=l.rotationAngle,this.applyRotation()}},G.prototype.clientToLocalCoordinates=function(l,f){var N=this.cropImage.getBoundingClientRect();return{x:l-N.left,y:f-N.top}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var l=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},G.prototype.rotateLeftButtonClicked=function(){var l=this.rotationAngle-90;this.rotationAngle%90!=0&&(l+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(l)},G.prototype.rotateRightButtonClicked=function(){var l=this.rotationAngle+90;this.rotationAngle%90!=0&&(l-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(l)},G.prototype.rotateTo=function(l){l=(l=l>180?l-360:l)<=-180?l+360:l,this.rotationAngle=l,this.applyRotation()},G.prototype.rotateBy=function(l){this.rotateTo((this.rotationAngle+l)%360)},G.prototype.applyRotation=function(){var l=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var f=this.editingTargetRotationContainer.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(f,0);var N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=l},G.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},G.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},G.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},G.prototype.startRenderAndClose=function(){return Tt(this,void 0,void 0,function(){var l,f;return Zt(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return l=N.sent(),f=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(l,f)}),this.close(!0),[2]}})})},G.prototype.render=function(){return Tt(this,void 0,void 0,function(){var l;return Zt(this,function(f){switch(f.label){case 0:return(l=new fi).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.width=this.renderWidth,l.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,l.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return f.sent(),[4,l.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,f.sent()]}})})},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ut("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var l=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ut("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*l)+`px;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ut("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ut("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ut("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},G.instanceCounter=0,G}(),_t=ie("8hTe"),pi=ie.n(_t),mi=/<pre[^>]*>/g;function gi(G){var l=document.createElement("div");return l.innerHTML=G,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var vi=tt.a=function(G){var l=G.value,f=l===void 0?"":l,N=G.edit,Q=N===void 0?!1:N,H=G.className,ye=G.showTextOnly,He=G.showLines,qe=G.replaces,yt=G.zoomImg,Ge=G.hasMask,St=G.style,Ht=St===void 0?{}:St,Jt=G.stylesPrev,Ur=Jt===void 0?{}:Jt,Sr=String(f),Cr=Object(R.useRef)(),$r=Object(R.useRef)(),Ri=Object(R.useState)(""),cr=Object(z.a)(Ri,2),Hr=cr[0],si=cr[1],li=Object(R.useState)("office"),Br=Object(z.a)(li,2),Oi=Br[0],yi=Br[1],zi=function(){var Gt=new Ve($r.current);Gt.displayMode="popup",Gt.addRenderEventListener(function(){var yr=Object(M.a)(U.a.mark(function It(sr){var Vt;return U.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return Cr.current.style.display="none",fr.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:sr}});case 3:Vt=fr.sent,Vt!=null&&Vt.id&&qe($r.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return fr.stop()}},It)}));return function(It){return yr.apply(this,arguments)}}()),Gt.show()},Ki=function(){var Gt=new Et($r.current);Gt.settings.displayMode="popup",Gt.addEventListener("render",function(){var yr=Object(M.a)(U.a.mark(function It(sr){var Vt;return U.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:if(Cr.current.style.display="none",!$r.current){fr.next=6;break}return fr.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:sr.dataUrl}});case 4:Vt=fr.sent,Vt!=null&&Vt.id&&qe($r.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return fr.stop()}},It)}));return function(It){return yr.apply(this,arguments)}}()),Gt.show(),window.markerArea=Gt},Jr=Object(R.useMemo)(function(){Cr.current&&(Cr.current.style.zIndex=-1);try{var ar=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Gt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,yr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Sr=Sr.replace(ar,"("+ee.a.API_SERVER+"/api/attachments/").replace(Gt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(yr,'"'+ee.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(ri){}var It=V(Sr),sr=x();if(Sr.match(/\[TOC\]/)&&(It=It.replace("<p>[TOC]</p>",L()),w()),It=It.replace(/(__special_katext_id_\d+__)/g,function(ri,fr){var Ar=sr[fr],Vi=Ar.type,xi=Ar.expression;return Object(oe.renderToString)(gi(xi)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),It=It.replace(/▁/g,"\u2581\u2581\u2581"),v(),ye){var Vt=document.createElement("div");return Vt.innerHTML=It,Vt.innerText}return setTimeout(function(){return hn()},500),It},[Sr]),Vr=Object(R.useRef)();m.WebkitLineClamp=He,He&&(Ht=Object(O.a)(Object(O.a)({},Ht),m));function bi(ar){var Gt=ar.target;if(Gt.tagName.toUpperCase()==="IMG"){if(yt){var yr=Gt.getAttribute("src");si(yr),yi("image")}}else if(Gt.tagName.toUpperCase()==="A"){var It=Gt.getAttribute("href");if(It.indexOf("office")>-1)ar.preventDefault(),si(It),yi("office");else if(It.indexOf("application/pdf")>-1)ar.preventDefault(),si(It),yi("pdf");else if(It.indexOf("text/html")>-1)ar.preventDefault(),si(It),yi("html");else if(It.startsWith("#")){ar.preventDefault();var sr=document.getElementById(It.replace("#",""));sr&&sr.scrollIntoView(!0)}}}var hn=function(){var Gt,yr=(Gt=Vr.current)===null||Gt===void 0?void 0:Gt.querySelectorAll("video");yr==null||yr.forEach(function(It){if(It.oncontextmenu=function(){return!1},It.src.indexOf(".m3u8")>-1&&!It.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var sr=new Y.a;sr.loadSource(It.src),sr.attachMedia(It)}}})};Object(R.useEffect)(function(){if(Vr.current&&Jr&&(Jr.match(mi)&&window.PR.prettyPrint()),Vr.current)return Vr.current.addEventListener("click",bi),function(){Vr.current.removeEventListener("click",bi),v(),w()}},[Jr,Vr.current,bi]);var Ei=function(Gt){if(!Q)return;Gt.target.nodeName==="IMG"?(Cr.current.style.zIndex=1,Cr.current.style.display="flex",Cr.current.style.width=Gt.target.clientWidth+"px",Cr.current.style.height=Gt.target.clientHeight+"px",Cr.current.style.top=Gt.target.offsetTop+"px",Cr.current.style.left=Gt.target.offsetLeft+"px",$r.current.src=Gt.target.getAttribute("src")):Cr.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Vr,style:Object(O.a)({},Ht),className:"".concat(H||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:Ei,dangerouslySetInnerHTML:{__html:Jr}}),y.a.createElement("div",{ref:Cr,className:pi.a.button},y.a.createElement(J.a,null,y.a.createElement($.a,{onClick:function(){return zi()}},"\u88C1\u526A"),y.a.createElement($.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:$r,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(pe.a,{close:!0,data:Hr,type:Hr!=null&&Hr.length?Oi:"",style:Object(O.a)({},Ur),onClose:function(){return si("")}}))}},"9VGf":function(ft,tt,ie){"use strict";ie.d(tt,"a",function(){return D});var se=ie("cDcd"),J=ie.n(se);function D($,O){var M=Object(se.useRef)();Object(se.useEffect)(function(){M.current=$}),Object(se.useEffect)(function(){function z(){M.current()}if(O!==null){var W=setInterval(z,O);return function(){return clearInterval(W)}}},[O])}},Bd2K:function(ft,tt,ie){(function(se){se(ie("VrN/"),ie("osHv"))})(function(se){se.defineOption("autoCloseTags",!1,function(U,R,y){if(y!=se.Init&&y&&U.removeKeyMap("autoCloseTags"),!R)return;var C={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(C["'/'"]=function(k){return M(k)}),(typeof R!="object"||R.whenOpening!==!1)&&(C["'>'"]=function(k){return $(k)}),U.addKeyMap(C)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function $(U){if(U.getOption("disableInput"))return se.Pass;for(var R=U.listSelections(),y=[],C=U.getOption("autoCloseTags"),k=0;k<R.length;k++){if(!R[k].empty())return se.Pass;var A=R[k].head,_=U.getTokenAt(A),E=se.innerMode(U.getMode(),_.state),u=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(u),s=o&&o.name;if(!s)return se.Pass;var d=E.mode.configuration=="html",w=typeof C=="object"&&C.dontCloseTags||d&&J,m=typeof C=="object"&&C.indentTags||d&&D;_.end>A.ch&&(s=s.slice(0,s.length-_.end+A.ch));var g=s.toLowerCase();if(!s||_.type=="string"&&(_.end!=A.ch||!/[\"\']/.test(_.string.charAt(_.string.length-1))||_.string.length==1)||_.type=="tag"&&o.close||_.string.indexOf("/")==A.ch-_.start-1||w&&z(w,g)>-1||W(U,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(u)||[],s,A,!0))return se.Pass;var L=typeof C=="object"&&C.emptyTags;if(L&&z(L,s)>-1){y[k]={text:"/>",newPos:se.Pos(A.line,A.ch+2)};continue}var b=m&&z(m,g)>-1;y[k]={indent:b,text:">"+(b?`
`:"")+"</"+s+">",newPos:b?se.Pos(A.line+1,0):se.Pos(A.line,A.ch+1)}}for(var c=typeof C=="object"&&C.dontIndentOnAutoClose,k=R.length-1;k>=0;k--){var p=y[k];U.replaceRange(p.text,R[k].head,R[k].anchor,"+insert");var h=U.listSelections().slice(0);h[k]={head:p.newPos,anchor:p.newPos},U.setSelections(h),!c&&p.indent&&(U.indentLine(p.newPos.line,null,!0),U.indentLine(p.newPos.line+1,null,!0))}}function O(U,R){for(var y=U.listSelections(),C=[],k=R?"/":"</",A=U.getOption("autoCloseTags"),_=typeof A=="object"&&A.dontIndentOnSlash,E=0;E<y.length;E++){if(!y[E].empty())return se.Pass;var u=y[E].head,o=U.getTokenAt(u),s=se.innerMode(U.getMode(),o.state),d=s.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return se.Pass;var w,m=s.mode.name!="xml"&&U.getMode().name=="htmlmixed";if(m&&s.mode.name=="javascript")w=k+"script";else if(m&&s.mode.name=="css")w=k+"style";else{var g=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!g||g.length&&W(U,g,g[g.length-1],u))return se.Pass;w=k+g[g.length-1]}U.getLine(u.line).charAt(o.end)!=">"&&(w+=">"),C[E]=w}if(U.replaceSelections(C),y=U.listSelections(),!_)for(var E=0;E<y.length;E++)(E==y.length-1||y[E].head.line<y[E+1].head.line)&&U.indentLine(y[E].head.line)}function M(U){return U.getOption("disableInput")?se.Pass:O(U,!0)}se.commands.closeTag=function(U){return O(U)};function z(U,R){if(U.indexOf)return U.indexOf(R);for(var y=0,C=U.length;y<C;++y)if(U[y]==R)return y;return-1}function W(U,R,y,C,k){if(!se.scanForClosingTag)return!1;var A=Math.min(U.lastLine()+1,C.line+500),_=se.scanForClosingTag(U,C,null,A);if(!_||_.tag!=y)return!1;for(var E=k?1:0,u=R.length-1;u>=0&&R[u]==y;u--)++E;C=_.to;for(var u=1;u<E;u++){var o=se.scanForClosingTag(U,C,null,A);if(!o||o.tag!=y)return!1;C=o.to}return!0}})},BjJ7:function(ft,tt,ie){"use strict";ie.d(tt,"d",function(){return J}),ie.d(tt,"c",function(){return D}),ie.d(tt,"e",function(){return $}),ie.d(tt,"b",function(){return O}),ie.d(tt,"a",function(){return z});var se=ie("m3rI");function J(W){var U=!0;if(W.length>0){for(var R=0;R<W.length;R++)if(W[R].compile_success==0||!W[R].compile_success){U=!1;break}}else U=!1;return U}function D(W){for(var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],y=0;y<W.length;y++){var C=W[y],k=U?"".concat(U,"/").concat(C.name):"".concat(C.name);R.push({title:C.name,isLeaf:!(C.type==="tree"),key:k})}return R}function $(W,U,R){for(var y=0;y<W.length;y++){var C=W[y];if(C.key===U){C.children=R;break}C.children&&$(C.children,U,R)}return W}function O(W,U,R){var y;return function(){var C=this,k=arguments,A=function(){y=null,R||W.apply(C,k)},_=R&&!y;clearTimeout(y),y=setTimeout(A,U),_&&W.apply(C,k)}}var M=!0,z=se.a.API_SERVER},"C+DQ":function(ft,tt,ie){},DlQD:function(ft,tt,ie){(function(se,J){ft.exports=J()})(this,function(){"use strict";function se(Ee,ve){for(var be=0;be<ve.length;be++){var re=ve[be];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ee,re.key,re)}}function J(Ee,ve,be){return ve&&se(Ee.prototype,ve),be&&se(Ee,be),Ee}function D(Ee,ve){if(!Ee)return;if(typeof Ee=="string")return $(Ee,ve);var be=Object.prototype.toString.call(Ee).slice(8,-1);if(be==="Object"&&Ee.constructor&&(be=Ee.constructor.name),be==="Map"||be==="Set")return Array.from(Ee);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return $(Ee,ve)}function $(Ee,ve){(ve==null||ve>Ee.length)&&(ve=Ee.length);for(var be=0,re=new Array(ve);be<ve;be++)re[be]=Ee[be];return re}function O(Ee,ve){var be;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(be=D(Ee))||ve&&Ee&&typeof Ee.length=="number"){be&&(Ee=be);var re=0;return function(){return re>=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return be=Ee[Symbol.iterator](),be.next.bind(be)}function M(Ee,ve){return ve={exports:{}},Ee(ve,ve.exports),ve.exports}var z=M(function(Ee){function ve(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function be(re){Ee.exports.defaults=re}Ee.exports={defaults:ve(),getDefaults:ve,changeDefaults:be}}),W=z.defaults,U=z.getDefaults,R=z.changeDefaults,y=/[&<>"']/,C=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=function(ve){return _[ve]};function u(Ee,ve){if(ve){if(y.test(Ee))return Ee.replace(C,E)}else if(k.test(Ee))return Ee.replace(A,E);return Ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ee){return Ee.replace(o,function(ve,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var d=/(^|[^\[])\^/g;function w(Ee,ve){Ee=Ee.source||Ee,ve=ve||"";var be={replace:function(ne,de){return de=de.source||de,de=de.replace(d,"$1"),Ee=Ee.replace(ne,de),be},getRegex:function(){return new RegExp(Ee,ve)}};return be}var m=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(Ee,ve,be){if(Ee){var re;try{re=decodeURIComponent(s(be)).replace(m,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ve&&!g.test(be)&&(be=a(ve,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ne){return null}return be}var b={},c=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Ee,ve){b[" "+Ee]||(c.test(Ee)?b[" "+Ee]=Ee+"/":b[" "+Ee]=B(Ee,"/",!0)),Ee=b[" "+Ee];var be=Ee.indexOf(":")===-1;return ve.substring(0,2)==="//"?be?ve:Ee.replace(p,"$1")+ve:ve.charAt(0)==="/"?be?ve:Ee.replace(h,"$1")+ve:Ee+ve}var x={exec:function(){}};function v(Ee){for(var ve=1,be,re;ve<arguments.length;ve++){be=arguments[ve];for(re in be)Object.prototype.hasOwnProperty.call(be,re)&&(Ee[re]=be[re])}return Ee}function S(Ee,ve){var be=Ee.replace(/\|/g,function(de,ue,fe){for(var Ae=!1,Ie=ue;--Ie>=0&&fe[Ie]==="\\";)Ae=!Ae;return Ae?"|":" |"}),re=be.split(/ \|/),ne=0;if(re.length>ve)re.splice(ve);else for(;re.length<ve;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function B(Ee,ve,be){var re=Ee.length;if(re===0)return"";for(var ne=0;ne<re;){var de=Ee.charAt(re-ne-1);if(de===ve&&!be)ne++;else if(de!==ve&&be)ne++;else break}return Ee.substr(0,re-ne)}function F(Ee,ve){if(Ee.indexOf(ve[1])===-1)return-1;for(var be=Ee.length,re=0,ne=0;ne<be;ne++)if(Ee[ne]==="\\")ne++;else if(Ee[ne]===ve[0])re++;else if(Ee[ne]===ve[1]&&(re--,re<0))return ne;return-1}function K(Ee){Ee&&Ee.sanitize&&!Ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:u,unescape:s,edit:w,cleanUrl:L,resolveUrl:a,noopTest:x,merge:v,splitCells:S,rtrim:B,findClosingBracket:F,checkSanitizeDeprecation:K},P=z.defaults,I=V.rtrim,Y=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function pe(Ee,ve,be){var re=ve.href,ne=ve.title?ee(ve.title):null,de=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:be,href:re,title:ne,text:de}:{type:"image",raw:be,href:re,title:ne,text:ee(de)}}function Oe(Ee,ve){var be=Ee.match(/^(\s+)(?:```)/);if(be===null)return ve;var re=be[1];return ve.split(`
`).map(function(ne){var de=ne.match(/^\s+/);if(de===null)return ne;var ue=de[0];return ue.length>=re.length?ne.slice(re.length):ne}).join(`
`)}var xe=function(){function Ee(be){this.options=be||P}var ve=Ee.prototype;return ve.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ve.code=function(re,ne){var de=this.rules.block.code.exec(re);if(de){var ue=ne[ne.length-1];if(ue&&ue.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var fe=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:I(fe,`
`)}}},ve.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var de=ne[0],ue=Oe(de,ne[3]||"");return{type:"code",raw:de,lang:ne[2]?ne[2].trim():ne[2],text:ue}}},ve.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ve.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var de={type:"table",header:Y(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(de.header.length===de.align.length){var ue=de.align.length,fe;for(fe=0;fe<ue;fe++)/^ *-+: *$/.test(de.align[fe])?de.align[fe]="right":/^ *:-+: *$/.test(de.align[fe])?de.align[fe]="center":/^ *:-+ *$/.test(de.align[fe])?de.align[fe]="left":de.align[fe]=null;for(ue=de.cells.length,fe=0;fe<ue;fe++)de.cells[fe]=Y(de.cells[fe],de.header.length);return de}}},ve.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},ve.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var de=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:de}}},ve.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var de=ne[0],ue=ne[2],fe=ue.length>1,Ae=ue[ue.length-1]===")",Ie={type:"list",raw:de,ordered:fe,start:fe?+ue.slice(0,-1):"",loose:!1,items:[]},Ye=ne[0].match(this.rules.block.item),ht=!1,Xe,gt,at,Qe,kt,Et,Dt,Ot=Ye.length,Tt=0;Tt<Ot;Tt++)Xe=Ye[Tt],de=Xe,gt=Xe.length,Xe=Xe.replace(/^ *([*+-]|\d+[.)]) */,""),~Xe.indexOf(`
`)&&(gt-=Xe.length,Xe=this.options.pedantic?Xe.replace(/^ {1,4}/gm,""):Xe.replace(new RegExp("^ {1,"+gt+"}","gm"),"")),Tt!==Ot-1&&(at=this.rules.block.bullet.exec(Ye[Tt+1])[0],(fe?at.length===1||!Ae&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==ue)&&(Qe=Ye.slice(Tt+1).join(`
`),Ie.raw=Ie.raw.substring(0,Ie.raw.length-Qe.length),Tt=Ot-1)),kt=ht||/\n\n(?!\s*$)/.test(Xe),Tt!==Ot-1&&(ht=Xe.charAt(Xe.length-1)===`
`,kt||(kt=ht)),kt&&(Ie.loose=!0),Et=/^\[[ xX]\] /.test(Xe),Dt=void 0,Et&&(Dt=Xe[1]!==" ",Xe=Xe.replace(/^\[[ xX]\] +/,"")),Ie.items.push({type:"list_item",raw:de,task:Et,checked:Dt,loose:kt,text:Xe});return Ie}},ve.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ee(ne[0]):ne[0]}},ve.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var de=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ne[0],href:ne[2],title:ne[3]}}},ve.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var de={type:"table",header:Y(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=ne[0];var ue=de.align.length,fe;for(fe=0;fe<ue;fe++)/^ *-+: *$/.test(de.align[fe])?de.align[fe]="right":/^ *:-+: *$/.test(de.align[fe])?de.align[fe]="center":/^ *:-+ *$/.test(de.align[fe])?de.align[fe]="left":de.align[fe]=null;for(ue=de.cells.length,fe=0;fe<ue;fe++)de.cells[fe]=Y(de.cells[fe].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},ve.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ve.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ve.text=function(re,ne){var de=this.rules.block.text.exec(re);if(de){var ue=ne[ne.length-1];return ue&&ue.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},ve.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:ee(ne[1])}},ve.tag=function(re,ne,de){var ue=this.rules.inline.tag.exec(re);if(ue)return!ne&&/^<a /i.test(ue[0])?ne=!0:ne&&/^<\/a>/i.test(ue[0])&&(ne=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:ne,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ee(ue[0]):ue[0]}},ve.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var de=oe(ne[2],"()");if(de>-1){var ue=ne[0].indexOf("!")===0?5:4,fe=ue+ne[1].length+de;ne[2]=ne[2].substring(0,de),ne[0]=ne[0].substring(0,fe).trim(),ne[3]=""}var Ae=ne[2],Ie="";if(this.options.pedantic){var Ye=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);Ye?(Ae=Ye[1],Ie=Ye[3]):Ie=""}else Ie=ne[3]?ne[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=pe(ne,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:Ie&&Ie.replace(this.rules.inline._escapes,"$1")},ne[0]);return ht}},ve.reflink=function(re,ne){var de;if((de=this.rules.inline.reflink.exec(re))||(de=this.rules.inline.nolink.exec(re))){var ue=(de[2]||de[1]).replace(/\s+/g," ");if(ue=ne[ue.toLowerCase()],!ue||!ue.href){var fe=de[0].charAt(0);return{type:"text",raw:fe,text:fe}}var Ae=pe(de,ue,de[0]);return Ae}},ve.strong=function(re,ne,de){de===void 0&&(de="");var ue=this.rules.inline.strong.start.exec(re);if(ue&&(!ue[1]||ue[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var fe=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var Ae;(ue=fe.exec(ne))!=null;)if(Ae=this.rules.inline.strong.middle.exec(ne.slice(0,ue.index+3)),Ae)return{type:"strong",raw:re.slice(0,Ae[0].length),text:re.slice(2,Ae[0].length-2)}}},ve.em=function(re,ne,de){de===void 0&&(de="");var ue=this.rules.inline.em.start.exec(re);if(ue&&(!ue[1]||ue[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var fe=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var Ae;(ue=fe.exec(ne))!=null;)if(Ae=this.rules.inline.em.middle.exec(ne.slice(0,ue.index+2)),Ae)return{type:"em",raw:re.slice(0,Ae[0].length),text:re.slice(1,Ae[0].length-1)}}},ve.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var de=ne[2].replace(/\n/g," "),ue=/[^ ]/.test(de),fe=de.startsWith(" ")&&de.endsWith(" ");return ue&&fe&&(de=de.substring(1,de.length-1)),de=ee(de,!0),{type:"codespan",raw:ne[0],text:de}}},ve.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},ve.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ve.autolink=function(re,ne){var de=this.rules.inline.autolink.exec(re);if(de){var ue,fe;return de[2]==="@"?(ue=ee(this.options.mangle?ne(de[1]):de[1]),fe="mailto:"+ue):(ue=ee(de[1]),fe=ue),{type:"link",raw:de[0],text:ue,href:fe,tokens:[{type:"text",raw:ue,text:ue}]}}},ve.url=function(re,ne){var de;if(de=this.rules.inline.url.exec(re)){var ue,fe;if(de[2]==="@")ue=ee(this.options.mangle?ne(de[0]):de[0]),fe="mailto:"+ue;else{var Ae;do Ae=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Ae!==de[0]);ue=ee(de[0]),de[1]==="www."?fe="http://"+ue:fe=ue}return{type:"link",raw:de[0],text:ue,href:fe,tokens:[{type:"text",raw:ue,text:ue}]}}},ve.inlineText=function(re,ne,de){var ue=this.rules.inline.text.exec(re);if(ue){var fe;return ne?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ee(ue[0]):ue[0]:fe=ee(this.options.smartypants?de(ue[0]):ue[0]),{type:"text",raw:ue[0],text:fe}}},Ee}(),_e=V.noopTest,Te=V.edit,Ce=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:_e,table:_e,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=Te(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=Te(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Te(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=Te(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Te(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=Te(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Ce({},me),me.gfm=Ce({},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=Te(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=Te(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=Ce({},me.normal,{html:Te(`^ *(?: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:_e,paragraph:Te(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 le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:_e,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:_e,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};le._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",le.punctuation=Te(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Te(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Te(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Te(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Te(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Te(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Te(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Te(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Te(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Te(le._blockSkip,"g").getRegex(),le.overlapSkip=Te(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Te(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Te(le.tag).replace("comment",me._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Te(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Te(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Te(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=Ce({},le),le.pedantic=Ce({},le.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=Ce({},le.normal,{escape:Te(le.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),le.gfm.url=Te(le.gfm.url,"i").replace("email",le.gfm._extended_email).getRegex(),le.breaks=Ce({},le.gfm,{br:Te(le.br).replace("{2,}","*").getRegex(),text:Te(le.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:me,inline:le},ce=z.defaults,ae=te.block,Le=te.inline;function Re(Ee){return Ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Se(Ee){var ve="",be,re,ne=Ee.length;for(be=0;be<ne;be++)re=Ee.charCodeAt(be),Math.random()>.5&&(re="x"+re.toString(16)),ve+="&#"+re+";";return ve}var De=function(){function Ee(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||ce,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ae.normal,inline:Le.normal};this.options.pedantic?(re.block=ae.pedantic,re.inline=Le.pedantic):this.options.gfm&&(re.block=ae.gfm,this.options.breaks?re.inline=Le.breaks:re.inline=Le.gfm),this.tokenizer.rules=re}Ee.lex=function(re,ne){var de=new Ee(ne);return de.lex(re)};var ve=Ee.prototype;return ve.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(re,ne,de){ne===void 0&&(ne=[]),de===void 0&&(de=!0),re=re.replace(/^ +$/gm,"");for(var ue,fe,Ae,Ie;re;){if(ue=this.tokenizer.space(re)){re=re.substring(ue.raw.length),ue.type&&ne.push(ue);continue}if(ue=this.tokenizer.code(re,ne)){re=re.substring(ue.raw.length),ue.type?ne.push(ue):(Ie=ne[ne.length-1],Ie.raw+=`
`+ue.raw,Ie.text+=`
`+ue.text);continue}if(ue=this.tokenizer.fences(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.heading(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.nptable(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.hr(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.blockquote(re)){re=re.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],de),ne.push(ue);continue}if(ue=this.tokenizer.list(re)){for(re=re.substring(ue.raw.length),Ae=ue.items.length,fe=0;fe<Ae;fe++)ue.items[fe].tokens=this.blockTokens(ue.items[fe].text,[],!1);ne.push(ue);continue}if(ue=this.tokenizer.html(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(de&&(ue=this.tokenizer.def(re))){re=re.substring(ue.raw.length),this.tokens.links[ue.tag]||(this.tokens.links[ue.tag]={href:ue.href,title:ue.title});continue}if(ue=this.tokenizer.table(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.lheading(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(de&&(ue=this.tokenizer.paragraph(re))){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.text(re,ne)){re=re.substring(ue.raw.length),ue.type?ne.push(ue):(Ie=ne[ne.length-1],Ie.raw+=`
`+ue.raw,Ie.text+=`
`+ue.text);continue}if(re){var Ye="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Ye);break}else throw new Error(Ye)}}return ne},ve.inline=function(re){var ne,de,ue,fe,Ae,Ie,Ye=re.length;for(ne=0;ne<Ye;ne++){Ie=re[ne];switch(Ie.type){case"paragraph":case"text":case"heading":{Ie.tokens=[],this.inlineTokens(Ie.text,Ie.tokens);break}case"table":{for(Ie.tokens={header:[],cells:[]},fe=Ie.header.length,de=0;de<fe;de++)Ie.tokens.header[de]=[],this.inlineTokens(Ie.header[de],Ie.tokens.header[de]);for(fe=Ie.cells.length,de=0;de<fe;de++)for(Ae=Ie.cells[de],Ie.tokens.cells[de]=[],ue=0;ue<Ae.length;ue++)Ie.tokens.cells[de][ue]=[],this.inlineTokens(Ae[ue],Ie.tokens.cells[de][ue]);break}case"blockquote":{this.inline(Ie.tokens);break}case"list":{for(fe=Ie.items.length,de=0;de<fe;de++)this.inline(Ie.items[de].tokens);break}}}return re},ve.inlineTokens=function(re,ne,de,ue,fe){ne===void 0&&(ne=[]),de===void 0&&(de=!1),ue===void 0&&(ue=!1),fe===void 0&&(fe="");var Ae,Ie=re,Ye;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;(Ye=this.tokenizer.rules.inline.reflinkSearch.exec(Ie))!=null;)ht.includes(Ye[0].slice(Ye[0].lastIndexOf("[")+1,-1))&&(Ie=Ie.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ye=this.tokenizer.rules.inline.blockSkip.exec(Ie))!=null;)Ie=Ie.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Ae=this.tokenizer.escape(re)){re=re.substring(Ae.raw.length),ne.push(Ae);continue}if(Ae=this.tokenizer.tag(re,de,ue)){re=re.substring(Ae.raw.length),de=Ae.inLink,ue=Ae.inRawBlock,ne.push(Ae);continue}if(Ae=this.tokenizer.link(re)){re=re.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,ue)),ne.push(Ae);continue}if(Ae=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,ue)),ne.push(Ae);continue}if(Ae=this.tokenizer.strong(re,Ie,fe)){re=re.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],de,ue),ne.push(Ae);continue}if(Ae=this.tokenizer.em(re,Ie,fe)){re=re.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],de,ue),ne.push(Ae);continue}if(Ae=this.tokenizer.codespan(re)){re=re.substring(Ae.raw.length),ne.push(Ae);continue}if(Ae=this.tokenizer.br(re)){re=re.substring(Ae.raw.length),ne.push(Ae);continue}if(Ae=this.tokenizer.del(re)){re=re.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],de,ue),ne.push(Ae);continue}if(Ae=this.tokenizer.autolink(re,Se)){re=re.substring(Ae.raw.length),ne.push(Ae);continue}if(!de&&(Ae=this.tokenizer.url(re,Se))){re=re.substring(Ae.raw.length),ne.push(Ae);continue}if(Ae=this.tokenizer.inlineText(re,ue,Re)){re=re.substring(Ae.raw.length),fe=Ae.raw.slice(-1),ne.push(Ae);continue}if(re){var Xe="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Xe);break}else throw new Error(Xe)}}return ne},J(Ee,null,[{key:"rules",get:function(){return{block:ae,inline:Le}}}]),Ee}(),Me=z.defaults,je=V.cleanUrl,We=V.escape,Be=function(){function Ee(be){this.options=be||Me}var ve=Ee.prototype;return ve.code=function(re,ne,de){var ue=(ne||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight(re,ue);fe!=null&&fe!==re&&(de=!0,re=fe)}return ue?'<pre><code class="'+this.options.langPrefix+We(ue,!0)+'">'+(de?re:We(re,!0))+`</code></pre>
`:"<pre><code>"+(de?re:We(re,!0))+`</code></pre>
`},ve.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ve.html=function(re){return re},ve.heading=function(re,ne,de,ue){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+ue.slug(de)+'">'+re+"</h"+ne+`>
`:"<h"+ne+">"+re+"</h"+ne+`>
`},ve.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ve.list=function(re,ne,de){var ue=ne?"ol":"ul",fe=ne&&de!==1?' start="'+de+'"':"";return"<"+ue+fe+`>
`+re+"</"+ue+`>
`},ve.listitem=function(re){return"<li>"+re+`</li>
`},ve.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(re){return"<p>"+re+`</p>
`},ve.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ne+`</table>
`},ve.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ve.tablecell=function(re,ne){var de=ne.header?"th":"td",ue=ne.align?"<"+de+' align="'+ne.align+'">':"<"+de+">";return ue+re+"</"+de+`>
`},ve.strong=function(re){return"<strong>"+re+"</strong>"},ve.em=function(re){return"<em>"+re+"</em>"},ve.codespan=function(re){return"<code>"+re+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(re){return"<del>"+re+"</del>"},ve.link=function(re,ne,de){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ue='<a href="'+We(re)+'"';return ne&&(ue+=' title="'+ne+'"'),ue+=">"+de+"</a>",ue},ve.image=function(re,ne,de){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ue='<img src="'+re+'" alt="'+de+'"';return ne&&(ue+=' title="'+ne+'"'),ue+=this.options.xhtml?"/>":">",ue},ve.text=function(re){return re},Ee}(),Ue=function(){function Ee(){}var ve=Ee.prototype;return ve.strong=function(re){return re},ve.em=function(re){return re},ve.codespan=function(re){return re},ve.del=function(re){return re},ve.html=function(re){return re},ve.text=function(re){return re},ve.link=function(re,ne,de){return""+de},ve.image=function(re,ne,de){return""+de},ve.br=function(){return""},Ee}(),ot=function(){function Ee(){this.seen={}}var ve=Ee.prototype;return ve.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var de=ne;do this.seen[de]++,ne=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},Ee}(),et=z.defaults,Ze=V.unescape,Je=function(){function Ee(be){this.options=be||et,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new ot}Ee.parse=function(re,ne){var de=new Ee(ne);return de.parse(re)};var ve=Ee.prototype;return ve.parse=function(re,ne){ne===void 0&&(ne=!0);var de="",ue,fe,Ae,Ie,Ye,ht,Xe,gt,at,Qe,kt,Et,Dt,Ot,Tt,Zt,Qt,vt,Lt=re.length;for(ue=0;ue<Lt;ue++){Qe=re[ue];switch(Qe.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,Ze(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(gt="",Xe="",Ie=Qe.header.length,fe=0;fe<Ie;fe++)Xe+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[fe]),{header:!0,align:Qe.align[fe]});for(gt+=this.renderer.tablerow(Xe),at="",Ie=Qe.cells.length,fe=0;fe<Ie;fe++){for(ht=Qe.tokens.cells[fe],Xe="",Ye=ht.length,Ae=0;Ae<Ye;Ae++)Xe+=this.renderer.tablecell(this.parseInline(ht[Ae]),{header:!1,align:Qe.align[Ae]});at+=this.renderer.tablerow(Xe)}de+=this.renderer.table(gt,at);continue}case"blockquote":{at=this.parse(Qe.tokens),de+=this.renderer.blockquote(at);continue}case"list":{for(kt=Qe.ordered,Et=Qe.start,Dt=Qe.loose,Ie=Qe.items.length,at="",fe=0;fe<Ie;fe++)Tt=Qe.items[fe],Zt=Tt.checked,Qt=Tt.task,Ot="",Tt.task&&(vt=this.renderer.checkbox(Zt),Dt?Tt.tokens.length>0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=vt+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=vt+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:vt}):Ot+=vt),Ot+=this.parse(Tt.tokens,Dt),at+=this.renderer.listitem(Ot,Qt,Zt);de+=this.renderer.list(at,kt,Et);continue}case"html":{de+=this.renderer.html(Qe.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(at=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;ue+1<Lt&&re[ue+1].type==="text";)Qe=re[++ue],at+=`
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);de+=ne?this.renderer.paragraph(at):at;continue}default:{var jt='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(jt);return}else throw new Error(jt)}}}return de},ve.parseInline=function(re,ne){ne=ne||this.renderer;var de="",ue,fe,Ae=re.length;for(ue=0;ue<Ae;ue++){fe=re[ue];switch(fe.type){case"escape":{de+=ne.text(fe.text);break}case"html":{de+=ne.html(fe.text);break}case"link":{de+=ne.link(fe.href,fe.title,this.parseInline(fe.tokens,ne));break}case"image":{de+=ne.image(fe.href,fe.title,fe.text);break}case"strong":{de+=ne.strong(this.parseInline(fe.tokens,ne));break}case"em":{de+=ne.em(this.parseInline(fe.tokens,ne));break}case"codespan":{de+=ne.codespan(fe.text);break}case"br":{de+=ne.br();break}case"del":{de+=ne.del(this.parseInline(fe.tokens,ne));break}case"text":{de+=ne.text(fe.text);break}default:{var Ie='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(Ie);return}else throw new Error(Ie)}}}return de},Ee}(),pt=V.merge,st=V.checkSanitizeDeprecation,rt=V.escape,Pe=z.getDefaults,dt=z.changeDefaults,lt=z.defaults;function Ne(Ee,ve,be){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 ve=="function"&&(be=ve,ve=null),ve=pt({},Ne.defaults,ve||{}),st(ve),be){var re=ve.highlight,ne;try{ne=De.lex(Ee,ve)}catch(Ae){return be(Ae)}var de=function(Ie){var Ye;if(!Ie)try{Ye=Je.parse(ne,ve)}catch(ht){Ie=ht}return ve.highlight=re,Ie?be(Ie):be(null,Ye)};if(!re||re.length<3)return de();if(delete ve.highlight,!ne.length)return de();var ue=0;Ne.walkTokens(ne,function(Ae){Ae.type==="code"&&(ue++,setTimeout(function(){re(Ae.text,Ae.lang,function(Ie,Ye){if(Ie)return de(Ie);Ye!=null&&Ye!==Ae.text&&(Ae.text=Ye,Ae.escaped=!0),ue--,ue===0&&de()})},0))}),ue===0&&de();return}try{var fe=De.lex(Ee,ve);return ve.walkTokens&&Ne.walkTokens(fe,ve.walkTokens),Je.parse(fe,ve)}catch(Ae){if(Ae.message+=`
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+rt(Ae.message+"",!0)+"</pre>";throw Ae}}Ne.options=Ne.setOptions=function(Ee){return pt(Ne.defaults,Ee),dt(Ne.defaults),Ne},Ne.getDefaults=Pe,Ne.defaults=lt,Ne.use=function(Ee){var ve=pt({},Ee);if(Ee.renderer&&function(){var re=Ne.defaults.renderer||new Be,ne=function(fe){var Ae=re[fe];re[fe]=function(){for(var Ie=arguments.length,Ye=new Array(Ie),ht=0;ht<Ie;ht++)Ye[ht]=arguments[ht];var Xe=Ee.renderer[fe].apply(re,Ye);return Xe===!1&&(Xe=Ae.apply(re,Ye)),Xe}};for(var de in Ee.renderer)ne(de);ve.renderer=re}(),Ee.tokenizer&&function(){var re=Ne.defaults.tokenizer||new xe,ne=function(fe){var Ae=re[fe];re[fe]=function(){for(var Ie=arguments.length,Ye=new Array(Ie),ht=0;ht<Ie;ht++)Ye[ht]=arguments[ht];var Xe=Ee.tokenizer[fe].apply(re,Ye);return Xe===!1&&(Xe=Ae.apply(re,Ye)),Xe}};for(var de in Ee.tokenizer)ne(de);ve.tokenizer=re}(),Ee.walkTokens){var be=Ne.defaults.walkTokens;ve.walkTokens=function(re){Ee.walkTokens(re),be&&be(re)}}Ne.setOptions(ve)},Ne.walkTokens=function(Ee,ve){for(var be=O(Ee),re;!(re=be()).done;){var ne=re.value;ve(ne);switch(ne.type){case"table":{for(var de=O(ne.tokens.header),ue;!(ue=de()).done;){var fe=ue.value;Ne.walkTokens(fe,ve)}for(var Ae=O(ne.tokens.cells),Ie;!(Ie=Ae()).done;)for(var Ye=Ie.value,ht=O(Ye),Xe;!(Xe=ht()).done;){var gt=Xe.value;Ne.walkTokens(gt,ve)}break}case"list":{Ne.walkTokens(ne.items,ve);break}default:ne.tokens&&Ne.walkTokens(ne.tokens,ve)}}},Ne.Parser=Je,Ne.parser=Je.parse,Ne.Renderer=Be,Ne.TextRenderer=Ue,Ne.Lexer=De,Ne.lexer=De.lex,Ne.Tokenizer=xe,Ne.Slugger=ot,Ne.parse=Ne;var Ke=Ne;return Ke})},EGTK:function(ft,tt,ie){"use strict";var se=ie("R9oj"),J=ie("ECub"),D=ie("T2oS"),$=ie("W9HT"),O=ie("5NDa"),M=ie("5rEg"),z=ie("k1fw"),W=ie("9og8"),U=ie("tJVT"),R=ie("WmNS"),y=ie.n(R),C=ie("cDcd"),k=ie.n(C),A=ie("TSYQ"),_=ie.n(A),E=ie("dGDm"),u=ie.n(E),o=ie("Lai7"),s=ie.n(o),d=ie("ErOA"),w=ie("LvDl"),m=ie.n(w),g=function(c){var p=c.className,h=c.dispatch,a=c.skin,x=a===void 0?"white":a,v=c.value,S=v===void 0?null:v,B=c.loading,F=B===void 0?!1:B,K=c.data,V=K===void 0?[]:K,P=c.otherData,I=P===void 0?[]:P,Y=c.tags,ee=Y===void 0?[]:Y,oe=c.onChange,pe=oe===void 0?function(){}:oe,Oe=Object(C.useState)(""),xe=Object(U.a)(Oe,2),_e=xe[0],Te=xe[1],Ce=Object(C.useState)(!1),me=Object(U.a)(Ce,2),le=me[0],te=me[1],ce=Object(C.useState)([]),ae=Object(U.a)(ce,2),Le=ae[0],Re=ae[1],Se=Object(C.useState)(0),De=Object(U.a)(Se,2),Me=De[0],je=De[1],We=Object(C.useRef)(null),Be=Object(C.useRef)(String(Math.floor(Math.random()*1e6))).current,Ue=Object(C.useRef)(),ot=Object(C.useRef)(null),et=Object(C.useRef)(0),Ze=Object(C.useRef)([]);Object(C.useEffect)(function(){return window.addEventListener("keydown",Je),function(){window.removeEventListener("keydown",Je)}},[_e,le,Le]);var Je=function(fe){if(!le||fe.keyCode!==40&&fe.keyCode!==38)return;var Ae=0;fe.keyCode===40&&le&&(Me<Le.length-1?Ae=Me+1:Ae=0,console.log("\u4E0B"),Pe(Ae,"down")),fe.keyCode===38&&le&&(Me===0?Ae=Le.length-1:Ae=Me-1,Pe(Ae,"up")),je(Ae),st(_e,Ae,!0)},pt=function(fe,Ae){var Ie=function(Xe){var gt=/[\^\.\\\|\(\)\*\+\-\$\[\]\?]/g,at={};return at["^"]="\\^",at["."]="\\.",at["\\"]="\\\\",at["|"]="\\|",at["("]="\\(",at[")"]="\\)",at["*"]="\\*",at["+"]="\\+",at["-"]="\\-",at.$="$",at["["]="\\[",at["]"]="\\]",at["?"]="\\?",Xe=Xe.replace(gt,function(Qe){return at[Qe]}),Xe},Ye=new RegExp(Ie(Ae),"gi");return fe=fe.replace(Ye,function(ht){return"<span style='color:#0152d9;'>"+ht+"</span>"}),fe},st=function(){var ue=Object(W.a)(y.a.mark(function fe(Ae,Ie,Ye){var ht,Xe,gt;return y.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:if(ht=et.current+1,et.current=ht,Xe=function(Et){var Dt=Et==null?void 0:Et.map(function(Ot,Tt){var Zt=Ot.id,Qt=Ot.name,vt=Object(z.a)(Object(z.a)({},Ot),{},{label:k.a.createElement("ul",{id:"search-".concat(Be,"-").concat(Tt),onClick:function(){return Ne(Zt,vt)},className:Tt===Ie?u.a.searchListActive:u.a.searchList},k.a.createElement("li",{className:u.a.name,dangerouslySetInnerHTML:{__html:pt(Qt,Ae)}}),Ot.private&&k.a.createElement("li",{className:u.a.tag},"\u79C1\u6709"))});return vt});return Dt},!Ye){Qe.next=7;break}return gt=Xe(Ze.current),Re(gt),Qe.abrupt("return");case 7:clearTimeout(ot.current),ot.current=setTimeout(Object(W.a)(y.a.mark(function kt(){var Et,Dt,Ot,Tt;return y.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,Object(d.a)("/api/shixuns/search_image.json",{method:"get",params:{keywords:Ae,page:1,limit:1e5}});case 2:Et=Qt.sent,(Et==null?void 0:Et.status)===0&&(Ot=Xe((Et==null||((Dt=Et.data)===null||Dt===void 0)?void 0:Dt.mirrors)||[]),ht===et.current&&(Re(Ot),Ze.current=Object(w.cloneDeep)((Et==null||((Tt=Et.data)===null||Tt===void 0)?void 0:Tt.mirrors)||[])));case 4:case"end":return Qt.stop()}},kt)})),300);case 9:case"end":return Qe.stop()}},fe)}));return function(Ae,Ie,Ye){return ue.apply(this,arguments)}}(),rt=function(fe){var Ae=document.getElementById("scroll-".concat(Be,"-").concat(fe));if(!Ae)return;var Ie=document.getElementById("scroll-".concat(Be));Ie.scrollTo(0,Ae.offsetTop)},Pe=function(fe,Ae){var Ie=document.getElementById("search-".concat(Be,"-").concat(fe));if(!Ie)return;var Ye=document.getElementById("search-".concat(Be)),ht=Ie.offsetTop-Ye.scrollTop>0&&Ie.offsetTop-Ye.scrollTop<Ye.clientHeight;if(ht)return;Ae==="down"?Ye.scrollTo(0,Ie.offsetTop-Ye.clientHeight+Ie.clientHeight):Ye.scrollTo(0,Ie.offsetTop)},dt=function(fe){st(fe,0),Te(fe)},lt=function(fe){var Ae,Ie;if(!Le.length)return;var Ye=Le==null||((Ae=Le[Me])===null||Ae===void 0)?void 0:Ae.id;pe(Ye),Re([]),je(0),Te(Le==null||((Ie=Le[Me])===null||Ie===void 0)?void 0:Ie.name),rt(Ye),Ue.current.blur()},Ne=function(fe,Ae){pe(fe),Re([]),je(0),Te(Ae==null?void 0:Ae.name),rt(fe)},Ke=function(){Re([]),Te("")},Ee=function(fe){pe(fe),Re([]),Te("")},ve=function(){return _e===""?k.a.createElement("i",{style:{pointerEvents:"none"},className:"iconfont icon-sousuo2 c-grey-c"}):k.a.createElement("i",{onClick:Ke,className:"iconfont icon-shanchu4 c-grey-c"})},be=function(){h({type:"newShixuns/setActionTabs",payload:{key:"NewShixuns-Apply"}})},re=function(){h({type:"newShixuns/setActionTabs",payload:{key:"Create-Environment"}})},ne=function(){We.current=setTimeout(function(){te(!1),je(0)},200)},de=!(V!=null&&V.length)&&!(I!=null&&I.length);return k.a.createElement("div",{className:_()(x==="night"?u.a.darklySelectEnvironment:u.a.selectEnvironment,p)},!de&&k.a.createElement("div",{className:u.a.search},k.a.createElement(M.a,{suffix:ve(),bordered:!1,ref:Ue,value:_e,onKeyDown:function(fe){(fe.keyCode===40||fe.keyCode===38)&&fe.preventDefault()},size:"large",onFocus:function(){clearTimeout(We.current),dt(_e),te(!0)},onBlur:ne,onChange:function(fe){return dt(fe.target.value)},placeholder:"\u641C\u7D22\u60A8\u9700\u8981\u7684\u5B9E\u9A8C\u73AF\u5883",onPressEnter:lt}),le&&k.a.createElement("div",{id:"search-".concat(Be),className:u.a.searchListWrap},Le.map(function(ue,fe){return k.a.createElement(k.a.Fragment,{key:fe}," ",ue.label)}))),F?k.a.createElement($.a,{className:u.a.spin}):k.a.createElement(k.a.Fragment,null,de&&k.a.createElement(J.a,{style:{margin:"60px 0"},image:s.a,description:k.a.createElement("span",{className:"c-grey-999"},"\u6682\u65E0\u5B9E\u9A8C\u73AF\u5883")}),!!ee.length&&k.a.createElement("aside",{className:u.a.common},k.a.createElement("div",{className:u.a.title},"\u63A8\u8350\u73AF\u5883:"),k.a.createElement("ul",{className:u.a.tags},ee.map(function(ue,fe){return k.a.createElement("li",{key:fe,onClick:function(){return Ee(ue.id)},className:S===ue.id?"".concat(u.a.tag," ").concat(u.a.tagActive):u.a.tag},ue.name)}))),k.a.createElement("aside",{className:u.a.wrap,id:"scroll-".concat(Be)},V.map(function(ue,fe){var Ae;return ue!=null&&(Ae=ue.image)!==null&&Ae!==void 0&&Ae.length?k.a.createElement(L,{key:fe,data:ue,id:S,handleClick:function(Ye){return Ee(Ye)}}):null}),k.a.createElement("ul",{className:u.a.allList},I.map(function(ue){return k.a.createElement("li",{key:"key-".concat(ue.id),id:"scroll-".concat(Be,"-").concat(ue.id),className:ue.id===S?"".concat(u.a.item," ").concat(u.a.itemActive):u.a.item,onClick:function(){return pe(ue.id)}},k.a.createElement("div",{className:u.a.name},ue.name),ue.private&&k.a.createElement("div",{className:u.a.tag},"\u79C1\u6709"))})))),k.a.createElement("div",{className:u.a.apply},k.a.createElement("span",{className:u.a.p1},"\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"),k.a.createElement("span",{className:u.a.p2,onClick:be}," \u7533\u8BF7\u65B0\u5EFA"),k.a.createElement("span",{className:u.a.p2,onClick:re}," \u5728\u7EBF\u521B\u5EFA")))},L=function(c){var p=c.data,h=c.id,a=c.handleClick,x=Object(C.useState)(!0),v=Object(U.a)(x,2),S=v[0],B=v[1],F=p.name,K=p.image;return k.a.createElement("div",{className:u.a.list},k.a.createElement("header",{onClick:function(){return B(!S)}},k.a.createElement("div",{className:u.a.title},F),k.a.createElement("i",{style:{transition:"0.5s",transform:S?"rotate(0deg)":"rotate(180deg)"},className:"iconfont icon-shangjiantou c-grey-999"})),k.a.createElement("ul",{className:u.a.items,style:{height:S?"auto":0}},K.map(function(V){return k.a.createElement("li",{key:V.id,className:V.id===h?"".concat(u.a.item," ").concat(u.a.itemActive):u.a.item,onClick:function(){return a(V.id)}},k.a.createElement("div",{className:u.a.name},V.name),V.private&&k.a.createElement("div",{className:u.a.tag},"\u79C1\u6709"))}),k.a.createElement("li",{className:u.a.line})))};tt.a=g},ELLl:function(ft,tt,ie){(function(se){se(ie("VrN/"))})(function(se){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=se.Pos;se.defineOption("autoCloseBrackets",!1,function(_,E,u){u&&u!=se.Init&&(_.removeKeyMap(O),_.state.closeBrackets=null),E&&(M($(E,"pairs")),_.state.closeBrackets=E,_.addKeyMap(O))});function $(_,E){return E=="pairs"&&typeof _=="string"?_:typeof _=="object"&&_[E]!=null?_[E]:J[E]}var O={Backspace:U,Enter:R};function M(_){for(var E=0;E<_.length;E++){var u=_.charAt(E),o="'"+u+"'";O[o]||(O[o]=z(u))}}M(J.pairs+"`");function z(_){return function(E){return C(E,_)}}function W(_){var E=_.state.closeBrackets;if(!E||E.override)return E;var u=_.getModeAt(_.getCursor());return u.closeBrackets||E}function U(_){var E=W(_);if(!E||_.getOption("disableInput"))return se.Pass;for(var u=$(E,"pairs"),o=_.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return se.Pass;var d=k(_,o[s].head);if(!d||u.indexOf(d)%2!=0)return se.Pass}for(var s=o.length-1;s>=0;s--){var w=o[s].head;_.replaceRange("",D(w.line,w.ch-1),D(w.line,w.ch+1),"+delete")}}function R(_){var E=W(_),u=E&&$(E,"explode");if(!u||_.getOption("disableInput"))return se.Pass;for(var o=_.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return se.Pass;var d=k(_,o[s].head);if(!d||u.indexOf(d)%2!=0)return se.Pass}_.operation(function(){var w=_.lineSeparator()||`
`;_.replaceSelection(w+w,null),_.execCommand("goCharLeft"),o=_.listSelections();for(var m=0;m<o.length;m++){var g=o[m].head.line;_.indentLine(g,null,!0),_.indentLine(g+1,null,!0)}})}function y(_){var E=se.cmpPos(_.anchor,_.head)>0;return{anchor:new D(_.anchor.line,_.anchor.ch+(E?-1:1)),head:new D(_.head.line,_.head.ch+(E?1:-1))}}function C(_,E){var u=W(_);if(!u||_.getOption("disableInput"))return se.Pass;var o=$(u,"pairs"),s=o.indexOf(E);if(s==-1)return se.Pass;for(var d=$(u,"closeBefore"),w=$(u,"triples"),m=o.charAt(s+1)==E,g=_.listSelections(),L=s%2==0,b,c=0;c<g.length;c++){var p=g[c],h=p.head,a,x=_.getRange(h,D(h.line,h.ch+1));if(L&&!p.empty())a="surround";else if((m||!L)&&x==E)m&&A(_,h)?a="both":w.indexOf(E)>=0&&_.getRange(h,D(h.line,h.ch+3))==E+E+E?a="skipThree":a="skip";else if(m&&h.ch>1&&w.indexOf(E)>=0&&_.getRange(D(h.line,h.ch-2),h)==E+E){if(h.ch>2&&/\bstring/.test(_.getTokenTypeAt(D(h.line,h.ch-2))))return se.Pass;a="addFour"}else if(m){var v=h.ch==0?" ":_.getRange(D(h.line,h.ch-1),h);if(!se.isWordChar(x)&&v!=E&&!se.isWordChar(v))a="both";else return se.Pass}else if(L&&(x.length===0||/\s/.test(x)||d.indexOf(x)>-1))a="both";else return se.Pass;if(!b)b=a;else if(b!=a)return se.Pass}var S=s%2?o.charAt(s-1):E,B=s%2?E:o.charAt(s+1);_.operation(function(){if(b=="skip")_.execCommand("goCharRight");else if(b=="skipThree")for(var F=0;F<3;F++)_.execCommand("goCharRight");else if(b=="surround"){for(var K=_.getSelections(),F=0;F<K.length;F++)K[F]=S+K[F]+B;_.replaceSelections(K,"around"),K=_.listSelections().slice();for(var F=0;F<K.length;F++)K[F]=y(K[F]);_.setSelections(K)}else b=="both"?(_.replaceSelection(S+B,null),_.triggerElectric(S+B),_.execCommand("goCharLeft")):b=="addFour"&&(_.replaceSelection(S+S+S+S,"before"),_.execCommand("goCharRight"))})}function k(_,E){var u=_.getRange(D(E.line,E.ch-1),D(E.line,E.ch+1));return u.length==2?u:null}function A(_,E){var u=_.getTokenAt(D(E.line,E.ch+1));return/\bstring/.test(u.type)&&u.start==E.ch&&(E.ch==0||!/\bstring/.test(_.getTokenTypeAt(E)))}})},FPkq:function(ft,tt,ie){ft.exports=ie.p+"static/qrCode.dd0fe9b2.png"},FrRK:function(ft,tt,ie){"use strict";var se=ie("+L6B"),J=ie("2/Rp"),D=ie("DZo9"),$=ie("8z0m"),O=ie("miYZ"),M=ie("tsqr"),z=ie("9og8"),W=ie("2qtc"),U=ie("kLXV"),R=ie("y8nQ"),y=ie("Vl3Y"),C=ie("tJVT"),k=ie("PpiC"),A=ie("5NDa"),_=ie("5rEg"),E=ie("WmNS"),u=ie.n(E),o=ie("cDcd"),s=ie.n(o),d=ie("9kvl"),w=ie("m3rI"),m=ie("FPkq"),g=ie.n(m),L=ie("qB8g"),b=ie.n(L),c=_.a.TextArea,p=function(a){var x=a.newShixuns,v=a.globalSetting,S=a.loading,B=a.dispatch,F=Object(k.a)(a,["newShixuns","globalSetting","loading","dispatch"]),K=y.a.useForm(),V=Object(C.a)(K,1),P=V[0],I=Object(o.useState)([]),Y=Object(C.a)(I,2),ee=Y[0],oe=Y[1],pe=function(me){var le=["uploading","done","removed"];le.includes(me.file.status)&&oe(me.fileList)},Oe=function(me){if(!me.percent||me.percent==100){var le,te=(le=me.response)===null||le===void 0?void 0:le.id;return U.a.confirm({centered:!0,title:"\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A\u9644\u4EF6\u5417?",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var ce=Object(z.a)(u.a.mark(function Le(){var Re;return u.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,B({type:"newShixuns/deleteAttachment",payload:{id:te}});case 2:Re=De.sent,Re&&oe(ee.filter(function(Me){var je;return((je=Me.response)===null||je===void 0?void 0:je.id)!==te}));case 4:case"end":return De.stop()}},Le)}));function ae(){return ce.apply(this,arguments)}return ae}()}),!1}},xe=function(me){if(ee.length)return!1;var le=me.size/1024/1024>50;return le?(M.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E50MB"),!1):!0},_e=function(){var Ce=Object(z.a)(u.a.mark(function me(le){var te,ce,ae,Le,Re,Se,De,Me;return u.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return ae=le||{},Le=ae.language,Re=ae.env,Se=ae.mode,De=ae.code,We.next=3,B({type:"newShixuns/applyShixunMirror",payload:{language:Le,runtime:Re,run_method:Se,attachment_id:ee==null||((te=ee[0])===null||te===void 0||((ce=te.response)===null||ce===void 0))?void 0:ce.id}});case 3:Me=We.sent,B({type:"newShixuns/setActionTabs",payload:{}}),Me&&M.b.success("\u65B0\u5EFA\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u7BA1\u7406\u5458\u5BA1\u6838\u3002");case 6:case"end":return We.stop()}},me)}));return function(le){return Ce.apply(this,arguments)}}(),Te=function(){P.resetFields(),oe([])};return s.a.createElement(U.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:x.actionTabs.key==="NewShixuns-Apply",title:"\u7533\u8BF7\u65B0\u5EFA",width:"1000px",footer:null,afterClose:Te},s.a.createElement("section",{className:b.a.qrCode},s.a.createElement("aside",{className:b.a.a1},s.a.createElement("div",{className:b.a.code},s.a.createElement("img",{width:120,height:120,src:g.a,alt:"\u4E8C\u7EF4\u7801"})),s.a.createElement("div",{className:b.a.group},"\u5B9E\u9A8C\u73AF\u5883\u7533\u8BF7QQ\u7FA4"),s.a.createElement("div",{className:b.a.groupNumber},"\u7FA4\u53F7\uFF1A740157011")),s.a.createElement("aside",{className:b.a.a2},"\u5C0A\u656C\u7684\u8001\u5E08/\u540C\u5B66\u60A8\u597D\uFF0C",s.a.createElement("br",null),"\u5982\u679C\u60A8\u60F3\u65B0\u5EFA\u5B9E\u9A8C\u73AF\u5883\uFF0C\u53EF\u4EE5\u626B\u63CF\u5DE6\u4FA7\u4E8C\u7EF4\u7801\u8FDB\u7FA4\uFF0C\u76F4\u63A5\u5411\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u7533\u8BF7\u54E6~ \u4E5F\u53EF\u4EE5\u63D0\u4EA4\u4E0B\u9762\u7684\u8868\u5355\u7533\u8BF7\uFF0C\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u6536\u5230\u7533\u8BF7\u4FE1\u606F\u5C06\u4F1A\u7B2C\u4E00\u65F6\u95F4\u8054\u7CFB\u60A8\uFF01")),s.a.createElement(y.a,{className:b.a.formWrap,form:P,labelCol:{span:4},wrapperCol:{span:20},onFinish:_e},s.a.createElement(y.a.Item,{label:"\u8BED\u8A00\uFF1A",name:"language",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00"}]},s.a.createElement(c,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48\u8BED\u8A00\uFF1A\u793A\u4F8B\uFF1APython",rows:4})),s.a.createElement(y.a.Item,{label:"\u7CFB\u7EDF\u73AF\u5883\uFF1A",name:"env",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00\u7CFB\u7EDF\u73AF\u5883"}]},s.a.createElement(c,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48linux\u7CFB\u7EDF\u73AF\u5883,\u4EE3\u7801\u8FD0\u884C\u73AF\u5883",rows:4})),s.a.createElement(y.a.Item,{label:"\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F\uFF1A",name:"mode",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F"}]},s.a.createElement(c,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u4E2D\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F",rows:4})),s.a.createElement(y.a.Item,{label:"\u6D4B\u8BD5\u4EE3\u7801\uFF1A",name:"code",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u9644\u4EF6"}]},s.a.createElement("div",{className:b.a.upload},s.a.createElement($.a,{fileList:ee,action:"".concat(w.a.API_SERVER,"/api/attachments.json?client_key=6d57f8c3dd186c5ada392546ace9620a"),onChange:pe,onRemove:Oe,beforeUpload:xe,withCredentials:!0},s.a.createElement("span",{className:"".concat(b.a.color0152d9," current")},"\u4E0A\u4F20\u9644\u4EF6"),s.a.createElement("span",{className:"".concat(b.a.colorCCC," ml10")},"(\u5355\u4E2A\u6587\u4EF650M\u4EE5\u5185)")))),s.a.createElement("div",{className:b.a.footerWrap},s.a.createElement(y.a.Item,null,s.a.createElement(J.a,{className:"mr5",size:"large",onClick:function(){B({type:"newShixuns/setActionTabs",payload:{}})}},"\u53D6\u6D88"),s.a.createElement(J.a,{size:"large",type:"primary",htmlType:"submit",loading:S["newShixuns/applyShixunMirror"]},"\u4FDD\u5B58")))))};tt.a=Object(d.a)(function(h){var a=h.newShixuns,x=h.loading,v=h.globalSetting;return{newShixuns:a,globalSetting:v,loading:x.effects}})(p)},GfqC:function(ft,tt,ie){"use strict";var se=ie("cDcd"),J=ie.n(se),D=ie("TSYQ"),$=ie.n(D);function O(V,P){var I="cannot "+V.method+" "+V.action+" "+P.status+"'",Y=new Error(I);return Y.status=P.status,Y.method=V.method,Y.url=V.action,Y}function M(V){var P=V.responseText||V.response;if(!P)return P;try{return JSON.parse(P)}catch(I){return P}}function z(V){var P=new XMLHttpRequest;V.onProgress&&P.upload&&(P.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var I=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(pe){I.append(ee+"[]",pe)});return}I.append(ee,V.data[ee])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),P.onerror=function(oe){V.onError(oe)},P.onload=function(){return P.status<200||P.status>=300?V.onError(O(V,P),M(P)):V.onSuccess(M(P),P)},P.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var Y=V.headers||{};return Y["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(ee){Y[ee]!==null&&P.setRequestHeader(ee,Y[ee])}),P.send(I),{abort:function(){P.abort()}}}var W=+new Date,U=0;function R(){return"rc-upload-"+W+"-"+ ++U}function y(V,P){return V.indexOf(P,V.length-P.length)!==-1}var C=function(V,P){if(V&&P){var I=Array.isArray(P)?P:P.split(","),Y=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return I.some(function(pe){var Oe=pe.trim();return Oe.charAt(0)==="."?y(Y.toLowerCase(),Oe.toLowerCase()):/\/\*$/.test(Oe)?oe===Oe.replace(/\/.*$/,""):ee===Oe})}return!0};function k(V,P){var I=V.createReader(),Y=[];function ee(){I.readEntries(function(oe){var pe=Array.prototype.slice.apply(oe);Y=Y.concat(pe);var Oe=!pe.length;Oe?P(Y):ee()})}ee()}var A=function(P,I,Y){var ee=function oe(pe,Oe){Oe=Oe||"",pe.isFile?pe.file(function(xe){Y(xe)&&(pe.fullPath&&!xe.webkitRelativePath&&(Object.defineProperties(xe,{webkitRelativePath:{writable:!0}}),xe.webkitRelativePath=pe.fullPath.replace(/^\//,""),Object.defineProperties(xe,{webkitRelativePath:{writable:!1}})),I([xe]))}):pe.isDirectory&&k(pe,function(xe){xe.forEach(function(_e){oe(_e,""+Oe+pe.name+"/")})})};P.forEach(function(oe){ee(oe.webkitGetAsEntry())})},_=A,E=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var Y in I)Object.prototype.hasOwnProperty.call(I,Y)&&(V[Y]=I[Y])}return V},u=function(){function V(P,I){var Y=[],ee=!0,oe=!1,pe=void 0;try{for(var Oe=P[Symbol.iterator](),xe;!(ee=(xe=Oe.next()).done)&&!(Y.push(xe.value),I&&Y.length===I);ee=!0);}catch(_e){oe=!0,pe=_e}finally{try{!ee&&Oe.return&&Oe.return()}finally{if(oe)throw pe}}return Y}return function(P,I){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return V(P,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(P,I){for(var Y=0;Y<I.length;Y++){var ee=I[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(P,ee.key,ee)}}return function(P,I,Y){return I&&V(P.prototype,I),Y&&V(P,Y),P}}();function s(V,P,I){return P in V?Object.defineProperty(V,P,{value:I,enumerable:!0,configurable:!0,writable:!0}):V[P]=I,V}function d(V,P){var I={};for(var Y in V){if(P.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,Y))continue;I[Y]=V[Y]}return I}function w(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function m(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function g(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}var L=function(P){return Object.keys(P).reduce(function(I,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(I[Y]=P[Y]),I},{})},b=function(V){g(P,V);function P(){var I,Y,ee,oe;w(this,P);for(var pe=arguments.length,Oe=Array(pe),xe=0;xe<pe;xe++)Oe[xe]=arguments[xe];return oe=(Y=(ee=m(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Oe))),ee),ee.state={uid:R()},ee.reqs={},ee.onChange=function(_e){var Te=_e.target.files;ee.uploadFiles(Te),ee.reset()},ee.onClick=function(_e){var Te=ee.fileInput;if(!Te)return;var Ce=ee.props,me=Ce.children,le=Ce.onClick;me&&me.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),le&&le(_e)},ee.onKeyDown=function(_e){_e.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(_e){var Te=ee.props.multiple;if(_e.preventDefault(),_e.type==="dragover")return;if(ee.props.directory)_(Array.prototype.slice.call(_e.dataTransfer.items),ee.uploadFiles,function(me){return C(me,ee.props.accept)});else{var Ce=Array.prototype.slice.call(_e.dataTransfer.files).filter(function(me){return C(me,ee.props.accept)});Te===!1&&(Ce=Ce.slice(0,1)),ee.uploadFiles(Ce)}},ee.uploadFiles=function(_e){var Te=Array.prototype.slice.call(_e);Te.map(function(Ce){return Ce.uid=R(),Ce}).forEach(function(Ce){ee.upload(Ce,Te)})},ee.saveFileInput=function(_e){ee.fileInput=_e},Y),m(ee,oe)}return o(P,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,ee){var oe=this,pe=this.props;if(!pe.beforeUpload)return setTimeout(function(){return oe.post(Y)},0);var Oe=pe.beforeUpload(Y,ee);Oe&&Oe.then?Oe.then(function(xe){var _e=Object.prototype.toString.call(xe);return _e==="[object File]"||_e==="[object Blob]"?oe.post(xe):oe.post(Y)}).catch(function(xe){console.log(xe)}):Oe!==!1&&setTimeout(function(){return oe.post(Y)},0);return}},{key:"post",value:function(Y){var ee=this;if(!this._isMounted)return;var oe=this.props,pe=oe.onStart,Oe=oe.onProgress,xe=oe.transformFile,_e=xe===void 0?function(Te){return Te}:xe;new Promise(function(Te){var Ce=oe.action;return typeof Ce=="function"&&(Ce=Ce(Y)),Te(Ce)}).then(function(Te){var Ce=Y.uid,me=oe.customRequest||z,le=Promise.resolve(_e(Y)).then(function(te){var ce=oe.data;return typeof ce=="function"&&(ce=ce(te)),Promise.all([te,ce])}).catch(function(te){console.error(te)});le.then(function(te){var ce=u(te,2),ae=ce[0],Le=ce[1],Re={action:Te,filename:oe.name,data:Le,file:ae,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:Oe?function(Se){Oe(Se,Y)}:null,onSuccess:function(De,Me){delete ee.reqs[Ce],oe.onSuccess(De,Y,Me)},onError:function(De,Me){delete ee.reqs[Ce],oe.onError(De,Me,Y)}};pe(Y),ee.reqs[Ce]=me(Re)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(Y){var ee=this.reqs;if(Y){var oe=Y;Y&&Y.uid&&(oe=Y.uid),ee[oe]&&ee[oe].abort&&ee[oe].abort(),delete ee[oe]}else Object.keys(ee).forEach(function(pe){ee[pe]&&ee[pe].abort&&ee[pe].abort(),delete ee[pe]})}},{key:"render",value:function(){var Y,ee=this.props,oe=ee.component,pe=ee.prefixCls,Oe=ee.className,xe=ee.disabled,_e=ee.id,Te=ee.style,Ce=ee.multiple,me=ee.accept,le=ee.children,te=ee.directory,ce=ee.openFileDialogOnClick,ae=ee.onMouseEnter,Le=ee.onMouseLeave,Re=d(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Se=$()((Y={},s(Y,pe,!0),s(Y,pe+"-disabled",xe),s(Y,Oe,Oe),Y)),De=xe?{}:{onClick:ce?this.onClick:function(){},onKeyDown:ce?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:Le,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(oe,E({},De,{className:Se,role:"button",style:Te}),J.a.createElement("input",E({},L(Re),{id:_e,type:"file",ref:this.saveFileInput,onClick:function(je){return je.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Ce,onChange:this.onChange})),le)}}]),P}(se.Component),c=b,p=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var Y in I)Object.prototype.hasOwnProperty.call(I,Y)&&(V[Y]=I[Y])}return V},h=function(){function V(P,I){for(var Y=0;Y<I.length;Y++){var ee=I[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(P,ee.key,ee)}}return function(P,I,Y){return I&&V(P.prototype,I),Y&&V(P,Y),P}}();function a(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function x(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function v(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}function S(){}var B=function(V){v(P,V);function P(){var I,Y,ee,oe;a(this,P);for(var pe=arguments.length,Oe=Array(pe),xe=0;xe<pe;xe++)Oe[xe]=arguments[xe];return oe=(Y=(ee=x(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Oe))),ee),ee.saveUploader=function(_e){ee.uploader=_e},Y),x(ee,oe)}return h(P,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return J.a.createElement(c,p({},this.props,{ref:this.saveUploader}))}}]),P}(se.Component);B.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 F=B,K=tt.a=F},Gytx:function(ft,tt){ft.exports=function(se,J,D,$){var O=D?D.call($,se,J):void 0;if(O!==void 0)return!!O;if(se===J)return!0;if(typeof se!="object"||!se||typeof J!="object"||!J)return!1;var M=Object.keys(se),z=Object.keys(J);if(M.length!==z.length)return!1;for(var W=Object.prototype.hasOwnProperty.bind(J),U=0;U<M.length;U++){var R=M[U];if(!W(R))return!1;var y=se[R],C=J[R];if(O=D?D.call($,y,C,R):void 0,O===!1||O===void 0&&y!==C)return!1}return!0}},HmJG:function(ft,tt,ie){},IH3J:function(ft,tt,ie){ft.exports={wrapInstallPackageStyle:"wrapInstallPackageStyle___2JdHa",installPackageStyle:"installPackageStyle___3mphi",title:"title___-Mfcd",line:"line___1qKKa",bodyHeight:"bodyHeight___3hV2N"}},Lai7:function(ft,tt,ie){ft.exports=ie.p+"static/noEnvData.6108fa6c.png"},LdHM:function(ft,tt,ie){"use strict";ie.d(tt,"b",function(){return d}),ie.d(tt,"a",function(){return m});var se=ie("1OyB"),J=ie("vuIU"),D=ie("Ji7U"),$=ie("LK+K"),O=ie("cDcd"),M=ie("rePB"),z=ie("Ff2n"),W=ie("ODXe"),U=ie("4IlW"),R=ie("bX4T"),y=ie("YrtM"),C=ie("TSYQ"),k=ie.n(C),A=ie("+nKL"),_=ie("8OUc"),E=function(Y,ee){var oe=Y.prefixCls,pe=Y.id,Oe=Y.flattenOptions,xe=Y.childrenAsData,_e=Y.values,Te=Y.searchValue,Ce=Y.multiple,me=Y.defaultActiveFirstOption,le=Y.height,te=Y.itemHeight,ce=Y.notFoundContent,ae=Y.open,Le=Y.menuItemSelectedIcon,Re=Y.virtual,Se=Y.onSelect,De=Y.onToggleOpen,Me=Y.onActiveValue,je=Y.onScroll,We=Y.onMouseEnter,Be="".concat(oe,"-item"),Ue=Object(y.a)(function(){return Oe},[ae,Oe],function(Ke,Ee){return Ee[0]&&Ke[1]!==Ee[1]}),ot=O.useRef(null),et=function(Ee){Ee.preventDefault()},Ze=function(Ee){ot.current&&ot.current.scrollTo({index:Ee})},Je=function(Ee){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ue.length,re=0;re<be;re+=1){var ne=(Ee+re*ve+be)%be,de=Ue[ne],ue=de.group,fe=de.data;if(!ue&&!fe.disabled)return ne}return-1},pt=O.useState(function(){return Je(0)}),st=Object(W.a)(pt,2),rt=st[0],Pe=st[1],dt=function(Ee){Pe(Ee);var ve=Ue[Ee];if(!ve){Me(null,-1);return}Me(ve.data.value,Ee)};O.useEffect(function(){dt(me!==!1?Je(0):-1)},[Ue.length,Te]),O.useEffect(function(){var Ke=setTimeout(function(){if(!Ce&&ae&&_e.size===1){var Ee=Array.from(_e)[0],ve=Ue.findIndex(function(be){var re=be.data;return re.value===Ee});dt(ve),Ze(ve)}});return function(){return clearTimeout(Ke)}},[ae]);var lt=function(Ee){Ee!==void 0&&Se(Ee,{selected:!_e.has(Ee)}),Ce||De(!1)};if(O.useImperativeHandle(ee,function(){return{onKeyDown:function(Ee){var ve=Ee.which;switch(ve){case U.a.UP:case U.a.DOWN:{var be=0;if(ve===U.a.UP?be=-1:ve===U.a.DOWN&&(be=1),be!==0){var re=Je(rt+be,be);Ze(re),dt(re)}break}case U.a.ENTER:{var ne=Ue[rt];ne&&!ne.data.disabled?lt(ne.data.value):lt(void 0),ae&&Ee.preventDefault();break}case U.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(Ee){Ze(Ee)}}}),Ue.length===0)return O.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),className:"".concat(Be,"-empty"),onMouseDown:et},ce);function Ne(Ke){var Ee=Ue[Ke];if(!Ee)return null;var ve=Ee.data||{},be=ve.value,re=ve.label,ne=ve.children,de=Object(R.a)(ve,!0),ue=xe?ne:re;return Ee?O.createElement("div",Object.assign({"aria-label":typeof ue=="string"?ue:null},de,{key:Ke,role:"option",id:"".concat(pe,"_list_").concat(Ke),"aria-selected":_e.has(be)}),be):null}return O.createElement(O.Fragment,null,O.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ne(rt-1),Ne(rt),Ne(rt+1)),O.createElement(A.a,{itemKey:"key",ref:ot,data:Ue,height:le,itemHeight:te,fullHeight:!1,onMouseDown:et,onScroll:je,virtual:Re,onMouseEnter:We},function(Ke,Ee){var ve,be=Ke.group,re=Ke.groupOption,ne=Ke.data,de=ne.label,ue=ne.key;if(be)return O.createElement("div",{className:k()(Be,"".concat(Be,"-group"))},de!==void 0?de:ue);var fe=ne.disabled,Ae=ne.value,Ie=ne.title,Ye=ne.children,ht=ne.style,Xe=ne.className,gt=Object(z.a)(ne,["disabled","value","title","children","style","className"]),at=_e.has(Ae),Qe="".concat(Be,"-option"),kt=k()(Be,Qe,Xe,(ve={},Object(M.a)(ve,"".concat(Qe,"-grouped"),re),Object(M.a)(ve,"".concat(Qe,"-active"),rt===Ee&&!fe),Object(M.a)(ve,"".concat(Qe,"-disabled"),fe),Object(M.a)(ve,"".concat(Qe,"-selected"),at),ve)),Et=xe?Ye:de,Dt=!Le||typeof Le=="function"||at;return O.createElement("div",Object.assign({},gt,{"aria-selected":at,className:kt,title:Ie,onMouseMove:function(){if(rt===Ee||fe)return;dt(Ee)},onClick:function(){fe||lt(Ae)},style:ht}),O.createElement("div",{className:"".concat(Qe,"-content")},Et||Ae),O.isValidElement(Le)||at,Dt&&O.createElement(_.a,{className:"".concat(Be,"-option-state"),customizeIcon:Le,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},u=O.forwardRef(E);u.displayName="OptionList";var o=u,s=function(){return null};s.isSelectOption=!0;var d=s,w=function(){return null};w.isSelectOptGroup=!0;var m=w,g=ie("VTBJ"),L=ie("Zm9Q");function b(I){var Y=I.key,ee=I.props,oe=ee.children,pe=ee.value,Oe=Object(z.a)(ee,["children","value"]);return Object(g.a)({key:Y,value:pe!==void 0?pe:Y,children:oe},Oe)}function c(I){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(I).map(function(ee,oe){if(!O.isValidElement(ee)||!ee.type)return null;var pe=ee.type.isSelectOptGroup,Oe=ee.key,xe=ee.props,_e=xe.children,Te=Object(z.a)(xe,["children"]);return Y||!pe?b(ee):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(Oe===null?oe:Oe,"__"),label:Oe},Te),{},{options:c(_e)})}).filter(function(ee){return ee})}var p=ie("2Qr1"),h=ie("qNPg"),a=ie("U8pU"),x=ie("Kwbf"),v=ie("WKfj");function S(I){var Y=I.mode,ee=I.options,oe=I.children,pe=I.backfill,Oe=I.allowClear,xe=I.placeholder,_e=I.getInputElement,Te=I.showSearch,Ce=I.onSearch,me=I.defaultOpen,le=I.autoFocus,te=I.labelInValue,ce=I.value,ae=I.inputValue,Le=I.optionLabelProp,Re=Y==="multiple"||Y==="tags",Se=Te!==void 0?Te:Re||Y==="combobox",De=ee||c(oe);if(Object(x.a)(Y!=="tags"||De.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var Me=De.some(function(Be){return Be.options?Be.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(x.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(Y!=="combobox"||!Le,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(Y==="combobox"||!pe,"`backfill` only works with `combobox` mode."),Object(x.a)(Y==="combobox"||!_e,"`getInputElement` only work with `combobox` mode."),Object(x.b)(Y!=="combobox"||!_e||!Oe||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ce&&!Se&&Y!=="combobox"&&Y!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!me||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ce!=null){var je=Object(v.d)(ce);Object(x.a)(!te||je.every(function(Be){return Object(a.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Re||Array.isArray(ce),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var We=null;Object(L.a)(oe).some(function(Be){if(!O.isValidElement(Be)||!Be.type)return!1;var Ue=Be.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var ot=Object(L.a)(Be.props.children).every(function(et){return!O.isValidElement(et)||!Be.type||et.type.isSelectOption?!0:(We=et.type,!1)});return!ot}return We=Ue,!0}),We&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(x.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var B=S,F=Object(h.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:c,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:B,fillOptionsWithMissingValue:p.a}),K=function(I){Object(D.a)(ee,I);var Y=Object($.a)(ee);function ee(){var oe;return Object(se.a)(this,ee),oe=Y.apply(this,arguments),oe.selectRef=O.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(J.a)(ee,[{key:"render",value:function(){return O.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),ee}(O.Component);K.Option=d,K.OptGroup=m;var V=K,P=tt.c=V},M8RZ:function(ft,tt,ie){"use strict";ie.d(tt,"a",function(){return U});var se=ie("fWQN"),J=ie("mtLc"),D=ie("yKVA"),$=ie("879j"),O=ie("cDcd"),M=ie.n(O),z=ie("faye"),W=ie.n(z),U=function(R){Object(D.a)(C,R);var y=Object($.a)(C);function C(k){var A;Object(se.a)(this,C),A=y.call(this,k);var _=window.document;return A.node=_.createElement("div"),_.body.appendChild(A.node),A}return Object(J.a)(C,[{key:"render",value:function(){var A=this.props.children;return Object(z.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),C}(M.a.Component)},N3QO:function(ft,tt,ie){"use strict";var se=ie("2qtc"),J=ie("kLXV"),D=ie("tJVT"),$=ie("cDcd"),O=ie.n($),M=ie("9kvl"),z=ie("FPkq"),W=ie.n(z),U=function(y){var C,k=y.newShixuns,A=y.dispatch,_=y.user,E=Object($.useState)(!1),u=Object(D.a)(E,2),o=u[0],s=u[1];Object($.useEffect)(function(){k.actionTabs.key==="Create-Environment"&&w()},[k==null||((C=k.actionTabs)===null||C===void 0)?void 0:C.key]);var d=function(){A({type:"newShixuns/setActionTabs",payload:{}})},w=function(){var g,L,b;d(),((g=_.userInfo)===null||g===void 0?void 0:g.mirror_marker_status)===0?s(!0):((L=_.userInfo)===null||L===void 0?void 0:L.mirror_marker_status)===1?M.d.push("/shixuns/new/CreateImg"):((b=_.userInfo)===null||b===void 0?void 0:b.mirror_marker_status)===2&&J.a.confirm({title:"\u60A8\u4ECA\u65E5\u5DF2\u8FBE\u5230\u7533\u8BF7\u4E0A\u9650\uFF0C\u662F\u5426\u8DF3\u8F6C\u81F3\u4E91\u4E3B\u673A\u5217\u8868\uFF1F",content:"\u63D0\u793A\uFF1A\u6BCF\u5929\u6700\u591A\u5141\u8BB8\u7533\u8BF7\u4E00\u53F0\u4E91\u4E3B\u673A",okText:"\u8DF3\u8F6C",cancelText:"\u53D6\u6D88",onOk:function(){var p;M.d.push("/users/".concat((p=_.userInfo)===null||p===void 0?void 0:p.login,"/experiment-img"))}})};return O.a.createElement(J.a,{title:"\u52A0\u5165qq\u7FA4\u63D0\u793A",visible:o,footer:null,onCancel:function(){s(!1)}},O.a.createElement("div",{style:{textAlign:"center"}},O.a.createElement("br",null),O.a.createElement("img",{width:120,height:120,style:{marginTop:"20px"},src:W.a,alt:"\u4E8C\u7EF4\u7801"})),O.a.createElement("img",null))};tt.a=Object(M.a)(function(R){var y=R.newShixuns,C=R.user,k=R.globalSetting;return{newShixuns:y,globalSetting:k,user:C}})(U)},OLES:function(ft,tt,ie){"use strict";var se=ie("U8pU"),J=ie("VTBJ"),D=ie("Ff2n"),$=ie("cDcd"),O=ie("uciX"),M=ie("7ixt"),z=function(k){var A=k.overlay,_=k.prefixCls,E=k.id,u=k.overlayInnerStyle;return $.createElement("div",{className:"".concat(_,"-inner"),id:E,role:"tooltip",style:u},typeof A=="function"?A():A)},W=z,U=function(k,A){var _=k.overlayClassName,E=k.trigger,u=E===void 0?["hover"]:E,o=k.mouseEnterDelay,s=o===void 0?0:o,d=k.mouseLeaveDelay,w=d===void 0?.1:d,m=k.overlayStyle,g=k.prefixCls,L=g===void 0?"rc-tooltip":g,b=k.children,c=k.onVisibleChange,p=k.afterVisibleChange,h=k.transitionName,a=k.animation,x=k.placement,v=x===void 0?"right":x,S=k.align,B=S===void 0?{}:S,F=k.destroyTooltipOnHide,K=F===void 0?!1:F,V=k.defaultVisible,P=k.getTooltipContainer,I=k.overlayInnerStyle,Y=Object(D.a)(k,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ee=Object($.useRef)(null);Object($.useImperativeHandle)(A,function(){return ee.current});var oe=Object(J.a)({},Y);"visible"in k&&(oe.popupVisible=k.visible);var pe=function(){var Ce=k.arrowContent,me=Ce===void 0?null:Ce,le=k.overlay,te=k.id;return[$.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},me),$.createElement(W,{key:"content",prefixCls:L,id:te,overlay:le,overlayInnerStyle:I})]},Oe=!1,xe=!1;if(typeof K=="boolean")Oe=K;else if(K&&Object(se.a)(K)==="object"){var _e=K.keepParent;Oe=_e===!0,xe=_e===!1}return $.createElement(O.a,Object.assign({popupClassName:_,prefixCls:L,popup:pe,action:u,builtinPlacements:M.a,popupPlacement:v,ref:ee,popupAlign:B,getPopupContainer:P,onPopupVisibleChange:c,afterPopupVisibleChange:p,popupTransitionName:h,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Oe,autoDestroy:xe,mouseLeaveDelay:w,popupStyle:m,mouseEnterDelay:s},oe),b)},R=Object($.forwardRef)(U),y=tt.a=R},Ot1p:function(ft,tt,ie){"use strict";var se=ie("2qtc"),J=ie("kLXV"),D=ie("rAM+"),$=ie("miYZ"),O=ie("tsqr"),M=ie("9og8"),z=ie("tJVT"),W=ie("jrin"),U=ie("WmNS"),R=ie.n(U),y=ie("cDcd"),C=ie.n(y),k=ie("VrN/"),A=ie.n(k),_=ie("bdgK"),E=ie("p77/"),u=ie("Bd2K"),o=ie("ELLl"),s=ie("19Vz"),d=ie("lZu9"),w=ie("+NIl"),m=ie("kSUc"),g=ie("9Bee"),L=function(fe){var Ae=fe.value,Ie=Ae===void 0?"":Ae,Ye=fe.className,ht=fe.showTextOnly,Xe=fe.showLines,gt=fe.style,at=gt===void 0?{}:gt,Qe=Object(y.useMemo)(function(){return""},[Ie]);return C.a.createElement(C.a.Fragment,null,C.a.createElement("div",{dangerouslySetInnerHTML:{__html:Qe}}))},b=ie("0Owb"),c=ie("dejd"),p=ie("C+DQ"),h=ie("1vsH"),a=ie("m3rI"),x=[{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 v(fe){var Ae=fe.onActionCallback,Ie=fe.title,Ye=fe.icon,ht=fe.actionName,Xe=fe.className,gt=Xe===void 0?"":Xe,at=fe.children;function Qe(){Ae(ht)}return C.a.createElement("a",{title:Ie,className:gt,onClick:Qe},C.a.createElement("i",{className:"md-iconfont ".concat(Ye)}),at)}var S=function(fe){var Ae=fe.watch,Ie=fe.showNullButton,Ye=fe.onActionCallback,ht=fe.fullScreen,Xe=fe.insertTemp,gt=fe.hidetoolBar,at=fe.uuid,Qe=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.F)("_educoder_session"),"&key=").concat(at,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var kt=[].concat(x,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return C.a.createElement("ul",{className:"markdown-toolbar-container"},!gt&&kt.map(function(Et,Dt){return C.a.createElement("li",{key:Dt},Et.actionName?C.a.createElement(v,Object(b.a)({},Et,{onActionCallback:Ye})):C.a.createElement("span",{className:"v-line"}))}),Ie?C.a.createElement("li",null,C.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ye},C.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Xe&&C.a.createElement("li",null,C.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Xe),onActionCallback:Ye},C.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),C.a.createElement("li",{className:"btn-full-screen"},C.a.createElement(v,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ye})))},B=ie("M8RZ"),F=ie("+L6B"),K=ie("2/Rp"),V=ie("y8nQ"),P=ie("Vl3Y"),I=ie("5NDa"),Y=ie("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(fe){var Ae=fe.callback,Ie=fe.onCancel;function Ye(ht){Ae(ht)}return C.a.createElement(P.a,Object(b.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ye}),C.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},C.a.createElement(Y.a,null)),C.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},C.a.createElement(Y.a,null)),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(K.a,{type:"ghost",onClick:Ie},"\u53D6\u6D88")))},pe=ie("7ahc"),Oe=ie("HmJG"),xe=ie("BjJ7"),_e=P.a.useForm,Te={width:280,marginRight:10},Ce={labelCol:{span:5},wrapperCol:{span:19}},me=function(fe){var Ae=fe.callback,Ie=fe.onCancel,Ye=_e(),ht=Object(z.a)(Ye,1),Xe=ht[0];function gt(kt){Ae(kt)}function at(kt,Et){if(kt.status===-1){O.b.error(kt.message);return}Xe.setFieldsValue({src:"/api/attachments/".concat(kt.id),type:Et.type})}function Qe(kt){var Et=kt.target.files[0];te(Et,at)}return C.a.createElement(P.a,Object(b.a)({form:Xe},Ce,{className:"upload-image-panel",onFinish:gt}),C.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},C.a.createElement("div",{className:"flex-container"},C.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},C.a.createElement(Y.a,{style:Te})),C.a.createElement(le,{onFileChange:Qe}))),C.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},C.a.createElement(Y.a,{style:{width:264}})),C.a.createElement(P.a.Item,{style:{textAlign:"right"}},C.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(K.a,{type:"ghost",onClick:Ie},"\u53D6\u6D88")))};function le(fe){var Ae=fe.onFileChange;return C.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",C.a.createElement("input",{type:"file",onChange:Ae}))}function te(fe,Ae){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ie=new FormData;Ie.append("editormd-image-file",fe),Ie.append("file_param_name","editormd-image-file"),Ie.append("byxhr","true");var Ye=new window.XMLHttpRequest;Ye.withCredentials=!0,Ye.addEventListener("load",function(ht){Ae(JSON.parse(ht.target.responseText),fe)},!1),Ye.addEventListener("error",function(ht){console.error(ht)},!1),Ye.open("POST","".concat(xe.a,"/api/attachments.json")),Ye.send(Ie)}var ce=ie("giR+"),ae=ie("fyUT"),Le=ie("7Kak"),Re=ie("9yH6"),Se=Re.a.Group,De={margin:"0 8px"},Me=function(fe){var Ae=fe.callback,Ie=fe.onCancel;function Ye(ht){Ae(ht)}return C.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ye},C.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},C.a.createElement("span",{style:De},"\u5355\u5143\u683C\u6570\uFF1A"),C.a.createElement("span",{style:De},"\u884C\u6570"),C.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},C.a.createElement(ae.a,null)),C.a.createElement("span",{style:De},"\u5217\u6570"),C.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},C.a.createElement(ae.a,null))),C.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},C.a.createElement("span",{style:De},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),C.a.createElement(P.a.Item,{name:"align"},C.a.createElement(Se,null,C.a.createElement(Re.a,{value:"default"},C.a.createElement("i",{className:"fa fa-align-justify"})),C.a.createElement(Re.a,{value:"left"},C.a.createElement("i",{className:"fa fa-align-left"})),C.a.createElement(Re.a,{value:"center"},C.a.createElement("i",{className:"fa fa-align-center"})),C.a.createElement(Re.a,{value:"right"},C.a.createElement("i",{className:"fa fa-align-right"}))))),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(K.a,{type:"ghost",onClick:Ie},"\u53D6\u6D88")))},je=ie("ErOA"),We=ie("7Cbv"),Be="link",Ue="upload-image",ot="code-block",et="add-table",Ze="------------",Je={default:Ze,left:":".concat(Ze),center:":".concat(Ze,":"),right:"".concat(Ze,":")},pt=ie("9VGf"),st,rt;function Pe(){}var dt=0,lt=1e4,Ne="\u2581",Ke=`
**\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(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,be=ve?"Cmd":"Ctrl",re=["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"],ne=(st={},Object(W.a)(st,be+"-B","bold"),Object(W.a)(st,be+"-I","italic"),st),de=(rt={},Object(W.a)(rt,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(rt,ot,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(rt,Ue,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(rt,et,"\u6DFB\u52A0\u8868\u683C"),rt),ue=tt.a=function(fe){var Ae=fe.defaultValue,Ie=Ae===void 0?"":Ae,Ye=fe.onChange,ht=fe.width,Xe=ht===void 0?"100%":ht,gt=fe.height,at=gt===void 0?400:gt,Qe=fe.miniToolbar,kt=Qe===void 0?!1:Qe,Et=fe.isFocus,Dt=Et===void 0?!1:Et,Ot=fe.watch,Tt=fe.insertTemp,Zt=fe.mode,Qt=Zt===void 0?"markdown":Zt,vt=fe.id,Lt=vt===void 0?"markdown-editor-id":vt,jt=fe.showResizeBar,Ut=jt===void 0?!1:jt,qt=fe.noStorage,ir=qt===void 0?!1:qt,er=fe.showNullButton,Bt=er===void 0?!1:er,ct=fe.hidetoolBar,Kr=ct===void 0?!1:ct,ti=fe.fullScreen,xr=ti===void 0?!1:ti,Mt=fe.onBlur,Wr=fe.onCMBeforeChange,Yr=fe.onFullScreen,fi=fe.className,Ve=fi===void 0?"":fi,_t=fe.disablePaste,pi=_t===void 0?!1:_t,mi=fe.placeholder,gi=mi===void 0?"":mi,vi=fe.values,G=vi===void 0?"":vi,l=Object(y.useState)(null),f=Object(z.a)(l,2),N=f[0],Q=f[1],H=Object(y.useState)(Ie),ye=Object(z.a)(H,2),He=ye[0],qe=ye[1],yt=Object(y.useState)(Ot),Ge=Object(z.a)(yt,2),St=Ge[0],Ht=Ge[1],Jt=Object(y.useState)(xr),Ur=Object(z.a)(Jt,2),Sr=Ur[0],Cr=Ur[1],$r=Object(y.useState)(""),Ri=Object(z.a)($r,2),cr=Ri[0],Hr=Ri[1],si=Object(y.useState)(0),li=Object(z.a)(si,2),Br=li[0],Oi=li[1],yi=Object(y.useState)(at),zi=Object(z.a)(yi,2),Ki=zi[0],Jr=zi[1],Vr=Object(y.useState)(!1),bi=Object(z.a)(Vr,2),hn=bi[0],Ei=bi[1],ar=Object(y.useRef)(Object(We.a)()),Gt=Object(y.useRef)(!1),yr=Object(y.useRef)(),It=Object(y.useRef)(),sr=Object(y.useRef)(),Vt=Object(y.useRef)(),ri=Object(y.useRef)(),fr=function(){var bt=Object(M.a)(R.a.mark(function At(){var Ct,Pt;return R.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ar.current}});case 2:Pt=Yt.sent,Pt!=null&&(Ct=Pt.attachments)!==null&&Ct!==void 0&&Ct.length&&(console.log("cm:",N,It),Pt.attachments.map(function(Ft){Ft.content_type.indexOf("image")>-1?N.replaceSelection("![,](/api/attachments/".concat(Ft.id,"?type=").concat(Ft.content_type,")")):Ft.content_type.indexOf("video")>-1?N.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ft.content_type.indexOf("pdf")>-1?N.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):N.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,")"))}));case 4:case"end":return Yt.stop()}},At)}));return function(){return bt.apply(this,arguments)}}();Object(y.useEffect)(function(){qe(G),N==null||N.setValue(G)},[G]),Object(y.useEffect)(function(){Yr==null||Yr(Sr)},[Sr]),Object(y.useEffect)(function(){if(It.current){var bt=A.a.fromTextArea(It.current,{mode:Qt,lineNumbers:!kt,lineWrapping:!0,value:Ie,autoCloseTags:!0,autoCloseBrackets:!0});Dt&&bt.focus();function At(Ct,Pt){if(pi){Pt.preventDefault();return}var Wt=Pt.clipboardData;if(Wt){var Yt=Wt.types.toString(),Ft=Wt.items;if(Yt==="Files"||Wt.types.indexOf("Files")>-1){if(Pt.preventDefault(),Qt=="stex")return;try{var dr,Dr=Ft[1];((dr=Ft[0])===null||dr===void 0?void 0:dr.kind)==="file"&&(Dr=Ft[0]);var Nt=Dr.getAsFile(),ui=Nt.name.split(".").pop();te(Nt,function(zt){if(zt.id){var Rr,Tr,Xr;(Nt==null||((Rr=Nt.type)===null||Rr===void 0)?void 0:Rr.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Nt==null||((Tr=Nt.type)===null||Tr===void 0)?void 0:Tr.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Nt==null||((Xr=Nt.type)===null||Xr===void 0)?void 0:Xr.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):re.includes(ui)?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):bt.replaceSelection("[".concat(Nt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){O.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",At),bt.on("dragleave",function(Ct,Pt){sr.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(Ct,Pt){sr.current.classList.add("mouse-hover-md")}),bt.on("drop",function(Ct,Pt){sr.current.classList.add("mouse-hover-md");var Wt;if(Wt=Pt.dataTransfer.files,Wt.length>0){Pt.preventDefault(),Pt.stopPropagation();for(var Yt=function(Dr){var Nt=Wt[Dr],ui=Nt.name.split(".").pop();te(Nt,function(zt){if(zt.id){var Rr,Tr,Xr;(Nt==null||((Rr=Nt.type)===null||Rr===void 0)?void 0:Rr.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Nt==null||((Tr=Nt.type)===null||Tr===void 0)?void 0:Tr.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Nt==null||((Xr=Nt.type)===null||Xr===void 0)?void 0:Xr.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):re.includes(ui)?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):bt.replaceSelection("[".concat(Nt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Ft=0;Ft<Wt.length;Ft++)Yt(Ft)}}),Q(bt),function(){bt.off("paste",At)}}},[]);var Ar=Object(y.useCallback)(function(){if(sr.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[Ki,sr,Sr]);Object(y.useEffect)(function(){function bt(){var Ct=new _.default(function(Pt){var Wt=Object(D.a)(Pt),Yt;try{for(Wt.s();!(Yt=Wt.n()).done;){var Ft=Yt.value;(Ft.target.offsetHeight>0||Ft.target.offsetWidth>0)&&(Ar(),N.setSize("100%","100%"),N.refresh())}}catch(dr){Wt.e(dr)}finally{Wt.f()}});return Ct.observe(It.current.parentElement),Ct}if(N){var At=bt();return function(){At.unobserve(It.current.parentElement)}}},[N,Ar]),Object(y.useEffect)(function(){if(N){for(var bt=[],At=function(){var Ft=Pt[Ct];Wt=Object(z.a)(Ft,2);var dr=Wt[0],Dr=Wt[1],Nt=Object(W.a)({},dr,function(){Vi(Dr)});bt.push(Nt),N.addKeyMap(Nt)},Ct=0,Pt=Object.entries(ne);Ct<Pt.length;Ct++){var Wt;At()}return yr.current=setInterval(function(){Gt.current&&fr()},4e3),function(){clearInterval(yr.current);var Yt=Object(D.a)(bt),Ft;try{for(Yt.s();!(Ft=Yt.n()).done;){var dr=Ft.value;N.removeKeyMap(dr)}}catch(Dr){Yt.e(Dr)}finally{Yt.f()}}}},[N]),Object(y.useEffect)(function(){xr!==Sr&&Cr(xr)},[xr]),Object(pt.a)(function(){if(!ir&&Br>0){var bt=new Date().getTime(),At=window.sessionStorage.getItem(Lt);bt>=Br+lt&&(!At||At!==He)&&(window.sessionStorage.setItem(Lt,He),Ei(!0))}},lt),Object(y.useEffect)(function(){Ht(Ot)},[N,Ot]),Object(y.useEffect)(function(){N&&(Dt&&N.focus())},[N,Dt]),Object(y.useEffect)(function(){if(St&&N){var bt=N.getScrollerElement();function At(Ct){var Pt=Ct.target;if(ri.current){var Wt=Pt.scrollTop/Pt.scrollHeight;ri.current.scrollTop=ri.current.scrollHeight*Wt}}return bt.addEventListener("scroll",At),function(){bt.removeEventListener("scroll",At)}}},[N,St]),Object(y.useEffect)(function(){if(N&&Wr){function bt(At,Ct){Wr(At,Ct)}return N.on("beforeChange",bt),function(){N.off("beforeChange",bt)}}},[N,Wr]),Object(y.useEffect)(function(){if(N&&Mt){function bt(){Mt(N.getValue())}return N.on("blur",bt),function(){N.off("blur",bt)}}},[N,Mt]),Object(y.useEffect)(function(){if(N){function bt(At){var Ct=At.getValue();qe(Ct),Oi(new Date().getTime()),At.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ye&&Ye(Ct)}return N.on("change",bt),function(){N.off("change",bt)}}},[N,Ye]),Object(y.useEffect)(function(){N&&(Ie==null?(N.setValue(""),qe("")):Ie!==N.getValue()&&(N.setValue(Ie),qe(Ie),N.setCursor(N.lineCount(),0)))},[N,Ie]);var Vi=Object(y.useCallback)(function(bt){var At=N.getCursor(),Ct=N.getSelection(),Pt=Ct.split(`
`);switch(bt){case"bold":return N.replaceSelection("**"+Ct+"**"),Ct===""&&N.setCursor(At.line,At.ch+2),N.focus();case"italic":return N.replaceSelection("*"+Ct+"*"),Ct===""&&N.setCursor(At.line,At.ch+1),N.focus();case"code":return N.replaceSelection("`"+Ct+"`"),Ct===""&&N.setCursor(At.line,At.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+Ct+"$$`"),Ct===""&&N.setCursor(At.line,At.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+Ct+"\n```"),N.setCursor(At.line+1,Ct.length+1),N.focus();case"line-break":return N.replaceSelection(`<br/>
`),N.focus();case"list-ul":return Ct===""?N.replaceSelection("- "+Ct):N.replaceSelection(Pt.map(function(Wt){return Wt===""?"":"- ".concat(Wt)}).join(`
`)),N.focus();case"list-ol":return Ct===""?N.replaceSelection("1. "+Ct):N.replaceSelection(Pt.map(function(Wt,Yt){return Wt===""?"":"".concat(Yt+1,". ").concat(Wt)}).join(`
`)),N.focus();case"add-null-ch":return Ct===""&&N.setCursor(At.line,At.ch+1),N.replaceSelection(Ne),N.focus();case"inster-template-1":return Ct===""&&N.setCursor(At.line,At.ch),N.replaceSelection(Ke),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return Ht(!St),N.focus();case"trigger-full-screen":return Cr(!Sr),N.focus();case Be:Hr(Be);return;case ot:Hr(ot);return;case Ue:Hr(Ue);return;case et:Hr(et);return;default:throw new Error}},[N,St,Sr]),xi=Object(y.useCallback)(function(bt){Hr("");switch(cr){case Be:var At=bt.title,Ct=bt.link;return N.replaceSelection("[".concat(At,"](").concat(Ct,")")),N.focus();case ot:var Pt=bt.language,Wt=bt.content;return N.replaceSelection(["```"+Pt,Wt,"```"].join(`
`)),N.focus();case Ue:var Yt=bt.src,Ft=bt.alt;return Ft?N.replaceSelection("![ ".concat(Ft," ]( ").concat(Yt,' "').concat(Ft,'" )')):N.replaceSelection("![,](".concat(Yt,")")),N.focus();case et:for(var dr=bt.row,Dr=bt.col,Nt=bt.align,ui=`
`,zt=0;zt<dr;zt++){for(var Rr=[],Tr=[],Xr=0;Xr<Dr;Xr++)zt===1&&Tr.push(Je[Nt]),Rr.push(" ");zt===1&&(ui+="| ".concat(Tr.join(" | "),` |
`)),ui+="| ".concat(Rr.join(Dr===1?"":" | "),` |
`)}return N.replaceSelection(ui+`
`),N.focus();default:throw new Error}},[N,cr]),cn=Object(y.useMemo)(function(){switch(cr){case Be:return C.a.createElement(oe,{callback:xi,onCancel:Si});case ot:return C.a.createElement(pe.b,{callback:xi,onCancel:Si});case Ue:return C.a.createElement(me,{callback:xi,onCancel:Si});case et:return C.a.createElement(Me,{callback:xi,onCancel:Si});default:return null}},[cr]);function Si(){Hr("")}Object(y.useEffect)(function(){if(Vt.current){var bt=Vt.current,At=!1,Ct=0;function Pt(Ft){At=!0,Ct=Ft.pageY}function Wt(){At=!1}function Yt(Ft){if(At){var dr=Ft.pageY-Ct;dr<0&&(dr=0),dr>300&&(dr=300);var Dr=at+dr+"px";Jr(Dr)}}return bt.addEventListener("mousedown",Pt),document.addEventListener("mousemove",Yt),document.addEventListener("mouseup",Wt),function(){bt.removeEventListener("mousedown",Pt),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Wt)}}},[N,Vt]),Object(y.useEffect)(function(){Jr(at)},[at]);var ii=Ee(Xe),fn=Ee(Ki),Zr={width:ii,height:fn},pn=Object(y.useMemo)(function(){if(Br){var bt=new Date(Br),At=bt.getHours(),Ct=bt.getMinutes(),Pt=bt.getSeconds();return At=At<10?"0"+At:At,Ct=Ct<10?"0"+Ct:Ct,Pt=Pt<10?"0"+Pt:Pt,"".concat(At,":").concat(Ct,":").concat(Pt)}return 0},[Br]);function jn(){window.sessionStorage.removeItem(Lt),Ei(!1),Oi(0)}function Pi(){Ei(!1),Oi(0),N.setValue(window.sessionStorage.getItem(Lt))}function ua(bt,At){var Ct=N.getValue();Ct=Ct.replace(bt,At),qe(Ct),N==null||N.setValue(Ct)}return C.a.createElement(y.Fragment,null,C.a.createElement("div",{className:"markdown-editor-wrapper",ref:sr},C.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(St?"on-preview":""," ").concat(kt?"mini":""," ").concat(Sr?"full-screen":""),style:Zr},C.a.createElement(S,{insertTemp:Tt,watch:St,fullScreen:Sr,showNullButton:Bt,onActionCallback:Vi,hidetoolBar:Kr,uuid:ar.current,setOpenPhones:function(){Gt.current=!0}}),C.a.createElement("div",{className:"markdown-editor-body"},C.a.createElement("div",{className:"codemirror-container"},C.a.createElement("textarea",{ref:It,placeholder:gi})),St?C.a.createElement("div",{ref:ri,className:"preview-container"},Qt==="stex"&&C.a.createElement(L,{value:He}),Qt!=="stex"&&C.a.createElement(g.a,{edit:!0,value:He,replaces:ua})):null))),Ut?C.a.createElement("a",{ref:Vt,className:"editor-resize"}):null,C.a.createElement(B.a,null,de[cr]?C.a.createElement(J.a,{centered:!0,title:de[cr],visible:!0,onCancel:Si,footer:null,className:"markdown-popup-form"},cn):null))}},QXZ7:function(ft,tt,ie){"use strict";var se=ie("2qtc"),J=ie("kLXV"),D=ie("cDcd"),$=ie.n(D),O=ie("9Bee"),M=ie("IH3J"),z=ie.n(M),W=function(R){var y,C,k=R.installPackage,A=R.visible,_=R.setVisible;return Object(D.useEffect)(function(){return A?document.body.setAttribute("class",z.a.bodyHeight):document.body.removeAttribute("class"),function(){document.body.removeAttribute("class")}},[A]),$.a.createElement(J.a,{centered:!0,keyboard:!1,destroyOnClose:!0,visible:A,title:"\u73AF\u5883\u4ECB\u7ECD",width:"1000px",wrapClassName:z.a.wrapInstallPackageStyle,footer:null,onCancel:function(){return _(!1)}},$.a.createElement("div",{className:z.a.installPackageStyle},$.a.createElement("div",{className:"mb30"},$.a.createElement("div",{className:z.a.title},k.mainTypeName),$.a.createElement("div",null,$.a.createElement(O.a,{value:k.mainTypeDescription}))),!!(k!=null&&(y=k.smallType)!==null&&y!==void 0&&y.length)&&$.a.createElement("div",{className:z.a.line}),$.a.createElement("div",null,k==null||((C=k.smallType)===null||C===void 0)?void 0:C.map(function(E,u){return $.a.createElement($.a.Fragment,{key:u},$.a.createElement("div",{className:z.a.title,style:{marginBottom:14}},E.name),$.a.createElement("div",{className:"mb30"},$.a.createElement(O.a,{value:E.des})))}))))};tt.a=W},SJMd:function(ft,tt){/**
* @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 ie,se,J,D=!1,$,O;window.PR_SHOULD_USE_CONTINUATION=!0;var M,z;(function(){var W=window,U=["break,continue,do,else,for,if,return,while"],R=[U,"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"],y=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],C=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],k=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[y,"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"],_="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",E=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[U,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[U,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[U,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[C,A,k,E,u,o,s,d],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",L="kwd",b="com",c="typ",p="lit",h="pun",a="pln",x="tag",v="dec",S="src",B="atn",F="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(Se){for(var De=0,Me=!1,je=!1,We=0,Be=Se.length;We<Be;++We){var Ue=Se[We];if(Ue.ignoreCase)je=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,je=!1;break}}var ot={b:8,t:9,n:10,v:11,f:12,r:13};function et(rt){var Pe=rt.charCodeAt(0);if(Pe!==92)return Pe;var dt=rt.charAt(1);return Pe=ot[dt],Pe||("0"<=dt&&dt<="7"?parseInt(rt.substring(1),8):dt==="u"||dt==="x"?parseInt(rt.substring(2),16):rt.charCodeAt(1))}function Ze(rt){if(rt<32)return(rt<16?"\\x0":"\\x")+rt.toString(16);var Pe=String.fromCharCode(rt);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function Je(rt){var Pe=rt.substring(1,rt.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")),dt=[],lt=Pe[0]==="^",Ne=["["];lt&&Ne.push("^");for(var Ke=lt?1:0,Ee=Pe.length;Ke<Ee;++Ke){var ve=Pe[Ke];if(/\\[bdsw]/i.test(ve))Ne.push(ve);else{var be=et(ve),re;Ke+2<Ee&&Pe[Ke+1]==="-"?(re=et(Pe[Ke+2]),Ke+=2):re=be,dt.push([be,re]),re<65||be>122||(re<65||be>90||dt.push([Math.max(65,be)|32,Math.min(re,90)|32]),re<97||be>122||dt.push([Math.max(97,be)&~32,Math.min(re,122)&~32]))}}dt.sort(function(fe,Ae){return fe[0]-Ae[0]||Ae[1]-fe[1]});for(var ne=[],de=[],Ke=0;Ke<dt.length;++Ke){var ue=dt[Ke];ue[0]<=de[1]+1?de[1]=Math.max(de[1],ue[1]):ne.push(de=ue)}for(var Ke=0;Ke<ne.length;++Ke){var ue=ne[Ke];Ne.push(Ze(ue[0])),ue[1]>ue[0]&&(ue[1]+1>ue[0]&&Ne.push("-"),Ne.push(Ze(ue[1])))}return Ne.push("]"),Ne.join("")}function pt(rt){for(var Pe=rt.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")),dt=Pe.length,lt=[],Ne=0,Ke=0;Ne<dt;++Ne){var Ee=Pe[Ne];if(Ee==="(")++Ke;else if(Ee.charAt(0)==="\\"){var ve=+Ee.substring(1);ve&&(ve<=Ke?lt[ve]=-1:Pe[Ne]=Ze(ve))}}for(var Ne=1;Ne<lt.length;++Ne)lt[Ne]===-1&&(lt[Ne]=++De);for(var Ne=0,Ke=0;Ne<dt;++Ne){var Ee=Pe[Ne];if(Ee==="(")++Ke,lt[Ke]||(Pe[Ne]="(?:");else if(Ee.charAt(0)==="\\"){var ve=+Ee.substring(1);ve&&ve<=Ke&&(Pe[Ne]="\\"+lt[ve])}}for(var Ne=0;Ne<dt;++Ne)Pe[Ne]==="^"&&Pe[Ne+1]!=="^"&&(Pe[Ne]="");if(rt.ignoreCase&&Me)for(var Ne=0;Ne<dt;++Ne){var Ee=Pe[Ne],be=Ee.charAt(0);Ee.length>=2&&be==="["?Pe[Ne]=Je(Ee):be!=="\\"&&(Pe[Ne]=Ee.replace(/[a-zA-Z]/g,function(de){var ue=de.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return Pe.join("")}for(var st=[],We=0,Be=Se.length;We<Be;++We){var Ue=Se[We];if(Ue.global||Ue.multiline)throw new Error(""+Ue);st.push("(?:"+pt(Ue)+")")}return new RegExp(st.join("|"),je?"gi":"g")}function I(Se,De){var Me=/(?:^|\s)nocode(?:\s|$)/,je=[],We=0,Be=[],Ue=0;function ot(et){var Ze=et.nodeType;if(Ze==1){if(Me.test(et.className))return;for(var Je=et.firstChild;Je;Je=Je.nextSibling)ot(Je);var pt=et.nodeName.toLowerCase();(pt==="br"||pt==="li")&&(je[Ue]=`
`,Be[Ue<<1]=We++,Be[Ue++<<1|1]=et)}else if(Ze==3||Ze==4){var st=et.nodeValue;st.length&&(De?st=st.replace(/\r\n?/g,`
`):st=st.replace(/[ \t\r\n]+/g," "),je[Ue]=st,Be[Ue<<1]=We,We+=st.length,Be[Ue++<<1|1]=et)}}return ot(Se),{sourceCode:je.join("").replace(/\n$/,""),spans:Be}}function Y(Se,De,Me,je,We){if(!Me)return;var Be={sourceNode:Se,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:De,decorations:null};je(Be),We.push.apply(We,Be.decorations)}var ee=/\S/;function oe(Se){for(var De=void 0,Me=Se.firstChild;Me;Me=Me.nextSibling){var je=Me.nodeType;De=je===1?De?Se:Me:je===3&&ee.test(Me.nodeValue)?Se:De}return De===Se?void 0:De}function pe(Se,De){var Me={},je;(function(){for(var Ue=Se.concat(De),ot=[],et={},Ze=0,Je=Ue.length;Ze<Je;++Ze){var pt=Ue[Ze],st=pt[3];if(st)for(var rt=st.length;--rt>=0;)Me[st.charAt(rt)]=pt;var Pe=pt[1],dt=""+Pe;et.hasOwnProperty(dt)||(ot.push(Pe),et[dt]=null)}ot.push(/[\0-\uffff]/),je=P(ot)})();var We=De.length,Be=function(Ue){for(var ot=Ue.sourceCode,et=Ue.basePos,Ze=Ue.sourceNode,Je=[et,a],pt=0,st=ot.match(je)||[],rt={},Pe=0,dt=st.length;Pe<dt;++Pe){var lt=st[Pe],Ne=rt[lt],Ke=void 0,Ee;if(typeof Ne=="string")Ee=!1;else{var ve=Me[lt.charAt(0)];if(ve)Ke=lt.match(ve[1]),Ne=ve[0];else{for(var be=0;be<We;++be)if(ve=De[be],Ke=lt.match(ve[1]),Ke){Ne=ve[0];break}Ke||(Ne=a)}Ee=Ne.length>=5&&Ne.substring(0,5)==="lang-",Ee&&!(Ke&&typeof Ke[1]=="string")&&(Ee=!1,Ne=S),Ee||(rt[lt]=Ne)}var re=pt;if(pt+=lt.length,!Ee)Je.push(et+re,Ne);else{var ne=Ke[1],de=lt.indexOf(ne),ue=de+ne.length;Ke[2]&&(ue=lt.length-Ke[2].length,de=ue-ne.length);var fe=Ne.substring(5);Y(Ze,et+re,lt.substring(0,de),Be,Je),Y(Ze,et+re+de,ne,le(fe,ne),Je),Y(Ze,et+re+ue,lt.substring(ue),Be,Je)}}Ue.decorations=Je};return Be}function Oe(Se){var De=[],Me=[];Se.tripleQuotedStrings?De.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Se.multiLineStrings?De.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Se.verbatimStrings&&Me.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=Se.hashComments;je&&(Se.cStyleComments?(je>1?De.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([b,/^#[^\r\n]*/,null,"#"])),Se.cStyleComments&&(Me.push([b,/^\/\/[^\r\n]*/,null]),Me.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=Se.regexLiterals;if(We){var Be=We>1?"":`
\r`,Ue=Be?".":"[\\S\\s]",ot="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+V+"("+ot+")")])}var et=Se.types;et&&Me.push([c,et]);var Ze=(""+Se.keywords).replace(/^ | $/g,"");Ze.length&&Me.push([L,new RegExp("^(?:"+Ze.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([a,/^\s+/,null,` \r
\xA0`]);var Je="^.[^\\s\\w.$@'\"`/\\\\]*";return Se.regexLiterals&&(Je+="(?!s*/)"),Me.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[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],[h,new RegExp(Je),null]),pe(De,Me)}var xe=Oe({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function _e(Se,De,Me){for(var je=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Be=Se.ownerDocument,Ue=Be.createElement("li");Se.firstChild;)Ue.appendChild(Se.firstChild);var ot=[Ue];function et(Pe){var dt=Pe.nodeType;if(dt==1&&!je.test(Pe.className))if(Pe.nodeName==="br")Ze(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var lt=Pe.firstChild;lt;lt=lt.nextSibling)et(lt);else if((dt==3||dt==4)&&Me){var Ne=Pe.nodeValue,Ke=Ne.match(We);if(Ke){var Ee=Ne.substring(0,Ke.index);Pe.nodeValue=Ee;var ve=Ne.substring(Ke.index+Ke[0].length);if(ve){var be=Pe.parentNode;be.insertBefore(Be.createTextNode(ve),Pe.nextSibling)}Ze(Pe),Ee||Pe.parentNode.removeChild(Pe)}}}function Ze(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function dt(Ke,Ee){var ve=Ee?Ke.cloneNode(!1):Ke,be=Ke.parentNode;if(be){var re=dt(be,1),ne=Ke.nextSibling;re.appendChild(ve);for(var de=ne;de;de=ne)ne=de.nextSibling,re.appendChild(de)}return ve}for(var lt=dt(Pe.nextSibling,0),Ne;(Ne=lt.parentNode)&&Ne.nodeType===1;)lt=Ne;ot.push(lt)}for(var Je=0;Je<ot.length;++Je)et(ot[Je]);De===(De|0)&&ot[0].setAttribute("value",De);var pt=Be.createElement("ol");pt.className="linenums";for(var st=Math.max(0,De-1|0)||0,Je=0,rt=ot.length;Je<rt;++Je)Ue=ot[Je],Ue.className="L"+(Je+st)%10,Ue.firstChild||Ue.appendChild(Be.createTextNode("\xA0")),pt.appendChild(Ue);Se.appendChild(pt)}function Te(Se){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var Me=/\n/g,je=Se.sourceCode,We=je.length,Be=0,Ue=Se.spans,ot=Ue.length,et=0,Ze=Se.decorations,Je=Ze.length,pt=0;Ze[Je]=We;var st,rt;for(rt=st=0;rt<Je;)Ze[rt]!==Ze[rt+2]?(Ze[st++]=Ze[rt++],Ze[st++]=Ze[rt++]):rt+=2;for(Je=st,rt=st=0;rt<Je;){for(var Pe=Ze[rt],dt=Ze[rt+1],lt=rt+2;lt+2<=Je&&Ze[lt+1]===dt;)lt+=2;Ze[st++]=Pe,Ze[st++]=dt,rt=lt}Je=Ze.length=st;var Ne=Se.sourceNode,Ke="";Ne&&(Ke=Ne.style.display,Ne.style.display="none");try{for(var Ee=null;et<ot;){var ve=Ue[et],be=Ue[et+2]||We,re=Ze[pt+2]||We,lt=Math.min(be,re),ne=Ue[et+1],de;if(ne.nodeType!==1&&(de=je.substring(Be,lt))){De&&(de=de.replace(Me,"\r")),ne.nodeValue=de;var ue=ne.ownerDocument,fe=ue.createElement("span");fe.className=Ze[pt+1];var Ae=ne.parentNode;Ae.replaceChild(fe,ne),fe.appendChild(ne),Be<be&&(Ue[et+1]=ne=ue.createTextNode(je.substring(lt,be)),Ae.insertBefore(ne,fe.nextSibling))}Be=lt,Be>=be&&(et+=2),Be>=re&&(pt+=2)}}finally{Ne&&(Ne.style.display=Ke)}}var Ce={};function me(Se,De){for(var Me=De.length;--Me>=0;){var je=De[Me];Ce.hasOwnProperty(je)?W.console&&console.warn("cannot override language handler %s",je):Ce[je]=Se}}function le(Se,De){return Se&&Ce.hasOwnProperty(Se)||(Se=/^\s*</.test(De)?"default-markup":"default-code"),Ce[Se]}me(xe,["default-code"]),me(pe([],[[a,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(pe([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[B,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),me(pe([],[[F,/^[\s\S]+/]]),["uq.val"]),me(Oe({keywords:C,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),me(Oe({keywords:"null,true,false"}),["json"]),me(Oe({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),me(Oe({keywords:k,cStyleComments:!0}),["java"]),me(Oe({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Oe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Oe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Oe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Oe({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Oe({keywords:_,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(pe([],[[g,/^[\s\S]+/]]),["regex"]);function te(Se){var De=Se.langExtension;try{var Me=I(Se.sourceNode,Se.pre),je=Me.sourceCode;Se.sourceCode=je,Se.spans=Me.spans,Se.basePos=0,le(De,je)(Se),Te(Se)}catch(We){W.console&&console.log(We&&We.stack||We)}}function ce(Se,De,Me){var je=Me||!1,We=De||null,Be=document.createElement("div");Be.innerHTML="<pre>"+Se+"</pre>",Be=Be.firstChild,je&&_e(Be,je,!0);var Ue={langExtension:We,numberLines:je,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ue),Be.innerHTML}function ae(Se,De){var Me=De||document.body,je=Me.ownerDocument||document;function We(ve){return Me.getElementsByTagName(ve)}for(var Be=[We("pre"),We("code"),We("xmp")],Ue=[],ot=0;ot<Be.length;++ot)for(var et=0,Ze=Be[ot].length;et<Ze;++et)Ue.push(Be[ot][et]);Be=null;var Je=Date;Je.now||(Je={now:function(){return+new Date}});var pt=0,st=/\blang(?:uage)?-([\w.]+)(?!\S)/,rt=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,dt=/pre|xmp/i,lt=/^code$/i,Ne=/^(?:pre|code|xmp)$/i,Ke={};function Ee(){for(var ve=W.PR_SHOULD_USE_CONTINUATION?Je.now()+250:Infinity;pt<Ue.length&&Je.now()<ve;pt++){for(var be=Ue[pt],re=Ke,ne=be;ne=ne.previousSibling;){var de=ne.nodeType,ue=(de===7||de===8)&&ne.nodeValue;if(ue?!/^\??prettify\b/.test(ue):de!==3||/\S/.test(ne.nodeValue))break;if(ue){re={},ue.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ot,Tt,Zt){re[Tt]=Zt});break}}var fe=be.className;if((re!==Ke||rt.test(fe))&&!Pe.test(fe)){for(var Ae=!1,Ie=be.parentNode;Ie;Ie=Ie.parentNode){var Ye=Ie.tagName;if(Ne.test(Ye)&&Ie.className&&rt.test(Ie.className)){Ae=!0;break}}if(!Ae){be.className+=" prettyprinted";var ht=re.lang;if(!ht){ht=fe.match(st);var Xe;!ht&&(Xe=oe(be))&&lt.test(Xe.tagName)&&(ht=Xe.className.match(st)),ht&&(ht=ht[1])}var gt;if(dt.test(be.tagName))gt=1;else{var at=be.currentStyle,Qe=je.defaultView,kt=at?at.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(be,null).getPropertyValue("white-space"):0;gt=kt&&kt.substring(0,3)==="pre"}var Et=re.linenums;(Et=Et==="true"||+Et)||(Et=fe.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&_e(be,Et,gt);var Dt={langExtension:ht,sourceNode:be,numberLines:Et,pre:gt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Dt)}}}pt<Ue.length?W.setTimeout(Ee,250):typeof Se=="function"&&Se()}Ee()}var Le=W.PR={createSimpleLexer:pe,registerLangHandler:me,sourceDecorator:Oe,PR_ATTRIB_NAME:B,PR_ATTRIB_VALUE:F,PR_COMMENT:b,PR_DECLARATION:v,PR_KEYWORD:L,PR_LITERAL:p,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:h,PR_SOURCE:S,PR_STRING:g,PR_TAG:x,PR_TYPE:c,prettyPrintOne:D?W.prettyPrintOne=ce:M=ce,prettyPrint:z=D?W.prettyPrint=ae:z=ae},Re=W.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return Le})})()},"VrN/":function(ft,tt,ie){(function(se,J){ft.exports=J()})(this,function(){"use strict";var se=navigator.userAgent,J=navigator.platform,D=/gecko\/\d/i.test(se),$=/MSIE \d/.test(se),O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(se),M=/Edge\/(\d+)/.exec(se),z=$||O||M,W=z&&($?document.documentMode||6:+(M||O)[1]),U=!M&&/WebKit\//.test(se),R=U&&/Qt\/\d+\.\d+/.test(se),y=!M&&/Chrome\//.test(se),C=/Opera\//.test(se),k=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(se),_=/PhantomJS/.test(se),E=!M&&/AppleWebKit/.test(se)&&/Mobile\/\w+/.test(se),u=/Android/.test(se),o=E||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(se),s=E||/Mac/.test(J),d=/\bCrOS\b/.test(se),w=/win/i.test(J),m=C&&se.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(C=!1,U=!0);var g=s&&(R||C&&(m==null||m<12.11)),L=D||z&&W>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var i=e.className,r=b(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 h(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 x(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var v;document.createRange?v=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:v=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 B(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var i=e.className;b(t).test(i)||(e.className+=(i?" ":"")+t)}function K(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!b(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};E?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:z&&(V=function(e){try{e.select()}catch(t){}});function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Y(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 X=e.indexOf(" ",T);if(X<0||X>=t)return j+(t-T);j+=X-T,j+=i-j%i,T=X+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var pe=50,Oe={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},_e={origin:"*mouse"},Te={origin:"+move"};function Ce(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 le(e){for(;me.length<=e;)me.push(te(me)+" ");return me[e]}function te(e){return e[e.length-1]}function ce(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ae(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Le(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(Le.prototype=e,i=new Le),t&&I(t,i),i}var Se=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Se.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Be(e){return e.charCodeAt(0)>=768&&We.test(e)}function Ue(e,t,i){for(;(i<0?t>0:t<e.length)&&Be(e.charAt(t));)t+=i;return t}function ot(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 et(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 Ze=null;function Je(e,t,i){var r;Ze=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:Ze=n),T.from==t&&(T.from!=T.to&&i!="before"?r=n:Ze=n)}return r!=null?r:Ze}var pt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,T=/[LRr]/,j=/[Lb1n]/,X=/[1n]/;function Z(q,he,ge){this.level=q,this.from=he,this.to=ge}return function(q,he){var ge=he=="ltr"?"L":"R";if(q.length==0||he=="ltr"&&!r.test(q))return!1;for(var ke=q.length,we=[],Fe=0;Fe<ke;++Fe)we.push(i(q.charCodeAt(Fe)));for(var ze=0,$e=ge;ze<ke;++ze){var it=we[ze];it=="m"?we[ze]=$e:$e=it}for(var ut=0,nt=ge;ut<ke;++ut){var mt=we[ut];mt=="1"&&nt=="r"?we[ut]="n":T.test(mt)&&(nt=mt,mt=="r"&&(we[ut]="R"))}for(var wt=1,xt=we[0];wt<ke-1;++wt){var Rt=we[wt];Rt=="+"&&xt=="1"&&we[wt+1]=="1"?we[wt]="1":Rt==","&&xt==we[wt+1]&&(xt=="1"||xt=="n")&&(we[wt]=xt),xt=Rt}for(var $t=0;$t<ke;++$t){var gr=we[$t];if(gr==",")we[$t]="N";else if(gr=="%"){var rr=void 0;for(rr=$t+1;rr<ke&&we[rr]=="%";++rr);for(var jr=$t&&we[$t-1]=="!"||rr<ke&&we[rr]=="1"?"1":"N",Mr=$t;Mr<rr;++Mr)we[Mr]=jr;$t=rr-1}}for(var lr=0,Ir=ge;lr<ke;++lr){var Er=we[lr];Ir=="L"&&Er=="1"?we[lr]="L":T.test(Er)&&(Ir=Er)}for(var hr=0;hr<ke;++hr)if(n.test(we[hr])){var ur=void 0;for(ur=hr+1;ur<ke&&n.test(we[ur]);++ur);for(var nr=(hr?we[hr-1]:ge)=="L",Nr=(ur<ke?we[ur]:ge)=="L",un=nr==Nr?nr?"L":"R":ge,Di=hr;Di<ur;++Di)we[Di]=un;hr=ur-1}for(var _r=[],oi,vr=0;vr<ke;)if(j.test(we[vr])){var Va=vr;for(++vr;vr<ke&&j.test(we[vr]);++vr);_r.push(new Z(0,Va,vr))}else{var ci=vr,Hi=_r.length,Gi=he=="rtl"?1:0;for(++vr;vr<ke&&we[vr]!="L";++vr);for(var kr=ci;kr<vr;)if(X.test(we[kr])){ci<kr&&(_r.splice(Hi,0,new Z(1,ci,kr)),Hi+=Gi);var dn=kr;for(++kr;kr<vr&&X.test(we[kr]);++kr);_r.splice(Hi,0,new Z(2,dn,kr)),Hi+=Gi,ci=kr}else++kr;ci<vr&&_r.splice(Hi,0,new Z(1,ci,vr))}return he=="ltr"&&(_r[0].level==1&&(oi=q.match(/^\s+/))&&(_r[0].from=oi[0].length,_r.unshift(new Z(0,0,oi[0].length))),te(_r).level==1&&(oi=q.match(/\s+$/))&&(te(_r).to-=oi[0].length,_r.push(new Z(0,ke-oi[0].length,ke)))),he=="rtl"?_r.reverse():_r}}();function st(e,t){var i=e.order;return i==null&&(i=e.order=pt(e.text,t)),i}var rt=[],Pe=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]||rt).concat(i)}};function dt(e,t){return e._handlers&&e._handlers[t]||rt}function lt(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var T=oe(n,i);T>-1&&(r[t]=n.slice(0,T).concat(n.slice(T+1)))}}}function Ne(e,t){var i=dt(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function Ke(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ne(e,i||t.type,e,t),de(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(i,t[r])==-1&&i.push(t[r])}function ve(e,t){return dt(e,t).length>0}function be(e){e.prototype.on=function(t,i){Pe(this,t,i)},e.prototype.off=function(t,i){lt(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ue(e){re(e),ne(e)}function fe(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Ie=function(){if(z&&W<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ye;function ht(e){if(Ye==null){var t=a("span","\u200B");h(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ye=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&W<8))}var i=Ye?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Xe;function gt(e){if(Xe!=null)return Xe;var t=h(e,document.createTextNode("A\u062EA")),i=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return p(e),!i||i.left==i.right?!1:Xe=r.right-i.right<3}var at=`
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/)},Qe=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},kt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Dt(e){if(Et!=null)return Et;var t=h(e,a("span","x")),i=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Et=Math.abs(i.left-r.left)>1}var Ot={},Tt={};function Zt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ot[e]=t}function Qt(e,t){Tt[e]=t}function vt(e){if(typeof e=="string"&&Tt.hasOwnProperty(e))e=Tt[e];else if(e&&typeof e.name=="string"&&Tt.hasOwnProperty(e.name)){var t=Tt[e.name];typeof t=="string"&&(t={name:t}),e=Re(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Lt(e,t){t=vt(t);var i=Ot[t.name];if(!i)return Lt(e,"text/plain");var r=i(e,t);if(jt.hasOwnProperty(t.name)){var n=jt[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 jt={};function Ut(e,t){var i=jt.hasOwnProperty(e)?jt[e]:jt[e]={};I(t,i)}function qt(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 ir(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 er(e,t,i){return e.startState?e.startState(t,i):!0}var Bt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Bt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Bt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Y(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Bt.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)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ct(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 Kr(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 ti(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function xr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Mt(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Wr(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 X=e.lines[j],Z=X.height;if(t<Z)break;t-=Z}return i+j}function Yr(e,t){return t>=e.first&&t<e.first+e.size}function fi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ve))return new Ve(e,t,i);this.line=e,this.ch=t,this.sticky=i}function _t(e,t){return e.line-t.line||e.ch-t.ch}function pi(e,t){return e.sticky==t.sticky&&_t(e,t)==0}function mi(e){return Ve(e.line,e.ch)}function gi(e,t){return _t(e,t)<0?t:e}function vi(e,t){return _t(e,t)<0?e:t}function G(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function l(e,t){if(t.line<e.first)return Ve(e.first,0);var i=e.first+e.size-1;return t.line>i?Ve(i,ct(e,i).text.length):f(t,ct(e,t.line).text.length)}function f(e,t){var i=e.ch;return i==null||i>t?Ve(e.line,t):i<0?Ve(e.line,0):e}function N(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=l(e,t[r]);return i}var Q=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,i){return t instanceof Q?new H(e,qt(e.mode,t.state),i,t.lookAhead):new H(e,qt(e.mode,t),i)},H.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function ye(e,t,i,r){var n=[e.state.modeGen],T={};Sr(e,t.text,e.doc.mode,i,function(q,he){return n.push(q,he)},T,r);for(var j=i.state,X=function(q){i.baseTokens=n;var he=e.state.overlays[q],ge=1,ke=0;i.state=!0,Sr(e,t.text,he.mode,i,function(we,Fe){for(var ze=ge;ke<we;){var $e=n[ge];$e>we&&n.splice(ge,1,we,n[ge+1],$e),ge+=2,ke=Math.min(we,$e)}if(!Fe)return;if(he.opaque)n.splice(ze,ge-ze,we,"overlay "+Fe),ge=ze+2;else for(;ze<ge;ze+=2){var it=n[ze+1];n[ze+1]=(it?it+" ":"")+"overlay "+Fe}},T),i.state=j,i.baseTokens=null,i.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)X(Z);return{styles:n,classes:T.bgClass||T.textClass?T:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=qe(e,Mt(t)),n=t.text.length>e.options.maxHighlightLength&&qt(e.doc.mode,r.state),T=ye(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 qe(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new H(r,!0,t);var T=Cr(e,t,i),j=T>r.first&&ct(r,T-1).stateAfter,X=j?H.fromSaved(r,j,T):new H(r,er(r.mode),T);return r.iter(T,t,function(Z){yt(e,Z.text,X);var q=X.line;Z.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?X.save():null,X.nextLine()}),i&&(r.modeFrontier=X.line),X}function yt(e,t,i,r){var n=e.doc.mode,T=new Bt(t,e.options.tabSize,i);for(T.start=T.pos=r||0,t==""&&Ge(n,i.state);!T.eol();)St(n,T,i.state),T.start=T.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=ir(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function St(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=ir(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 Ht=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Jt(e,t,i,r){var n=e.doc,T=n.mode,j;t=l(n,t);var X=ct(n,t.line),Z=qe(e,t.line,i),q=new Bt(X.text,e.options.tabSize,Z),he;for(r&&(he=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,j=St(T,q,Z.state),r&&he.push(new Ht(q,j,qt(n.mode,Z.state)));return r?he:new Ht(q,j,Z.state)}function Ur(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 Sr(e,t,i,r,n,T,j){var X=i.flattenSpans;X==null&&(X=e.options.flattenSpans);var Z=0,q=null,he=new Bt(t,e.options.tabSize,r),ge,ke=e.options.addModeClass&&[null];for(t==""&&Ur(Ge(i,r.state),T);!he.eol();){if(he.pos>e.options.maxHighlightLength?(X=!1,j&&yt(e,t,r,he.pos),he.pos=t.length,ge=null):ge=Ur(St(i,he,r.state,ke),T),ke){var we=ke[0].name;we&&(ge="m-"+(ge?we+" "+ge:we))}if(!X||q!=ge){for(;Z<he.start;)Z=Math.min(he.start,Z+5e3),n(Z,q);q=ge}he.start=he.pos}for(;Z<he.pos;){var Fe=Math.min(he.pos,Z+5e3);n(Fe,q),Z=Fe}}function Cr(e,t,i){for(var r,n,T=e.doc,j=i?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>j;--X){if(X<=T.first)return T.first;var Z=ct(T,X-1),q=Z.stateAfter;if(q&&(!i||X+(q instanceof Q?q.lookAhead:0)<=T.modeFrontier))return X;var he=Y(Z.text,null,e.options.tabSize);(n==null||r>he)&&(n=X-1,r=he)}return n}function $r(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=ct(e,r).stateAfter;if(n&&(!(n instanceof Q)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ri=!1,cr=!1;function Hr(){Ri=!0}function si(){cr=!0}function li(e,t,i){this.marker=e,this.from=t,this.to=i}function Br(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Oi(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function yi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function zi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],j=T.marker,X=T.from==null||(j.inclusiveLeft?T.from<=t:T.from<t);if(X||T.from==t&&j.type=="bookmark"&&(!i||!T.marker.insertLeft)){var Z=T.to==null||(j.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new li(j,T.from,Z?null:T.to))}}return r}function Ki(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],j=T.marker,X=T.to==null||(j.inclusiveRight?T.to>=t:T.to>t);if(X||T.from==t&&j.type=="bookmark"&&(!i||T.marker.insertLeft)){var Z=T.from==null||(j.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new li(j,Z?null:T.from-t,T.to==null?null:T.to-t))}}return r}function Jr(e,t){if(t.full)return null;var i=Yr(e,t.from.line)&&ct(e,t.from.line).markedSpans,r=Yr(e,t.to.line)&&ct(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,T=t.to.ch,j=_t(t.from,t.to)==0,X=zi(i,n,j),Z=Ki(r,T,j),q=t.text.length==1,he=te(t.text).length+(q?n:0);if(X)for(var ge=0;ge<X.length;++ge){var ke=X[ge];if(ke.to==null){var we=Br(Z,ke.marker);we?q&&(ke.to=we.to==null?null:we.to+he):ke.to=n}}if(Z)for(var Fe=0;Fe<Z.length;++Fe){var ze=Z[Fe];if(ze.to!=null&&(ze.to+=he),ze.from==null){var $e=Br(X,ze.marker);$e||(ze.from=he,q&&(X||(X=[])).push(ze))}else ze.from+=he,q&&(X||(X=[])).push(ze)}X&&(X=Vr(X)),Z&&Z!=X&&(Z=Vr(Z));var it=[X];if(!q){var ut=t.text.length-2,nt;if(ut>0&&X)for(var mt=0;mt<X.length;++mt)X[mt].to==null&&(nt||(nt=[])).push(new li(X[mt].marker,null,null));for(var wt=0;wt<ut;++wt)it.push(nt);it.push(Z)}return it}function Vr(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 bi(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(we){if(we.markedSpans)for(var Fe=0;Fe<we.markedSpans.length;++Fe){var ze=we.markedSpans[Fe].marker;ze.readOnly&&(!r||oe(r,ze)==-1)&&(r||(r=[])).push(ze)}}),!r)return null;for(var n=[{from:t,to:i}],T=0;T<r.length;++T)for(var j=r[T],X=j.find(0),Z=0;Z<n.length;++Z){var q=n[Z];if(_t(q.to,X.from)<0||_t(q.from,X.to)>0)continue;var he=[Z,1],ge=_t(q.from,X.from),ke=_t(q.to,X.to);(ge<0||!j.inclusiveLeft&&!ge)&&he.push({from:q.from,to:X.from}),(ke>0||!j.inclusiveRight&&!ke)&&he.push({from:X.to,to:q.to}),n.splice.apply(n,he),Z+=he.length-3}return n}function hn(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 Ei(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function ar(e){return e.inclusiveLeft?-1:0}function Gt(e){return e.inclusiveRight?1:0}function yr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),T=_t(r.from,n.from)||ar(e)-ar(t);if(T)return-T;var j=_t(r.to,n.to)||Gt(e)-Gt(t);return j||t.id-e.id}function It(e,t){var i=cr&&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||yr(r,n.marker)<0)&&(r=n.marker);return r}function sr(e){return It(e,!0)}function Vt(e){return It(e,!1)}function ri(e,t){var i=cr&&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||yr(r,T.marker)<0)&&(r=T.marker)}return r}function fr(e,t,i,r,n){var T=ct(e,t),j=cr&&T.markedSpans;if(j)for(var X=0;X<j.length;++X){var Z=j[X];if(!Z.marker.collapsed)continue;var q=Z.marker.find(0),he=_t(q.from,i)||ar(Z.marker)-ar(n),ge=_t(q.to,r)||Gt(Z.marker)-Gt(n);if(he>=0&&ge<=0||he<=0&&ge>=0)continue;if(he<=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?_t(q.to,i)>=0:_t(q.to,i)>0)||he>=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?_t(q.from,r)<=0:_t(q.from,r)<0))return!0}}function Ar(e){for(var t;t=sr(e);)e=t.find(-1,!0).line;return e}function Vi(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function xi(e){for(var t,i;t=Vt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function cn(e,t){var i=ct(e,t),r=Ar(i);return i==r?t:Mt(r)}function Si(e,t){if(t>e.lastLine())return t;var i=ct(e,t),r;if(!ii(e,i))return t;for(;r=Vt(i);)i=r.find(1,!0).line;return Mt(i)+1}function ii(e,t){var i=cr&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Br(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)&&fn(e,t,n))return!0}function Zr(e){e=Ar(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 X=T.children[j];if(X==i)break;t+=X.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=sr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Vt(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 jn(e){var t=e.display,i=e.doc;t.maxLine=ct(i,i.first),t.maxLineLength=pn(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=pn(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Pi=function(e,t,i){this.text=e,Ei(this,t),this.height=i?i(this):1};Pi.prototype.lineNo=function(){return Mt(this)},be(Pi);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),hn(e),Ei(e,i);var n=r?r(e):1;n!=e.height&&xr(e,n)}function bt(e){e.parent=null,hn(e)}var At={},Ct={};function Pt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ct:At;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Wt(e,t){var i=x("span",null,null,U?"padding-right: .1px":null),r={pre:x("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=Ft,gt(e.display.measure)&&(j=st(T,e.doc.direction))&&(r.addToken=Dr(r.addToken,j)),r.map=[];var X=t!=e.display.externalMeasured&&Mt(T);ui(T,r,He(e,T,X)),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(ht(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(U){var Z=r.content.lastChild;(/\bcm-tab\b/.test(Z.className)||Z.querySelector&&Z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ne(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Yt(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 Ft(e,t,i,r,n,T,j){if(!t)return;var X=e.splitSpaces?dr(t,e.trailingSpace):t,Z=e.cm.state.specialChars,q=!1,he;if(!Z.test(t))e.col+=t.length,he=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,he),z&&W<9&&(q=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var ge=0;;){Z.lastIndex=ge;var ke=Z.exec(t),we=ke?ke.index-ge:t.length-ge;if(we){var Fe=document.createTextNode(X.slice(ge,ge+we));z&&W<9?he.appendChild(a("span",[Fe])):he.appendChild(Fe),e.map.push(e.pos,e.pos+we,Fe),e.col+=we,e.pos+=we}if(!ke)break;ge+=we+1;var ze=void 0;if(ke[0]==" "){var $e=e.cm.options.tabSize,it=$e-e.col%$e;ze=he.appendChild(a("span",le(it),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=it}else ke[0]=="\r"||ke[0]==`
`?(ze=he.appendChild(a("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",ke[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(ke[0]),ze.setAttribute("cm-text",ke[0]),z&&W<9?he.appendChild(a("span",[ze])):he.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,i||r||n||q||T||j){var ut=i||"";r&&(ut+=r),n&&(ut+=n);var nt=a("span",[he],ut,T);if(j)for(var mt in j)j.hasOwnProperty(mt)&&mt!="style"&&mt!="class"&&nt.setAttribute(mt,j[mt]);return e.content.appendChild(nt)}e.content.appendChild(he)}function dr(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 Dr(e,t){return function(i,r,n,T,j,X,Z){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,he=q+r.length;;){for(var ge=void 0,ke=0;ke<t.length&&!(ge=t[ke],ge.to>q&&ge.from<=q);ke++);if(ge.to>=he)return e(i,r,n,T,j,X,Z);e(i,r.slice(0,ge.to-q),n,T,null,X,Z),T=null,r=r.slice(ge.to-q),q=ge.to}}}function Nt(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 ui(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]),Pt(i[j+1],t.cm.options));return}for(var X=n.length,Z=0,q=1,he="",ge,ke,we=0,Fe,ze,$e,it,ut;;){if(we==Z){Fe=ze=$e=ke="",ut=null,it=null,we=Infinity;for(var nt=[],mt=void 0,wt=0;wt<r.length;++wt){var xt=r[wt],Rt=xt.marker;if(Rt.type=="bookmark"&&xt.from==Z&&Rt.widgetNode)nt.push(Rt);else if(xt.from<=Z&&(xt.to==null||xt.to>Z||Rt.collapsed&&xt.to==Z&&xt.from==Z)){if(xt.to!=null&&xt.to!=Z&&we>xt.to&&(we=xt.to,ze=""),Rt.className&&(Fe+=" "+Rt.className),Rt.css&&(ke=(ke?ke+";":"")+Rt.css),Rt.startStyle&&xt.from==Z&&($e+=" "+Rt.startStyle),Rt.endStyle&&xt.to==we&&(mt||(mt=[])).push(Rt.endStyle,xt.to),Rt.title&&((ut||(ut={})).title=Rt.title),Rt.attributes)for(var $t in Rt.attributes)(ut||(ut={}))[$t]=Rt.attributes[$t];Rt.collapsed&&(!it||yr(it.marker,Rt)<0)&&(it=xt)}else xt.from>Z&&we>xt.from&&(we=xt.from)}if(mt)for(var gr=0;gr<mt.length;gr+=2)mt[gr+1]==we&&(ze+=" "+mt[gr]);if(!it||it.from==Z)for(var rr=0;rr<nt.length;++rr)Nt(t,0,nt[rr]);if(it&&(it.from||0)==Z){if(Nt(t,(it.to==null?X+1:it.to)-Z,it.marker,it.from==null),it.to==null)return;it.to==Z&&(it=!1)}}if(Z>=X)break;for(var jr=Math.min(X,we);;){if(he){var Mr=Z+he.length;if(!it){var lr=Mr>jr?he.slice(0,jr-Z):he;t.addToken(t,lr,ge?ge+Fe:Fe,$e,Z+lr.length==we?ze:"",ke,ut)}if(Mr>=jr){he=he.slice(jr-Z),Z=jr;break}Z=Mr,$e=""}he=n.slice(T,T=i[q++]),ge=Pt(i[q++],t.cm.options)}}}function zt(e,t,i){this.line=t,this.rest=xi(t),this.size=this.rest?Mt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=ii(e,t)}function Rr(e,t,i){for(var r=[],n,T=t;T<i;T=n){var j=new zt(e.doc,ct(e.doc,T),T);n=T+j.size,r.push(j)}return r}var Tr=null;function Xr(e){Tr?Tr.ops.push(e):e.ownsGroup=Tr={ops:[e],delayedCallbacks:[]}}function Ds(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 Rs(e,t){var i=e.ownsGroup;if(!i)return;try{Ds(i)}finally{Tr=null,t(i)}}var mn=null;function br(e,t){var i=dt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;Tr?n=Tr.delayedCallbacks:mn?n=mn:(n=mn=[],setTimeout(Os,0));for(var T=function(X){n.push(function(){return i[X].apply(null,r)})},j=0;j<i.length;++j)T(j)}function Os(){var e=mn;mn=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"?Ms(e,t):T=="gutter"?Ja(e,t,i,r):T=="class"?da(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function gn(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&&W<8&&(e.node.style.zIndex=2)),e.node}function Ps(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=gn(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):Wt(e,t)}function Ms(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,da(e,t)):i&&(t.text.className=i)}function da(e,t){Ps(e,t),t.line.wrapClass?gn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Ja(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=gn(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=gn(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),j.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",fi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=e.display.gutterSpecs[Z].className,he=T.hasOwnProperty(q)&&T[q];he&&X.appendChild(a("div",[he],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),n=t.node.firstChild,T=void 0;n;n=T)T=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Za(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),da(e,t),Ja(e,t,i,r),Za(e,t,r),t.node}function Za(e,t,i){if(Qa(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,i,!1)}function Qa(e,t,i,r,n){if(!t.widgets)return;for(var T=gn(i),j=0,X=t.widgets;j<X.length;++j){var Z=X[j],q=a("div",[Z.node],"CodeMirror-linewidget"+(Z.className?" "+Z.className:""));Z.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Us(Z,q,i,r),e.display.input.setUneditable(q),n&&Z.above?T.insertBefore(q,i.gutter||i.text):T.appendChild(q),br(Z,"redraw")}}function Us(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 vn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),h(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function di(e,t){for(var i=fe(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Wn(e){return e.lineSpace.offsetTop}function ha(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ni(e){return pe-e.display.nativeBarWidth}function Mi(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Bs(e,t,i){var r=e.options.lineWrapping,n=r&&Mi(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(),X=0;X<j.length-1;X++){var Z=j[X],q=j[X+1];Math.abs(Z.bottom-q.bottom)>2&&T.push((Z.bottom+q.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(Mt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=Ar(t);var i=Mt(t),r=e.display.externalMeasured=new zt(e.doc,t,i);r.lineN=i;var n=r.built=Wt(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return ai(e,Xi(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ui(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Mt(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=Fs(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 ai(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||(Bs(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,X,Z,q=0;q<e.length;q+=3)if(X=e[q],Z=e[q+1],t<X?(n=0,T=1,j="left"):t<Z?(n=t-X,T=n+1):(q==e.length-3||t==Z&&e[q+3]>t)&&(T=Z-X,n=T-1,t>=Z&&(j="right")),n!=null){if(r=e[q+2],X==Z&&i==(r.insertLeft?"left":"right")&&(j=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],j="left";if(i=="right"&&n==Z-X)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],j="right";break}return{node:r,start:n,end:T,collapse:j,coverStart:X,coverEnd:Z}}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,X=n.end,Z=n.collapse,q;if(T.nodeType==3){for(var he=0;he<4;he++){for(;j&&Be(t.line.text.charAt(n.coverStart+j));)--j;for(;n.coverStart+X<n.coverEnd&&Be(t.line.text.charAt(n.coverStart+X));)++X;if(z&&W<9&&j==0&&X==n.coverEnd-n.coverStart?q=T.parentNode.getBoundingClientRect():q=js(v(T,j,X).getClientRects(),r),q.left||q.right||j==0)break;X=j,j=j-1,Z="right"}z&&W<11&&(q=Hs(e.display.measure,q))}else{j>0&&(Z=r="right");var ge;e.options.lineWrapping&&(ge=T.getClientRects()).length>1?q=ge[r=="right"?ge.length-1:0]:q=T.getBoundingClientRect()}if(z&&W<9&&!j&&(!q||!q.left&&!q.right)){var ke=T.parentNode.getClientRects()[0];ke?q={left:ke.left,right:ke.left+$i(e.display),top:ke.top,bottom:ke.bottom}:q=ro}for(var we=q.top-t.rect.top,Fe=q.bottom-t.rect.top,ze=(we+Fe)/2,$e=t.view.measure.heights,it=0;it<$e.length-1&&!(ze<$e[it]);it++);var ut=it?$e[it-1]:0,nt=$e[it],mt={left:(Z=="right"?q.right:q.left)-t.rect.left,right:(Z=="left"?q.left:q.right)-t.rect.left,top:ut,bottom:nt};return!q.left&&!q.right&&(mt.bogus=!0),e.options.singleCursorHeightPerLine||(mt.rtop=we,mt.rbottom=Fe),mt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Dt(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 yn(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 y&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=vn(e.widgets[i]));return t}function Hn(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=Zr(t);if(r=="local"?j+=Wn(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();j+=X.top+(r=="window"?0:so());var Z=X.left+(r=="window"?0:oo());i.left+=Z,i.right+=Z}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=ct(e.doc,t.line)),Hn(e,r,to(e,r,t.ch,n),i)}function Qr(e,t,i,r,n,T){r=r||ct(e.doc,t.line),n||(n=Xi(e,r));function j(Fe,ze){var $e=ai(e,n,Fe,ze?"right":"left",T);return ze?$e.left=$e.right:$e.right=$e.left,Hn(e,r,$e,i)}var X=st(r,e.doc.direction),Z=t.ch,q=t.sticky;if(Z>=r.text.length?(Z=r.text.length,q="before"):Z<=0&&(Z=0,q="after"),!X)return j(q=="before"?Z-1:Z,q=="before");function he(Fe,ze,$e){var it=X[ze],ut=it.level==1;return j($e?Fe-1:Fe,ut!=$e)}var ge=Je(X,Z,q),ke=Ze,we=he(Z,ge,q=="before");return ke!=null&&(we.other=he(Z,ke,q!="before")),we}function uo(e,t){var i=0;t=l(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=ct(e.doc,t.line),n=Zr(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var T=Ve(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=Wr(r,i),T=r.first+r.size-1;if(n>T)return ga(r.first+r.size-1,ct(r,T).text.length,null,1,1);t<0&&(t=0);for(var j=ct(r,n);;){var X=Gs(e,j,n,t,i),Z=ri(j,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Z)return X;var q=Z.find(1);if(q.line==n)return q;j=ct(r,n=q.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,T=ot(function(j){return ai(e,i,j-1).bottom<=r},n,0);return n=ot(function(j){return ai(e,i,j).top>r},T,n),{begin:T,end:n}}function co(e,t,i,r){i||(i=Xi(e,t));var n=Hn(e,t,ai(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-=Zr(t);var T=Xi(e,t),j=pa(t),X=0,Z=t.text.length,q=!0,he=st(t,e.doc.direction);if(he){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,T,he,r,n);q=ge.level!=1,X=q?ge.from:ge.to-1,Z=q?ge.to:ge.from-1}var ke=null,we=null,Fe=ot(function(wt){var xt=ai(e,T,wt);return xt.top+=j,xt.bottom+=j,ya(xt,r,n,!1)?(xt.top<=n&&xt.left<=r&&(ke=wt,we=xt),!0):!1},X,Z),ze,$e,it=!1;if(we){var ut=r-we.left<we.right-r,nt=ut==q;Fe=ke+(nt?0:1),$e=nt?"after":"before",ze=ut?we.left:we.right}else{!q&&(Fe==Z||Fe==X)&&Fe++,$e=Fe==0?"after":Fe==t.text.length?"before":ai(e,T,Fe-(q?1:0)).bottom+j<=n==q?"after":"before";var mt=Qr(e,Ve(i,Fe,$e),"line",t,T);ze=mt.left,it=n<mt.top?-1:n>=mt.bottom?1:0}return Fe=Ue(t.text,Fe,1),ga(i,Fe,$e,it,r-ze)}function zs(e,t,i,r,n,T,j){var X=ot(function(ge){var ke=n[ge],we=ke.level!=1;return ya(Qr(e,Ve(i,we?ke.to:ke.from,we?"before":"after"),"line",t,r),T,j,!0)},0,n.length-1),Z=n[X];if(X>0){var q=Z.level!=1,he=Qr(e,Ve(i,q?Z.from:Z.to,q?"after":"before"),"line",t,r);ya(he,T,j,!0)&&he.top>j&&(Z=n[X-1])}return Z}function Ks(e,t,i,r,n,T,j){var X=ho(e,t,r,j),Z=X.begin,q=X.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var he=null,ge=null,ke=0;ke<n.length;ke++){var we=n[ke];if(we.from>=q||we.to<=Z)continue;var Fe=we.level!=1,ze=ai(e,r,Fe?Math.min(q,we.to)-1:Math.max(Z,we.from)).right,$e=ze<T?T-ze+1e9:ze-T;(!he||ge>$e)&&(he=we,ge=$e)}return he||(he=n[n.length-1]),he.from<Z&&(he={from:Z,to:he.to,level:he.level}),he.to>q&&(he={from:he.from,to:q,level:he.level}),he}var Ii;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ii==null){Ii=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ii.appendChild(document.createTextNode("x")),Ii.appendChild(a("br"));Ii.appendChild(document.createTextNode("x"))}h(e.measure,Ii);var i=Ii.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),p(e.measure),i||1}function $i(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function 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 X=e.display.gutterSpecs[j].className;i[X]=T.offsetLeft+T.clientLeft+n,r[X]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(ii(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 xa(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&xr(r,n)})}function Ni(e,t,i,r){var n=e.display;if(!i&&fe(t).getAttribute("cm-not-content")=="true")return null;var T,j,X=n.lineSpace.getBoundingClientRect();try{T=t.clientX-X.left,j=t.clientY-X.top}catch(ge){return null}var Z=va(e,T,j),q;if(r&&Z.xRel>0&&(q=ct(e.doc,Z.line).text).length==Z.ch){var he=Y(q,q.length,e.options.tabSize)-q.length;Z=Ve(Z.line,Math.max(0,Math.round((T-qa(e.display).left)/$i(e.display))-he))}return Z}function Ui(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Or(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)cr&&cn(e.doc,t)<n.viewTo&&Ti(e);else if(i<=n.viewFrom)cr&&Si(e.doc,i+r)>n.viewFrom?Ti(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ti(e);else if(t<=n.viewFrom){var T=Gn(e,i,i+r,1);T?(n.view=n.view.slice(T.index),n.viewFrom=T.lineN,n.viewTo+=r):Ti(e)}else if(i>=n.viewTo){var j=Gn(e,t,t,-1);j?(n.view=n.view.slice(0,j.index),n.viewTo=j.lineN):Ti(e)}else{var X=Gn(e,t,t,-1),Z=Gn(e,i,i+r,1);X&&Z?(n.view=n.view.slice(0,X.index).concat(Rr(e,X.lineN,Z.lineN)).concat(n.view.slice(Z.index)),n.viewTo+=r):Ti(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function Ci(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[Ui(e,t)];if(T.node==null)return;var j=T.changes||(T.changes=[]);oe(j,i)==-1&&j.push(i)}function Ti(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,i,r){var n=Ui(e,t),T,j=e.display.view;if(!cr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var X=e.display.viewFrom,Z=0;Z<n;Z++)X+=j[Z].size;if(X!=t){if(r>0){if(n==j.length-1)return null;T=X+j[n].size-t,n++}else T=X-t;t+=T,i+=T}for(;cn(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=Rr(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Rr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ui(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Rr(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ui(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 bn(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 X=i.sel.ranges[j];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Z=X.empty();(Z||e.options.showCursorWhenSelecting)&&go(e,X.head,n),Z||Xs(e,X,T)}return r}function go(e,t,i){var r=Qr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var 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 zn(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),X=j.left,Z=Math.max(r.sizerWidth,Mi(e)-r.sizer.offsetLeft)-j.right,q=n.direction=="ltr";function he(nt,mt,wt,xt){mt<0&&(mt=0),mt=Math.round(mt),xt=Math.round(xt),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
top: `+mt+"px; width: "+(wt==null?Z-nt:wt)+`px;
height: `+(xt-mt)+"px"))}function ge(nt,mt,wt){var xt=ct(n,nt),Rt=xt.text.length,$t,gr;function rr(lr,Ir){return ma(e,Ve(nt,lr),"div",xt,Ir)}function jr(lr,Ir,Er){var hr=co(e,xt,null,lr),ur=Ir=="ltr"==(Er=="after")?"left":"right",nr=Er=="after"?hr.begin:hr.end-(/\s/.test(xt.text.charAt(hr.end-1))?2:1);return rr(nr,ur)[ur]}var Mr=st(xt,n.direction);return et(Mr,mt||0,wt==null?Rt:wt,function(lr,Ir,Er,hr){var ur=Er=="ltr",nr=rr(lr,ur?"left":"right"),Nr=rr(Ir-1,ur?"right":"left"),un=mt==null&&lr==0,Di=wt==null&&Ir==Rt,_r=hr==0,oi=!Mr||hr==Mr.length-1;if(Nr.top-nr.top<=3){var vr=(q?un:Di)&&_r,Va=(q?Di:un)&&oi,ci=vr?X:(ur?nr:Nr).left,Hi=Va?Z:(ur?Nr:nr).right;he(ci,nr.top,Hi-ci,nr.bottom)}else{var Gi,kr,dn,Xa;ur?(Gi=q&&un&&_r?X:nr.left,kr=q?Z:jr(lr,Er,"before"),dn=q?X:jr(Ir,Er,"after"),Xa=q&&Di&&oi?Z:Nr.right):(Gi=q?jr(lr,Er,"before"):X,kr=!q&&un&&_r?Z:nr.right,dn=!q&&Di&&oi?X:Nr.left,Xa=q?jr(Ir,Er,"after"):Z),he(Gi,nr.top,kr-Gi,nr.bottom),nr.bottom<Nr.top&&he(X,nr.bottom,null,Nr.top),he(dn,Nr.top,Xa-dn,Nr.bottom)}(!$t||zn(nr,$t)<0)&&($t=nr),zn(Nr,$t)<0&&($t=Nr),(!gr||zn(nr,gr)<0)&&(gr=nr),zn(Nr,gr)<0&&(gr=Nr)}),{start:$t,end:gr}}var ke=t.from(),we=t.to();if(ke.line==we.line)ge(ke.line,ke.ch,we.ch);else{var Fe=ct(n,ke.line),ze=ct(n,we.line),$e=Ar(Fe)==Ar(ze),it=ge(ke.line,ke.ch,$e?Fe.text.length+1:null).end,ut=ge(we.line,$e?0:null,we.ch).start;$e&&(it.top<ut.top-2?(he(it.right,it.top,null,it.bottom),he(X,ut.top,ut.left,ut.bottom)):he(it.right,it.top,ut.left-it.right,it.bottom)),it.bottom<ut.top&&he(X,it.bottom,null,ut.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()||Ji(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(),Ca(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ji(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ne(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),U&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Ji(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ne(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],T=e.options.lineWrapping,j=void 0,X=0;if(n.hidden)continue;if(z&&W<8){var Z=n.node.offsetTop+n.node.offsetHeight;j=Z-i,i=Z}else{var q=n.node.getBoundingClientRect();j=q.bottom-q.top,!T&&n.text.firstChild&&(X=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var he=n.line.height-j;if((he>.005||he<-.005)&&(xr(n.line,j),bo(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)bo(n.rest[ge]);if(X>e.display.sizerWidth){var ke=Math.ceil(X/$i(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,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 Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,T=Wr(t,r),j=Wr(t,n);if(i&&i.ensure){var X=i.ensure.from.line,Z=i.ensure.to.line;X<T?(T=X,j=Wr(t,Zr(ct(t,X))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=j&&(T=Wr(t,Zr(ct(t,Z))-e.wrapper.clientHeight),j=Z)}return{from:T,to:Math.max(j,T+1)}}function Ys(e,t){if(Ke(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!_){var T=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(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?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var j=!1,X=Qr(e,t),Z=!i||i==t?X:Qr(e,i);n={left:Math.min(X.left,Z.left),top:Math.min(X.top,Z.top)-r,right:Math.max(X.left,Z.left),bottom:Math.max(X.bottom,Z.bottom)+r};var q=Ta(e,n),he=e.doc.scrollTop,ge=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(j=!0)),q.scrollLeft!=null&&(Bi(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(j=!0)),!j)break}return n}function Js(e,t){var i=Ta(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Bi(e,i.scrollLeft)}function Ta(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,T=ca(e),j={};t.bottom-t.top>T&&(t.bottom=t.top+T);var X=e.doc.height+ha(i),Z=t.top<r,q=t.bottom>X-r;if(t.top<n)j.scrollTop=Z?0:t.top;else if(t.bottom>n+T){var he=Math.min(t.top,(q?X:t.bottom)-T);he!=n&&(j.scrollTop=he)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,we=Mi(e)-i.gutters.offsetWidth,Fe=t.right-t.left>we;return Fe&&(t.right=t.left+we),t.left<10?j.scrollLeft=0:t.left<ke?j.scrollLeft=Math.max(0,t.left+ge-(Fe?0:10)):t.right>we+ke-3&&(j.scrollLeft=t.right+(Fe?0:10)-we),j}function wa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zi(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function En(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Zs(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);Eo(e,i,r,t.margin)}}function Eo(e,t,i,r){var n=Ta(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});En(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Aa(e,{top:t}),xo(e,t,!0),D&&Aa(e),Tn(e,100)}function xo(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 Bi(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,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Sn(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ha(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Fi=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),Pe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Pe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fi.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}},Fi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fi.prototype.zeroWidthHack=function(){var e=s&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Fi.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)},Fi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Cn=function(){};Cn.prototype.update=function(){return{bottom:0,right:0}},Cn.prototype.setScrollLeft=function(){},Cn.prototype.setScrollTop=function(){},Cn.prototype.clear=function(){};function Qi(e,t){t||(t=Sn(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&&Kn(e),So(e,Sn(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 Co={native:Fi,null:Cn};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(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"?Bi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function ji(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:++Qs},Xr(e.curOp)}function Wi(e){var t=e.curOp;t&&Rs(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&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=Sn(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+ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Mi(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&&Bi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==B();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(t,e.barMeasure),e.updatedDisplay&&ka(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&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Bi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,l(r,e.scrollToPos.from),l(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var T=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(T)for(var X=0;X<T.length;++X)T[X].lines.length||Ne(T[X],"hide");if(j)for(var Z=0;Z<j.length;++Z)j[Z].lines.length&&Ne(j[Z],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ne(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Fr(e,t){if(e.curOp)return t();ji(e);try{return t()}finally{Wi(e)}}function pr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ji(e);try{return t.apply(e,arguments)}finally{Wi(e)}}}function Lr(e){return function(){if(this.curOp)return e.apply(this,arguments);ji(this);try{return e.apply(this,arguments)}finally{Wi(this)}}}function mr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ji(t);try{return e.apply(this,arguments)}finally{Wi(t)}}}function Tn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=qe(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var j=T.styles,X=T.text.length>e.options.maxHighlightLength?qt(t.mode,r.state):null,Z=ye(e,T,r,!0);X&&(r.state=X),T.styles=Z.styles;var q=T.styleClasses,he=Z.classes;he?T.styleClasses=he:q&&(T.styleClasses=null);for(var ge=!j||j.length!=T.styles.length||q!=he&&(!q||!he||q.bgClass!=he.bgClass||q.textClass!=he.textClass),ke=0;!ge&&ke<j.length;++ke)ge=j[ke]!=T.styles[ke];ge&&n.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&yt(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Tn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Fr(e,function(){for(var T=0;T<n.length;T++)Ci(e,n[T],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mi(e),this.force=i,this.dims=ba(e),this.events=[]};Yn.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ne.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=B();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==B())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 _a(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ti(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;Ao(e)&&(Ti(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)),cr&&(T=cn(e.doc,T),j=Si(e.doc,j));var X=T!=i.viewFrom||j!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,T,j),i.viewOffset=Zr(ct(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Z=po(e);if(!X&&Z==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var q=sl(e);return Z>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Z>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(q),p(i.cursorDiv),p(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,X&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Tn(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==Mi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ha(e.display)-ca(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!_a(e,t))break;Kn(e);var n=Sn(e);bn(e),Qi(e,n),ka(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 Aa(e,t){var i=new Yn(e,t);if(_a(e,i)){Kn(e),wo(e,i);var r=Sn(e);bn(e),Qi(e,r),ka(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,T=r.lineDiv,j=T.firstChild;function X(Fe){var ze=Fe.nextSibling;return U&&s&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),ze}for(var Z=r.view,q=r.viewFrom,he=0;he<Z.length;he++){var ge=Z[he];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=T){var ke=Ns(e,ge,q,i);T.insertBefore(ke,j)}else{for(;j!=ge.node;)j=X(j);var we=n&&t!=null&&t<=q&&ge.lineNumber;ge.changes&&(oe(ge.changes,"gutter")>-1&&(we=!1),Ya(e,ge,q,i)),we&&(p(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(fi(e.options,q)))),j=ge.node.nextSibling}q+=ge.size}for(;j;)j=X(j)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ka(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+ni(e)+"px"}function _o(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,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 X=i[j].alignable;if(X)for(var Z=0;Z<X.length;Z++)X[Z].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=fi(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",La(e.display),!0}return!1}function Da(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 Lo(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,X=t.appendChild(a("div",null,"CodeMirror-gutter "+T));j&&(X.style.cssText=j),T=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",La(e)}function wn(e){Lo(e.display),Or(e),_o(e)}function dl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=x("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=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var T=x("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: "+pe+"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&&W<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!U&&!(D&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Da(r.gutters,r.lineNumbers),Lo(n),i.init(n)}var $n=0,Gr=null;z?Gr=-.53:D?Gr=15:y?Gr=-.7:k&&(Gr=-1/3);function ko(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hl(e){var t=ko(e);return t.x*=Gr,t.y*=Gr,t}function Do(e,t){var i=ko(t),r=i.x,n=i.y,T=e.display,j=T.scroller,X=j.scrollWidth>j.clientWidth,Z=j.scrollHeight>j.clientHeight;if(!(r&&X||n&&Z))return;if(n&&s&&U){e:for(var q=t.target,he=T.view;q!=j;q=q.parentNode)for(var ge=0;ge<he.length;ge++)if(he[ge].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!D&&!C&&Gr!=null){n&&Z&&xn(e,Math.max(0,j.scrollTop+n*Gr)),Bi(e,Math.max(0,j.scrollLeft+r*Gr)),(!n||n&&Z)&&re(t),T.wheelStartX=null;return}if(n&&Gr!=null){var ke=n*Gr,we=e.doc.scrollTop,Fe=we+T.wrapper.clientHeight;ke<0?we=Math.max(0,we+ke-50):Fe=Math.min(e.doc.height,Fe+ke+50),Aa(e,{top:we,bottom:Fe})}$n<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 ze=j.scrollLeft-T.wheelStartX,$e=j.scrollTop-T.wheelStartY,it=$e&&T.wheelDY&&$e/T.wheelDY||ze&&T.wheelDX&&ze/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!it)return;Gr=(Gr*$n+it)/($n+1),++$n},200)):(T.wheelDX+=r,T.wheelDY+=n))}var zr=function(e,t){this.ranges=e,this.primIndex=t};zr.prototype.primary=function(){return this.ranges[this.primIndex]},zr.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(!pi(i.anchor,r.anchor)||!pi(i.head,r.head))return!1}return!0},zr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Kt(mi(this.ranges[t].anchor),mi(this.ranges[t].head));return new zr(e,this.primIndex)},zr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},zr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(_t(t,r.from())>=0&&_t(e,r.to())<=0)return i}return-1};var Kt=function(e,t){this.anchor=e,this.head=t};Kt.prototype.from=function(){return vi(this.anchor,this.head)},Kt.prototype.to=function(){return gi(this.anchor,this.head)},Kt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(ke,we){return _t(ke.from(),we.from())}),i=oe(t,n);for(var T=1;T<t.length;T++){var j=t[T],X=t[T-1],Z=_t(X.to(),j.from());if(r&&!j.empty()?Z>0:Z>=0){var q=vi(X.from(),j.from()),he=gi(X.to(),j.to()),ge=X.empty()?j.from()==j.head:X.from()==X.head;T<=i&&--i,t.splice(--T,2,new Kt(ge?he:q,ge?q:he))}}return new zr(t,i)}function wi(e,t){return new zr([new Kt(e,t||e)],0)}function _i(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(_t(e,t.from)<0)return e;if(_t(e,t.to)<=0)return _i(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+=_i(t).ch-t.to.ch),Ve(i,r)}function Ra(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Kt(Ro(n.anchor,t),Ro(n.head,t)))}return qr(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?Ve(i.line,e.ch-t.ch+i.ch):Ve(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ve(e.first,0),T=n,j=0;j<t.length;j++){var X=t[j],Z=Oo(X.from,n,T),q=Oo(_i(X),n,T);if(n=X.to,T=q,i=="around"){var he=e.sel.ranges[j],ge=_t(he.head,he.anchor)<0;r[j]=new Kt(ge?q:Z,ge?Z:q)}else r[j]=new Kt(Z,Z)}return new zr(r,e.sel.primIndex)}function Oa(e){e.doc.mode=Lt(e.options,e.doc.modeOption),_n(e)}function _n(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,Tn(e,100),e.state.modeGen++,e.curOp&&Or(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(ut){return i?i[ut]:null}function T(ut,nt,mt){ua(ut,nt,mt,r),br(ut,"change",ut,t)}function j(ut,nt){for(var mt=[],wt=ut;wt<nt;++wt)mt.push(new Pi(q[wt],n(wt),r));return mt}var X=t.from,Z=t.to,q=t.text,he=ct(e,X.line),ge=ct(e,Z.line),ke=te(q),we=n(q.length-1),Fe=Z.line-X.line;if(t.full)e.insert(0,j(0,q.length)),e.remove(q.length,e.size-q.length);else if(Po(e,t)){var ze=j(0,q.length-1);T(ge,ge.text,we),Fe&&e.remove(X.line,Fe),ze.length&&e.insert(X.line,ze)}else if(he==ge)if(q.length==1)T(he,he.text.slice(0,X.ch)+ke+he.text.slice(Z.ch),we);else{var $e=j(1,q.length-1);$e.push(new Pi(ke+he.text.slice(Z.ch),we,r)),T(he,he.text.slice(0,X.ch)+q[0],n(0)),e.insert(X.line+1,$e)}else if(q.length==1)T(he,he.text.slice(0,X.ch)+q[0]+ge.text.slice(Z.ch),n(0)),e.remove(X.line+1,Fe);else{T(he,he.text.slice(0,X.ch)+q[0],n(0)),T(ge,ke+ge.text.slice(Z.ch),we);var it=j(1,q.length-1);Fe>1&&e.remove(X.line+1,Fe-1),e.insert(X.line+1,it)}br(e,"change",e,t)}function Ai(e,t,i){function r(n,T,j){if(n.linked)for(var X=0;X<n.linked.length;++X){var Z=n.linked[X];if(Z.doc==T)continue;var q=j&&Z.sharedHist;if(i&&!q)continue;t(Z.doc,q),r(Z.doc,n,q)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Oa(e),Io(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Or(e)}function Io(e){(e.doc.direction=="rtl"?F:c)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Fr(e,function(){Io(e),Or(e)})}function Jn(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 Ma(e,t){var i={from:mi(t.from),to:_i(t),text:Kr(e,t.from,t.to)};return Bo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Bo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Uo(e,t,i,r){var n=e.history;n.undone.length=0;var T=+new Date,j,X;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)))X=te(j.changes),_t(t.from,t.to)==0&&_t(t.from,X.to)==0?X.to=_i(t):j.changes.push(Ma(e,t));else{var Z=te(n.done);for((!Z||!Z.ranges)&&Zn(e.sel,n.done),j={changes:[Ma(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,X||Ne(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,T=r&&r.origin;i==n.lastSelOp||T&&n.lastSelOrigin==T&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==T||ml(e,T,te(n.done),t))?n.done[n.done.length-1]=t:Zn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=T,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Zn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Bo(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 Fo(e,t){var i=yl(e,t),r=Jr(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 X=0;X<j.length;++X){for(var Z=j[X],q=0;q<T.length;++q)if(T[q].marker==Z.marker)continue e;T.push(Z)}}else j&&(i[n]=j)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var T=e[n];if(T.ranges){r.push(i?zr.prototype.deepCopy.call(T):T);continue}var j=T.changes,X=[];r.push({changes:X});for(var Z=0;Z<j.length;++Z){var q=j[Z],he=void 0;if(X.push({from:q.from,to:q.to,text:q.text}),t)for(var ge in q)(he=ge.match(/^spans_(\d+)$/))&&(oe(t,Number(he[1]))>-1&&(te(X)[ge]=q[ge],delete q[ge]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var T=_t(t,n)<0;T!=_t(i,n)<0?(n=t,t=i):T!=_t(t,i)<0&&(t=i)}return new Kt(n,t)}else return new Kt(i||t,t)}function Qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),wr(e,new zr([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=qr(e.cm,r,e.sel.primIndex);wr(e,j,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,wr(e,qr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){wr(e,wi(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 Kt(l(e,n[T].anchor),l(e,n[T].head))},origin:i&&i.origin};return Ne(e,"beforeSelectionChange",e,r),e.cm&&Ne(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?qr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):wr(e,t,i)}function wr(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(_t(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Zi(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)),br(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],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],Z=ea(e,j.anchor,X&&X.anchor,i,r),q=ea(e,j.head,X&&X.head,i,r);(n||Z!=j.anchor||q!=j.head)&&(n||(n=t.ranges.slice(0,T)),n[T]=new Kt(Z,q))}return n?qr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var T=ct(e,t.line);if(T.markedSpans)for(var j=0;j<T.markedSpans.length;++j){var X=T.markedSpans[j],Z=X.marker,q="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,he="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if((X.from==null||(q?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(he?X.to>=t.ch:X.to>t.ch))){if(n&&(Ne(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(T.markedSpans){--j;continue}else break;if(!Z.atomic)continue;if(i){var ge=Z.find(r<0?1:-1),ke=void 0;if((r<0?he:q)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?T:null)),ge&&ge.line==t.line&&(ke=_t(ge,i))&&(r<0?ke<0:ke>0))return en(e,ge,t,r,n)}var we=Z.find(r<0?-1:1);return(r<0?q:he)&&(we=Vo(e,we,r,we.line==t.line?T:null)),we?en(e,we,t,r,n):null}}return t}function ea(e,t,i,r,n){var T=r||1,j=en(e,t,i,T,n)||!n&&en(e,t,i,T,!0)||en(e,t,i,-T,n)||!n&&en(e,t,i,-T,!0);return j||(e.cantEdit=!0,Ve(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?l(e,Ve(t.line-1)):null:i>0&&t.ch==(r||ct(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+i)}function Xo(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),xe)}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,X){n&&(r.from=l(e,n)),T&&(r.to=l(e,T)),j&&(r.text=j),X!==void 0&&(r.origin=X)}),Ne(e,"beforeChange",e,r),e.cm&&Ne(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function tn(e,t,i){if(e.cm){if(!e.cm.curOp)return pr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Ri&&!i&&bi(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]==""&&_t(t.from,t.to)==0)return;var i=Ra(e,t);Uo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Jr(e,t));var r=[];Ai(e,function(n,T){!T&&oe(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),An(n,t,null,Jr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,T,j=e.sel,X=t=="undo"?n.done:n.undone,Z=t=="undo"?n.undone:n.done,q=0;q<X.length&&!(T=X[q],i?T.ranges&&!T.equals(e.sel):!T.ranges);q++);if(q==X.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(T=X.pop(),T.ranges){if(Zn(T,Z),i&&!T.equals(e.sel)){wr(e,T,{clearRedo:!1});return}j=T}else if(r){X.push(T);return}else break;var he=[];Zn(j,Z),Z.push({changes:he,generation:n.generation}),n.generation=T.generation||++n.maxGeneration;for(var ge=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),ke=function(ze){var $e=T.changes[ze];if($e.origin=t,ge&&!Yo(e,$e,!1))return X.length=0,{};he.push(Ma(e,$e));var it=ze?Ra(e,$e):te(X);An(e,$e,it,Fo(e,$e)),!ze&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:_i($e)});var ut=[];Ai(e,function(nt,mt){!mt&&oe(ut,nt.history)==-1&&(qo(nt.history,$e),ut.push(nt.history)),An(nt,$e,null,Fo(nt,$e))})},we=T.changes.length-1;we>=0;--we){var Fe=ke(we);if(Fe)return Fe.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new zr(ce(e.sel.ranges,function(n){return new Kt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Or(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Ci(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return pr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Jo(e,n),t={from:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ve(T,ct(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Kr(e,t.from,t.to),i||(i=Ra(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),qn(e,i,xe),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,i){var r=e.doc,n=e.display,T=t.from,j=t.to,X=!1,Z=T.line;e.options.lineWrapping||(Z=Mt(Ar(ct(r,T.line))),r.iter(Z,j.line+1,function(we){if(we==n.maxLine)return X=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ee(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Z,T.line+t.text.length,function(we){var Fe=pn(we);Fe>n.maxLineLength&&(n.maxLine=we,n.maxLineLength=Fe,n.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),$r(r,T.line),Tn(e,400);var q=t.text.length-(j.line-T.line)-1;t.full?Or(e):T.line==j.line&&t.text.length==1&&!Po(e.doc,t)?Ci(e,T.line,"text"):Or(e,T.line,j.line+1,q);var he=ve(e,"changes"),ge=ve(e,"change");if(ge||he){var ke={from:T,to:j,text:t.text,removed:t.removed,origin:t.origin};ge&&br(e,"change",e,ke),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var T;r||(r=i),_t(r,i)<0&&(T=[r,i],i=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function Zo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(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 X=0;X<T.ranges.length;X++)Zo(T.ranges[X].anchor,t,i,r),Zo(T.ranges[X].head,t,i,r);continue}for(var Z=0;Z<T.changes.length;++Z){var q=T.changes[Z];if(i<q.from.line)q.from=Ve(q.from.line+r,q.from.ch),q.to=Ve(q.to.line+r,q.to.ch);else if(t<=q.to.line){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;Qo(e.done,i,r,n),Qo(e.undone,i,r,n)}function Ln(e,t,i,r){var n=t,T=t;return typeof t=="number"?T=ct(e,G(e,t)):n=Mt(t),n==null?null:(r(T,n)&&e.cm&&Ci(e.cm,n,i),T)}function kn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}kn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,bt(n),br(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Dn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}Dn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var 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 kn))){var X=[];this.collapse(X),this.children=[new kn(X)],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,X=j;X<n.lines.length;){var Z=new kn(n.lines.slice(X,X+=25));n.height-=Z.height,this.children.splice(++r,0,Z),Z.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 Dn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=oe(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Dn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],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 Rn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Rn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Mt(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=vn(this);xr(i,Math.max(0,i.height-T)),e&&(Fr(e,function(){es(e,i,-T),Ci(e,r,"widget")}),br(e,"lineWidgetCleared",e,this,r))},Rn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=vn(this)-t;if(!n)return;ii(this.doc,r)||xr(r,r.height+n),i&&Fr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),br(i,"lineWidgetChanged",i,e,Mt(r))})},be(Rn);function es(e,t,i){Zr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function xl(e,t,i,r){var n=new Rn(e,i,r),T=e.cm;return T&&n.noHScroll&&(T.display.alignWidgets=!0),Ln(e,t,"widget",function(j){var X=j.widgets||(j.widgets=[]);if(n.insertAt==null?X.push(n):X.splice(Math.min(X.length-1,Math.max(0,n.insertAt)),0,n),n.line=j,T&&!ii(e,j)){var Z=Zr(j)<e.scrollTop;xr(j,j.height+vn(n)),Z&&wa(T,n.height),T.curOp.forceUpdate=!0}return!0}),T&&br(T,"lineWidgetAdded",T,n,typeof t=="number"?t:Mt(t)),n}var ts=0,Li=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ji(e),ve(this,"clear")){var i=this.find();i&&br(this,"clear",i.from,i.to)}for(var r=null,n=null,T=0;T<this.lines.length;++T){var j=this.lines[T],X=Br(j.markedSpans,this);e&&!this.collapsed?Ci(e,Mt(j),"text"):e&&(X.to!=null&&(n=Mt(j)),X.from!=null&&(r=Mt(j))),j.markedSpans=Oi(j.markedSpans,X),X.from==null&&this.collapsed&&!ii(this.doc,j)&&e&&xr(j,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var q=Ar(this.lines[Z]),he=pn(q);he>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Or(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&&br(e,"markerCleared",e,this,r,n),t&&Wi(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var T=this.lines[n],j=Br(T.markedSpans,this);if(j.from!=null&&(i=Ve(t?T:Mt(T),j.from),e==-1))return i;if(j.to!=null&&(r=Ve(t?T:Mt(T),j.to),e==1))return r}return i&&{from:i,to:r}},Li.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Fr(r,function(){var n=t.line,T=Mt(t.line),j=fa(r,T);if(j&&(no(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!ii(i.doc,n)&&i.height!=null){var X=i.height;i.height=null;var Z=vn(i)-X;Z&&xr(n,n.height+Z)}br(r,"markerChanged",r,e)})},Li.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Li.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(Li);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return pr(e.cm,nn)(e,t,i,r,n);var T=new Li(e,n),j=_t(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=x("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(fr(e,t.line,t,i,T)||t.line!=i.line&&fr(e,i.line,t,i,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");si()}T.addToHistory&&Uo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var X=t.line,Z=e.cm,q;if(e.iter(X,i.line+1,function(ge){Z&&T.collapsed&&!Z.options.lineWrapping&&Ar(ge)==Z.display.maxLine&&(q=!0),T.collapsed&&X!=t.line&&xr(ge,0),yi(ge,new li(T,X==t.line?t.ch:null,X==i.line?i.ch:null)),++X}),T.collapsed&&e.iter(t.line,i.line+1,function(ge){ii(e,ge)&&xr(ge,0)}),T.clearOnEnter&&Pe(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Hr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),Z){if(q&&(Z.curOp.updateMaxLine=!0),T.collapsed)Or(Z,t.line,i.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var he=t.line;he<=i.line;he++)Ci(Z,he,"text");T.atomic&&zo(Z.doc),br(Z,"markerAdded",Z,T)}return T}var On=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};On.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();br(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},be(On);function Sl(e,t,i,r,n){r=I(r),r.shared=!1;var T=[nn(e,t,i,r,n)],j=T[0],X=r.widgetNode;return Ai(e,function(Z){X&&(r.widgetNode=X.cloneNode(!0)),T.push(nn(Z,l(Z,t),l(Z,i),r,n));for(var q=0;q<Z.linked.length;++q)if(Z.linked[q].isParent)return;j=te(T)}),new On(T,j)}function rs(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),T=e.clipPos(n.from),j=e.clipPos(n.to);if(_t(T,j)){var X=nn(e,T,j,r.primary,r.primary.type);r.markers.push(X),X.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],T=[n.primary.doc];Ai(n.primary.doc,function(Z){return T.push(Z)});for(var j=0;j<n.markers.length;j++){var X=n.markers[j];oe(T,X.doc)==-1&&(X.parent=null,n.markers.splice(j--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Pr=function(e,t,i,r,n){if(!(this instanceof Pr))return new Pr(e,t,i,r,n);i==null&&(i=0),Dn.call(this,[new kn([new Pi("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var T=Ve(i,0);this.sel=wi(T),this.history=new Jn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:T,to:T,text:e}),wr(this,wi(T),xe)};Pr.prototype=Re(Dn.prototype,{constructor:Pr,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=ti(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:mr(function(e){var t=Ve(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ve(i,ct(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&En(this.cm,0,0),wr(this,wi(t),xe)}),replaceRange:function(e,t,i,r){t=l(this,t),i=i?l(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Kr(this,l(this,e),l(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Yr(this,e))return ct(this,e)},getLineNumber:function(e){return Mt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ct(this,e)),Ar(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return l(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:mr(function(e,t,i){Wo(this,l(this,typeof e=="number"?Ve(e,t||0):e),null,i)}),setSelection:mr(function(e,t,i){Wo(this,l(this,e),l(this,t||e),i)}),extendSelection:mr(function(e,t,i){Qn(this,l(this,e),t&&l(this,t),i)}),extendSelections:mr(function(e,t){jo(this,N(this,e),t)}),extendSelectionsBy:mr(function(e,t){var i=ce(this.sel.ranges,e);jo(this,N(this,i),t)}),setSelections:mr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Kt(l(this,e[n].anchor),l(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),wr(this,qr(this.cm,r,t),i)}),addSelection:mr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Kt(l(this,e),l(this,t||e))),wr(this,qr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Kr(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=Kr(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:mr(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 X=t&&t!="end"&&cl(this,r,t),Z=r.length-1;Z>=0;Z--)tn(this,r[Z]);X?Ho(this,X):this.cm&&Zi(this.cm)}),undo:mr(function(){ta(this,"undo")}),redo:mr(function(){ta(this,"redo")}),undoSelection:mr(function(){ta(this,"undo",!0)}),redoSelection:mr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Jn(this.history.maxGeneration),Ai(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Jn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:mr(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&je(n)&&(r.gutterMarkers=null),!0})}),clearGutter:mr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,je(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Yr(this,e))return null;if(t=e,e=ct(this,e),!e)return null}else if(t=Mt(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:mr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(b(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:mr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[n];if(T)if(i==null)r[n]=null;else{var j=T.match(b(i));if(!j)return!1;var X=j.index+j[0].length;r[n]=T.slice(0,j.index)+(!j.index||X==T.length?"":" ")+T.slice(X)||null}else return!1;return!0})}),addLineWidget:mr(function(e,t,i){return xl(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,l(this,e),l(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=l(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=l(this,e);var t=[],i=ct(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=l(this,e),t=l(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(T){var j=T.markedSpans;if(j)for(var X=0;X<j.length;X++){var Z=j[X];!(Z.to!=null&&n==e.line&&e.ch>=Z.to||Z.from==null&&n!=e.line||Z.from!=null&&n==t.line&&Z.from>=t.ch)&&(!i||i(Z.marker))&&r.push(Z.marker.parent||Z.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var T=n.text.length+r;if(T>e)return t=e,!0;e-=T,++i}),l(this,Ve(i,t))},indexFromPos:function(e){e=l(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Pr(ti(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 Pr(ti(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof tr&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(rs(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Jn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):at(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:mr(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)})}),Pr.prototype.eachLine=Pr.prototype.iter;var is=0;function _l(e){var t=this;if(ns(t),Ke(t,e)||di(t.display,e))return;re(e),z&&(is=+new Date);var i=Ni(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,X=function(){++j==n&&pr(t,function(){i=l(t.doc,i);var we={from:i,to:i,text:t.doc.splitLines(T.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,we),Ho(t.doc,wi(l(t.doc,i),l(t.doc,_i(we))))})()},Z=function(we,Fe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,we.type)==-1){X();return}var ze=new FileReader;ze.onerror=function(){return X()},ze.onload=function(){var $e=ze.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){X();return}T[Fe]=$e,X()},ze.readAsText(we)},q=0;q<r.length;q++)Z(r[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var he=e.dataTransfer.getData("Text");if(he){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,wi(i,i)),ge)for(var ke=0;ke<ge.length;++ke)rn(t.doc,"",ge[ke].anchor,ge[ke].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(we){}}}function Al(e,t){if(z&&(!e.state.draggingText||+new Date-is<100)){ue(t);return}if(Ke(e,t)||di(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!k){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",C&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),C&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Ni(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)),h(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 kl(){if(os)return;Dl(),os=!0}function Dl(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Pe(window,"blur",function(){return as(Ji)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ki={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Pn=0;Pn<10;Pn++)ki[Pn+48]=ki[Pn+96]=String(Pn);for(var ra=65;ra<=90;ra++)ki[ra]=String.fromCharCode(ra);for(var Mn=1;Mn<=12;Mn++)ki[Mn+111]=ki[Mn+63235]="F"+Mn;var hi={};hi.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"},hi.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"},hi.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"},hi.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"]},hi.default=s?hi.macDefault:hi.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 X=t[j];if(/^(cmd|meta|m)$/i.test(X))T=!0;else if(/^a(lt)?$/i.test(X))i=!0;else if(/^(c|ctrl|control)$/i.test(X))r=!0;else if(/^s(hift)?$/i.test(X))n=!0;else throw new Error("Unrecognized modifier name: "+X)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(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=ce(i.split(" "),Ol),T=0;T<n.length;T++){var j=void 0,X=void 0;T==n.length-1?(X=n.join(" "),j=r):(X=n.slice(0,T+1).join(" "),j="...");var Z=t[X];if(!Z)t[X]=j;else if(Z!=j)throw new Error("Inconsistent bindings for "+X)}delete e[i]}for(var q in t)e[q]=t[q];return e}function an(e,t,i,r){t=ia(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,i,r);for(var T=0;T<t.fallthrough.length;T++){var j=an(e,t.fallthrough[T],i,r);if(j)return j}}}function ss(e){var t=typeof e=="string"?e:ki[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),(g?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(g?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(C&&e.keyCode==34&&e.char)return!1;var i=ki[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function ia(e){return typeof e=="string"?hi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var T=t(i[n]);r.length&&_t(T.from,te(r).to)<=0;){var j=r.pop();if(_t(j.from,T.from)<0){T.from=j.from;break}}r.push(T)}Fr(e,function(){for(var X=r.length-1;X>=0;X--)rn(e.doc,"",r[X].from,r[X].to,"+delete");Zi(e)})}function Ua(e,t,i){var r=Ue(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ba(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Ve(t.line,r,i<0?"after":"before")}function Fa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var T=st(i,t.doc.direction);if(T){var j=n<0?te(T):T[0],X=n<0==(j.level==1),Z=X?"after":"before",q;if(j.level>0||t.doc.direction=="rtl"){var he=Xi(t,i);q=n<0?i.text.length-1:0;var ge=ai(t,he,q).top;q=ot(function(ke){return ai(t,he,ke).top==ge},n<0==(j.level==1)?j.from:j.to-1,q),Z=="before"&&(q=Ua(i,q,1))}else q=n<0?j.to:j.from;return new Ve(r,q,Z)}}return new Ve(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=st(t,e.doc.direction);if(!n)return Ba(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=Je(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 Ba(t,i,r);var X=function(it,ut){return Ua(t,it instanceof Ve?it.ch:it,ut)},Z,q=function(it){return e.options.lineWrapping?(Z=Z||Xi(e,t),co(e,t,Z,it)):{begin:0,end:t.text.length}},he=q(i.sticky=="before"?X(i,-1):i.ch);if(e.doc.direction=="rtl"||j.level==1){var ge=j.level==1==r<0,ke=X(i,ge?1:-1);if(ke!=null&&(ge?ke<=j.to&&ke<=he.end:ke>=j.from&&ke>=he.begin)){var we=ge?"before":"after";return new Ve(i.line,ke,we)}}var Fe=function(it,ut,nt){for(var mt=function($t,gr){return gr?new Ve(i.line,X($t,1),"before"):new Ve(i.line,$t,"after")};it>=0&&it<n.length;it+=ut){var wt=n[it],xt=ut>0==(wt.level!=1),Rt=xt?nt.begin:X(nt.end,-1);if(wt.from<=Rt&&Rt<wt.to)return mt(Rt,xt);if(Rt=xt?wt.from:X(wt.to,-1),nt.begin<=Rt&&Rt<nt.end)return mt(Rt,xt)}},ze=Fe(T+r,r,he);if(ze)return ze;var $e=r>0?he.end:X(he.begin,-1);return $e!=null&&!(r>0&&$e==t.text.length)&&(ze=Fe(r>0?0:n.length-1,r,q($e)),ze)?ze:null}var In={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=ct(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:l(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?hs(e,t.head):r},Te)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var T=i[n].from(),j=Y(e.getLine(T.line),T.ch,r);t.push(le(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Fr(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=ct(e.doc,n.line).text;if(T){if(n.ch==T.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(T.charAt(n.ch-1)+T.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var j=ct(e.doc,n.line-1).text;j&&(n=new Ve(n.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ve(n.line-1,j.length-1),n,"+transpose"))}}i.push(new Kt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Fr(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);Zi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var i=ct(e.doc,t),r=Ar(i);return r!=i&&(t=Mt(r)),Fa(!0,e,r,t,1)}function Il(e,t){var i=ct(e.doc,t),r=Vi(i);return r!=i&&(t=Mt(r)),Fa(!0,e,i,t,-1)}function hs(e,t){var i=ds(e,t.line),r=ct(e.doc,i.line),n=st(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 Ve(i.line,j?0:T,i.sticky)}return i}function na(e,t,i){if(typeof t=="string"&&(t=In[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Oe}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Ul=new ee;function Nn(e,t,i,r){var n=e.state.keySeq;if(n){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.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"&&br(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Nn(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||Nn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):Nn(e,i,t,function(r){return na(e,r)}):!1}function Bl(e,t,i){return Nn(e,"'"+i+"'",t,function(r){return na(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=B(),Ke(t,e))return;z&&W<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);C&&(ja=r?i:null,!r&&i==88&&!kt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!s&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),lt(document,"keyup",i),lt(document,"mouseover",i))}Pe(document,"keyup",i),Pe(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(di(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(C&&i==ja){ja=null,re(e);return}if(C&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Bl(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&&_t(t,this.pos)==0&&i==this.button};var Un,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Un=Bn=null,"triple"):Un&&Un.compare(i,e,t)?(Bn=new Wa(i,e,t),Un=null,"double"):(Un=new Wa(i,e,t),Bn=null,"single")}function vs(e){var t=this,i=t.display;if(Ke(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,di(i,e)){U||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=Ni(t,e),n=Ae(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):fe(e)==i.scroller&&re(e):n==2?(r&&Qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?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,Nn(e,ls(T,n),n,function(j){if(typeof j=="string"&&(j=In[j]),!j)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=j(e,i)!=Oe}finally{e.state.suppressEdits=!1}return X})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var T=d?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=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){z?setTimeout(P(vo,e),0):e.curOp.focus=B();var n=Gl(e,i,r),T=e.doc.sel,j;e.options.dragDrop&&Ie&&!e.isReadOnly()&&i=="single"&&(j=T.contains(t))>-1&&(_t((j=T.ranges[j]).from(),t)<0||t.xRel>0)&&(_t(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=pr(e,function(q){U&&(n.scroller.draggable=!1),e.state.draggingText=!1,lt(n.wrapper.ownerDocument,"mouseup",j),lt(n.wrapper.ownerDocument,"mousemove",X),lt(n.scroller,"dragstart",Z),lt(n.scroller,"drop",j),T||(re(q),r.addNew||Qn(e.doc,i,null,null,r.extend),U&&!k||z&&W==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),X=function(q){T=T||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Z=function(){return T=!0};U&&(n.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Pe(n.wrapper.ownerDocument,"mouseup",j),Pe(n.wrapper.ownerDocument,"mousemove",X),Pe(n.scroller,"dragstart",Z),Pe(n.scroller,"drop",j),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Kt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Kt(Ve(t.line,0),l(e.doc,Ve(t.line+1,0)));var r=i(e,t);return new Kt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,T=e.doc;re(t);var j,X,Z=T.sel,q=Z.ranges;if(r.addNew&&!r.extend?(X=T.sel.contains(i),X>-1?j=q[X]:j=new Kt(i,i)):(j=T.sel.primary(),X=T.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new Kt(i,i)),i=Ni(e,t,!0,!0),X=-1;else{var he=ys(e,i,r.unit);r.extend?j=Ia(j,he.anchor,he.head,r.extend):j=he}r.addNew?X==-1?(X=q.length,wr(T,qr(e,q.concat([j]),X),{scroll:!1,origin:"*mouse"})):q.length>1&&q[X].empty()&&r.unit=="char"&&!r.extend?(wr(T,qr(e,q.slice(0,X).concat(q.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Z=T.sel):Na(T,X,j,_e):(X=0,wr(T,new zr([j],0),_e),Z=T.sel);var ge=i;function ke(nt){if(_t(ge,nt)==0)return;if(ge=nt,r.unit=="rectangle"){for(var mt=[],wt=e.options.tabSize,xt=Y(ct(T,i.line).text,i.ch,wt),Rt=Y(ct(T,nt.line).text,nt.ch,wt),$t=Math.min(xt,Rt),gr=Math.max(xt,Rt),rr=Math.min(i.line,nt.line),jr=Math.min(e.lastLine(),Math.max(i.line,nt.line));rr<=jr;rr++){var Mr=ct(T,rr).text,lr=Ce(Mr,$t,wt);$t==gr?mt.push(new Kt(Ve(rr,lr),Ve(rr,lr))):Mr.length>lr&&mt.push(new Kt(Ve(rr,lr),Ve(rr,Ce(Mr,gr,wt))))}mt.length||mt.push(new Kt(i,i)),wr(T,qr(e,Z.ranges.slice(0,X).concat(mt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var Ir=j,Er=ys(e,nt,r.unit),hr=Ir.anchor,ur;_t(Er.anchor,hr)>0?(ur=Er.head,hr=vi(Ir.from(),Er.anchor)):(ur=Er.anchor,hr=gi(Ir.to(),Er.head));var nr=Z.ranges.slice(0);nr[X]=Xl(e,new Kt(l(T,hr),ur)),wr(T,qr(e,nr,X),_e)}}var we=n.wrapper.getBoundingClientRect(),Fe=0;function ze(nt){var mt=++Fe,wt=Ni(e,nt,!0,r.unit=="rectangle");if(!wt)return;if(_t(wt,ge)!=0){e.curOp.focus=B(),ke(wt);var xt=Vn(n,T);(wt.line>=xt.to||wt.line<xt.from)&&setTimeout(pr(e,function(){Fe==mt&&ze(nt)}),150)}else{var Rt=nt.clientY<we.top?-20:nt.clientY>we.bottom?20:0;Rt&&setTimeout(pr(e,function(){if(Fe!=mt)return;n.scroller.scrollTop+=Rt,ze(nt)}),50)}}function $e(nt){e.state.selectingText=!1,Fe=Infinity,nt&&(re(nt),n.input.focus()),lt(n.wrapper.ownerDocument,"mousemove",it),lt(n.wrapper.ownerDocument,"mouseup",ut),T.history.lastSelOrigin=null}var it=pr(e,function(nt){nt.buttons===0||!Ae(nt)?$e(nt):ze(nt)}),ut=pr(e,$e);e.state.selectingText=ut,Pe(n.wrapper.ownerDocument,"mousemove",it),Pe(n.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var i=t.anchor,r=t.head,n=ct(e.doc,i.line);if(_t(i,r)==0&&i.sticky==r.sticky)return t;var T=st(n);if(!T)return t;var j=Je(T,i.ch,i.sticky),X=T[j];if(X.from!=i.ch&&X.to!=i.ch)return t;var Z=j+(X.from==i.ch==(X.level!=1)?0:1);if(Z==0||Z==T.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=Je(T,r.ch,r.sticky),ge=he-j||(r.ch-i.ch)*(X.level==1?-1:1);he==Z-1||he==Z?q=ge<0:q=ge>0}var ke=T[Z+(q?-1:0)],we=q==(ke.level==1),Fe=we?ke.from:ke.to,ze=we?"after":"before";return i.ch==Fe&&i.sticky==ze?t:new Kt(new Ve(i.line,Fe,ze),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(ke){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var j=e.display,X=j.lineDiv.getBoundingClientRect();if(T>X.bottom||!ve(e,i))return de(t);T-=X.top-j.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=j.gutters.childNodes[Z];if(q&&q.getBoundingClientRect().right>=n){var he=Wr(e.doc,T),ge=e.display.gutterSpecs[Z];return Ne(e,i,e,he,ge.className,t),de(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(di(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ss={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,T,j){e.defaults[r]=n,T&&(t[r]=j?function(X,Z,q){q!=sn&&T(X,Z,q)}:T)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){_n(r),yn(r),Or(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(Z){for(var q=0;;){var he=Z.text.indexOf(n,q);if(he==-1)break;q=he+n.length,T.push(Ve(j,he))}j++});for(var X=T.length-1;X>=0;X--)rn(r.doc,n,T[X],Ve(T[X].line,T[X].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!=sn&&r.refresh()}),i("specialCharPlaceholder",Yt,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",!w),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){xs(r),wn(r)},!0),i("keyMap","default",function(r,n,T){var j=ia(n),X=T!=sn&&ia(T);X&&X.detach&&X.detach(r,j),j.attach&&j.attach(r,X||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Zl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Da(n,r.options.lineNumbers),wn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){To(r),Qi(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=Da(r.options.gutters,n),wn(r)},!0),i("firstLineNumber",1,wn,!0),i("lineNumberFormatter",function(r){return r},wn,!0),i("showCursorWhenSelecting",!1,bn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Ji(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Jl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,bn,!0),i("singleCursorHeightPerLine",!0,bn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,_n,!0),i("addModeClass",!1,_n,!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,_n,!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 Jl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,T=t?Pe:lt;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 Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),jn(e)),xa(e),Or(e),yn(e),setTimeout(function(){return Qi(e)},100)}function tr(e,t){var i=this;if(!(this instanceof tr))return new tr(e,t);this.options=t=t?I(t):{},I(Ss,t,!1);var r=t.value;typeof r=="string"?r=new Pr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new tr.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,n,t);T.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),To(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),z&&W<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),ji(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ca(i)},20):Ji(this);for(var j in aa)aa.hasOwnProperty(j)&&aa[j](this,t[j],sn);Ao(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ga.length;++X)Ga[X](this);Wi(this),U&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}tr.defaults=Ss,tr.optionHandlers=aa;function Ql(e){var t=e.display;Pe(t.scroller,"mousedown",pr(e,vs)),z&&W<11?Pe(t.scroller,"dblclick",pr(e,function(Z){if(Ke(e,Z))return;var q=Ni(e,Z);if(!q||Ha(e,Z)||di(e.display,Z))return;re(Z);var he=e.findWordAt(q);Qn(e.doc,he.anchor,he.head)})):Pe(t.scroller,"dblclick",function(Z){return Ke(e,Z)||re(Z)}),Pe(t.scroller,"contextmenu",function(Z){return Es(e,Z)}),Pe(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||Es(e,Z)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(Z){if(Z.touches.length!=1)return!1;var q=Z.touches[0];return q.radiusX<=1&&q.radiusY<=1}function j(Z,q){if(q.left==null)return!0;var he=q.left-Z.left,ge=q.top-Z.top;return he*he+ge*ge>20*20}Pe(t.scroller,"touchstart",function(Z){if(!Ke(e,Z)&&!T(Z)&&!Ha(e,Z)){t.input.ensurePolled(),clearTimeout(i);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},Z.touches.length==1&&(t.activeTouch.left=Z.touches[0].pageX,t.activeTouch.top=Z.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(Z){var q=t.activeTouch;if(q&&!di(t,Z)&&q.left!=null&&!q.moved&&new Date-q.start<300){var he=e.coordsChar(t.activeTouch,"page"),ge;!q.prev||j(q,q.prev)?ge=new Kt(he,he):!q.prev.prev||j(q,q.prev.prev)?ge=e.findWordAt(he):ge=new Kt(Ve(he.line,0),l(e.doc,Ve(he.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(Z)}n()}),Pe(t.scroller,"touchcancel",n),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Bi(e,t.scroller.scrollLeft,!0),Ne(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(Z){return Do(e,Z)}),Pe(t.scroller,"DOMMouseScroll",function(Z){return Do(e,Z)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){Ke(e,Z)||ue(Z)},over:function(Z){Ke(e,Z)||(Ll(e,Z),ue(Z))},start:function(Z){return Al(e,Z)},drop:pr(e,_l),leave:function(Z){Ke(e,Z)||ns(e)}};var X=t.input.getField();Pe(X,"keyup",function(Z){return ms.call(e,Z)}),Pe(X,"keydown",pr(e,ps)),Pe(X,"keypress",pr(e,gs)),Pe(X,"focus",function(Z){return Ca(e,Z)}),Pe(X,"blur",function(Z){return Ji(e,Z)})}var Ga=[];tr.defineInitHook=function(e){return Ga.push(e)};function Fn(e,t,i,r){var n=e.doc,T;i==null&&(i="add"),i=="smart"&&(n.mode.indent?T=qe(e,t).state:i="prev");var j=e.options.tabSize,X=ct(n,t),Z=Y(X.text,null,j);X.stateAfter&&(X.stateAfter=null);var q=X.text.match(/^\s*/)[0],he;if(!r&&!/\S/.test(X.text))he=0,i="not";else if(i=="smart"&&(he=n.mode.indent(T,X.text.slice(q.length),X.text),he==Oe||he>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?he=Y(ct(n,t-1).text,null,j):he=0:i=="add"?he=Z+e.options.indentUnit:i=="subtract"?he=Z-e.options.indentUnit:typeof i=="number"&&(he=Z+i),he=Math.max(0,he);var ge="",ke=0;if(e.options.indentWithTabs)for(var we=Math.floor(he/j);we;--we)ke+=j,ge+=" ";if(ke<he&&(ge+=le(he-ke)),ge!=q)return rn(n,ge,Ve(t,0),Ve(t,q.length),"+input"),X.stateAfter=null,!0;for(var Fe=0;Fe<n.sel.ranges.length;Fe++){var ze=n.sel.ranges[Fe];if(ze.head.line==t&&ze.head.ch<q.length){var $e=Ve(t,q.length);Na(n,Fe,new Kt($e,$e));break}}}var ei=null;function oa(e){ei=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,X=n=="paste"||e.state.pasteIncoming>j,Z=at(t),q=null;if(X&&r.ranges.length>1)if(ei&&ei.text.join(`
`)==t){if(r.ranges.length%ei.text.length==0){q=[];for(var he=0;he<ei.text.length;he++)q.push(T.splitLines(ei.text[he]))}}else Z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=ce(Z,function(it){return[it]}));for(var ge=e.curOp.updateInput,ke=r.ranges.length-1;ke>=0;ke--){var we=r.ranges[ke],Fe=we.from(),ze=we.to();we.empty()&&(i&&i>0?Fe=Ve(Fe.line,Fe.ch-i):e.state.overwrite&&!X?ze=Ve(ze.line,Math.min(ct(T,ze.line).text.length,ze.ch+te(Z).length)):X&&ei&&ei.lineWise&&ei.text.join(`
`)==Z.join(`
`)&&(Fe=ze=Ve(Fe.line,0)));var $e={from:Fe,to:ze,text:q?q[ke%q.length]:Z,origin:n||(X?"paste":e.state.cutIncoming>j?"cut":"+input")};tn(e.doc,$e),br(e,"inputRead",e,$e)}t&&!X&&Ts(e,t),Zi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Fr(t,function(){return za(t,i,0,null,"paste")}),!0}function Ts(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 X=0;X<T.electricChars.length;X++)if(t.indexOf(T.electricChars.charAt(X))>-1){j=Fn(e,n.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(ct(e.doc,n.head.line).text.slice(0,n.head.ch))&&(j=Fn(e,n.head.line,"smart")));j&&br(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:Ve(n,0),head:Ve(n+1,0)};i.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:i}}function _s(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){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 U?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),_s(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)&&pr(this,t[r])(this,n,j),Ne(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,T=0;T<n.length;++T)if(n[T]==r||n[T].name==r)return n.splice(T,1),!0},addOverlay:Lr(function(r,n){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:T,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(j){return j.priority}),this.state.modeGen++,Or(this)}),removeOverlay:Lr(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++,Or(this);return}}}),indentLine:Lr(function(r,n,T){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Yr(this.doc,r)&&Fn(this,r,n,T)}),indentSelection:Lr(function(r){for(var n=this.doc.sel.ranges,T=-1,j=0;j<n.length;j++){var X=n[j];if(X.empty())X.head.line>T&&(Fn(this,X.head.line,r,!0),T=X.head.line,j==this.doc.sel.primIndex&&Zi(this));else{var Z=X.from(),q=X.to(),he=Math.max(T,Z.line);T=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var ge=he;ge<T;++ge)Fn(this,ge,r);var ke=this.doc.sel.ranges;Z.ch==0&&n.length==ke.length&&ke[j].from().ch>0&&Na(this.doc,j,new Kt(Z,ke[j].to()),xe)}}}),getTokenAt:function(r,n){return Jt(this,r,n)},getLineTokens:function(r,n){return Jt(this,Ve(r),n,!0)},getTokenTypeAt:function(r){r=l(this.doc,r);var n=He(this,ct(this.doc,r.line)),T=0,j=(n.length-1)/2,X=r.ch,Z;if(X==0)Z=n[2];else for(;;){var q=T+j>>1;if((q?n[q*2-1]:0)>=X)j=q;else if(n[q*2+1]<X)T=q+1;else{Z=n[q*2+2];break}}var he=Z?Z.indexOf("overlay "):-1;return he<0?Z:he==0?null:Z.slice(0,he-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],X=this.getModeAt(r);if(typeof X[n]=="string")j[X[n]]&&T.push(j[X[n]]);else if(X[n])for(var Z=0;Z<X[n].length;Z++){var q=j[X[n][Z]];q&&T.push(q)}else X.helperType&&j[X.helperType]?T.push(j[X.helperType]):j[X.name]&&T.push(j[X.name]);for(var he=0;he<j._global.length;he++){var ge=j._global[he];ge.pred(X,this)&&oe(T,ge.val)==-1&&T.push(ge.val)}return T},getStateAfter:function(r,n){var T=this.doc;return r=G(T,r==null?T.first+T.size-1:r),qe(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=l(this.doc,r):T=r?j.from():j.to(),Qr(this,T,n||"page")},charCoords:function(r,n){return ma(this,l(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,Wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,T){var j=!1,X;if(typeof r=="number"){var Z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Z&&(r=Z,j=!0),X=ct(this.doc,r)}else X=r;return Hn(this,X,{top:0,left:0},n||"page",T||j).top+(j?this.doc.height-Zr(X):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,T,j,X){var Z=this.display;r=Qr(this,l(this.doc,r));var q=r.bottom,he=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Z.sizer.appendChild(n),j=="over")q=r.top;else if(j=="above"||j=="near"){var ge=Math.max(Z.wrapper.clientHeight,this.doc.height),ke=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(j=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(q=r.bottom),he+n.offsetWidth>ke&&(he=ke-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",X=="right"?(he=Z.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(X=="left"?he=0:X=="middle"&&(he=(Z.sizer.clientWidth-n.offsetWidth)/2),n.style.left=he+"px"),T&&Js(this,{left:he,top:q,right:he+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:Lr(ps),triggerOnKeyPress:Lr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Lr(vs),execCommand:function(r){if(In.hasOwnProperty(r))return In[r].call(null,this)},triggerElectric:Lr(function(r){Ts(this,r)}),findPosH:function(r,n,T,j){var X=1;n<0&&(X=-1,n=-n);for(var Z=l(this.doc,r),q=0;q<n&&!(Z=Ka(this.doc,Z,X,T,j),Z.hitSide);++q);return Z},moveH:Lr(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()},Te)}),deleteH:Lr(function(r,n){var T=this.doc.sel,j=this.doc;T.somethingSelected()?j.replaceSelection("",null,"+delete"):on(this,function(X){var Z=Ka(j,X.head,r,n,!1);return r<0?{from:Z,to:X.head}:{from:X.head,to:Z}})}),findPosV:function(r,n,T,j){var X=1,Z=j;n<0&&(X=-1,n=-n);for(var q=l(this.doc,r),he=0;he<n;++he){var ge=Qr(this,q,"div");if(Z==null?Z=ge.left:ge.left=Z,q=Ls(this,ge,X,T),q.hitSide)break}return q},moveV:Lr(function(r,n){var T=this,j=this.doc,X=[],Z=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(he){if(Z)return r<0?he.from():he.to();var ge=Qr(T,he.head,"div");he.goalColumn!=null&&(ge.left=he.goalColumn),X.push(ge.left);var ke=Ls(T,ge,r,n);return n=="page"&&he==j.sel.primary()&&wa(T,ma(T,ke,"div").top-ge.top),ke},Te),X.length)for(var q=0;q<j.sel.ranges.length;q++)j.sel.ranges[q].goalColumn=X[q]}),findWordAt:function(r){var n=this.doc,T=ct(n,r.line).text,j=r.ch,X=r.ch;if(T){var Z=this.getHelper(r,"wordChars");(r.sticky=="before"||X==T.length)&&j?--j:++X;for(var q=T.charAt(j),he=Me(q,Z)?function(ge){return Me(ge,Z)}:/\s/.test(q)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Me(ge)};j>0&&he(T.charAt(j-1));)--j;for(;X<T.length&&he(T.charAt(X));)++X}return new Kt(Ve(r.line,j),Ve(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Ne(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==B()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Lr(function(r,n){En(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Mi(this)}},scrollIntoView:Lr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ve(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Zs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Lr(function(r,n){var T=this,j=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};r!=null&&(this.display.wrapper.style.width=j(r)),n!=null&&(this.display.wrapper.style.height=j(n)),this.options.lineWrapping&&ao(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Z){if(Z.widgets){for(var q=0;q<Z.widgets.length;q++)if(Z.widgets[q].noHScroll){Ci(T,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Ne(this,"refresh",this)}),operation:function(r){return Fr(this,r)},startOperation:function(){return ji(this)},endOperation:function(){return Wi(this)},refresh:Lr(function(){var r=this.display.cachedTextHeight;Or(this),this.curOp.forceUpdate=!0,yn(this),En(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&xa(this),Ne(this,"refresh",this)}),swapDoc:Lr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),yn(this),this.display.input.reset(),En(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,br(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},be(e),e.registerHelper=function(r,n,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,X=ct(e,t.line),Z=n&&e.direction=="rtl"?-i:i;function q(){var ut=t.line+Z;return ut<e.first||ut>=e.first+e.size?!1:(t=new Ve(ut,t.ch,t.sticky),X=ct(e,ut))}function he(ut){var nt;if(r=="codepoint"){var mt=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(mt)?nt=null:nt=new Ve(t.line,Math.max(0,Math.min(X.text.length,t.ch+i*(mt>=55296&&mt<56320?2:1))),-i)}else n?nt=Ml(e.cm,X,t,i):nt=Ba(X,t,i);if(nt==null)if(!ut&&q())t=Fa(n,e.cm,X,t.line,Z);else return!1;else t=nt;return!0}if(r=="char"||r=="codepoint")he();else if(r=="column")he(!0);else if(r=="word"||r=="group")for(var ge=null,ke=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(i<0&&!he(!Fe));Fe=!1){var ze=X.text.charAt(t.ch)||`
`,$e=Me(ze,we)?"w":ke&&ze==`
`?"n":!ke||/\s/.test(ze)?null:"p";if(ke&&!Fe&&!$e&&($e="s"),ge&&ge!=$e){i<0&&(i=1,he(),t.sticky="after");break}if($e&&(ge=$e),i>0&&!he(!Fe))break}var it=ea(e,t,T,j,!0);return pi(T,it)&&(it.hitSide=!0),it}function Ls(e,t,i,r){var n=e.doc,T=t.left,j;if(r=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max(X-.5*Yi(e.display),3);j=(i>0?t.bottom:t.top)+i*Z}else r=="line"&&(j=i>0?t.bottom+3:t.top-3);for(var q;!(q=va(e,T,j),!q.outside);){if(i<0?j<=0:j>=n.height){q.hitSide=!0;break}j+=i*5}return q}var Xt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Xt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;_s(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(X){for(var Z=X.target;Z;Z=Z.parentNode){if(Z==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Z.className))break}return!1}Pe(n,"paste",function(X){if(!T(X)||Ke(r,X)||Cs(X,r))return;W<=11&&setTimeout(pr(r,function(){return t.updateFromDOM()}),20)}),Pe(n,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Pe(n,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Pe(n,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(n,"touchstart",function(){return i.forceCompositionEnd()}),Pe(n,"input",function(){t.composing||t.readFromDOMSoon()});function j(X){if(!T(X)||Ke(r,X))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),X.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Z=ws(r);oa({lineWise:!0,text:Z.text}),X.type=="cut"&&r.operation(function(){r.setSelections(Z.ranges,0,xe),r.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var q=ei.text.join(`
`);if(X.clipboardData.setData("Text",q),X.clipboardData.getData("Text")==q){X.preventDefault();return}}var he=As(),ge=he.firstChild;r.display.lineSpace.insertBefore(he,r.display.lineSpace.firstChild),ge.value=ei.text.join(`
`);var ke=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(he),ke.focus(),ke==n&&i.showPrimarySelection()},50)}Pe(n,"copy",j),Pe(n,"cut",j)},Xt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Xt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Xt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Xt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Xt.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=sa(t,e.anchorNode,e.anchorOffset),j=sa(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&j&&!j.bad&&_t(vi(T,j),r)==0&&_t(gi(T,j),n)==0)return;var X=t.display.view,Z=r.line>=t.display.viewFrom&&ks(t,r)||{node:X[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&ks(t,n);if(!q){var he=X[X.length-1].measure,ge=he.maps?he.maps[he.maps.length-1]:he.map;q={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!Z||!q){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),we;try{we=v(Z.node,Z.offset,q.offset,q.node)}catch(Fe){}we&&(!D&&t.state.focused?(e.collapse(Z.node,Z.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),ke&&e.anchorNode==null?e.addRange(ke):D&&this.startGracePeriod()),this.rememberSelection()},Xt.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)},Xt.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},Xt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Xt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},Xt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Xt.prototype.blur=function(){this.div.blur()},Xt.prototype.getField=function(){return this.div},Xt.prototype.supportsTouch=function(){return!0},Xt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Fr(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)},Xt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Xt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Fr(t,function(){wr(t.doc,wi(i,r),xe),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Xt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ve(r.line-1,ct(e.doc,r.line-1).length)),n.ch==ct(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var T,j,X;r.line==t.viewFrom||(T=Ui(e,r.line))==0?(j=Mt(t.view[0].line),X=t.view[0].node):(j=Mt(t.view[T].line),X=t.view[T-1].node.nextSibling);var Z=Ui(e,n.line),q,he;if(Z==t.view.length-1?(q=t.viewTo-1,he=t.lineDiv.lastChild):(q=Mt(t.view[Z+1].line)-1,he=t.view[Z+1].node.previousSibling),!X)return!1;for(var ge=e.doc.splitLines(tu(e,X,he,j,q)),ke=Kr(e.doc,Ve(j,0),Ve(q,ct(e.doc,q).text.length));ge.length>1&&ke.length>1;)if(te(ge)==te(ke))ge.pop(),ke.pop(),q--;else if(ge[0]==ke[0])ge.shift(),ke.shift(),j++;else break;for(var we=0,Fe=0,ze=ge[0],$e=ke[0],it=Math.min(ze.length,$e.length);we<it&&ze.charCodeAt(we)==$e.charCodeAt(we);)++we;for(var ut=te(ge),nt=te(ke),mt=Math.min(ut.length-(ge.length==1?we:0),nt.length-(ke.length==1?we:0));Fe<mt&&ut.charCodeAt(ut.length-Fe-1)==nt.charCodeAt(nt.length-Fe-1);)++Fe;if(ge.length==1&&ke.length==1&&j==r.line)for(;we&&we>r.ch&&ut.charCodeAt(ut.length-Fe-1)==nt.charCodeAt(nt.length-Fe-1);)we--,Fe++;ge[ge.length-1]=ut.slice(0,ut.length-Fe).replace(/^\u200b+/,""),ge[0]=ge[0].slice(we).replace(/\u200b+$/,"");var wt=Ve(j,we),xt=Ve(q,ke.length?te(ke).length-Fe:0);if(ge.length>1||ge[0]||_t(wt,xt))return rn(e.doc,ge,wt,xt,"+input"),!0},Xt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Xt.prototype.reset=function(){this.forceCompositionEnd()},Xt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Xt.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)},Xt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Fr(this.cm,function(){return Or(e.cm)})},Xt.prototype.setUneditable=function(e){e.contentEditable="false"},Xt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||pr(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Xt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Xt.prototype.onContextMenu=function(){},Xt.prototype.resetPosition=function(){},Xt.prototype.needsContentAttribute=!0;function ks(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=ct(e.doc,t.line),n=eo(i,r,t.line),T=st(r,e.doc.direction),j="left";if(T){var X=Je(T,t.ch);j=X%2?"right":"left"}var Z=io(n.map,t.ch,j);return Z.offset=Z.collapse=="right"?Z.end:Z.start,Z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var T="",j=!1,X=e.doc.lineSeparator(),Z=!1;function q(we){return function(Fe){return Fe.id==we}}function he(){j&&(T+=X,Z&&(T+=X),j=Z=!1)}function ge(we){we&&(he(),T+=we)}function ke(we){if(we.nodeType==1){var Fe=we.getAttribute("cm-text");if(Fe){ge(Fe);return}var ze=we.getAttribute("cm-marker"),$e;if(ze){var it=e.findMarks(Ve(r,0),Ve(n+1,0),q(+ze));it.length&&($e=it[0].find(0))&&ge(Kr(e.doc,$e.from,$e.to).join(X));return}if(we.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;ut&&he();for(var nt=0;nt<we.childNodes.length;nt++)ke(we.childNodes[nt]);/^(pre|p)$/i.test(we.nodeName)&&(Z=!0),ut&&(j=!0)}else we.nodeType==3&&ge(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==i);)t=t.nextSibling,Z=!1;return T}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var 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 ln(Ve(Mt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var T=e.rest?te(e.rest):e.line;return ln(Ve(Mt(T),T.text.length),n)}var j=t.nodeType==3?t:null,X=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,i&&(i=j.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var Z=e.measure,q=Z.maps;function he($e,it,ut){for(var nt=-1;nt<(q?q.length:0);nt++)for(var mt=nt<0?Z.map:q[nt],wt=0;wt<mt.length;wt+=3){var xt=mt[wt+2];if(xt==$e||xt==it){var Rt=Mt(nt<0?e.line:e.rest[nt]),$t=mt[wt]+ut;return(ut<0||xt!=$e)&&($t=mt[wt+(ut?1:0)]),Ve(Rt,$t)}}}var ge=he(j,X,i);if(ge)return ln(ge,n);for(var ke=X.nextSibling,we=j?j.nodeValue.length-i:0;ke;ke=ke.nextSibling){if(ge=he(ke,ke.firstChild,0),ge)return ln(Ve(ge.line,ge.ch-we),n);we+=ke.textContent.length}for(var Fe=X.previousSibling,ze=i;Fe;Fe=Fe.previousSibling){if(ge=he(Fe,Fe.firstChild,-1),ge)return ln(Ve(ge.line,ge.ch+ze),n);ze+=Fe.textContent.length}}var or=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};or.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),E&&(n.style.width="0px"),Pe(n,"input",function(){z&&W>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Pe(n,"paste",function(j){if(Ke(r,j)||Cs(j,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function T(j){if(Ke(r,j))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var X=ws(r);oa({lineWise:!0,text:X.text}),j.type=="cut"?r.setSelections(X.ranges,null,xe):(i.prevInput="",n.value=X.text.join(`
`),V(n))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Pe(n,"cut",T),Pe(n,"copy",T),Pe(e.scroller,"paste",function(j){if(di(e,j)||Ke(r,j))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var X=new Event("paste");X.clipboardData=j.clipboardData,n.dispatchEvent(X)}),Pe(e.lineSpace,"selectstart",function(j){di(e,j)||re(j)}),Pe(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"})}}),Pe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},or.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},or.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},or.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Qr(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},or.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},or.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&&W>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",z&&W>=9&&(this.hasSelection=null))},or.prototype.getField=function(){return this.textarea},or.prototype.supportsTouch=function(){return!1},or.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||B()!=this.textarea))try{this.textarea.focus()}catch(e){}},or.prototype.blur=function(){this.textarea.blur()},or.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},or.prototype.receivedFocus=function(){this.slowPoll()},or.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()})},or.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)},or.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(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&&W>=9&&this.hasSelection===n||s&&/[\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,X=Math.min(r.length,n.length);j<X&&r.charCodeAt(j)==n.charCodeAt(j);)++j;return Fr(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},or.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},or.prototype.onKeyPress=function(){z&&W>=9&&(this.hasSelection=null),this.fastPoll()},or.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=Ni(i,e),j=r.scroller.scrollTop;if(!T||C)return;var X=i.options.resetSelectionOnContextMenu;X&&i.doc.sel.contains(T)==-1&&pr(i,wr)(i.doc,wi(T),xe);var Z=n.style.cssText,q=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.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 ge;U&&(ge=window.scrollY),r.input.focus(),U&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function ke(){if(n.selectionStart!=null){var ze=i.somethingSelected(),$e="\u200B"+(ze?n.value:"");n.value="\u21DA",n.value=$e,t.prevInput=ze?"":"\u200B",n.selectionStart=1,n.selectionEnd=$e.length,r.selForContextMenu=i.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=Z,z&&W<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),n.selectionStart!=null){(!z||z&&W<9)&&ke();var ze=0,$e=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?pr(i,Xo)(i):ze++<10?r.detectingSelectAll=setTimeout($e,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout($e,200)}}if(z&&W>=9&&ke(),L){ue(e);var Fe=function(){lt(window,"mouseup",Fe),setTimeout(we,20)};Pe(window,"mouseup",Fe)}else setTimeout(we,50)},or.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},or.prototype.setUneditable=function(){},or.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=B();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=X.getValue()}var n;if(e.form&&(Pe(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(Z){}}t.finishInit=function(Z){Z.save=r,Z.getTextArea=function(){return e},Z.toTextArea=function(){Z.toTextArea=isNaN,r(),e.parentNode.removeChild(Z.getWrapperElement()),e.style.display="",e.form&&(lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var X=tr(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return X}function nu(e){e.off=lt,e.on=Pe,e.wheelEventPixels=hl,e.Doc=Pr,e.splitLines=at,e.countColumn=Y,e.findColumn=Ce,e.isWordChar=De,e.Pass=Oe,e.signal=Ne,e.Line=Pi,e.changeEnd=_i,e.scrollbarModel=Co,e.Pos=Ve,e.cmpPos=_t,e.modes=Ot,e.mimeModes=Tt,e.resolveMode=vt,e.getMode=Lt,e.modeExtensions=jt,e.extendMode=Ut,e.copyState=qt,e.startState=er,e.innerMode=ir,e.commands=In,e.keyMap=hi,e.keyName=us,e.isModifierKey=ss,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=Bt,e.SharedTextMarker=On,e.TextMarker=Li,e.LineWidget=Rn,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=ue,e.addClass=F,e.contains=S,e.rmClass=c,e.keyNames=ki}$l(tr),ql(tr);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Pr.prototype)Pr.prototype.hasOwnProperty(la)&&oe(au,la)<0&&(tr.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Pr.prototype[la]));return be(Pr),tr.inputStyles={textarea:or,contenteditable:Xt},tr.defineMode=function(e){!tr.defaults.mode&&e!="null"&&(tr.defaults.mode=e),Zt.apply(this,arguments)},tr.defineMIME=Qt,tr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),tr.defineMIME("text/plain","null"),tr.defineExtension=function(e,t){tr.prototype[e]=t},tr.defineDocExtension=function(e,t){Pr.prototype[e]=t},tr.fromTextArea=iu,nu(tr),tr.version="5.58.2",tr})},Y1PL:function(ft,tt,ie){"use strict";ie.r(tt),ie.d(tt,"ResizableTextArea",function(){return oe});var se=ie("wx14"),J=ie("1OyB"),D=ie("vuIU"),$=ie("Ji7U"),O=ie("LK+K"),M=ie("cDcd"),z=ie("VTBJ"),W=ie("rePB"),U=ie("Zm9Q"),R=ie("Kwbf"),y=ie("c+Xe"),C=ie("m+aA"),k=ie("bdgK"),A=new Map;function _(xe){xe.forEach(function(_e){var Te,Ce=_e.target;(Te=A.get(Ce))===null||Te===void 0||Te.forEach(function(me){return me(Ce)})})}var E=new k.default(_),u=null,o=null;function s(xe,_e){A.has(xe)||(A.set(xe,new Set),E.observe(xe)),A.get(xe).add(_e)}function d(xe,_e){A.has(xe)&&(A.get(xe).delete(_e),A.get(xe).size||(E.unobserve(xe),A.delete(xe)))}var w=function(xe){Object($.a)(Te,xe);var _e=Object(O.a)(Te);function Te(){return Object(J.a)(this,Te),_e.apply(this,arguments)}return Object(D.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(M.Component),m=M.createContext(null);function g(xe){var _e=xe.children,Te=xe.onBatchResize,Ce=M.useRef(0),me=M.useRef([]),le=M.useContext(m),te=M.useCallback(function(ce,ae,Le){Ce.current+=1;var Re=Ce.current;me.current.push({size:ce,element:ae,data:Le}),Promise.resolve().then(function(){Re===Ce.current&&(Te==null||Te(me.current),me.current=[])}),le==null||le(ce,ae,Le)},[Te,le]);return M.createElement(m.Provider,{value:te},_e)}function L(xe){var _e=xe.children,Te=xe.disabled,Ce=M.useRef(null),me=M.useRef(null),le=M.useContext(m),te=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ce=M.isValidElement(_e)&&Object(y.c)(_e),ae=ce?_e.ref:null,Le=M.useMemo(function(){return Object(y.a)(ae,Ce)},[ae,Ce]),Re=M.useRef(xe);Re.current=xe;var Se=M.useCallback(function(De){var Me=Re.current,je=Me.onResize,We=Me.data,Be=De.getBoundingClientRect(),Ue=Be.width,ot=Be.height,et=De.offsetWidth,Ze=De.offsetHeight,Je=Math.floor(Ue),pt=Math.floor(ot);if(te.current.width!==Je||te.current.height!==pt||te.current.offsetWidth!==et||te.current.offsetHeight!==Ze){var st={width:Je,height:pt,offsetWidth:et,offsetHeight:Ze};te.current=st;var rt=et===Math.round(Ue)?Ue:et,Pe=Ze===Math.round(ot)?ot:Ze,dt=Object(z.a)(Object(z.a)({},st),{},{offsetWidth:rt,offsetHeight:Pe});le==null||le(dt,De,We),je&&Promise.resolve().then(function(){je(dt,De)})}},[]);return M.useEffect(function(){var De=Object(C.a)(Ce.current)||Object(C.a)(me.current);return De&&!Te&&s(De,Se),function(){return d(De,Se)}},[Ce.current,Te]),M.createElement(w,{ref:me},ce?M.cloneElement(_e,{ref:Le}):_e)}var b="rc-observer-key";function c(xe){var _e=xe.children,Te=Object(U.a)(_e);return Te.map(function(Ce,me){var le=(Ce==null?void 0:Ce.key)||"".concat(b,"-").concat(me);return M.createElement(L,Object(se.a)({},xe,{key:le}),Ce)})}c.Collection=g;var p=c,h=ie("bT9E"),a=ie("TSYQ"),x=ie.n(a),v=`
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"],B={},F;function K(xe){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(_e&&B[Te])return B[Te];var Ce=window.getComputedStyle(xe),me=Ce.getPropertyValue("box-sizing")||Ce.getPropertyValue("-moz-box-sizing")||Ce.getPropertyValue("-webkit-box-sizing"),le=parseFloat(Ce.getPropertyValue("padding-bottom"))+parseFloat(Ce.getPropertyValue("padding-top")),te=parseFloat(Ce.getPropertyValue("border-bottom-width"))+parseFloat(Ce.getPropertyValue("border-top-width")),ce=S.map(function(Le){return"".concat(Le,":").concat(Ce.getPropertyValue(Le))}).join(";"),ae={sizingStyle:ce,paddingSize:le,borderSize:te,boxSizing:me};return _e&&Te&&(B[Te]=ae),ae}function V(xe){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),xe.getAttribute("wrap")?F.setAttribute("wrap",xe.getAttribute("wrap")):F.removeAttribute("wrap");var me=K(xe,_e),le=me.paddingSize,te=me.borderSize,ce=me.boxSizing,ae=me.sizingStyle;F.setAttribute("style","".concat(ae,";").concat(v)),F.value=xe.value||xe.placeholder||"";var Le=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,Se=F.scrollHeight,De;if(ce==="border-box"?Se+=te:ce==="content-box"&&(Se-=le),Te!==null||Ce!==null){F.value=" ";var Me=F.scrollHeight-le;Te!==null&&(Le=Me*Te,ce==="border-box"&&(Le=Le+le+te),Se=Math.max(Le,Se)),Ce!==null&&(Re=Me*Ce,ce==="border-box"&&(Re=Re+le+te),De=Se>Re?"":"hidden",Se=Math.min(Re,Se))}return{height:Se,minHeight:Le,maxHeight:Re,overflowY:De,resize:"none"}}var P=ie("Gytx"),I=ie.n(P),Y;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})(Y||(Y={}));var ee=function(xe){Object($.a)(Te,xe);var _e=Object(O.a)(Te);function Te(Ce){var me;return Object(J.a)(this,Te),me=_e.call(this,Ce),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(le){me.textArea=le},me.handleResize=function(le){var te=me.state.resizeStatus,ce=me.props,ae=ce.autoSize,Le=ce.onResize;if(te!==Y.NONE)return;typeof Le=="function"&&Le(le),ae&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var le=me.props.autoSize;if(!le||!me.textArea)return;var te=le.minRows,ce=le.maxRows,ae=V(me.textArea,!1,te,ce);me.setState({textareaStyles:ae,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var le=me.props,te=le.prefixCls,ce=te===void 0?"rc-textarea":te,ae=le.autoSize,Le=le.onResize,Re=le.className,Se=le.disabled,De=me.state,Me=De.textareaStyles,je=De.resizeStatus,We=Object(h.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=x()(ce,Re,Object(W.a)({},"".concat(ce,"-disabled"),Se));"value"in We&&(We.value=We.value||"");var Ue=Object(z.a)(Object(z.a)(Object(z.a)({},me.props.style),Me),je===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(p,{onResize:me.handleResize,disabled:!(ae||Le)},M.createElement("textarea",Object(se.a)({},We,{className:Be,style:Ue,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:Y.NONE},me}return Object(D.a)(Te,[{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,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,le)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(M.Component),oe=ee,pe=function(xe){Object($.a)(Te,xe);var _e=Object(O.a)(Te);function Te(Ce){var me;Object(J.a)(this,Te),me=_e.call(this,Ce),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(te){me.resizableTextArea=te},me.handleChange=function(te){var ce=me.props.onChange;me.setValue(te.target.value,function(){me.resizableTextArea.resizeTextarea()}),ce&&ce(te)},me.handleKeyDown=function(te){var ce=me.props,ae=ce.onPressEnter,Le=ce.onKeyDown;te.keyCode===13&&ae&&ae(te),Le&&Le(te)};var le=typeof Ce.value=="undefined"||Ce.value===null?Ce.defaultValue:Ce.value;return me.state={value:le},me}return Object(D.a)(Te,[{key:"setValue",value:function(me,le){"value"in this.props||this.setState({value:me},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(oe,Object(se.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}}]),Te}(M.Component),Oe=tt.default=pe},YiCM:function(ft,tt,ie){ft.exports={flexRow:"flexRow___1gyd-",flexJustifyCenter:"flexJustifyCenter___19NSh",flexAlignEnd:"flexAlignEnd___3THeK",flexAlignCenter:"flexAlignCenter___1yurC",flexColumn:"flexColumn___3l0VS",formWrap:"formWrap___28DyB",JupyterFieldWrapElse:"JupyterFieldWrapElse___9ONZN",button:"button___3DTwc",buttonWrap:"buttonWrap___n_juQ",width240:"width240___3x3F-",difficultyHint:"difficultyHint___bU8gT",color888:"color888___3aAYi",color0152d9:"color0152d9___2qsP8",installPackage:"installPackage___3uqSL",apply:"apply___1rKfU",p1:"p1___tgl6j",p2:"p2___1P24b"}},ZpRC:function(ft,tt,ie){"use strict";function se(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function J(y,C){return(!C||y!=="hidden")&&y!=="visible"&&y!=="clip"}function D(y,C){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var k=getComputedStyle(y,null);return J(k.overflowY,C)||J(k.overflowX,C)||function(A){var _=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(u){return null}}(A);return!!_&&(_.clientHeight<A.scrollHeight||_.clientWidth<A.scrollWidth)}(y)}return!1}function $(y,C,k,A,_,E,u,o){return E<y&&u>C||E>y&&u<C?0:E<=y&&o<=k||u>=C&&o>=k?E-y-A:u>C&&o<k||E<y&&o>k?u-C+_:0}var O=function(y,C){var k=window,A=C.scrollMode,_=C.block,E=C.inline,u=C.boundary,o=C.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Me){return Me!==u};if(!se(y))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,w=[],m=y;se(m)&&s(m);){if((m=m.parentElement)===d){w.push(m);break}m!=null&&m===document.body&&D(m)&&!D(document.documentElement)||m!=null&&D(m,o)&&w.push(m)}for(var g=k.visualViewport?k.visualViewport.width:innerWidth,L=k.visualViewport?k.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,p=y.getBoundingClientRect(),h=p.height,a=p.width,x=p.top,v=p.right,S=p.bottom,B=p.left,F=_==="start"||_==="nearest"?x:_==="end"?S:x+h/2,K=E==="center"?B+a/2:E==="end"?v:B,V=[],P=0;P<w.length;P++){var I=w[P],Y=I.getBoundingClientRect(),ee=Y.height,oe=Y.width,pe=Y.top,Oe=Y.right,xe=Y.bottom,_e=Y.left;if(A==="if-needed"&&x>=0&&B>=0&&S<=L&&v<=g&&x>=pe&&S<=xe&&B>=_e&&v<=Oe)return V;var Te=getComputedStyle(I),Ce=parseInt(Te.borderLeftWidth,10),me=parseInt(Te.borderTopWidth,10),le=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),ce=0,ae=0,Le="offsetWidth"in I?I.offsetWidth-I.clientWidth-Ce-le:0,Re="offsetHeight"in I?I.offsetHeight-I.clientHeight-me-te:0;if(d===I)ce=_==="start"?F:_==="end"?F-L:_==="nearest"?$(c,c+L,L,me,te,c+F,c+F+h,h):F-L/2,ae=E==="start"?K:E==="center"?K-g/2:E==="end"?K-g:$(b,b+g,g,Ce,le,b+K,b+K+a,a),ce=Math.max(0,ce+c),ae=Math.max(0,ae+b);else{ce=_==="start"?F-pe-me:_==="end"?F-xe+te+Re:_==="nearest"?$(pe,xe,ee,me,te+Re,F,F+h,h):F-(pe+ee/2)+Re/2,ae=E==="start"?K-_e-Ce:E==="center"?K-(_e+oe/2)+Le/2:E==="end"?K-Oe+le+Le:$(_e,Oe,oe,Ce,le+Le,K,K+a,a);var Se=I.scrollLeft,De=I.scrollTop;F+=De-(ce=Math.max(0,Math.min(De+ce,I.scrollHeight-ee+Re))),K+=Se-(ae=Math.max(0,Math.min(Se+ae,I.scrollWidth-oe+Le)))}V.push({el:I,top:ce,left:ae})}return V};function M(y){return y===Object(y)&&Object.keys(y).length!==0}function z(y,C){C===void 0&&(C="auto");var k="scrollBehavior"in document.body.style;y.forEach(function(A){var _=A.el,E=A.top,u=A.left;_.scroll&&k?_.scroll({top:E,left:u,behavior:C}):(_.scrollTop=E,_.scrollLeft=u)})}function W(y){return y===!1?{block:"end",inline:"nearest"}:M(y)?y:{block:"start",inline:"nearest"}}function U(y,C){var k=!y.ownerDocument.documentElement.contains(y);if(M(C)&&typeof C.behavior=="function")return C.behavior(k?[]:O(y,C));if(k)return;var A=W(C);return z(O(y,A),A.behavior)}var R=tt.a=U},Zss7:function(ft,tt,ie){var se;(function(J){var D=/^\s+/,$=/\s+$/,O=0,M=J.round,z=J.min,W=J.max,U=J.random;function R(te,ce){if(te=te||"",ce=ce||{},te instanceof R)return te;if(!(this instanceof R))return new R(te,ce);var ae=y(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=M(100*this._a)/100,this._format=ce.format||ae.format,this._gradientType=ce.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=ae.ok,this._tc_id=O++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),ce,ae,Le,Re,Se,De;return ce=te.r/255,ae=te.g/255,Le=te.b/255,ce<=.03928?Re=ce/12.92:Re=J.pow((ce+.055)/1.055,2.4),ae<=.03928?Se=ae/12.92:Se=J.pow((ae+.055)/1.055,2.4),Le<=.03928?De=Le/12.92:De=J.pow((Le+.055)/1.055,2.4),.2126*Re+.7152*Se+.0722*De},setAlpha:function(te){return this._a=V(te),this._roundA=M(100*this._a)/100,this},toHsv:function(){var te=_(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=_(this._r,this._g,this._b),ce=M(te.h*360),ae=M(te.s*100),Le=M(te.v*100);return this._a==1?"hsv("+ce+", "+ae+"%, "+Le+"%)":"hsva("+ce+", "+ae+"%, "+Le+"%, "+this._roundA+")"},toHsl:function(){var te=k(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=k(this._r,this._g,this._b),ce=M(te.h*360),ae=M(te.s*100),Le=M(te.l*100);return this._a==1?"hsl("+ce+", "+ae+"%, "+Le+"%)":"hsla("+ce+", "+ae+"%, "+Le+"%, "+this._roundA+")"},toHex:function(te){return u(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(P(this._r,255)*100)+"%",g:M(P(this._g,255)*100)+"%",b:M(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(P(this._r,255)*100)+"%, "+M(P(this._g,255)*100)+"%, "+M(P(this._b,255)*100)+"%)":"rgba("+M(P(this._r,255)*100)+"%, "+M(P(this._g,255)*100)+"%, "+M(P(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var ce="#"+s(this._r,this._g,this._b,this._a),ae=ce,Le=this._gradientType?"GradientType = 1, ":"";if(te){var Re=R(te);ae="#"+s(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+Le+"startColorstr="+ce+",endColorstr="+ae+")"},toString:function(te){var ce=!!te;te=te||this._format;var ae=!1,Le=this._a<1&&this._a>=0,Re=!ce&&Le&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Re?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(te,ce){var ae=te.apply(null,[this].concat([].slice.call(ce)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function(te,ce){return te.apply(null,[this].concat([].slice.call(ce)))},analogous:function(){return this._applyCombination(v,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(te,ce){if(typeof te=="object"){var ae={};for(var Le in te)te.hasOwnProperty(Le)&&(Le==="a"?ae[Le]=te[Le]:ae[Le]=Oe(te[Le]));te=ae}return R(te,ce)};function y(te){var ce={r:0,g:0,b:0},ae=1,Le=null,Re=null,Se=null,De=!1,Me=!1;return typeof te=="string"&&(te=me(te)),typeof te=="object"&&(Ce(te.r)&&Ce(te.g)&&Ce(te.b)?(ce=C(te.r,te.g,te.b),De=!0,Me=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Ce(te.h)&&Ce(te.s)&&Ce(te.v)?(Le=Oe(te.s),Re=Oe(te.v),ce=E(te.h,Le,Re),De=!0,Me="hsv"):Ce(te.h)&&Ce(te.s)&&Ce(te.l)&&(Le=Oe(te.s),Se=Oe(te.l),ce=A(te.h,Le,Se),De=!0,Me="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=V(ae),{ok:De,format:te.format||Me,r:z(255,W(ce.r,0)),g:z(255,W(ce.g,0)),b:z(255,W(ce.b,0)),a:ae}}function C(te,ce,ae){return{r:P(te,255)*255,g:P(ce,255)*255,b:P(ae,255)*255}}function k(te,ce,ae){te=P(te,255),ce=P(ce,255),ae=P(ae,255);var Le=W(te,ce,ae),Re=z(te,ce,ae),Se,De,Me=(Le+Re)/2;if(Le==Re)Se=De=0;else{var je=Le-Re;De=Me>.5?je/(2-Le-Re):je/(Le+Re);switch(Le){case te:Se=(ce-ae)/je+(ce<ae?6:0);break;case ce:Se=(ae-te)/je+2;break;case ae:Se=(te-ce)/je+4;break}Se/=6}return{h:Se,s:De,l:Me}}function A(te,ce,ae){var Le,Re,Se;te=P(te,360),ce=P(ce,100),ae=P(ae,100);function De(We,Be,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?We+(Be-We)*6*Ue:Ue<1/2?Be:Ue<2/3?We+(Be-We)*(2/3-Ue)*6:We}if(ce===0)Le=Re=Se=ae;else{var Me=ae<.5?ae*(1+ce):ae+ce-ae*ce,je=2*ae-Me;Le=De(je,Me,te+1/3),Re=De(je,Me,te),Se=De(je,Me,te-1/3)}return{r:Le*255,g:Re*255,b:Se*255}}function _(te,ce,ae){te=P(te,255),ce=P(ce,255),ae=P(ae,255);var Le=W(te,ce,ae),Re=z(te,ce,ae),Se,De,Me=Le,je=Le-Re;if(De=Le===0?0:je/Le,Le==Re)Se=0;else{switch(Le){case te:Se=(ce-ae)/je+(ce<ae?6:0);break;case ce:Se=(ae-te)/je+2;break;case ae:Se=(te-ce)/je+4;break}Se/=6}return{h:Se,s:De,v:Me}}function E(te,ce,ae){te=P(te,360)*6,ce=P(ce,100),ae=P(ae,100);var Le=J.floor(te),Re=te-Le,Se=ae*(1-ce),De=ae*(1-Re*ce),Me=ae*(1-(1-Re)*ce),je=Le%6,We=[ae,De,Se,Se,Me,ae][je],Be=[Me,ae,ae,De,Se,Se][je],Ue=[Se,Se,Me,ae,ae,De][je];return{r:We*255,g:Be*255,b:Ue*255}}function u(te,ce,ae,Le){var Re=[pe(M(te).toString(16)),pe(M(ce).toString(16)),pe(M(ae).toString(16))];return Le&&Re[0].charAt(0)==Re[0].charAt(1)&&Re[1].charAt(0)==Re[1].charAt(1)&&Re[2].charAt(0)==Re[2].charAt(1)?Re[0].charAt(0)+Re[1].charAt(0)+Re[2].charAt(0):Re.join("")}function o(te,ce,ae,Le,Re){var Se=[pe(M(te).toString(16)),pe(M(ce).toString(16)),pe(M(ae).toString(16)),pe(xe(Le))];return Re&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)&&Se[3].charAt(0)==Se[3].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0)+Se[3].charAt(0):Se.join("")}function s(te,ce,ae,Le){var Re=[pe(xe(Le)),pe(M(te).toString(16)),pe(M(ce).toString(16)),pe(M(ae).toString(16))];return Re.join("")}R.equals=function(te,ce){return!te||!ce?!1:R(te).toRgbString()==R(ce).toRgbString()},R.random=function(){return R.fromRatio({r:U(),g:U(),b:U()})};function d(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.s-=ce/100,ae.s=I(ae.s),R(ae)}function w(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.s+=ce/100,ae.s=I(ae.s),R(ae)}function m(te){return R(te).desaturate(100)}function g(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.l+=ce/100,ae.l=I(ae.l),R(ae)}function L(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toRgb();return ae.r=W(0,z(255,ae.r-M(255*-(ce/100)))),ae.g=W(0,z(255,ae.g-M(255*-(ce/100)))),ae.b=W(0,z(255,ae.b-M(255*-(ce/100)))),R(ae)}function b(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.l-=ce/100,ae.l=I(ae.l),R(ae)}function c(te,ce){var ae=R(te).toHsl(),Le=(ae.h+ce)%360;return ae.h=Le<0?360+Le:Le,R(ae)}function p(te){var ce=R(te).toHsl();return ce.h=(ce.h+180)%360,R(ce)}function h(te){var ce=R(te).toHsl(),ae=ce.h;return[R(te),R({h:(ae+120)%360,s:ce.s,l:ce.l}),R({h:(ae+240)%360,s:ce.s,l:ce.l})]}function a(te){var ce=R(te).toHsl(),ae=ce.h;return[R(te),R({h:(ae+90)%360,s:ce.s,l:ce.l}),R({h:(ae+180)%360,s:ce.s,l:ce.l}),R({h:(ae+270)%360,s:ce.s,l:ce.l})]}function x(te){var ce=R(te).toHsl(),ae=ce.h;return[R(te),R({h:(ae+72)%360,s:ce.s,l:ce.l}),R({h:(ae+216)%360,s:ce.s,l:ce.l})]}function v(te,ce,ae){ce=ce||6,ae=ae||30;var Le=R(te).toHsl(),Re=360/ae,Se=[R(te)];for(Le.h=(Le.h-(Re*ce>>1)+720)%360;--ce;)Le.h=(Le.h+Re)%360,Se.push(R(Le));return Se}function S(te,ce){ce=ce||6;for(var ae=R(te).toHsv(),Le=ae.h,Re=ae.s,Se=ae.v,De=[],Me=1/ce;ce--;)De.push(R({h:Le,s:Re,v:Se})),Se=(Se+Me)%1;return De}R.mix=function(te,ce,ae){ae=ae===0?0:ae||50;var Le=R(te).toRgb(),Re=R(ce).toRgb(),Se=ae/100,De={r:(Re.r-Le.r)*Se+Le.r,g:(Re.g-Le.g)*Se+Le.g,b:(Re.b-Le.b)*Se+Le.b,a:(Re.a-Le.a)*Se+Le.a};return R(De)},R.readability=function(te,ce){var ae=R(te),Le=R(ce);return(J.max(ae.getLuminance(),Le.getLuminance())+.05)/(J.min(ae.getLuminance(),Le.getLuminance())+.05)},R.isReadable=function(te,ce,ae){var Le=R.readability(te,ce),Re,Se;Se=!1,Re=le(ae);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":Se=Le>=4.5;break;case"AAlarge":Se=Le>=3;break;case"AAAsmall":Se=Le>=7;break}return Se},R.mostReadable=function(te,ce,ae){var Le=null,Re=0,Se,De,Me,je;ae=ae||{},De=ae.includeFallbackColors,Me=ae.level,je=ae.size;for(var We=0;We<ce.length;We++)Se=R.readability(te,ce[We]),Se>Re&&(Re=Se,Le=R(ce[We]));return R.isReadable(te,Le,{level:Me,size:je})||!De?Le:(ae.includeFallbackColors=!1,R.mostReadable(te,["#fff","#000"],ae))};var B=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=R.hexNames=K(B);function K(te){var ce={};for(var ae in te)te.hasOwnProperty(ae)&&(ce[te[ae]]=ae);return ce}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function P(te,ce){ee(te)&&(te="100%");var ae=oe(te);return te=z(ce,W(0,parseFloat(te))),ae&&(te=parseInt(te*ce,10)/100),J.abs(te-ce)<1e-6?1:te%ce/parseFloat(ce)}function I(te){return z(1,W(0,te))}function Y(te){return parseInt(te,16)}function ee(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function pe(te){return te.length==1?"0"+te:""+te}function Oe(te){return te<=1&&(te=te*100+"%"),te}function xe(te){return J.round(parseFloat(te)*255).toString(16)}function _e(te){return Y(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",ce="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+ce+")|(?:"+te+")",Le="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Re="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+Le),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+Le),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+Le),hsva:new RegExp("hsva"+Re),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ce(te){return!!Te.CSS_UNIT.exec(te)}function me(te){te=te.replace(D,"").replace($,"").toLowerCase();var ce=!1;if(B[te])te=B[te],ce=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Te.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Te.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Te.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Te.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Te.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Te.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Te.hex8.exec(te))?{r:Y(ae[1]),g:Y(ae[2]),b:Y(ae[3]),a:_e(ae[4]),format:ce?"name":"hex8"}:(ae=Te.hex6.exec(te))?{r:Y(ae[1]),g:Y(ae[2]),b:Y(ae[3]),format:ce?"name":"hex"}:(ae=Te.hex4.exec(te))?{r:Y(ae[1]+""+ae[1]),g:Y(ae[2]+""+ae[2]),b:Y(ae[3]+""+ae[3]),a:_e(ae[4]+""+ae[4]),format:ce?"name":"hex8"}:(ae=Te.hex3.exec(te))?{r:Y(ae[1]+""+ae[1]),g:Y(ae[2]+""+ae[2]),b:Y(ae[3]+""+ae[3]),format:ce?"name":"hex"}:!1}function le(te){var ce,ae;return te=te||{level:"AA",size:"small"},ce=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),ce!=="AA"&&ce!=="AAA"&&(ce="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:ce,size:ae}}ft.exports?ft.exports=R:!(se=function(){return R}.call(tt,ie,tt,ft),se!==void 0&&(ft.exports=se))})(Math)},bT9E:function(ft,tt,ie){"use strict";ie.d(tt,"a",function(){return J});var se=ie("VTBJ");function J(D,$){var O=Object(se.a)({},D);return Array.isArray($)&&$.forEach(function(M){delete O[M]}),O}},c5Ni:function(ft,tt,ie){},dGDm:function(ft,tt,ie){ft.exports={selectEnvironment:"selectEnvironment___1zrTT",search:"search___2Sku-",searchListWrap:"searchListWrap___30F5Q",searchList:"searchList___dxlP6",name:"name___28Ilk",tag:"tag___GYHhS",searchListActive:"searchListActive___1H-dL",spin:"spin___2GYcy",common:"common___JE3ZS",title:"title___11-q3",tags:"tags___3vE7b",tagActive:"tagActive___1c0bT",wrap:"wrap___fFVWs",allList:"allList___2mVBv",item:"item___2NPtB",itemActive:"itemActive___2aQTm",line:"line___yjjYk",apply:"apply___3NyxD",p1:"p1___2xNuY",p2:"p2___uGM8U",list:"list___1jtVf",items:"items___3gafm",darklySelectEnvironment:"darklySelectEnvironment___2KS0W"}},dejd:function(ft,tt,ie){},dmUQ:function(ft,tt,ie){"use strict";var se=ie("Ff2n"),J=ie("rePB"),D=ie("1OyB"),$=ie("vuIU"),O=ie("Ji7U"),M=ie("md7G"),z=ie("foSv"),W=ie("cDcd"),U=ie.n(W),R=ie("TSYQ"),y=ie.n(R),C=ie("4IlW");function k(h,a){var x=Object.keys(h);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(h);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(h,S).enumerable})),x.push.apply(x,v)}return x}function A(h){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?k(Object(x),!0).forEach(function(v){Object(J.a)(h,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(x)):k(Object(x)).forEach(function(v){Object.defineProperty(h,v,Object.getOwnPropertyDescriptor(x,v))})}return h}function _(h){var a=E();return function(){var v=Object(z.a)(h),S;if(a){var B=Object(z.a)(this).constructor;S=Reflect.construct(v,arguments,B)}else S=v.apply(this,arguments);return Object(M.a)(this,S)}}function E(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(h){return!1}}function u(){}function o(h){h.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,w=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(a){return a!=null},L=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},b=function(h){Object(O.a)(x,h);var a=_(x);function x(v){var S;Object(D.a)(this,x),S=a.call(this,v),S.onKeyDown=function(K){var V=S.props,P=V.onKeyDown,I=V.onPressEnter;if(K.keyCode===C.a.UP){var Y=S.getRatio(K);S.up(K,Y,null),S.stop()}else if(K.keyCode===C.a.DOWN){var ee=S.getRatio(K);S.down(K,ee,null),S.stop()}else K.keyCode===C.a.ENTER&&I&&I(K);if(S.recordCursorPosition(),S.lastKeyCode=K.keyCode,P){for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),Oe=1;Oe<oe;Oe++)pe[Oe-1]=arguments[Oe];P.apply(void 0,[K].concat(pe))}},S.onKeyUp=function(K){var V=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),V){for(var P=arguments.length,I=new Array(P>1?P-1:0),Y=1;Y<P;Y++)I[Y-1]=arguments[Y];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),P=S.setValue(V,u);if(K){var I=S.input.value,Y=S.getInputDisplayValue({focus:!1,value:P});S.input.value=Y&&Number(Y),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(g(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 P=0;return V.indexOf(".")>=0&&(P=V.length-V.indexOf(".")-1),P},S.getInputDisplayValue=function(K){var V=K||S.state,P=V.focused,I=V.inputValue,Y=V.value,ee;P?ee=I:ee=S.toPrecisionAsStep(Y),ee==null&&(ee="");var oe=S.formatWrapper(ee);return g(S.props.decimalSeparator)&&(oe=oe.toString().replace(".",S.props.decimalSeparator)),oe},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(K){}},S.restoreByAfter=function(K){if(K===void 0)return!1;var V=S.input.value,P=V.lastIndexOf(K);if(P===-1)return!1;var I=S.cursorBefore.length;return S.lastKeyCode===C.a.DELETE&&S.cursorBefore.charAt(I-1)===K[0]?(S.fixCaret(I,I),!0):P+K.length===V.length?(S.fixCaret(P,P),!0):!1},S.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,P){var I=K.substring(P);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,P){S.pressingUpOrDown=!0,S.step("down",K,V,P)},S.up=function(K,V,P){S.pressingUpOrDown=!0,S.step("up",K,V,P)},S.saveInput=function(K){S.input=K};var B=v.value;B===void 0&&(B=v.defaultValue),S.state={focused:v.autoFocus};var F=S.getValidValue(S.toNumber(B));return S.state=A(A({},S.state),{},{inputValue:S.toPrecisionAsStep(F),value:F}),S}return Object($.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var B=this.props,F=B.value,K=B.onChange,V=B.max,P=B.min,I=this.state.focused;if(S){if(!L(S.value,F)||!L(S.max,V)||!L(S.min,P)){var Y=I?F:this.getValidValue(F),ee;this.pressingUpOrDown?ee=Y:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:ee})}var oe="value"in this.props?F:this.state.value;"max"in this.props&&S.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&S.min!==P&&typeof oe=="number"&&oe<P&&K&&K(P)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var pe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===C.a.BACKSPACE?pe=this.cursorStart-1:this.lastKeyCode===C.a.DELETE&&(pe=this.cursorStart):pe=this.input.value.length,this.fixCaret(pe,pe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case C.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case C.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Oe){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(S){var B=S;return B===""?B="":this.isNotCompleteNumber(parseFloat(B))?B=this.state.value:B=this.getValidValue(B),this.toNumber(B)}},{key:"getValueFromEvent",value:function(S){var B=S.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(B=B.replace(this.props.decimalSeparator,".")),B}},{key:"getValidValue",value:function(S){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(S);return isNaN(K)?S:(K<B&&(K=B),K>F&&(K=F),K)}},{key:"setValue",value:function(S,B){var F=this.props.precision,K=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),V=this.state.value,P=V===void 0?null:V,I=this.state.inputValue,Y=I===void 0?null:I,ee=typeof K=="number"?K.toFixed(F):"".concat(K),oe=K!==P||ee!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},B)):this.setState({value:K,inputValue:this.toPrecisionAsStep(S)},B),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(S){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,K=F.precision,V=F.step;if(g(K))return K;var P=this.getPrecision(B),I=this.getPrecision(V),Y=this.getPrecision(S);return S?Math.max(Y,P+I):P+I}},{key:"getPrecisionFactor",value:function(S){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(S,B);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var B=Math.abs(this.getMaxPrecision(S));return isNaN(B)?S.toString():Number(S).toFixed(B)}},{key:"toNumber",value:function(S){var B=this.props.precision,F=this.state.focused,K=S&&S.length>16&&F;return this.isNotCompleteNumber(S)||K?S:g(B)?Math.round(S*Math.pow(10,B))/Math.pow(10,B):Number(S)}},{key:"upStep",value:function(S,B){var F=this.props.step,K=this.getPrecisionFactor(S,B),V=Math.abs(this.getMaxPrecision(S,B)),P=((K*S+K*F*B)/K).toFixed(V);return this.toNumber(P)}},{key:"downStep",value:function(S,B){var F=this.props.step,K=this.getPrecisionFactor(S,B),V=Math.abs(this.getMaxPrecision(S,B)),P=((K*S-K*F*B)/K).toFixed(V);return this.toNumber(P)}},{key:"step",value:function(S,B){var F=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),B&&(B.persist(),B.preventDefault());var P=this.props;if(P.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var Y=this["".concat(S,"Step")](I,K),ee=Y>P.max||Y<P.min;if(Y>P.max?Y=P.max:Y<P.min&&(Y=P.min),this.setValue(Y,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){F[S](B,K,!0)},V?d:w)}},{key:"fixCaret",value:function(S,B){if(S===void 0||B===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,K=this.input.selectionEnd;(S!==F||B!==K)&&this.input.setSelectionRange(S,B)}catch(V){}}},{key:"render",value:function(){var S,B=this.props,F=B.prefixCls,K=B.disabled,V=B.readOnly,P=B.useTouch,I=B.autoComplete,Y=B.upHandler,ee=B.downHandler,oe=B.className,pe=B.max,Oe=B.min,xe=B.style,_e=B.title,Te=B.onMouseEnter,Ce=B.onMouseLeave,me=B.onMouseOver,le=B.onMouseOut,te=B.required,ce=B.onClick,ae=B.tabIndex,Le=B.type,Re=B.placeholder,Se=B.id,De=B.inputMode,Me=B.pattern,je=B.step,We=B.maxLength,Be=B.autoFocus,Ue=B.name,ot=B.onPaste,et=B.onInput,Ze=Object(se.a)(B,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Je=this.state,pt=Je.value,st=Je.focused,rt=y()(F,(S={},Object(J.a)(S,oe,!!oe),Object(J.a)(S,"".concat(F,"-disabled"),K),Object(J.a)(S,"".concat(F,"-focused"),st),S)),Pe={};Object.keys(Ze).forEach(function(ue){(ue.substr(0,5)==="data-"||ue.substr(0,5)==="aria-"||ue==="role")&&(Pe[ue]=Ze[ue])});var dt=!V&&!K,lt=this.getInputDisplayValue(null),Ne=(pt||pt===0)&&(isNaN(pt)||Number(pt)>=pe),Ke=(pt||pt===0)&&(isNaN(pt)||Number(pt)<=Oe),Ee=Ne||K||V,ve=Ke||K||V,be=y()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(J.a)({},"".concat(F,"-handler-up-disabled"),Ee)),re=y()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(J.a)({},"".concat(F,"-handler-down-disabled"),ve)),ne=P?{onTouchStart:Ee?u:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=P?{onTouchStart:ve?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return U.a.createElement("div",{className:rt,style:xe,title:_e,onMouseEnter:Te,onMouseLeave:Ce,onMouseOver:me,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},U.a.createElement("div",{className:"".concat(F,"-handler-wrap")},U.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:be}),Y||U.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),U.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:re}),ee||U.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),U.a.createElement("div",{className:"".concat(F,"-input-wrap")},U.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Oe,"aria-valuemax":pe,"aria-valuenow":pt,required:te,type:Le,placeholder:Re,onPaste:ot,onClick:ce,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:ae,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:dt?this.onKeyDown:u,onKeyUp:dt?this.onKeyUp:u,autoFocus:Be,maxLength:We,readOnly:V,disabled:K,max:pe,min:Oe,step:je,name:Ue,title:_e,id:Se,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(lt),pattern:Me,inputMode:De,onInput:et},Pe))))}}]),x}(U.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var c=b,p=tt.a=c},dugo:function(ft,tt,ie){"use strict";ie.r(tt);var se=ie("7Kak"),J=ie("9yH6"),D=ie("tJVT"),$=ie("cDcd"),O=ie.n($),M=ie("FrRK"),z=ie("2qtc"),W=ie("kLXV"),U=ie("5Dmo"),R=ie("3S7+"),y=ie("+L6B"),C=ie("2/Rp"),k=ie("R9oj"),A=ie("ECub"),_=ie("miYZ"),E=ie("tsqr"),u=ie("9og8"),o=ie("WmNS"),s=ie.n(o),d=ie("9kvl"),w=ie("HBuW"),m=ie("1vsH"),g=ie("Lai7"),L=ie.n(g),b=ie("9Bee"),c=ie("EGTK"),p=ie("m3rI"),h=ie("mT4J"),a=ie.n(h),x=ie("ErOA"),v=function(Se){var De=Se.newShixuns,Me=Se.user,je=Se.dispatch,We=Object($.useState)(null),Be=Object(D.a)(We,2),Ue=Be[0],ot=Be[1],et=Object($.useState)(null),Ze=Object(D.a)(et,2),Je=Ze[0],pt=Ze[1],st=Object($.useState)({}),rt=Object(D.a)(st,2),Pe=rt[0],dt=rt[1],lt=Object($.useState)(!1),Ne=Object(D.a)(lt,2),Ke=Ne[0],Ee=Ne[1],ve=Object($.useState)(!1),be=Object(D.a)(ve,2),re=be[0],ne=be[1],de=De.environmentData,ue=de.frequence_image,fe=ue===void 0?[]:ue,Ae=de.environments,Ie=Ae===void 0?[]:Ae,Ye=de.other_image,ht=Ye===void 0?[]:Ye,Xe=Pe.name,gt=Pe.description,at=Pe.authorization,Qe=Pe.template_shixuns,kt=Qe===void 0?[]:Qe,Et=Pe.recommend_shixuns,Dt=Et===void 0?[]:Et;Object($.useEffect)(function(){je({type:"newShixuns/getEnvironmentData"})},[]),Object($.useEffect)(function(){if(Je===null)return;Ot()},[Je]);var Ot=function(){var Lt=Object(u.a)(s.a.mark(function jt(){var Ut;return s.a.wrap(function(ir){for(;;)switch(ir.prev=ir.next){case 0:return ir.next=2,Object(w.S)({mirror_repository_id:Je});case 2:Ut=ir.sent,dt(Ut.data);case 4:case"end":return ir.stop()}},jt)}));return function(){return Lt.apply(this,arguments)}}();Object($.useEffect)(function(){(fe==null?void 0:fe.length)>0&&pt(fe[0].id)},[fe]);var Tt=function(jt){ot(jt),Ee(!0)},Zt=function(){var Lt=Object(u.a)(s.a.mark(function jt(){var Ut,qt;return s.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return ne(!0),er.next=3,Object(x.a)("/api/shixuns/".concat(Ue==null?void 0:Ue.identifier,"/copy.json"),{method:"post",body:{}});case 3:Ut=er.sent,Ut.status===0&&(d.d===null||d.d===void 0||d.d.push("/shixuns/".concat((qt=Ut.data)===null||qt===void 0?void 0:qt.shixun,"/edit")),Ee(!1),E.b.success("\u590D\u5236\u6210\u529F")),ne(!1);case 6:case"end":return er.stop()}},jt)}));return function(){return Lt.apply(this,arguments)}}(),Qt=function(){Ee(!1)},vt=function(){var Lt=Object(u.a)(s.a.mark(function jt(){var Ut,qt,ir,er=arguments;return s.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return Ut=er.length>0&&er[0]!==void 0?er[0]:!1,Object(m.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE","\u5168\u5B9E\u8DF5\u9879\u76EE",Ut?"\u6682\u4E0D\u9009\u7528\u955C\u50CF":"\u4F7F\u7528\u5F53\u524D\u955C\u50CF"]),qt=Je&&!Ut?{image_id:Je}:{},ct.next=5,Object(x.a)("/api/shixuns/choose_environment_or_skip.json",{method:"post",body:qt});case 5:ir=ct.sent,ir.status===0&&d.d.push("/shixuns/".concat(ir.data.identifier,"/edit"));case 7:case"end":return ct.stop()}},jt)}));return function(){return Lt.apply(this,arguments)}}();return O.a.createElement("div",{className:a.a.practice},O.a.createElement(c.a,{dispatch:je,value:Je,data:Ie,otherData:ht,tags:fe,onChange:function(jt){return pt(jt)}}),O.a.createElement("div",{className:a.a.right},O.a.createElement("header",null,O.a.createElement("div",{className:a.a.title},"\u5B9E\u9A8C\u73AF\u5883:\xA0",Je===null?"\u2014 \u2014":Xe)),O.a.createElement("div",{className:a.a.content},Je===null&&O.a.createElement(O.a.Fragment,null,O.a.createElement(A.a,{image:L.a,description:"\u8BF7\u9009\u62E9\u5B9E\u9A8C\u73AF\u5883"}),O.a.createElement("div",{className:a.a.btns},O.a.createElement(C.a,{size:"large",style:{marginRight:20},onClick:function(){return vt(!0)}}," \u6682\u4E0D\u9009\u7528\u955C\u50CF"),O.a.createElement(C.a,{size:"large",type:"primary",disabled:Je===null,onClick:function(){return vt()}},"\u4F7F\u7528\u5F53\u524D\u955C\u50CF"))),Je!==null&&O.a.createElement("div",{className:a.a.des},O.a.createElement("div",{className:a.a.mainBody},O.a.createElement(b.a,{value:gt})),O.a.createElement("div",{className:a.a.btns,style:{borderBottom:kt.length||Dt.length?"1px solid #F1F1F1":0}},O.a.createElement(C.a,{size:"large",style:{marginRight:20},onClick:function(){return vt(!0)}}," \u6682\u4E0D\u9009\u7528\u955C\u50CF"),O.a.createElement(C.a,{size:"large",type:"primary",disabled:Je===null,onClick:function(){return vt()}},"\u4F7F\u7528\u5F53\u524D\u955C\u50CF")),!!kt.length&&O.a.createElement("div",{className:a.a.title},"\u57FA\u4E8E\u6A21\u677F\u521B\u5EFA"),O.a.createElement("ul",{className:a.a.sys},kt.map(function(Lt,jt){var Ut=Lt.pic,qt=Lt.name,ir=Lt.identifier,er=Lt.template_description,Bt=Lt.id;return O.a.createElement("li",{className:a.a.li,key:jt},O.a.createElement("div",{className:a.a.d1},O.a.createElement("div",{className:a.a.img},O.a.createElement("img",{src:"".concat(p.a.IMG_SERVER,"/").concat(Ut)})),O.a.createElement("div",{className:a.a.btn},O.a.createElement("div",{className:a.a.b1,onClick:function(){return Object(m.S)("/shixuns/".concat(ir,"/challenges"))}},"\u67E5\u770B\u8BE6\u60C5"),O.a.createElement("div",{className:a.a.b2,onClick:function(){return Tt(Lt)}},"\u4F7F\u7528\u6A21\u677F")),O.a.createElement("div",{className:a.a.bot},qt||"--")),er?O.a.createElement(R.a,{title:er},O.a.createElement("div",{className:a.a.d2},er)):O.a.createElement("div",{className:a.a.d2},"--"))})),!!Dt.length&&O.a.createElement("div",{className:a.a.title},"\u63A8\u8350\u5B9E\u8DF5\u9879\u76EE\u6837\u4F8B"),O.a.createElement("ul",{className:a.a.sys},Dt.map(function(Lt,jt){var Ut=Lt.pic,qt=Lt.name,ir=Lt.identifier,er=Lt.id;return O.a.createElement("li",{className:a.a.li,key:jt},O.a.createElement("div",{className:a.a.d1},O.a.createElement("div",{className:a.a.img},O.a.createElement("img",{src:"".concat(p.a.IMG_SERVER,"/").concat(Ut)})),O.a.createElement("div",{className:a.a.btn},O.a.createElement("div",{className:a.a.b1,onClick:function(){return Object(m.S)("/shixuns/".concat(ir,"/challenges"))}},"\u67E5\u770B\u8BE6\u60C5"),O.a.createElement("div",{className:a.a.b2,onClick:function(){return Tt(Lt)}},"\u4E00\u952E\u590D\u5236")),O.a.createElement("div",{className:a.a.bot},qt)))}))))),O.a.createElement(W.a,{title:"\u4E00\u952E\u65B0\u5EFA",visible:Ke,centered:!0,onCancel:Qt,footer:null,wrapClassName:a.a.practiceModal},at&&O.a.createElement("div",{className:a.a.content},O.a.createElement("p",null,"\u4E00\u952E\u65B0\u5EFA\u540E\uFF0C\u60A8\u53EF\u4EE5\u57FA\u4E8E\u8FD9\u4E2A\u5B9E\u8BAD\u4FEE\u6539\u5F62\u6210\u65B0\u7684\u5B9E\u8BAD"),O.a.createElement(C.a,{className:a.a.btn,loading:re,onClick:Zt},"\u786E\u8BA4\u590D\u5236")),!at&&O.a.createElement("div",{className:a.a.content},O.a.createElement("aside",null,O.a.createElement("p",null,"\u8BE5\u5B9E\u8BAD\u6240\u4F7F\u7528\u7684\u5B9E\u9A8C\u73AF\u5883\u4E3A\u79C1\u6709\u73AF\u5883\uFF1A",O.a.createElement("span",{style:{color:"#0152d9"}},Xe)),O.a.createElement("p",null,"\u60A8\u65E0\u8BE5\u5B9E\u9A8C\u73AF\u5883\u7684\u4F7F\u7528\u6743\u9650\uFF0C\u6240\u4EE5\u65E0\u6CD5\u590D\u5236\u8BE5\u5B9E\u8BAD")),O.a.createElement("div",{onClick:function(){return Ee(!1)}},"\u6211\u77E5\u9053\u4E86"))))},S=Object(d.a)(function(Re){var Se=Re.newShixuns,De=Re.globalSetting,Me=Re.user;return{newShixuns:Se,globalSetting:De,user:Me}})(v),B=ie("sRBo"),F=ie("kaz8"),K=ie("5NDa"),V=ie("5rEg"),P=ie("k1fw"),I=ie("y8nQ"),Y=ie("Vl3Y"),ee=ie("OaEy"),oe=ie("2fM7"),pe=ie("Ot1p"),Oe=ie("YiCM"),xe=ie.n(Oe),_e=ie("QXZ7"),Te=oe.a.Option,Ce=function(Se){var De,Me,je,We,Be,Ue=Se.newShixuns,ot=Se.loading,et=Se.dispatch,Ze=Se.is_jupyter_lab,Je=Se.user,pt=Y.a.useForm(),st=Object(D.a)(pt,1),rt=st[0],Pe=Object($.useState)({}),dt=Object(D.a)(Pe,2),lt=dt[0],Ne=dt[1],Ke=Object($.useState)(!1),Ee=Object(D.a)(Ke,2),ve=Ee[0],be=Ee[1],re=Object($.useState)({}),ne=Object(D.a)(re,2),de=ne[0],ue=ne[1];Object($.useEffect)(function(){var Xe="newShixuns/getNewShixunsData";Ze&&(Xe="newShixuns/getShixunsJupyterLab"),et({type:Xe})},[Ze]),Object($.useEffect)(function(){var Xe,gt,at,Qe=Ue==null||((Xe=Ue.newData)===null||Xe===void 0||((gt=Xe.main_type)===null||gt===void 0||((at=gt[0])===null||at===void 0)))?void 0:at.id;rt.setFieldsValue({mainType:Qe}),Ie(Qe)},[Ue]);var fe=function(){et({type:"newShixuns/setActionTabs",payload:{key:"NewShixuns-Apply"}})},Ae=function(gt,at){Ne(Object(P.a)({},at)),console.log(gt,"changeValues"),"mainType"in gt&&Ie(at.mainType,at.subType),"subType"in gt&&Ie(at.mainType,at.subType)},Ie=function(gt){var at=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Qe=Ue.newData||{},kt=Qe.main_type,Et=Qe.small_type,Dt=kt==null?void 0:kt.find(function(Tt){return Tt.id===gt}),Ot={mainTypeName:Dt==null?void 0:Dt.type_name,mainTypeDescription:Dt==null?void 0:Dt.description,smallType:[]};at.map(function(Tt){Et.map(function(Zt){Tt===Zt.id&&!!Zt.description&&Ot.smallType.push({name:Zt.type_name,des:Zt.description})})}),ue(Ot)},Ye=function(){var Xe=Object(u.a)(s.a.mark(function gt(at){var Qe,kt,Et,Dt,Ot,Tt,Zt,Qt,vt,Lt;return s.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return Qe=at||{},kt=Qe.intro,Et=Qe.mainType,Dt=Qe.subType,Ot=Qe.name,Tt=Qe.number,Zt=Qe.difficulty,Qt=Qe.jupyter_show_description,vt=Qt===void 0?!1:Qt,Object(m.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE",Ze?"Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE":"JupyterLab\u5B9E\u8DF5\u9879\u76EE","\u4FDD\u5B58"]),Ut.next=4,et({type:"newShixuns/submitShixuns",payload:{description:kt,main_type:Et,sub_type:Dt,shixun:{jupyter_show_description:vt,name:Ot,number:Tt,trainee:Zt,is_jupyter:!Ze,is_jupyter_lab:Ze}}});case 4:Lt=Ut.sent,(Lt==null?void 0:Lt.status)!==-1&&d.d.push("/shixuns/".concat(Lt.shixun_identifier,"/challenges"));case 6:case"end":return Ut.stop()}},gt)}));return function(at){return Xe.apply(this,arguments)}}(),ht=function(){et({type:"newShixuns/setActionTabs",payload:{key:"Create-Environment"}})};return O.a.createElement(Y.a,{form:rt,className:xe.a.JupyterFieldWrapElse,scrollToFirstError:!0,layout:"vertical",initialValues:{difficulty:1},onValuesChange:Ae,onFinish:Ye},O.a.createElement("div",{className:xe.a.fieldWrap},O.a.createElement(Y.a.Item,{name:"name",label:"\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0"},{max:60,message:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"},{whitespace:!0,message:"\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C"}]},O.a.createElement(V.a,{bordered:!1,placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26",suffix:"".concat(((De=lt.name)===null||De===void 0?void 0:De.length)||0,"/60")})),O.a.createElement(Y.a.Item,{name:"intro",label:"\u7B80\u4ECB:"},O.a.createElement(pe.a,{watch:!0})),O.a.createElement(Y.a.Item,{name:"jupyter_show_description",valuePropName:"checked"},O.a.createElement(F.a,null,"\u663E\u793A\u4EFB\u52A1\u8981\u6C42\uFF08\u52FE\u9009\u540E\uFF0C\u5C06\u7B80\u4ECB\u4F5C\u4E3A\u4EFB\u52A1\u8981\u6C42\u663E\u793A\u5728\u5B9E\u8DF5\u9879\u76EE\u6311\u6218\u9875\u9762\uFF09")),O.a.createElement("div",{className:"".concat(xe.a.flexRow," ").concat(xe.a.flexAlignCenter)},O.a.createElement(Y.a.Item,{className:xe.a.width180,name:"number",label:"\u5B9E\u9A8C\u7F16\u53F7:"},O.a.createElement(V.a,{bordered:!1,style:{width:500},placeholder:"\u8BF7\u8F93\u5165\u5B9E\u9A8C\u7F16\u53F7\uFF0C\u6700\u591A20\u4E2A\u5B57\u7B26",maxLength:20}))),O.a.createElement("div",{className:"".concat(xe.a.flexRow," ").concat(xe.a.flexAlignCenter)},O.a.createElement(Y.a.Item,{className:xe.a.width180,name:"difficulty",label:"\u96BE\u6613\u5EA6:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6"}]},O.a.createElement(oe.a,{bordered:!1,placeholder:"\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6",style:{width:500}},O.a.createElement(Te,{value:1},"\u521D\u7EA7"),O.a.createElement(Te,{value:2},"\u4E2D\u7EA7"),O.a.createElement(Te,{value:3},"\u4E2D\u9AD8\u7EA7"),O.a.createElement(Te,{value:4},"\u9AD8\u7EA7")))),O.a.createElement("div",{className:"".concat(xe.a.flexRow," ").concat(xe.a.flexAlignEnd)},O.a.createElement(Y.a.Item,{className:xe.a.width240,name:"mainType",label:"\u5B9E\u9A8C\u73AF\u5883:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B"}]},O.a.createElement(oe.a,{bordered:!1,placeholder:"\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B"},(Me=Ue.newData)===null||Me===void 0||((je=Me.main_type)===null||je===void 0)?void 0:je.map(function(Xe){return O.a.createElement(Te,{value:Xe.id,key:Xe.id,name:Xe.description},Xe.type_name)}))),O.a.createElement(Y.a.Item,{name:"subType",className:"".concat(xe.a.width240," ml20")},O.a.createElement(oe.a,{getPopupContainer:function(gt){return gt.parentNode},bordered:!1,placeholder:"\u8BF7\u9009\u62E9\u5C0F\u7C7B\u522B",mode:"multiple"},(We=Ue.newData)===null||We===void 0||((Be=We.small_type)===null||Be===void 0)?void 0:Be.map(function(Xe){return O.a.createElement(Te,{value:Xe.id,key:Xe.id,name:Xe.description},Xe.type_name)}))),O.a.createElement("div",{className:xe.a.installPackage,onClick:function(){return be(!0)}},"\u73AF\u5883\u4ECB\u7ECD")),O.a.createElement("div",{className:xe.a.apply},O.a.createElement("span",{className:xe.a.p1},"\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"),O.a.createElement("span",{className:xe.a.p2,onClick:fe}," ","\u7533\u8BF7\u65B0\u5EFA"),O.a.createElement("span",{className:xe.a.p2,onClick:ht}," ","\u5728\u7EBF\u521B\u5EFA"))),O.a.createElement(Y.a.Item,null,O.a.createElement("div",{className:xe.a.buttonWrap},O.a.createElement(C.a,{size:"large",className:"".concat(xe.a.button," mr20"),onClick:function(){Object(m.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE",Ze?"Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE":"JupyterLab\u5B9E\u8DF5\u9879\u76EE","\u53D6\u6D88"]),d.d.push("/shixuns")}},"\u53D6\u6D88"),O.a.createElement(C.a,{size:"large",type:"primary",className:"".concat(xe.a.button," mr20"),htmlType:"submit",loading:ot["newShixuns/submitCourses"]},"\u4FDD\u5B58"))),O.a.createElement(_e.a,{installPackage:de,visible:ve,setVisible:be}))},me=Object(d.a)(function(Re){var Se=Re.newShixuns,De=Re.loading,Me=Re.user;return{newShixuns:Se,loading:De.effects,user:Me}})(Ce),le=ie("N3QO"),te=ie("6f40"),ce=ie.n(te),ae=function(){var Se=Object($.useState)("1"),De=Object(D.a)(Se,2),Me=De[0],je=De[1],We=function(Ue){je(Ue.target.value)};return O.a.createElement("section",{className:ce.a.practicalTraining},O.a.createElement("div",{className:ce.a.titleWrap},O.a.createElement("div",{className:ce.a.title},"\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE"),O.a.createElement("div",{className:ce.a.line}),O.a.createElement(J.a.Group,{value:Me,onChange:We},O.a.createElement(J.a,{style:{fontSize:16},value:"1"},"\u5168\u6808\u5B9E\u8DF5\u9879\u76EE"),O.a.createElement(J.a,{value:"2",style:{marginLeft:40,fontSize:16}},"Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE"),O.a.createElement(J.a,{value:"3",style:{marginLeft:40,fontSize:16}},"JupyterLab\u5B9E\u8DF5\u9879\u76EE")),O.a.createElement("div",{className:ce.a.dec},Me==="1"&&"\u591A\u529F\u80FD\u65B0\u578B\u5B9E\u6218\u9879\u76EE\u6A21\u5F0F\uFF0C\u652F\u6301\u56FE\u5F62\u5316\u684C\u9762\u3001Web IDE\u3001\u547D\u4EE4\u884C\u3001\u865A\u62DF\u4EFF\u771F\u7B49\u591A\u79CD\u5B9E\u9A8C\u573A\u666F\uFF0C\u9002\u7528\u4E8E\u5404\u7C7B\u590D\u6742\u5DE5\u7A0B\u9879\u76EE\u7814\u53D1\u3002",Me==="2"&&"\u591A\u529F\u80FD\u5B9E\u65F6\u4EA4\u4E92\u5B9E\u9A8C\u6A21\u5F0F\uFF0C\u652F\u6301\u5B9E\u65F6\u4EE3\u7801\u3001\u6570\u5B66\u65B9\u7A0B\u3001\u53EF\u89C6\u5316\u548CMarkDown\u7B49\u3002 \u9002\u7528\u4E8E\u6570\u636E\u6E05\u7406\u3001\u6570\u503C\u6A21\u62DF\u3001\u7EDF\u8BA1\u5EFA\u6A21\u3001\u673A\u5668\u5B66\u4E60\u7B49\u7CFB\u5217\u5B9E\u9A8C\u3002",Me==="3"&&"JupyterLab\u662F\u65B0\u4E00\u4EE3Jupyter Notebook\uFF0C\u914D\u7F6E\u6587\u4EF6\u76EE\u5F55\u548CNotebook\uFF0C\u652F\u6301\u6570\u636E\u79D1\u5B66\u4E2D\u7684\u5404\u79CD\u5DE5\u4F5C\u6D41\u7A0B\uFF0C\u9002\u5408\u4E2D\u5927\u578B\u9879\u76EE\u3002")),Me==="1"&&O.a.createElement(S,null),(Me==="2"||Me==="3")&&O.a.createElement(me,{is_jupyter_lab:!(Me==="2")}),O.a.createElement(M.a,null),O.a.createElement(le.a,null))},Le=tt.default=ae},h78n:function(ft,tt,ie){"use strict";ie.d(tt,"a",function(){return S});var se=ie("cDcd"),J=ie.n(se),D=ie("TSYQ"),$=ie.n(D),O={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(K){var V=K.map(function(){return Object(se.useRef)()}),P=Object(se.useRef)();return Object(se.useEffect)(function(){var I=Date.now(),Y=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;Y=!0;var pe=oe.style;pe.transitionDuration=".3s, .3s, .3s, .06s",P.current&&I-P.current<100&&(pe.transitionDuration="0s, 0s")}),Y&&(P.current=Date.now())}),[V]};function z(){return z=Object.assign||function(F){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(F[P]=V[P])}return F},z.apply(this,arguments)}function W(F,K){return k(F)||C(F,K)||R(F,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 R(F,K){if(!F)return;if(typeof F=="string")return y(F,K);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return y(F,K)}function y(F,K){(K==null||K>F.length)&&(K=F.length);for(var V=0,P=new Array(K);V<K;V++)P[V]=F[V];return P}function C(F,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],P=!0,I=!1,Y=void 0;try{for(var ee=F[Symbol.iterator](),oe;!(P=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);P=!0);}catch(pe){I=!0,Y=pe}finally{try{!P&&ee.return!=null&&ee.return()}finally{if(I)throw Y}}return V}function k(F){if(Array.isArray(F))return F}function A(F,K){if(F==null)return{};var V=_(F,K),P,I;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(F);for(I=0;I<Y.length;I++){if(P=Y[I],K.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,P))continue;V[P]=F[P]}}return V}function _(F,K){if(F==null)return{};var V={},P=Object.keys(F),I,Y;for(Y=0;Y<P.length;Y++){if(I=P[Y],K.indexOf(I)>=0)continue;V[I]=F[I]}return V}var E=function(K){var V=K.className,P=K.percent,I=K.prefixCls,Y=K.strokeColor,ee=K.strokeLinecap,oe=K.strokeWidth,pe=K.style,Oe=K.trailColor,xe=K.trailWidth,_e=K.transition,Te=A(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var Ce=Array.isArray(P)?P:[P],me=Array.isArray(Y)?Y:[Y],le=M(Ce),te=W(le,1),ce=te[0],ae=oe/2,Le=100-oe/2,Re="M ".concat(ee==="round"?ae:0,",").concat(ae,`
L `).concat(ee==="round"?Le:100,",").concat(ae),Se="0 0 100 ".concat(oe),De=0;return J.a.createElement("svg",z({className:$()("".concat(I,"-line"),V),viewBox:Se,preserveAspectRatio:"none",style:pe},Te),J.a.createElement("path",{className:"".concat(I,"-line-trail"),d:Re,strokeLinecap:ee,stroke:Oe,strokeWidth:xe||oe,fillOpacity:"0"}),Ce.map(function(Me,je){var We={strokeDasharray:"".concat(Me,"px, 100px"),strokeDashoffset:"-".concat(De,"px"),transition:_e||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Be=me[je]||me[me.length-1];return De+=Me,J.a.createElement("path",{key:je,className:"".concat(I,"-line-path"),d:Re,strokeLinecap:ee,stroke:Be,strokeWidth:oe,fillOpacity:"0",ref:ce[je],style:We})}))};E.defaultProps=O;var u=E;function o(){return o=Object.assign||function(F){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(F[P]=V[P])}return F},o.apply(this,arguments)}function s(F,K){return L(F)||g(F,K)||w(F,K)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(F,K){if(!F)return;if(typeof F=="string")return m(F,K);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return m(F,K)}function m(F,K){(K==null||K>F.length)&&(K=F.length);for(var V=0,P=new Array(K);V<K;V++)P[V]=F[V];return P}function g(F,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],P=!0,I=!1,Y=void 0;try{for(var ee=F[Symbol.iterator](),oe;!(P=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);P=!0);}catch(pe){I=!0,Y=pe}finally{try{!P&&ee.return!=null&&ee.return()}finally{if(I)throw Y}}return V}function L(F){if(Array.isArray(F))return F}function b(F,K){if(F==null)return{};var V=c(F,K),P,I;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(F);for(I=0;I<Y.length;I++){if(P=Y[I],K.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,P))continue;V[P]=F[P]}}return V}function c(F,K){if(F==null)return{};var V={},P=Object.keys(F),I,Y;for(Y=0;Y<P.length;Y++){if(I=P[Y],K.indexOf(I)>=0)continue;V[I]=F[I]}return V}var p=0;function h(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function x(F,K,V,P){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,ee=50-P/2,oe=0,pe=-ee,Oe=0,xe=-2*ee;switch(Y){case"left":oe=-ee,pe=0,Oe=2*ee,xe=0;break;case"right":oe=ee,pe=0,Oe=-2*ee,xe=0;break;case"bottom":pe=ee,xe=2*ee;break;default:}var _e="M 50,50 m ".concat(oe,",").concat(pe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Oe,",").concat(-xe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Oe,",").concat(xe),Te=Math.PI*2*ee,Ce={stroke:V,strokeDasharray:"".concat(K/100*(Te-I),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(I/2+F/100*(Te-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:_e,pathStyle:Ce}}var v=function(K){var V=K.prefixCls,P=K.strokeWidth,I=K.trailWidth,Y=K.gapDegree,ee=K.gapPosition,oe=K.trailColor,pe=K.strokeLinecap,Oe=K.style,xe=K.className,_e=K.strokeColor,Te=K.percent,Ce=b(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(se.useMemo)(function(){return p+=1,p},[]),le=x(0,100,oe,P,Y,ee),te=le.pathString,ce=le.pathStyle,ae=a(Te),Le=a(_e),Re=Le.find(function(We){return Object.prototype.toString.call(We)==="[object Object]"}),Se=M(ae),De=s(Se,1),Me=De[0],je=function(){var Be=0;return ae.map(function(Ue,ot){var et=Le[ot]||Le[Le.length-1],Ze=Object.prototype.toString.call(et)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(me,")"):"",Je=x(Be,Ue,et,P,Y,ee);return Be+=Ue,J.a.createElement("path",{key:ot,className:"".concat(V,"-circle-path"),d:Je.pathString,stroke:Ze,strokeLinecap:pe,strokeWidth:P,opacity:Ue===0?0:1,fillOpacity:"0",style:Je.pathStyle,ref:Me[ot]})})};return J.a.createElement("svg",o({className:$()("".concat(V,"-circle"),xe),viewBox:"0 0 100 100",style:Oe},Ce),Re&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(We,Be){return h(We)-h(Be)}).map(function(We,Be){return J.a.createElement("stop",{key:Be,offset:We,stopColor:Re[We]})}))),J.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:pe,strokeWidth:I||P,fillOpacity:"0",style:ce}),je().reverse())};v.defaultProps=O;var S=v,B={Line:u,Circle:S}},kSUc:function(ft,tt,ie){},lZu9:function(ft,tt,ie){(function(se){se(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(se){"use strict";se.defineMode("markdown",function(J,D){var $=se.getMode(J,"text/html"),O=$.name=="null";function M(P){if(se.findModeByName){var I=se.findModeByName(P);I&&(P=I.mime||I.mimes[0])}var Y=se.getMode(J,P);return Y.name=="null"?null:Y}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var 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 W in z)z.hasOwnProperty(W)&&D.tokenTypeOverrides[W]&&(z[W]=D.tokenTypeOverrides[W]);var U=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,C=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(P,I,Y){return I.f=I.inline=Y,Y(P,I)}function d(P,I,Y){return I.f=I.block=Y,Y(P,I)}function w(P){return!P||!/\S/.test(P.string)}function m(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==L){var I=O;if(!I){var Y=se.innerMode($,P.htmlState);I=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}I&&(P.f=h,P.block=g,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function g(P,I){var Y=P.column()===I.indentation,ee=w(I.prevLine.stream),oe=I.indentedCode,pe=I.prevLine.hr,Oe=I.list!==!1,xe=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var _e=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,Oe)){for(I.list=null;_e<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=_e-I.listStack[I.listStack.length-1])}var Te=!ee&&!pe&&!I.prevLine.header&&(!Oe||!oe)&&!I.prevLine.fencedCodeEnd,Ce=(I.list===!1||pe||ee)&&I.indentation<=xe&&P.match(U),me=null;if(I.indentationDiff>=4&&(oe||I.prevLine.fencedCodeEnd||I.prevLine.header||ee))return P.skipToEnd(),I.indentedCode=!0,z.code;if(P.eatSpace())return null;if(Y&&I.indentation<=xe&&(me=P.match(C))&&me[1].length<=6)return I.quote=0,I.header=me[1].length,I.thisLine.header=!0,D.highlightFormatting&&(I.formatting="header"),I.f=I.inline,c(I);if(I.indentation<=xe&&P.eat(">"))return I.quote=Y?1:I.quote+1,D.highlightFormatting&&(I.formatting="quote"),P.eatSpace(),c(I);if(!Ce&&!I.setext&&Y&&I.indentation<=xe&&(me=P.match(R))){var le=me[1]?"ol":"ul";return I.indentation=_e+P.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,D.taskLists&&P.match(y,!1)&&(I.taskList=!0),I.f=I.inline,D.highlightFormatting&&(I.formatting=["list","list-"+le]),c(I)}else{if(Y&&I.indentation<=xe&&(me=P.match(_,!0)))return I.quote=0,I.fencedEndRE=new RegExp(me[1]+"+ *$"),I.localMode=D.fencedCodeBlockHighlighting&&M(me[2]||D.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=se.startState(I.localMode)),I.f=I.block=b,D.highlightFormatting&&(I.formatting="code-block"),I.code=-1,c(I);if(I.setext||(!Te||!Oe)&&!I.quote&&I.list===!1&&!I.code&&!Ce&&!E.test(P.string)&&(me=P.lookAhead(1))&&(me=me.match(k)))return I.setext?(I.header=I.setext,I.setext=0,P.skipToEnd(),D.highlightFormatting&&(I.formatting="header")):(I.header=me[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,c(I);if(Ce)return P.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,z.hr;if(P.peek()==="[")return s(P,I,B)}return s(P,I,I.inline)}function L(P,I){var Y=$.token(P,I.htmlState);if(!O){var ee=se.innerMode($,I.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||I.md_inside&&P.current().indexOf(">")>-1)&&(I.f=h,I.block=g,I.htmlState=null)}return Y}function b(P,I){var Y=I.listStack[I.listStack.length-1]||0,ee=I.indentation<Y,oe=Y+3;if(I.fencedEndRE&&I.indentation<=oe&&(ee||P.match(I.fencedEndRE))){D.highlightFormatting&&(I.formatting="code-block");var pe;return ee||(pe=c(I)),I.localMode=I.localState=null,I.block=g,I.f=h,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,ee?d(P,I,I.block):pe}else return I.localMode?I.localMode.token(P,I.localState):(P.skipToEnd(),z.code)}function c(P){var I=[];if(P.formatting){I.push(z.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var Y=0;Y<P.formatting.length;Y++)I.push(z.formatting+"-"+P.formatting[Y]),P.formatting[Y]==="header"&&I.push(z.formatting+"-"+P.formatting[Y]+"-"+P.header),P.formatting[Y]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?I.push(z.formatting+"-"+P.formatting[Y]+"-"+P.quote):I.push("error"))}if(P.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(P.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(P.linkHref?I.push(z.linkHref,"url"):(P.strong&&I.push(z.strong),P.em&&I.push(z.em),P.strikethrough&&I.push(z.strikethrough),P.emoji&&I.push(z.emoji),P.linkText&&I.push(z.linkText),P.code&&I.push(z.code),P.image&&I.push(z.image),P.imageAltText&&I.push(z.imageAltText,"link"),P.imageMarker&&I.push(z.imageMarker)),P.header&&I.push(z.header,z.header+"-"+P.header),P.quote&&(I.push(z.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?I.push(z.quote+"-"+P.quote):I.push(z.quote+"-"+D.maxBlockquoteDepth)),P.list!==!1){var ee=(P.listStack.length-1)%3;ee?ee===1?I.push(z.list2):I.push(z.list3):I.push(z.list1)}return P.trailingSpaceNewLine?I.push("trailing-space-new-line"):P.trailingSpace&&I.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function p(P,I){return P.match(A,!0)?c(I):void 0}function h(P,I){var Y=I.text(P,I);if(typeof Y!="undefined")return Y;if(I.list)return I.list=null,c(I);if(I.taskList){var ee=P.match(y,!0)[1]===" ";return ee?I.taskOpen=!0:I.taskClosed=!0,D.highlightFormatting&&(I.formatting="task"),I.taskList=!1,c(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&P.match(/^#+$/,!0))return D.highlightFormatting&&(I.formatting="header"),c(I);var oe=P.next();if(I.linkTitle){I.linkTitle=!1;var pe=oe;oe==="("&&(pe=")"),pe=(pe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Oe="^\\s*(?:[^"+pe+"\\\\]+|\\\\\\\\|\\\\.)"+pe;if(P.match(new RegExp(Oe),!0))return z.linkHref}if(oe==="`"){var xe=I.formatting;D.highlightFormatting&&(I.formatting="code"),P.eatWhile("`");var _e=P.current().length;if(I.code==0&&(!I.quote||_e==1))return I.code=_e,c(I);if(_e==I.code){var Te=c(I);return I.code=0,Te}else return I.formatting=xe,c(I)}else if(I.code)return c(I);if(oe==="\\"&&(P.next(),D.highlightFormatting)){var Ce=c(I),me=z.formatting+"-escape";return Ce?Ce+" "+me:me}if(oe==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,D.highlightFormatting&&(I.formatting="image"),c(I);if(oe==="["&&I.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,D.highlightFormatting&&(I.formatting="image"),c(I);if(oe==="]"&&I.imageAltText){D.highlightFormatting&&(I.formatting="image");var Ce=c(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=x,Ce}if(oe==="["&&!I.image)return I.linkText&&P.match(/^.*?\]/)||(I.linkText=!0,D.highlightFormatting&&(I.formatting="link")),c(I);if(oe==="]"&&I.linkText){D.highlightFormatting&&(I.formatting="link");var Ce=c(I);return I.linkText=!1,I.inline=I.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?x:h,Ce}if(oe==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,D.highlightFormatting&&(I.formatting="link");var Ce=c(I);return Ce?Ce+=" ":Ce="",Ce+z.linkInline}if(oe==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,D.highlightFormatting&&(I.formatting="link");var Ce=c(I);return Ce?Ce+=" ":Ce="",Ce+z.linkEmail}if(D.xml&&oe==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=P.string.indexOf(">",P.pos);if(le!=-1){var te=P.string.substring(P.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(I.md_inside=!0)}return P.backUp(1),I.htmlState=se.startState($),d(P,I,L)}if(D.xml&&oe==="<"&&P.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var ce=1,ae=P.pos==1?" ":P.string.charAt(P.pos-2);ce<3&&P.eat(oe);)ce++;var Le=P.peek()||" ",Re=!/\s/.test(Le)&&(!u.test(Le)||/\s/.test(ae)||u.test(ae)),Se=!/\s/.test(ae)&&(!u.test(ae)||/\s/.test(Le)||u.test(Le)),De=null,Me=null;if(ce%2&&(!I.em&&Re&&(oe==="*"||!Se||u.test(ae))?De=!0:I.em==oe&&Se&&(oe==="*"||!Re||u.test(Le))&&(De=!1)),ce>1&&(!I.strong&&Re&&(oe==="*"||!Se||u.test(ae))?Me=!0:I.strong==oe&&Se&&(oe==="*"||!Re||u.test(Le))&&(Me=!1)),Me!=null||De!=null){D.highlightFormatting&&(I.formatting=De==null?"strong":Me==null?"em":"strong em"),De===!0&&(I.em=oe),Me===!0&&(I.strong=oe);var Te=c(I);return De===!1&&(I.em=!1),Me===!1&&(I.strong=!1),Te}}else if(oe===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return c(I);P.backUp(1)}if(D.strikethrough){if(oe==="~"&&P.eatWhile(oe)){if(I.strikethrough){D.highlightFormatting&&(I.formatting="strikethrough");var Te=c(I);return I.strikethrough=!1,Te}else if(P.match(/^[^\s]/,!1))return I.strikethrough=!0,D.highlightFormatting&&(I.formatting="strikethrough"),c(I)}else if(oe===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return c(I);P.backUp(2)}}if(D.emoji&&oe===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,D.highlightFormatting&&(I.formatting="emoji");var je=c(I);return I.emoji=!1,je}return oe===" "&&(P.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),c(I)}function a(P,I){var Y=P.next();if(Y===">"){I.f=I.inline=h,D.highlightFormatting&&(I.formatting="link");var ee=c(I);return ee?ee+=" ":ee="",ee+z.linkInline}return P.match(/^[^>]+/,!0),z.linkInline}function x(P,I){if(P.eatSpace())return null;var Y=P.next();return Y==="("||Y==="["?(I.f=I.inline=S(Y==="("?")":"]"),D.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,c(I)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(P){return function(I,Y){var ee=I.next();if(ee===P){Y.f=Y.inline=h,D.highlightFormatting&&(Y.formatting="link-string");var oe=c(Y);return Y.linkHref=!1,oe}return I.match(v[P]),Y.linkHref=!0,c(Y)}}function B(P,I){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=F,P.next(),D.highlightFormatting&&(I.formatting="link"),I.linkText=!0,c(I)):s(P,I,h)}function F(P,I){if(P.match(/^\]:/,!0)){I.f=I.inline=K,D.highlightFormatting&&(I.formatting="link");var Y=c(I);return I.linkText=!1,Y}return P.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function K(P,I){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?I.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=h,z.linkHref+" url")}var V={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(P){return{f:P.f,prevLine:P.prevLine,thisLine:P.thisLine,block:P.block,htmlState:P.htmlState&&se.copyState($,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?se.copyState(P.localMode,P.localState):null,inline:P.inline,text:P.text,formatting:!1,linkText:P.linkText,linkTitle:P.linkTitle,linkHref:P.linkHref,code:P.code,em:P.em,strong:P.strong,strikethrough:P.strikethrough,emoji:P.emoji,header:P.header,setext:P.setext,hr:P.hr,taskList:P.taskList,list:P.list,listStack:P.listStack.slice(0),quote:P.quote,indentedCode:P.indentedCode,trailingSpace:P.trailingSpace,trailingSpaceNewLine:P.trailingSpaceNewLine,md_inside:P.md_inside,fencedEndRE:P.fencedEndRE}},token:function(P,I){if(I.formatting=!1,P!=I.thisLine.stream){if(I.header=0,I.hr=!1,P.match(/^\s*$/,!0))return m(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:P},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=L)){var Y=P.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=Y,I.indentationDiff=null,Y>0)return null}}return I.f(P,I)},innerMode:function(P){return P.block==L?{state:P.htmlState,mode:$}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:V}},indent:function(P,I,Y){return P.block==L&&$.indent?$.indent(P.htmlState,I,Y):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,I,Y):se.Pass},blankLine:m,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),se.defineMIME("text/markdown","markdown"),se.defineMIME("text/x-markdown","markdown")})},mT4J:function(ft,tt,ie){ft.exports={practice:"practice___2GgSp",right:"right___2iW-T",title:"title___2wI-Y",content:"content___39urh",des:"des___3lOLJ",mainBody:"mainBody___2O3bf",sys:"sys___9a4Vo",li:"li___1a3_u",d1:"d1___--jU-",img:"img___3TRW8",bot:"bot___3H4-s",btn:"btn___2pVoZ",b1:"b1___3uZem",b2:"b2___3A6em",d2:"d2___2tiq3",btns:"btns___2p8vO",practiceModal:"practiceModal___15Ue6"}},osHv:function(ft,tt,ie){(function(se){se(ie("VrN/"))})(function(se){"use strict";var J=se.Pos;function D(u,o){return u.line-o.line||u.ch-o.ch}var $="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",O=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+$+"]["+O+"]*)","g");function z(u,o,s,d){this.line=o,this.ch=s,this.cm=u,this.text=u.getLine(o),this.min=d?Math.max(d.from,u.firstLine()):u.firstLine(),this.max=d?Math.min(d.to-1,u.lastLine()):u.lastLine()}function W(u,o){var s=u.cm.getTokenTypeAt(J(u.line,o));return s&&/\btag\b/.test(s)}function U(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function R(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function y(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(U(u))continue;return}if(!W(u,o+1)){u.ch=o+1;continue}var s=u.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function C(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(R(u))continue;return}if(!W(u,o+1)){u.ch=o;continue}M.lastIndex=o,u.ch=o;var s=M.exec(u.text);if(s&&s.index==o)return s}}function k(u){for(;;){M.lastIndex=u.ch;var o=M.exec(u.text);if(!o){if(U(u))continue;return}if(!W(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function A(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(R(u))continue;return}if(!W(u,o+1)){u.ch=o;continue}var s=u.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function _(u,o){for(var s=[];;){var d=k(u),w,m=u.line,g=u.ch-(d?d[0].length:0);if(!d||!(w=y(u)))return;if(w=="selfClose")continue;if(d[1]){for(var L=s.length-1;L>=0;--L)if(s[L]==d[2]){s.length=L;break}if(L<0&&(!o||o==d[2]))return{tag:d[2],from:J(m,g),to:J(u.line,u.ch)}}else s.push(d[2])}}function E(u,o){for(var s=[];;){var d=A(u);if(!d)return;if(d=="selfClose"){C(u);continue}var w=u.line,m=u.ch,g=C(u);if(!g)return;if(g[1])s.push(g[2]);else{for(var L=s.length-1;L>=0;--L)if(s[L]==g[2]){s.length=L;break}if(L<0&&(!o||o==g[2]))return{tag:g[2],from:J(u.line,u.ch),to:J(w,m)}}}}se.registerHelper("fold","xml",function(u,o){for(var s=new z(u,o.line,0);;){var d=k(s);if(!d||s.line!=o.line)return;var w=y(s);if(!w)return;if(!d[1]&&w!="selfClose"){var m=J(s.line,s.ch),g=_(s,d[2]);return g&&D(g.from,m)>0?{from:m,to:g.from}:null}}}),se.findMatchingTag=function(u,o,s){var d=new z(u,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var w=y(d),m=w&&J(d.line,d.ch),g=w&&C(d);if(!w||!g||D(d,o)>0)return;var L={from:J(d.line,d.ch),to:m,tag:g[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:g[1]?{open:E(d,g[2]),close:L,at:"close"}:(d=new z(u,m.line,m.ch,s),{open:L,close:_(d,g[2]),at:"open"})},se.findEnclosingTag=function(u,o,s,d){for(var w=new z(u,o.line,o.ch,s);;){var m=E(w,d);if(!m)break;var g=new z(u,o.line,o.ch,s),L=_(g,m.tag);if(L)return{open:m,close:L}}},se.scanForClosingTag=function(u,o,s,d){var w=new z(u,o.line,o.ch,d?{from:0,to:d}:null);return _(w,s)}})},p5ED:function(ft,tt,ie){"use strict";var se=ie("+L6B"),J=ie("2/Rp"),D=ie("5Dmo"),$=ie("3S7+"),O=ie("k1fw"),M=ie("tJVT"),z=ie("cDcd"),W=ie.n(z),U=ie("vHTk"),R=ie.n(U),y=ie("yEEn"),C=ie("ZW9T"),k=ie("1vsH");tt.a=function(A){var _=A.name,E=A.data,u=A.theme,o=A.type,s=A.filename,d=A.monacoEditor,w=A.className,m=A.style,g=A.close,L=A.onClose,b=A.hasMask,c=Object(z.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),p=Object(M.a)(c,2),h=p[0],a=p[1],x=Object(z.useState)(""),v=Object(M.a)(x,2),S=v[0],B=v[1],F,K=1024*1024,V=10*K,P=Object(z.useRef)();o==="office"&&(F=Object(k.T)(E).filesize,F>V&&(o="other")),s&&(d.filename=s),Object(z.useEffect)(function(){var ee,oe,pe=(ee=document.cookie)===null||ee===void 0||((oe=ee.replace(/\s/g,""))===null||oe===void 0)?void 0:oe.split(";");pe==null||pe.map(function(Oe){var xe=Oe.split("=");xe[0]==="_educoder_session"&&B(xe[1])})},[]);var I=function(){if(E.startsWith("http")||E.startsWith("/")){Y();return}Object(k.z)(s||"educoder",E,s)},Y=function(){Object(k.x)(s||_,E)};return console.log("data:",E,"fileanme:",s," name:",_),W.a.createElement("div",{style:Object(O.a)({},m||{}),className:"".concat(b&&R.a.bgBlack," ").concat(o?R.a.wrp:"hide")},g&&W.a.createElement("div",{className:R.a.close,ref:P},W.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return P.current}},W.a.createElement("span",{onClick:Y},W.a.createElement("i",{className:"icon-quxiaozhiding"}))),W.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return P.current}},W.a.createElement("span",{className:"",onClick:L},W.a.createElement("i",{className:"icon-guanbi1"})))),W.a.createElement("div",{className:"".concat(R.a[w]," ").concat(w," ").concat(R.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&W.a.createElement(C.b,d)),o==="audio"&&W.a.createElement("audio",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?E:"data:audio/mp3;base64,").concat(E),autoPlay:!0}),o==="video"&&W.a.createElement(W.a.Fragment,null,E!=null&&E.startsWith("/")?W.a.createElement("video",{controls:!0,src:"".concat(E),autoPlay:!0}):W.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(E),autoPlay:!0})),o==="html"&&W.a.createElement("iframe",{src:E+"&disposition=inline"}),o==="pdf"&&W.a.createElement("embed",{className:R.a.embed,src:E}),o==="image"&&W.a.createElement(W.a.Fragment,null,W.a.createElement("img",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(E)})),o==="other"&&W.a.createElement("div",null,W.a.createElement(J.a,{type:"primary",size:"large",onClick:I},W.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&W.a.createElement(J.a,{type:"primary",size:"large",onClick:I},W.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ft,tt,ie){},qB8g:function(ft,tt,ie){ft.exports={flexRow:"flexRow___Aj71W",flexColumn:"flexColumn___2jvSr",formWrap:"formWrap___3OxLN",upload:"upload___2lUf4",color0152d9:"color0152d9___10ICR",colorCCC:"colorCCC___2mbRd",footerWrap:"footerWrap___1Ytvb",qrCode:"qrCode___2RFKG",a1:"a1___HdrHw",code:"code___17cwA",group:"group___DUj4t",groupNumber:"groupNumber___3_2zt",a2:"a2___2_e5C"}},rUJ1:function(ft,tt){const ie=/[&<>"']/,se=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},O=b=>$[b];function M(b,c){if(c){if(ie.test(b))return b.replace(se,O)}else if(J.test(b))return b.replace(D,O);return b}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(b){return b.replace(z,(c,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 U=/(^|[^\[])\^/g;function R(b,c){b=b.source||b,c=c||"";const p={replace:(h,a)=>(a=a.source||a,a=a.replace(U,"$1"),b=b.replace(h,a),p),getRegex:()=>new RegExp(b,c)};return p}const y=/[^\w:]/g,C=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(b,c,p){if(b){let h;try{h=decodeURIComponent(W(p)).replace(y,"").toLowerCase()}catch(a){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}c&&!C.test(p)&&(p=o(c,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(h){return null}return p}const A={},_=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,c){A[" "+b]||(_.test(b)?A[" "+b]=b+"/":A[" "+b]=m(b,"/",!0)),b=A[" "+b];const p=b.indexOf(":")===-1;return c.substring(0,2)==="//"?p?c:b.replace(E,"$1")+c:c.charAt(0)==="/"?p?c:b.replace(u,"$1")+c:b+c}const s={exec:function(){}};function d(b){let c=1,p,h;for(;c<arguments.length;c++){p=arguments[c];for(h in p)Object.prototype.hasOwnProperty.call(p,h)&&(b[h]=p[h])}return b}function w(b,c){const p=b.replace(/\|/g,(x,v,S)=>{let B=!1,F=v;for(;--F>=0&&S[F]==="\\";)B=!B;return B?"|":" |"}),h=p.split(/ \|/);let a=0;if(h.length>c)h.splice(c);else for(;h.length<c;)h.push("");for(;a<h.length;a++)h[a]=h[a].trim().replace(/\\\|/g,"|");return h}function m(b,c,p){const h=b.length;if(h===0)return"";let a=0;for(;a<h;){const x=b.charAt(h-a-1);if(x===c&&!p)a++;else if(x!==c&&p)a++;else break}return b.substr(0,h-a)}function g(b,c){if(b.indexOf(c[1])===-1)return-1;const p=b.length;let h=0,a=0;for(;a<p;a++)if(b[a]==="\\")a++;else if(b[a]===c[0])h++;else if(b[a]===c[1]&&(h--,h<0))return a;return-1}function L(b){b&&b.sanitize&&!b.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")}ft.exports={escape:M,unescape:W,edit:R,cleanUrl:k,resolveUrl:o,noopTest:s,merge:d,splitCells:w,rtrim:m,findClosingBracket:g,checkSanitizeDeprecation:L}},ulZh:function(ft,tt,ie){typeof window!="undefined"&&function(J,D){ft.exports=D()}(this,function(){return function(se){var J={};function D($){if(J[$])return J[$].exports;var O=J[$]={i:$,l:!1,exports:{}};return se[$].call(O.exports,O,O.exports,D),O.l=!0,O.exports}return D.m=se,D.c=J,D.d=function($,O,M){D.o($,O)||Object.defineProperty($,O,{enumerable:!0,get:M})},D.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},D.t=function($,O){if(O&1&&($=D($)),O&8)return $;if(O&4&&typeof $=="object"&&$&&$.__esModule)return $;var M=Object.create(null);if(D.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:$}),O&2&&typeof $!="string")for(var z in $)D.d(M,z,function(W){return $[W]}.bind(null,z));return M},D.n=function($){var O=$&&$.__esModule?function(){return $.default}:function(){return $};return D.d(O,"a",O),O},D.o=function($,O){return Object.prototype.hasOwnProperty.call($,O)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(se,J,D){"use strict";var $=Object.prototype.hasOwnProperty,O="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(O=!1));function z(y,C,k){this.fn=y,this.context=C,this.once=k||!1}function W(y,C,k,A,_){if(typeof k!="function")throw new TypeError("The listener must be a function");var E=new z(k,A||y,_),u=O?O+C:C;return y._events[u]?y._events[u].fn?y._events[u]=[y._events[u],E]:y._events[u].push(E):(y._events[u]=E,y._eventsCount++),y}function U(y,C){--y._eventsCount===0?y._events=new M:delete y._events[C]}function R(){this._events=new M,this._eventsCount=0}R.prototype.eventNames=function(){var C=[],k,A;if(this._eventsCount===0)return C;for(A in k=this._events)$.call(k,A)&&C.push(O?A.slice(1):A);return Object.getOwnPropertySymbols?C.concat(Object.getOwnPropertySymbols(k)):C},R.prototype.listeners=function(C){var k=O?O+C:C,A=this._events[k];if(!A)return[];if(A.fn)return[A.fn];for(var _=0,E=A.length,u=new Array(E);_<E;_++)u[_]=A[_].fn;return u},R.prototype.listenerCount=function(C){var k=O?O+C:C,A=this._events[k];return A?A.fn?1:A.length:0},R.prototype.emit=function(C,k,A,_,E,u){var o=O?O+C:C;if(!this._events[o])return!1;var s=this._events[o],d=arguments.length,w,m;if(s.fn){s.once&&this.removeListener(C,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,k),!0;case 3:return s.fn.call(s.context,k,A),!0;case 4:return s.fn.call(s.context,k,A,_),!0;case 5:return s.fn.call(s.context,k,A,_,E),!0;case 6:return s.fn.call(s.context,k,A,_,E,u),!0}for(m=1,w=new Array(d-1);m<d;m++)w[m-1]=arguments[m];s.fn.apply(s.context,w)}else{var g=s.length,L;for(m=0;m<g;m++){s[m].once&&this.removeListener(C,s[m].fn,void 0,!0);switch(d){case 1:s[m].fn.call(s[m].context);break;case 2:s[m].fn.call(s[m].context,k);break;case 3:s[m].fn.call(s[m].context,k,A);break;case 4:s[m].fn.call(s[m].context,k,A,_);break;default:if(!w)for(L=1,w=new Array(d-1);L<d;L++)w[L-1]=arguments[L];s[m].fn.apply(s[m].context,w)}}}return!0},R.prototype.on=function(C,k,A){return W(this,C,k,A,!1)},R.prototype.once=function(C,k,A){return W(this,C,k,A,!0)},R.prototype.removeListener=function(C,k,A,_){var E=O?O+C:C;if(!this._events[E])return this;if(!k)return U(this,E),this;var u=this._events[E];if(u.fn)u.fn===k&&(!_||u.once)&&(!A||u.context===A)&&U(this,E);else{for(var o=0,s=[],d=u.length;o<d;o++)(u[o].fn!==k||_&&!u[o].once||A&&u[o].context!==A)&&s.push(u[o]);s.length?this._events[E]=s.length===1?s[0]:s:U(this,E)}return this},R.prototype.removeAllListeners=function(C){var k;return C?(k=O?O+C:C,this._events[k]&&U(this,k)):(this._events=new M,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=O,R.EventEmitter=R,se.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(se,J,D){(function($){var O=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,z=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,U={buildAbsoluteURL:function(R,y,C){if(C=C||{},R=R.trim(),y=y.trim(),!y){if(!C.alwaysNormalize)return R;var k=U.parseURL(R);if(!k)throw new Error("Error trying to parse base URL.");return k.path=U.normalizePath(k.path),U.buildURLFromParts(k)}var A=U.parseURL(y);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return C.alwaysNormalize?(A.path=U.normalizePath(A.path),U.buildURLFromParts(A)):y;var _=U.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");if(!_.netLoc&&_.path&&_.path[0]!=="/"){var E=M.exec(_.path);_.netLoc=E[1],_.path=E[2]}_.netLoc&&!_.path&&(_.path="/");var u={scheme:_.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(u.netLoc=_.netLoc,A.path[0]!=="/"))if(!A.path)u.path=_.path,A.params||(u.params=_.params,A.query||(u.query=_.query));else{var o=_.path,s=o.substring(0,o.lastIndexOf("/")+1)+A.path;u.path=U.normalizePath(s)}return u.path===null&&(u.path=C.alwaysNormalize?U.normalizePath(A.path):A.path),U.buildURLFromParts(u)},parseURL:function(R){var y=O.exec(R);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(z,"");R.length!==(R=R.replace(W,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};se.exports=U})(this)},"./node_modules/webworkify-webpack/index.js":function(se,J,D){function $(C){var k={};function A(E){if(k[E])return k[E].exports;var u=k[E]={i:E,l:!1,exports:{}};return C[E].call(u.exports,u,u.exports,A),u.l=!0,u.exports}A.m=C,A.c=k,A.i=function(E){return E},A.d=function(E,u,o){A.o(E,u)||Object.defineProperty(E,u,{configurable:!1,enumerable:!0,get:o})},A.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},A.n=function(E){var u=E&&E.__esModule?function(){return E.default}:function(){return E};return A.d(u,"a",u),u},A.o=function(E,u){return Object.prototype.hasOwnProperty.call(E,u)},A.p="/",A.oe=function(E){throw console.error(E),E};var _=A(A.s=ENTRY_MODULE);return _.default||_}var O="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+O+").*?\\)";function z(C){return(C+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(C){return!isNaN(1*C)}function U(C,k,A){var _={};_[A]=[];var E=k.toString(),u=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return _;for(var o=u[1],s=new RegExp("(\\\\n|\\W)"+z(o)+M,"g"),d;d=s.exec(E);){if(d[3]==="dll-reference")continue;_[A].push(d[3])}for(s=new RegExp("\\("+z(o)+'\\("(dll-reference\\s('+O+'))"\\)\\)'+M,"g");d=s.exec(E);)C[d[2]]||(_[A].push(d[1]),C[d[2]]=D(d[1]).m),_[d[2]]=_[d[2]]||[],_[d[2]].push(d[4]);for(var w=Object.keys(_),m=0;m<w.length;m++)for(var g=0;g<_[w[m]].length;g++)W(_[w[m]][g])&&(_[w[m]][g]=1*_[w[m]][g]);return _}function R(C){var k=Object.keys(C);return k.reduce(function(A,_){return A||C[_].length>0},!1)}function y(C,k){for(var A={main:[k]},_={main:[]},E={main:{}};R(A);)for(var u=Object.keys(A),o=0;o<u.length;o++){var s=u[o],d=A[s],w=d.pop();if(E[s]=E[s]||{},E[s][w]||!C[s][w])continue;E[s][w]=!0,_[s]=_[s]||[],_[s].push(w);for(var m=U(C,C[s][w],s),g=Object.keys(m),L=0;L<g.length;L++)A[g[L]]=A[g[L]]||[],A[g[L]]=A[g[L]].concat(m[g[L]])}return _}se.exports=function(C,k){k=k||{};var A={main:D.m},_=k.all?{main:Object.keys(A.main)}:y(A,C),E="";Object.keys(_).filter(function(w){return w!=="main"}).forEach(function(w){for(var m=0;_[w][m];)m++;_[w].push(m),A[w][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+w+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+_[w].map(function(g){return""+JSON.stringify(g)+": "+A[w][g].toString()}).join(",")+`});
`}),E=E+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(C))+")({"+_.main.map(function(w){return""+JSON.stringify(w)+": "+A.main[w].toString()}).join(",")+"}))(self);";var u=new window.Blob([E],{type:"text/javascript"});if(k.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(u),d=new window.Worker(s);return d.objectURL=s,d}},"./src/config.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"hlsDefaultConfig",function(){return L}),D.d(J,"mergeConfig",function(){return c}),D.d(J,"enableStreamingMode",function(){return p});var $=D("./src/controller/abr-controller.ts"),O=D("./src/controller/audio-stream-controller.ts"),M=D("./src/controller/audio-track-controller.ts"),z=D("./src/controller/subtitle-stream-controller.ts"),W=D("./src/controller/subtitle-track-controller.ts"),U=D("./src/controller/buffer-controller.ts"),R=D("./src/controller/timeline-controller.ts"),y=D("./src/controller/cap-level-controller.ts"),C=D("./src/controller/fps-controller.ts"),k=D("./src/controller/eme-controller.ts"),A=D("./src/controller/cmcd-controller.ts"),_=D("./src/utils/xhr-loader.ts"),E=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(h){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var v in x)Object.prototype.hasOwnProperty.call(x,v)&&(h[v]=x[v])}return h},d.apply(this,arguments)}function w(h,a){var x=Object.keys(h);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(h);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(h,S).enumerable})),x.push.apply(x,v)}return x}function m(h){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?w(Object(x),!0).forEach(function(v){g(h,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(x)):w(Object(x)).forEach(function(v){Object.defineProperty(h,v,Object.getOwnPropertyDescriptor(x,v))})}return h}function g(h,a,x){return a in h?Object.defineProperty(h,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):h[a]=x,h}var L=m(m({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:_.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:U.default,capLevelController:y.default,fpsController:C.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},b()),{},{subtitleStreamController:z.SubtitleStreamController,subtitleTrackController:W.default,timelineController:R.TimelineController,audioStreamController:O.default,audioTrackController:M.default,emeController:k.default,cmcdController:A.default});function b(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function c(h,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},h,a)}function p(h){var a=h.loader;if(a!==E.default&&a!==_.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var x=Object(E.fetchSupported)();x&&(h.loader=E.default,h.progressive=!0,h.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/polyfills/number.ts"),O=D("./src/utils/ewma-bandwidth-estimator.ts"),M=D("./src/events.ts"),z=D("./src/utils/buffer-helper.ts"),W=D("./src/errors.ts"),U=D("./src/types/loader.ts"),R=D("./src/utils/logger.ts");function y(A,_){for(var E=0;E<_.length;E++){var u=_[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(A,u.key,u)}}function C(A,_,E){return _&&y(A.prototype,_),E&&y(A,E),A}var k=function(){function A(E){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=E;var u=E.config;this.bwEstimator=new O.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var _=A.prototype;return _.registerListeners=function(){var u=this.hls;u.on(M.Events.FRAG_LOADING,this.onFragLoading,this),u.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(M.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var u=this.hls;u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(M.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},_.onFragLoading=function(u,o){var s=o.frag;if(s.type===U.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},_.onLevelLoaded=function(u,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},_._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,w=s.config,m=s.media;if(!u||!m)return;var g=o?o.stats:u.stats,L=o?o.duration:u.duration;if(g.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||m.paused||!m.playbackRate||!m.readyState)return;var b=performance.now()-g.loading.start,c=Math.abs(m.playbackRate);if(b<=500*L/c)return;var p=s.levels,h=s.minAutoLevel,a=p[u.level],x=g.total||Math.max(g.loaded,Math.round(L*a.maxBitrate/8)),v=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/b),S=(x-g.loaded)/v,B=m.currentTime,F=(z.BufferHelper.bufferInfo(m,B,w.maxBufferHole).end-B)/c;if(F>=2*L/c||S<=F)return;var K=Number.POSITIVE_INFINITY,V;for(V=u.level-1;V>h;V--){var P=p[V].maxBitrate;if(K=L*P/(8*.8*v),K<F)break}if(K>=S)return;var I=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object($.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: `+F.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(b,g.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:g})},_.onFragLoaded=function(u,o){var s=o.frag,d=o.part;if(s.type===U.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(s.sn)){var w=d?d.stats:s.stats,m=d?d.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[s.level],L=(g.loaded?g.loaded.bytes:0)+w.loaded,b=(g.loaded?g.loaded.duration:0)+m;g.loaded={bytes:L,duration:b},g.realBitrate=Math.round(8*L/b)}if(s.bitrateTest){var c={stats:w,frag:s,part:d,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},_.onFragBuffered=function(u,o){var s=o.frag,d=o.part,w=d?d.stats:s.stats;if(w.aborted)return;if(s.type!==U.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var m=w.parsing.end-w.loading.start;this.bwEstimator.sample(m,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},_.onError=function(u,o){switch(o.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},_.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},_.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,w=s.config,m=s.minAutoLevel,g=s.media,L=o?o.duration:u?u.duration:0,b=g?g.currentTime:0,c=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,h=(z.BufferHelper.bufferInfo(g,b,w.maxBufferHole).end-b)/c,a=this.findBestLevel(p,m,d,h,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,v=w.abrBandWidthFactor,S=w.abrBandWidthUpFactor;if(!h){var B=this.bitrateTestDelay;if(B){var F=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;x=F-B,R.logger.trace("bitrate test took "+Math.round(1e3*B)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),v=S=1}}return a=this.findBestLevel(p,m,d,h+x,v,S),Math.max(a,0)},_.findBestLevel=function(u,o,s,d,w,m){for(var g,L=this.fragCurrent,b=this.partCurrent,c=this.lastLoadedFragLevel,p=this.hls.levels,h=p[c],a=!!(h!=null&&(g=h.details)!==null&&g!==void 0&&g.live),x=h==null?void 0:h.codecSet,v=b?b.duration:L?L.duration:0,S=s;S>=o;S--){var B=p[S];if(!B||x&&B.codecSet!==x)continue;var F=B.details,K=(b?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||v,V=void 0;S<=c?V=w*u:V=m*u;var P=p[S].maxBitrate,I=P*K/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(V)+"/"+P+"/"+K+"/"+d+"/"+I),V>P&&(!I||a&&!this.bitrateTestDelay||I<d))return S}return-1},C(A,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),A}();J.default=k},"./src/controller/audio-stream-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/polyfills/number.ts"),O=D("./src/controller/base-stream-controller.ts"),M=D("./src/events.ts"),z=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-tracker.ts"),U=D("./src/types/level.ts"),R=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),C=D("./src/demux/chunk-cache.ts"),k=D("./src/demux/transmuxer-interface.ts"),A=D("./src/types/transmuxer.ts"),_=D("./src/controller/fragment-finders.ts"),E=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(L[p]=c[p])}return L},s.apply(this,arguments)}function d(L,b){L.prototype=Object.create(b.prototype),L.prototype.constructor=L,w(L,b)}function w(L,b){return w=Object.setPrototypeOf||function(p,h){return p.__proto__=h,p},w(L,b)}var m=100,g=function(L){d(b,L);function b(p,h){var a;return a=L.call(this,p,h,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var c=b.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var h=this.hls;h.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(M.Events.ERROR,this.onError,this),h.on(M.Events.BUFFER_RESET,this.onBufferReset,this),h.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var h=this.hls;h.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(M.Events.ERROR,this.onError,this),h.off(M.Events.BUFFER_RESET,this.onBufferReset,this),h.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(h,a){var x=a.frag,v=a.id,S=a.initPTS;if(v==="main"){var B=x.cc;this.initPTS[x.cc]=S,this.log("InitPTS for cc: "+B+" found from main: "+S),this.videoTrackCC=B,this.state===O.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=O.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,a>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=O.State.IDLE):(this.loadedmetadata=!1,this.state=O.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},c.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_TRACK:{var h,a=this.levels,x=this.trackId,v=a==null||((h=a[x])===null||h===void 0)?void 0:h.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=O.State.WAITING_INIT_PTS}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var S,B=performance.now(),F=this.retryDate;(!F||B>=F||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=O.State.IDLE);break}case O.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,P=K.part,I=K.cache,Y=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.FRAG_LOADING;var ee=I.flush(),oe={frag:V,part:P,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),Y&&L.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var pe=this.getLoadPosition(),Oe=z.BufferHelper.bufferInfo(this.mediaBuffer,pe,this.config.maxBufferHole),xe=Object(_.fragmentWithinToleranceTest)(Oe.end,this.config.maxFragLookUpTolerance,V);xe<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=O.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.IDLE)},c.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:h,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},c.doTickIdle=function(){var h,a,x=this.hls,v=this.levels,S=this.media,B=this.trackId,F=x.config;if(!v||!v[B])return;if(!S&&(this.startFragRequested||!F.startFragPrefetch))return;var K=v[B],V=K.details;if(!V||V.live&&this.levelLastLoaded!==B||this.waitForCdnTuneIn(V)){this.state=O.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(P===null)return;var I=P.len,Y=this.getMaxBufferLength(),ee=this.audioSwitch;if(I>=Y&&!ee)return;if(!ee&&this._streamEnded(P,V)){x.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=O.State.ENDED;return}var oe=V.fragments,pe=oe[0].start,Oe=P.end;if(ee){var xe=this.getLoadPosition();Oe=xe,V.PTSKnown&&xe<pe&&((P.end>pe||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=pe+.05))}var _e=this.getNextFragment(Oe,V);if(!_e){this.bufferFlushed=!0;return}((h=_e.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((a=_e.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(_e,V):this.loadFragment(_e,V,Oe)},c.getMaxBufferLength=function(){var h=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?h:Math.max(h,a.len)},c.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(h,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(v){return new U.Level(v)})},c.onAudioTrackSwitching=function(h,a){var x=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(m):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=O.State.IDLE):this.state=O.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(h,a){this.mainDetails=a.details},c.onAudioTrackLoaded=function(h,a){var x,v=this.levels,S=a.details,B=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+B);return}this.log("Track "+B+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var F=v[B],K=0;if(S.live||(x=F.details)!==null&&x!==void 0&&x.live){var V=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!V)return;!F.details&&S.hasProgramDateTime&&V.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(S,V),K=S.fragments[0].start):K=this.alignPlaylists(S,F.details)}F.details=S,this.levelLastLoaded=B,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(F.details,K),this.state===O.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=O.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(h){var a,x=h.frag,v=h.part,S=h.payload,B=this.config,F=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var V=K[F];console.assert(V,"Audio track is defined on fragment load progress");var P=V.details;console.assert(P,"Audio track details are defined on fragment load progress");var I=B.defaultAudioCodec||V.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new k.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[x.cc],oe=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var pe=!1,Oe=v?v.index:-1,xe=Oe!==-1,_e=new A.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,S.byteLength,Oe,xe);Y.push(S,oe,I,"",x,v,P.totalduration,pe,_e,ee)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+F);var Te=this.waitingData=this.waitingData||{frag:x,part:v,cache:new C.default,complete:!1},Ce=Te.cache;Ce.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=O.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,h)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(h,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},c.onFragBuffered=function(h,a){var x=a.frag,v=a.part;if(x.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(v?" p: "+v.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,v)},c.onError=function(h,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==O.State.ERROR&&this.state!==O.State.STOPPED&&(this.state=a.fatal?O.State.ERROR:O.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var x=!0,v=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);v&&v.len>.5&&(x=!this.reduceMaxBufferLength(v.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(h,a){var x=a.type;x===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(h){var a,x="audio",v=this.hls,S=h.remuxResult,B=h.chunkMeta,F=this.getCurrentContext(B);if(!F){this.warn("The loading context changed while buffering fragment "+B.sn+" of level "+B.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(B.level);return}var K=F.frag,V=F.part,P=S.audio,I=S.text,Y=S.id3,ee=S.initSegment;if(this.fragContextChanged(K))return;if(this.state=O.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,B),v.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:x,tracks:ee.tracks})),P){var oe=P.startPTS,pe=P.endPTS,Oe=P.startDTS,xe=P.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:pe,startDTS:Oe,endDTS:xe}),K.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,oe,pe,Oe,xe),this.bufferFragmentData(P,K,V,B)}if(Y!=null&&(a=Y.samples)!==null&&a!==void 0&&a.length){var _e=s({frag:K,id:x},Y);v.trigger(M.Events.FRAG_PARSING_METADATA,_e)}if(I){var Te=s({frag:K,id:x},I);v.trigger(M.Events.FRAG_PARSING_USERDATA,Te)}},c._bufferInitSegment=function(h,a,x){if(this.state!==O.State.PARSING)return;h.video&&delete h.video;var v=h.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,h);var S=v.initSegment;if(S!=null&&S.byteLength){var B={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:S};this.hls.trigger(M.Events.BUFFER_APPENDING,B)}this.tick()},c.loadFragment=function(h,a,x){var v=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||v===W.FragmentState.NOT_LOADED||v===W.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):a.live&&!Object($.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=O.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,h,a,x)))},c.completeAudioSwitch=function(){var h=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:x})},b}(O.default);J.default=g},"./src/controller/audio-track-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/events.ts"),O=D("./src/errors.ts"),M=D("./src/controller/base-playlist-controller.ts"),z=D("./src/types/loader.ts");function W(k,A){for(var _=0;_<A.length;_++){var E=A[_];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(k,E.key,E)}}function U(k,A,_){return A&&W(k.prototype,A),_&&W(k,_),k}function R(k,A){k.prototype=Object.create(A.prototype),k.prototype.constructor=k,y(k,A)}function y(k,A){return y=Object.setPrototypeOf||function(E,u){return E.__proto__=u,E},y(k,A)}var C=function(k){R(A,k);function A(E){var u;return u=k.call(this,E,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var _=A.prototype;return _.registerListeners=function(){var u=this.hls;u.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on($.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var u=this.hls;u.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off($.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,k.prototype.destroy.call(this)},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},_.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},_.onAudioTrackLoaded=function(u,o){var s=o.id,d=o.details,w=this.tracksInGroup[s];if(!w){this.warn("Invalid audio track id "+s);return}var m=w.details;w.details=o.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,m))},_.onLevelLoading=function(u,o){this.switchLevel(o.level)},_.onLevelSwitching=function(u,o){this.switchLevel(o.level)},_.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var d=this.tracks.filter(function(m){return!s||m.groupId===s});this.selectDefaultTrack&&!d.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var w={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},_.onError=function(u,o){if(k.prototype.onError.call(this,u,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)},_.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+u);var d=o[u],w=d.id,m=d.groupId,g=m===void 0?"":m,L=d.name,b=d.type,c=d.url;if(this.trackId=u,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:g,name:L,type:b,url:c}),d.details&&!d.details.live)return;var p=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(p)},_.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},_.findTrackId=function(u){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var d=o[s];if((!this.selectDefaultTrack||d.default)&&(!u||u===d.name))return d.id}return-1},_.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,d=o.groupId,w=o.url;if(u)try{w=u.addDirectives(w)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:w,id:s,groupId:d,deliveryDirectives:u||null})}},U(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),A}(M.default);J.default=C},"./src/controller/base-playlist-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return U});var $=D("./src/polyfills/number.ts"),O=D("./src/types/level.ts"),M=D("./src/controller/level-helper.ts"),z=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),U=function(){function R(C,k){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,k+":"),this.warn=z.logger.warn.bind(z.logger,k+":"),this.hls=C}var y=R.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(k,A){A.fatal&&A.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(k,A){var _=A==null?void 0:A.renditionReports;if(_)for(var E=0;E<_.length;E++){var u=_[E],o=""+u.URI;if(o===k.substr(-o.length)){var s=parseInt(u["LAST-MSN"]),d=parseInt(u["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var w=Math.min(A.age-A.partTarget,A.targetduration);d!==void 0&&w>A.partTarget&&(d+=1)}if(Object($.isFiniteNumber)(s))return new O.HlsUrlParameters(s,Object($.isFiniteNumber)(d)?d:void 0,O.HlsSkip.No)}}},y.loadPlaylist=function(k){},y.shouldLoadTrack=function(k){return this.canLoad&&k&&!!k.url&&(!k.details||k.details.live)},y.playlistLoaded=function(k,A,_){var E=this,u=A.details,o=A.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||_!=null&&_.live){if(u.reloaded(_),_&&this.log("live playlist "+k+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),_&&u.fragments.length>0&&Object(M.mergeDetails)(_,u),!this.canLoad||!u.live)return;var d,w=void 0,m=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var g=this.hls.config.lowLatencyMode,L=u.lastPartSn,b=u.endSN,c=u.lastPartIndex,p=c!==-1,h=L===b,a=g?0:c;p?(w=h?b+1:L,m=h?a:c+1):w=b+1;var x=u.age,v=x+u.ageHeader,S=Math.min(v-u.partTarget,u.targetduration*1.5);if(S>0){if(_&&S>_.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+_.tuneInGoal+" to: "+S+" with playlist age: "+u.age),S=0;else{var B=Math.floor(S/u.targetduration);if(w+=B,m!==void 0){var F=Math.round(S%u.targetduration/u.partTarget);m+=F}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+S+" skip sn "+B+" to part "+m)}u.tuneInGoal=S}if(d=this.getDeliveryDirectives(u,A.deliveryDirectives,w,m),g||!h){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(u,A.deliveryDirectives,w,m);var K=Object(M.computeReloadInterval)(u,o);w!==void 0&&u.canBlockReload&&(K-=u.partTarget||1),this.log("reload live playlist "+k+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},K)}else this.clearTimer()},y.getDeliveryDirectives=function(k,A,_,E){var u=Object(O.getSkipValue)(k,_);return A!=null&&A.skip&&k.deltaUpdateFailed&&(_=A.msn,E=A.part,u=O.HlsSkip.No),new O.HlsUrlParameters(_,E,u)},y.retryLoadingOrFail=function(k){var A=this,_=this.hls.config,E=this.retryCount<_.levelLoadingMaxRetry;if(E){var u;if(this.retryCount++,k.details.indexOf("LoadTimeOut")>-1&&(u=k.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+k.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*_.levelLoadingRetryDelay,_.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+k.details+'"')}}else this.warn('cannot recover from error "'+k.details+'"'),this.clearTimer(),k.fatal=!0;return E},R}()},"./src/controller/base-stream-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"State",function(){return b}),D.d(J,"default",function(){return c});var $=D("./src/polyfills/number.ts"),O=D("./src/task-loop.ts"),M=D("./src/controller/fragment-tracker.ts"),z=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts"),U=D("./src/events.ts"),R=D("./src/errors.ts"),y=D("./src/types/transmuxer.ts"),C=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/discontinuities.ts"),A=D("./src/controller/fragment-finders.ts"),_=D("./src/controller/level-helper.ts"),E=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function d(p,h){for(var a=0;a<h.length;a++){var x=h[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(p,x.key,x)}}function w(p,h,a){return h&&d(p.prototype,h),a&&d(p,a),p}function m(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function g(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,L(p,h)}function L(p,h){return L=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},L(p,h)}var b={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"},c=function(p){g(h,p);function h(x,v,S){var B;return B=p.call(this)||this,B.hls=void 0,B.fragPrevious=null,B.fragCurrent=null,B.fragmentTracker=void 0,B.transmuxer=null,B._state=b.STOPPED,B.media=void 0,B.mediaBuffer=void 0,B.config=void 0,B.bitrateTest=!1,B.lastCurrentTime=0,B.nextLoadPosition=0,B.startPosition=0,B.loadedmetadata=!1,B.fragLoadError=0,B.retryDate=0,B.levels=null,B.fragmentLoader=void 0,B.levelLastLoaded=null,B.startFragRequested=!1,B.decrypter=void 0,B.initPTS=[],B.onvseeking=null,B.onvended=null,B.logPrefix="",B.log=void 0,B.warn=void 0,B.logPrefix=S,B.log=W.logger.log.bind(W.logger,S+":"),B.warn=W.logger.warn.bind(W.logger,S+":"),B.hls=x,B.fragmentLoader=new E.default(x.config),B.fragmentTracker=v,B.config=x.config,B.decrypter=new u.default(x,x.config),x.on(U.Events.KEY_LOADED,B.onKeyLoaded,m(B)),B}var a=h.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(v){},a.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(v,S){var B=this.fragCurrent,F=this.fragmentTracker;if(!S.live&&B&&B.sn===S.endSN&&!v.nextStart){var K=F.getState(B);return K===M.FragmentState.PARTIAL||K===M.FragmentState.OK}return!1},a.onMediaAttached=function(v,S){var B=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),B.addEventListener("seeking",this.onvseeking),B.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.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 v=this.config,S=this.fragCurrent,B=this.media,F=this.mediaBuffer,K=this.state,V=B?B.currentTime:0,P=z.BufferHelper.bufferInfo(F||B,V,v.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===b.ENDED)this.resetLoadingState();else if(S&&!P.len){var I=v.maxFragLookUpTolerance,Y=S.start-I,ee=S.start+S.duration+I,oe=V>ee;(V<Y||oe)&&(oe&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}B&&(this.lastCurrentTime=V),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(v,S){if(this.state!==b.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var B=this.levels[S.frag.level].details;B&&this.loadFragment(S.frag,B,S.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(U.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(v,S){this.log("Loading key for "+v.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=b.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(U.Events.KEY_LOADING,{frag:v})},a.loadFragment=function(v,S,B){this._loadFragForPlayback(v,S,B)},a._loadFragForPlayback=function(v,S,B){var F=this,K=function(P){if(F.fragContextChanged(v)){F.warn("Fragment "+v.sn+(P.part?" p: "+P.part.index:"")+" of level "+v.level+" was dropped during download."),F.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,F._handleFragmentLoadProgress(P)};this._doFragLoad(v,S,B,K).then(function(V){if(!V)return;F.fragLoadError=0;var P=F.state;if(F.fragContextChanged(v)){(P===b.FRAG_LOADING||P===b.BACKTRACKING||!F.fragCurrent&&P===b.PARSING)&&(F.fragmentTracker.removeFragment(v),F.state=b.IDLE);return}if("payload"in V&&(F.log("Loaded fragment "+v.sn+" of level "+v.level),F.hls.trigger(U.Events.FRAG_LOADED,V),F.state===b.BACKTRACKING)){F.fragmentTracker.backtrack(v,V),F.resetFragmentLoading(v);return}F._handleFragmentLoadComplete(V)}).catch(function(V){F.warn(V),F.resetFragmentLoading(v)})},a.flushMainBuffer=function(v,S,B){if(B===void 0&&(B=null),!(v-S))return;var F={startOffset:v,endOffset:S,type:B};this.fragLoadError=0,this.hls.trigger(U.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(v){var S=this;this._doFragLoad(v).then(function(B){if(!B||S.fragContextChanged(v)||!S.levels)throw new Error("init load aborted");return B}).then(function(B){var F=S.hls,K=B.payload,V=v.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var P=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(I){var Y=self.performance.now();return F.trigger(U.Events.FRAG_DECRYPTED,{frag:v,payload:I,stats:{tstart:P,tdecrypt:Y}}),B.payload=I,B})}return B}).then(function(B){var F=S.fragCurrent,K=S.hls,V=S.levels;if(!V)throw new Error("init load aborted, missing levels");var P=V[v.level].details;console.assert(P,"Level details are defined when init segment is loaded");var I=v.stats;S.state=b.IDLE,S.fragLoadError=0,v.data=new Uint8Array(B.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),B.frag===F&&K.trigger(U.Events.FRAG_BUFFERED,{stats:I,frag:F,part:null,id:v.type}),S.tick()}).catch(function(B){S.warn(B),S.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var S=this.fragCurrent;return!v||!S||v.level!==S.level||v.sn!==S.sn||v.urlId!==S.urlId},a.fragBufferedComplete=function(v,S){var B=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(z.BufferHelper.getBuffered(B))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var S=this.transmuxer;if(!S)return;var B=v.frag,F=v.part,K=v.partsLoaded,V=!K||K.length===0||K.some(function(I){return!I}),P=new y.ChunkMetadata(B.level,B.sn,B.stats.chunkCount+1,0,F?F.index:-1,!V);S.flush(P)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,S,B,F){var K=this;if(B===void 0&&(B=null),!this.levels)throw new Error("frag load aborted, missing levels");if(B=Math.max(v.start,B||0),this.config.lowLatencyMode&&S){var V=S.partList;if(V&&F){B>v.end&&S.fragmentHint&&(v=S.fragmentHint);var P=this.getNextPart(V,v,B);if(P>-1){var I=V[P];return this.log("Loading part sn: "+v.sn+" p: "+I.index+" cc: "+v.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+P+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(B.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=b.FRAG_LOADING,this.hls.trigger(U.Events.FRAG_LOADING,{frag:v,part:V[P],targetBufferTime:B}),this.doFragPartsLoad(v,V,P,F).catch(function(Y){return K.handleFragLoadError(Y)})}else if(!v.url||this.loadedEndOfParts(V,B))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(B.toFixed(3))),Object($.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=b.FRAG_LOADING,this.hls.trigger(U.Events.FRAG_LOADING,{frag:v,targetBufferTime:B}),this.fragmentLoader.load(v,F).catch(function(Y){return K.handleFragLoadError(Y)})},a.doFragPartsLoad=function(v,S,B,F){var K=this;return new Promise(function(V,P){var I=[],Y=function ee(oe){var pe=S[oe];K.fragmentLoader.loadPart(v,pe,F).then(function(Oe){I[pe.index]=Oe;var xe=Oe.part;K.hls.trigger(U.Events.FRAG_LOADED,Oe);var _e=S[oe+1];if(_e&&_e.fragment===v)ee(oe+1);else return V({frag:v,part:xe,partsLoaded:I})}).catch(P)};Y(B)})},a.handleFragLoadError=function(v){var S=v.data;return S&&S.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(U.Events.ERROR,S),null},a._handleTransmuxerFlush=function(v){var S=this.getCurrentContext(v);if(!S||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var B=S.frag,F=S.part,K=S.level,V=self.performance.now();B.stats.parsing.end=V,F&&(F.stats.parsing.end=V),this.updateLevelTiming(B,F,K,v.partial)},a.getCurrentContext=function(v){var S=this.levels,B=v.level,F=v.sn,K=v.part;if(!S||!S[B])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+B+". The current chunk will not be buffered."),null;var V=S[B],P=K>-1?Object(_.getPartWith)(V,F,K):null,I=P?P.fragment:Object(_.getFragmentWithSN)(V,F,this.fragCurrent);return I?{frag:I,part:P,level:V}:null},a.bufferFragmentData=function(v,S,B,F){if(!v||this.state!==b.PARSING)return;var K=v.data1,V=v.data2,P=K;if(K&&V&&(P=Object(C.appendUint8Array)(K,V)),!P||!P.length)return;var I={type:v.type,frag:S,part:B,chunkMeta:F,parent:S.type,data:P};this.hls.trigger(U.Events.BUFFER_APPENDING,I),v.dropped&&v.independent&&!B&&this.flushBufferGap(S)},a.flushBufferGap=function(v){var S=this.media;if(!S)return;if(!z.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,v.start);return}var B=S.currentTime,F=z.BufferHelper.bufferInfo(S,B,0),K=v.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),P=Math.max(Math.min(v.start-V,F.end-V),B+V);v.start-P>V&&this.flushMainBuffer(P,v.start)},a.getFwdBufferInfo=function(v,S){var B=this.config,F=this.getLoadPosition();if(!Object($.isFiniteNumber)(F))return null;var K=z.BufferHelper.bufferInfo(v,F,B.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(F,S);if(V&&K.nextStart<V.end)return z.BufferHelper.bufferInfo(v,F,Math.max(K.nextStart,B.maxBufferHole))}return K},a.getMaxBufferLength=function(v){var S=this.config,B;return v?B=Math.max(8*S.maxBufferSize/v,S.maxBufferLength):B=S.maxBufferLength,Math.min(B,S.maxMaxBufferLength)},a.reduceMaxBufferLength=function(v){var S=this.config,B=v||S.maxBufferLength;return S.maxMaxBufferLength>=B?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,S){var B,F,K=S.fragments,V=K.length;if(!V)return null;var P=this.config,I=K[0].start,Y;if(S.live){var ee=P.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(S,K),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:v)}else v<=I&&(Y=K[0]);if(!Y){var oe=P.lowLatencyMode?S.partEnd:S.fragmentEnd;Y=this.getFragmentAtPosition(v,oe,S)}return(B=Y)!==null&&B!==void 0&&B.initSegment&&!((F=Y)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},a.getNextPart=function(v,S,B){for(var F=-1,K=!1,V=!0,P=0,I=v.length;P<I;P++){var Y=v[P];if(V=V&&!Y.independent,F>-1&&B<Y.start)break;var ee=Y.loaded;!ee&&(K||Y.independent||V)&&Y.fragment===S&&(F=P),K=ee}return F},a.loadedEndOfParts=function(v,S){var B=v[v.length-1];return B&&S>B.start&&B.loaded},a.getInitialLiveFragment=function(v,S){var B=this.fragPrevious,F=null;if(B){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+B.programDateTime),F=Object(A.findFragmentByPDT)(S,B.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var K=B.sn+1;if(K>=v.startSN&&K<=v.endSN){var V=S[K-v.startSN];B.cc===V.cc&&(F=V,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(A.findFragWithCC)(S,B.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(F=this.getFragmentAtPosition(P,this.bitrateTest?v.fragmentEnd:v.edge,v))}return F},a.getFragmentAtPosition=function(v,S,B){var F=this.config,K=this.fragPrevious,V=B.fragments,P=B.endSN,I=B.fragmentHint,Y=F.maxFragLookUpTolerance,ee=!!(F.lowLatencyMode&&B.partList&&I);ee&&I&&!this.bitrateTest&&(V=V.concat(I),P=I.sn);var oe;if(v<S){var pe=v>S-Y?0:Y;oe=Object(A.findFragmentByPTS)(K,V,v,pe)}else oe=V[V.length-1];if(oe){var Oe=oe.sn-B.startSN,xe=K&&oe.level===K.level,_e=V[Oe+1],Te=this.fragmentTracker.getState(oe);if(Te===M.FragmentState.BACKTRACKED){oe=null;for(var Ce=Oe;V[Ce]&&this.fragmentTracker.getState(V[Ce])===M.FragmentState.BACKTRACKED;)K?oe=V[Ce--]:oe=V[--Ce];oe||(oe=_e)}else K&&oe.sn===K.sn&&!ee&&(xe&&(oe.sn<P&&this.fragmentTracker.getState(_e)!==M.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+_e.sn),oe=_e):oe=null))}return oe},a.synchronizeToLiveEdge=function(v){var S=this.config,B=this.media;if(!B)return;var F=this.hls.liveSyncPosition,K=B.currentTime,V=v.fragments[0].start,P=v.edge,I=K>=V-S.maxFragLookUpTolerance&&K<=P;if(F!==null&&B.duration>F&&(K<F||!I)){var Y=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*v.targetduration;(!I&&B.readyState<4||K<P-Y)&&(this.loadedmetadata||(this.nextLoadPosition=F),B.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+F.toFixed(3)),B.currentTime=F))}},a.alignPlaylists=function(v,S){var B=this.levels,F=this.levelLastLoaded,K=this.fragPrevious,V=F!==null?B[F]:null,P=v.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var I=v.fragments[0].start,Y=!S,ee=v.alignedSliding&&Object($.isFiniteNumber)(I);if(Y||!ee&&!I){Object(k.alignStream)(K,V,v);var oe=v.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+v.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+P),oe}return I},a.waitForCdnTuneIn=function(v){var S=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*S)},a.setStartPosition=function(v,S){var B=this.startPosition;if(B<S&&(B=-1),B===-1||this.lastCurrentTime===-1){var F=v.startTimeOffset;Object($.isFiniteNumber)(F)?(B=S+F,F<0&&(B+=v.totalduration),B=Math.min(Math.max(S,B),S+v.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+B),this.startPosition=B):v.live?B=this.hls.liveSyncPosition||S:this.startPosition=B=0,this.lastCurrentTime=B}this.nextLoadPosition=B},a.getLoadPosition=function(){var v=this.media,S=0;return this.loadedmetadata&&v?S=v.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},a.handleFragLoadAborted=function(v,S){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(S?" part"+S.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},a.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(v,S){if(S.fatal)return;var B=S.frag;if(!B||B.type!==v)return;var F=this.fragCurrent;console.assert(F&&B.sn===F.sn&&B.level===F.level&&B.urlId===F.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(B.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+B.sn+" of "+v+" "+B.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(v===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(W.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(v,S,B){if(!v)return;var F=z.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(S,F,B),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[v].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(v,S,B,F){var K=this,V=B.details;console.assert(!!V,"level.details must be defined");var P=Object.keys(v.elementaryStreams).reduce(function(I,Y){var ee=v.elementaryStreams[Y];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+v.sn+" "+Y+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),I||!1;var pe=F?0:Object(_.updateFragPTSDTS)(V,v,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(U.Events.LEVEL_PTS_UPDATED,{details:V,level:B,drift:pe,type:Y,frag:v,start:ee.startPTS,end:ee.endPTS}),!0}return I},!1);P?(this.state=b.PARSED,this.hls.trigger(U.Events.FRAG_PARSED,{frag:v,part:S})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(h,[{key:"state",get:function(){return this._state},set:function(v){var S=this._state;S!==v&&(this._state=v,this.log(S+"->"+v))}}]),h}(O.default)},"./src/controller/buffer-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return A});var $=D("./src/polyfills/number.ts"),O=D("./src/events.ts"),M=D("./src/utils/logger.ts"),z=D("./src/errors.ts"),W=D("./src/utils/buffer-helper.ts"),U=D("./src/utils/mediasource-helper.ts"),R=D("./src/loader/fragment.ts"),y=D("./src/controller/buffer-operation-queue.ts"),C=Object(U.getMediaSource)(),k=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function _(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,d=o.media,w=o.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(O.Events.MEDIA_ATTACHED,{media:d})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var E=_.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var o=this.hls;o.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(O.Events.BUFFER_RESET,this.onBufferReset,this),o.on(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(O.Events.BUFFER_EOS,this.onBufferEos,this),o.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(O.Events.FRAG_PARSED,this.onFragParsed,this),o.on(O.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var o=this.hls;o.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(O.Events.BUFFER_RESET,this.onBufferReset,this),o.off(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(O.Events.BUFFER_EOS,this.onBufferEos,this),o.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(O.Events.FRAG_PARSED,this.onFragParsed,this),o.off(O.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&C){var w=this.mediaSource=new C;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(w),this._objectUrl=d.src}},E.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(w){M.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):M.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(O.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var d=o.sourceBuffer[s];try{d&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[s]=void 0)}catch(w){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",w)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,s){var d=this,w=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(m){if(w){var g=d.tracks[m];if(g&&typeof g.buffer.changeType=="function"){var L=s[m],b=L.codec,c=L.levelCodec,p=L.container,h=(g.levelCodec||g.codec).replace(k,"$1"),a=(c||b).replace(k,"$1");if(h!==a){var x=p+";codecs="+(c||b);d.appendChangeType(m,x)}}}else d.pendingTracks[m]=s[m]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,s){var d=this,w=this.operationQueue,m={execute:function(){var L=d.sourceBuffer[o];L&&(M.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),L.changeType(s)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){M.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};w.append(m,o)},E.onBufferAppending=function(o,s){var d=this,w=this.hls,m=this.operationQueue,g=this.tracks,L=s.data,b=s.type,c=s.frag,p=s.part,h=s.chunkMeta,a=h.buffering[b],x=self.performance.now();a.start=x;var v=c.stats.buffering,S=p?p.stats.buffering:null;v.start===0&&(v.start=x),S&&S.start===0&&(S.start=x);var B=g.audio,F=b==="audio"&&h.id===1&&(B==null?void 0:B.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),F){var P=d.sourceBuffer[b];if(P){var I=c.start-P.timestampOffset;Math.abs(I)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+I+") sn: "+c.sn+")"),P.timestampOffset=c.start)}}d.appendExecutor(L,b)},onStart:function(){},onComplete:function(){var P=self.performance.now();a.executeEnd=a.end=P,v.first===0&&(v.first=P),S&&S.first===0&&(S.first=P);var I=d.sourceBuffer,Y={};for(var ee in I)Y[ee]=W.BufferHelper.getBuffered(I[ee]);d.appendError=0,d.hls.trigger(O.Events.BUFFER_APPENDED,{type:b,frag:c,part:p,chunkMeta:h,parent:c.type,timeRanges:Y})},onError:function(P){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",P);var I={type:z.ErrorTypes.MEDIA_ERROR,parent:c.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=z.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,I.details=z.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>w.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),w.trigger(O.Events.ERROR,I)}};m.append(K,b)},E.onBufferFlushing=function(o,s){var d=this,w=this.operationQueue,m=function(L){return{execute:d.removeExecutor.bind(d,L,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(O.Events.BUFFER_FLUSHED,{type:L})},onError:function(c){M.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",c)}}};s.type?w.append(m(s.type),s.type):this.getSourceBufferTypes().forEach(function(g){w.append(m(g),g)})},E.onFragParsed=function(o,s){var d=this,w=s.frag,m=s.part,g=[],L=m?m.elementaryStreams:w.elementaryStreams;L[R.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(L[R.ElementaryStreamTypes.AUDIO]&&g.push("audio"),L[R.ElementaryStreamTypes.VIDEO]&&g.push("video"));var b=function(){var p=self.performance.now();w.stats.buffering.end=p,m&&(m.stats.buffering.end=p);var h=m?m.stats:w.stats;d.hls.trigger(O.Events.FRAG_BUFFERED,{frag:w,part:m,stats:h,id:w.type})};g.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(b,g)},E.onFragChanged=function(o,s){this.flushBackBuffer()},E.onBufferEos=function(o,s){var d=this,w=this.getSourceBufferTypes().reduce(function(m,g){var L=d.sourceBuffer[g];return(!s.type||s.type===g)&&(L&&!L.ended&&(L.ended=!0,M.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),m&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var m=d.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},E.onLevelUpdated=function(o,s){var d=s.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var o=this.hls,s=this.details,d=this.media,w=this.sourceBuffer;if(!d||s===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var g=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object($.isFiniteNumber)(g)||g<0)return;var L=d.currentTime,b=s.levelTargetDuration,c=Math.max(g,b),p=Math.floor(L/b)*b-c;m.forEach(function(h){var a=w[h];if(a){var x=W.BufferHelper.getBuffered(a);x.length>0&&p>x.start(0)&&(o.trigger(O.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),s.live&&o.trigger(O.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),o.trigger(O.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:h}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,d=this.media,w=this.mediaSource,m=o.fragments[0].start+o.totalduration,g=d.duration,L=Object($.isFiniteNumber)(w.duration)?w.duration:0;o.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(m>L&&m>g||!Object($.isFiniteNumber)(g))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),w.duration=m)},E.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,w=d.length;if(w&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var m=Math.max(0,d[0].start),g=Math.max(m,m+o.totalduration);s.setLiveSeekableRange(m,g)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,w=Object.keys(d).length;if(w&&!o||w===2){this.createSourceBuffers(d),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(O.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}m.forEach(function(g){s.executeNext(g)})}},E.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var m in o)if(!s[m]){var g=o[m];if(!g)throw Error("source buffer exists for track "+m+", however track does not");var L=g.levelCodec||g.codec,b=g.container+";codecs="+L;M.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var c=s[m]=d.addSourceBuffer(b),p=m;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[m]={buffer:c,codec:L,container:g.container,levelCodec:g.levelCodec,id:g.id},w++}catch(h){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(O.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:b})}}w&&this.hls.trigger(O.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var s=this.operationQueue,d=s.current(o);d.onStart()},E._onSBUpdateEnd=function(o){var s=this.operationQueue,d=s.current(o);d.onComplete(),s.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,s){M.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(O.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(s)},E.removeExecutor=function(o,s,d){var w=this.media,m=this.mediaSource,g=this.operationQueue,L=this.sourceBuffer,b=L[o];if(!w||!m||!b){M.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(o);return}var c=Object($.isFiniteNumber)(w.duration)?w.duration:Infinity,p=Object($.isFiniteNumber)(m.duration)?m.duration:Infinity,h=Math.max(0,s),a=Math.min(d,c,p);a>h?(M.logger.log("[buffer-controller]: Removing ["+h+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(h,a)):g.shiftAndExecuteNext(o)},E.appendExecutor=function(o,s){var d=this.operationQueue,w=this.sourceBuffer,m=w[s];if(!m){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}m.ended=!1,console.assert(!m.updating,s+" sourceBuffer must not be updating"),m.appendBuffer(o)},E.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,m=s.map(function(g){return w.appendBlocker(g)});Promise.all(m).then(function(){o(),s.forEach(function(g){var L=d.sourceBuffer[g];(!L||!L.updating)&&w.shiftAndExecuteNext(g)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,s,d){var w=this.sourceBuffer[o];if(!w)return;var m=d.bind(this,o);this.listeners[o].push({event:s,listener:m}),w.addEventListener(s,m)},E.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},_}()},"./src/controller/buffer-operation-queue.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return O});var $=D("./src/utils/logger.ts"),O=function(){function M(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var z=M.prototype;return z.append=function(U,R){var y=this.queues[R];y.push(U),y.length===1&&this.buffers[R]&&this.executeNext(R)},z.insertAbort=function(U,R){var y=this.queues[R];y.unshift(U),this.executeNext(R)},z.appendBlocker=function(U){var R,y=new Promise(function(k){R=k}),C={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(C,U),y},z.executeNext=function(U){var R=this.buffers,y=this.queues,C=R[U],k=y[U];if(k.length){var A=k[0];try{A.execute()}catch(_){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(_),(!C||!C.updating)&&(k.shift(),this.executeNext(U))}}},z.shiftAndExecuteNext=function(U){this.queues[U].shift(),this.executeNext(U)},z.current=function(U){return this.queues[U][0]},M}()},"./src/controller/cap-level-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/events.ts");function O(W,U){for(var R=0;R<U.length;R++){var y=U[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(W,y.key,y)}}function M(W,U,R){return U&&O(W.prototype,U),R&&O(W,R),W}var z=function(){function W(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var U=W.prototype;return U.setStreamController=function(y){this.streamController=y},U.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},U.registerListeners=function(){var y=this.hls;y.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},U.unregisterListener=function(){var y=this.hls;y.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},U.onFpsDropLevelCapping=function(y,C){W.isLevelAllowed(C.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(C.droppedLevel)},U.onMediaAttaching=function(y,C){this.media=C.media instanceof HTMLVideoElement?C.media:null},U.onManifestParsed=function(y,C){var k=this.hls;this.restrictedLevels=[],this.firstLevel=C.firstLevel,k.config.capLevelToPlayerSize&&C.video&&this.startCapping()},U.onBufferCodecs=function(y,C){var k=this.hls;k.config.capLevelToPlayerSize&&C.video&&this.startCapping()},U.onMediaDetaching=function(){this.stopCapping()},U.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var C=this.hls;C.autoLevelCapping=this.getMaxLevel(y.length-1),C.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=C.autoLevelCapping}}},U.getMaxLevel=function(y){var C=this,k=this.hls.levels;if(!k.length)return-1;var A=k.filter(function(_,E){return W.isLevelAllowed(E,C.restrictedLevels)&&E<=y});return this.clientRect=null,W.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},U.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()},U.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},U.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,C={width:0,height:0};if(y){var k=y.getBoundingClientRect();C.width=k.width,C.height=k.height,!C.width&&!C.height&&(C.width=k.right-k.left||y.width||0,C.height=k.bottom-k.top||y.height||0)}return this.clientRect=C,C},W.isLevelAllowed=function(y,C){return C===void 0&&(C=[]),C.indexOf(y)===-1},W.getMaxLevelByMediaSize=function(y,C,k){if(!y||!y.length)return-1;for(var A=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},_=y.length-1,E=0;E<y.length;E+=1){var u=y[E];if((u.width>=C||u.height>=k)&&A(u,y[E+1])){_=E;break}}return _},M(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(C){}return y}}]),W}();J.default=z},"./src/controller/cmcd-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return A});var $=D("./src/events.ts"),O=D("./src/types/cmcd.ts"),M=D("./src/utils/buffer-helper.ts"),z=D("./src/utils/logger.ts");function W(_,E){for(var u=0;u<E.length;u++){var o=E[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(_,o.key,o)}}function U(_,E,u){return E&&W(_.prototype,E),u&&W(_,u),_}function R(_,E){var u=typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(u)return(u=u.call(_)).next.bind(u);if(Array.isArray(_)||(u=y(_))||E&&_&&typeof _.length=="number"){u&&(_=u);var o=0;return function(){return o>=_.length?{done:!0}:{done:!1,value:_[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 y(_,E){if(!_)return;if(typeof _=="string")return C(_,E);var u=Object.prototype.toString.call(_).slice(8,-1);if(u==="Object"&&_.constructor&&(u=_.constructor.name),u==="Map"||u==="Set")return Array.from(_);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return C(_,E)}function C(_,E){(E==null||E>_.length)&&(E=_.length);for(var u=0,o=new Array(E);u<E;u++)o[u]=_[u];return o}function k(){return k=Object.assign||function(_){for(var E=1;E<arguments.length;E++){var u=arguments[E];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(_[o]=u[o])}return _},k.apply(this,arguments)}var A=function(){function _(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:O.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(m){z.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(w){try{var m=w.frag,g=o.hls.levels[m.level],L=o.getObjectType(m),b={d:m.duration*1e3,ot:L};(L===O.CMCDObjectType.VIDEO||L===O.CMCDObjectType.AUDIO||L==O.CMCDObjectType.MUXED)&&(b.br=g.bitrate/1e3,b.tb=o.getTopBandwidth(L),b.bl=o.getBufferLength(L)),o.apply(w,b)}catch(c){z.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=u;var s=this.config=u.config,d=s.cmcd;d!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||_.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var E=_.prototype;return E.registerListeners=function(){var o=this.hls;o.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var o=this.hls;o.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(o,s){var d,w;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(w=s.tracks.video)===null||w===void 0?void 0:w.buffer},E.createData=function(){var o;return{v:O.CMCDVersion,sf:O.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}},E.apply=function(o,s){s===void 0&&(s={}),k(s,this.createData());var d=s.ot===O.CMCDObjectType.INIT||s.ot===O.CMCDObjectType.VIDEO||s.ot===O.CMCDObjectType.MUXED;if(this.starved&&d&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var w=_.toHeaders(s);if(!Object.keys(w).length)return;o.headers||(o.headers={}),k(o.headers,w)}else{var m=_.toQuery(s);if(!m)return;o.url=_.appendQueryToUri(o.url,m)}},E.getObjectType=function(o){var s=o.type;return s==="subtitle"?O.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?O.CMCDObjectType.INIT:s==="audio"?O.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?O.CMCDObjectType.VIDEO:O.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(o){for(var s=0,d=o===O.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=R(d),m;!(m=w()).done;){var g=m.value;g.bitrate>s&&(s=g.bitrate)}return s>0?s:NaN},E.getBufferLength=function(o){var s=this.hls.media,d=o===O.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var w=M.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return w.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function w(g){this.loader=void 0,this.loader=new d(g)}var m=w.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(L,b,c){s(L),this.loader.load(L,b,c)},U(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},E.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function w(g){this.loader=void 0,this.loader=new d(g)}var m=w.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(L,b,c){s(L),this.loader.load(L,b,c)},U(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},_.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},_.serialize=function(o){for(var s=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},m=function(F){return w(F/100)*100},g=function(F){return encodeURIComponent(F)},L={br:w,d:w,bl:m,dl:m,mtp:m,nor:g,rtp:m,tb:w},b=Object.keys(o||{}).sort(),c=R(b),p;!(p=c()).done;){var h=p.value,a=o[h];if(!d(a))continue;if(h==="v"&&a===1)continue;if(h=="pr"&&a===1)continue;var x=L[h];x&&(a=x(a));var v=typeof a,S=void 0;h==="ot"||h==="sf"||h==="st"?S=h+"="+a:v==="boolean"?S=h:v==="number"?S=h+"="+a:S=h+"="+JSON.stringify(a),s.push(S)}return s.join(",")},_.toHeaders=function(o){for(var s=Object.keys(o),d={},w=["Object","Request","Session","Status"],m=[{},{},{},{}],g={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,b=s;L<b.length;L++){var c=b[L],p=g[c]!=null?g[c]:1;m[p][c]=o[c]}for(var h=0;h<m.length;h++){var a=_.serialize(m[h]);a&&(d["CMCD-"+w[h]]=a)}return d},_.toQuery=function(o){return"CMCD="+encodeURIComponent(_.serialize(o))},_.appendQueryToUri=function(o,s){if(!s)return o;var d=o.includes("?")?"&":"?";return""+o+d+s},_}()},"./src/controller/eme-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/events.ts"),O=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),z=D("./src/utils/mediakeys-helper.ts");function W(A,_){for(var E=0;E<_.length;E++){var u=_[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(A,u.key,u)}}function U(A,_,E){return _&&W(A.prototype,_),E&&W(A,E),A}var R=3,y=function(_,E,u){var o={audioCapabilities:[],videoCapabilities:[]};return _.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),E.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[o]},C=function(_,E,u,o){switch(_){case z.KeySystems.WIDEVINE:return y(E,u,o);default:throw new Error("Unknown key-system: "+_)}},k=function(){function A(E){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=E,this._config=E.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 _=A.prototype;return _.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},_._registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_._unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_.getLicenseServerUrl=function(u){switch(u){case z.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},_._attemptKeySystemAccess=function(u,o,s){var d=this,w=C(u,o,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(u,w);this.mediaKeysPromise=m.then(function(g){return d._onMediaKeySystemAccessObtained(u,g)}),m.catch(function(g){M.logger.error('Failed to obtain key-system "'+u+'" access:',g)})},_._onMediaKeySystemAccessObtained=function(u,o){var s=this;M.logger.log('Access for key-system "'+u+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(d);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(m){return d.mediaKeys=m,M.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),m});return w.catch(function(m){M.logger.error("Failed to create media-keys:",m)}),w},_._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},_._onNewMediaKeySession=function(u){var o=this;M.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){o._onKeySessionMessage(u,s.message)},!1)},_._onKeySessionMessage=function(u,o){M.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},_.onMediaEncrypted=function(u){var o=this;if(M.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},_._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},_._generateRequestWithPreferredKeySession=function(u,o){var s=this,d=this._mediaKeysList[0];if(!d){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var w=d.mediaKeysSession;if(!w){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+u+'" init data type'),d.mediaKeysSessionInitialized=!0,w.generateRequest(u,o).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(m){M.logger.error("Error generating key-session request:",m),s.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},_._createLicenseXhr=function(u,o,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,u,o,s);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,d,u),w=void 0}catch(m){M.logger.error(m)}try{d.readyState||d.open("POST",u,!0),w&&w.call(this.hls,d,u)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return d},_._onLicenseRequestReadyStageChange=function(u,o,s,d){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var w=u.response,m=this._licenseResponseCallback;if(m)try{w=m.call(this.hls,u,o)}catch(L){M.logger.error(L)}d(w)}else{if(M.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=R-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(s,d)}break}},_._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},_._requestLicense=function(u,o){M.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),w=this._createLicenseXhr(d,u,o);M.logger.log("Sending license request to URL: "+d);var m=this._generateLicenseRequestChallenge(s,u);w.send(m)}catch(g){M.logger.error("Failure requesting DRM license: "+g),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},_.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},_.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},_.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var s=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),d=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,s,d)},U(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();J.default=k},"./src/controller/fps-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/events.ts"),O=D("./src/utils/logger.ts"),M=function(){function z(U){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=U,this.registerListeners()}var W=z.prototype;return W.setStreamController=function(R){this.streamController=R},W.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(R,y){var C=this.hls.config;if(C.capLevelOnFPSDrop){var k=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=k,k&&typeof k.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),C.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(R,y,C){var k=performance.now();if(y){if(this.lastTime){var A=k-this.lastTime,_=C-this.lastDroppedFrames,E=y-this.lastDecodedFrames,u=1e3*_/A,o=this.hls;if(o.trigger($.Events.FPS_DROP,{currentDropped:_,currentDecoded:E,totalDroppedFrames:C}),u>0&&_>o.config.fpsDroppedMonitoringThreshold*E){var s=o.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=k,this.lastDroppedFrames=C,this.lastDecodedFrames=y}},W.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var y=R.getVideoPlaybackQuality();this.checkFPS(R,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},z}();J.default=M},"./src/controller/fragment-finders.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"findFragmentByPDT",function(){return M}),D.d(J,"findFragmentByPTS",function(){return z}),D.d(J,"fragmentWithinToleranceTest",function(){return W}),D.d(J,"pdtWithinToleranceTest",function(){return U}),D.d(J,"findFragWithCC",function(){return R});var $=D("./src/polyfills/number.ts"),O=D("./src/utils/binary-search.ts");function M(y,C,k){if(C===null||!Array.isArray(y)||!y.length||!Object($.isFiniteNumber)(C))return null;var A=y[0].programDateTime;if(C<(A||0))return null;var _=y[y.length-1].endProgramDateTime;if(C>=(_||0))return null;k=k||0;for(var E=0;E<y.length;++E){var u=y[E];if(U(C,k,u))return u}return null}function z(y,C,k,A){k===void 0&&(k=0),A===void 0&&(A=0);var _=null;if(y?_=C[y.sn-C[0].sn+1]||null:k===0&&C[0].start===0&&(_=C[0]),_&&W(k,A,_)===0)return _;var E=O.default.search(C,W.bind(null,k,A));return E||_}function W(y,C,k){y===void 0&&(y=0),C===void 0&&(C=0);var A=Math.min(C,k.duration+(k.deltaPTS?k.deltaPTS:0));return k.start+k.duration-A<=y?1:k.start-A>y&&k.start?-1:0}function U(y,C,k){var A=Math.min(C,k.duration+(k.deltaPTS?k.deltaPTS:0))*1e3,_=k.endProgramDateTime||0;return _-A>y}function R(y,C){return O.default.search(y,function(k){return k.cc<C?1:k.cc>C?-1:0})}},"./src/controller/fragment-tracker.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"FragmentState",function(){return M}),D.d(J,"FragmentTracker",function(){return z});var $=D("./src/events.ts"),O=D("./src/types/loader.ts"),M;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(M||(M={}));var z=function(){function R(C){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=C,this._registerListeners()}var y=R.prototype;return y._registerListeners=function(){var k=this.hls;k.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var k=this.hls;k.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(k,A){if(A===O.PlaylistLevelType.MAIN){var _=this.activeFragment,E=this.activeParts;if(!_)return null;if(E)for(var u=E.length;u--;){var o=E[u],s=o?o.end:_.appendedPTS;if(o.start<=k&&s!==void 0&&k<=s)return u>9&&(this.activeParts=E.slice(u-9)),o}else if(_.start<=k&&_.appendedPTS!==void 0&&k<=_.appendedPTS)return _}return this.getBufferedFrag(k,A)},y.getBufferedFrag=function(k,A){for(var _=this.fragments,E=Object.keys(_),u=E.length;u--;){var o=_[E[u]];if((o==null?void 0:o.body.type)===A&&o.buffered){var s=o.body;if(s.start<=k&&k<=s.end)return s}}return null},y.detectEvictedFragments=function(k,A,_){var E=this;Object.keys(this.fragments).forEach(function(u){var o=E.fragments[u];if(!o)return;if(!o.buffered){o.body.type===_&&E.removeFragment(o.body);return}var s=o.range[k];if(!s)return;s.time.some(function(d){var w=!E.isTimeBuffered(d.startPTS,d.endPTS,A);return w&&E.removeFragment(o.body),w})})},y.detectPartialFragments=function(k){var A=this,_=this.timeRanges,E=k.frag,u=k.part;if(!_||E.sn==="initSegment")return;var o=U(E),s=this.fragments[o];if(!s)return;Object.keys(_).forEach(function(d){var w=E.elementaryStreams[d];if(!w)return;var m=_[d],g=u!==null||w.partial===!0;s.range[d]=A.getBufferedTimes(E,u,g,m)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},y.fragBuffered=function(k){var A=U(k),_=this.fragments[A];_&&(_.backtrack=_.loaded=null,_.buffered=!0)},y.getBufferedTimes=function(k,A,_,E){for(var u={time:[],partial:_},o=A?A.start:k.start,s=A?A.end:k.end,d=k.minEndPTS||s,w=k.maxStartPTS||o,m=0;m<E.length;m++){var g=E.start(m)-this.bufferPadding,L=E.end(m)+this.bufferPadding;if(w>=g&&d<=L){u.time.push({startPTS:Math.max(o,E.start(m)),endPTS:Math.min(s,E.end(m))});break}else if(o<L&&s>g)u.partial=!0,u.time.push({startPTS:Math.max(o,E.start(m)),endPTS:Math.min(s,E.end(m))});else if(s<=g)break}return u},y.getPartialFragment=function(k){var A=null,_,E,u,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(w){var m=d[w];if(!m)return;W(m)&&(E=m.body.start-s,u=m.body.end+s,k>=E&&k<=u&&(_=Math.min(k-E,u-k),o<=_&&(A=m.body,o=_)))}),A},y.getState=function(k){var A=U(k),_=this.fragments[A];return _?_.buffered?W(_)?M.PARTIAL:M.OK:_.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},y.backtrack=function(k,A){var _=U(k),E=this.fragments[_];if(!E||E.backtrack)return null;var u=E.backtrack=A||E.loaded;return E.loaded=null,u},y.getBacktrackData=function(k){var A=U(k),_=this.fragments[A];if(_){var E,u=_.backtrack;if(u!=null&&(E=u.payload)!==null&&E!==void 0&&E.byteLength)return u;this.removeFragment(k)}return null},y.isTimeBuffered=function(k,A,_){for(var E,u,o=0;o<_.length;o++){if(E=_.start(o)-this.bufferPadding,u=_.end(o)+this.bufferPadding,k>=E&&A<=u)return!0;if(A<=E)return!1}return!1},y.onFragLoaded=function(k,A){var _=A.frag,E=A.part;if(_.sn==="initSegment"||_.bitrateTest||E)return;var u=U(_);this.fragments[u]={body:_,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(k,A){var _=this,E=A.frag,u=A.part,o=A.timeRanges;if(E.type===O.PlaylistLevelType.MAIN)if(this.activeFragment=E,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var w=o[d];if(_.detectEvictedFragments(d,w),!u)for(var m=0;m<w.length;m++)E.appendedPTS=Math.max(w.end(m),E.appendedPTS||0)})},y.onFragBuffered=function(k,A){this.detectPartialFragments(A)},y.hasFragment=function(k){var A=U(k);return!!this.fragments[A]},y.removeFragmentsInRange=function(k,A,_){var E=this;Object.keys(this.fragments).forEach(function(u){var o=E.fragments[u];if(!o)return;if(o.buffered){var s=o.body;s.type===_&&s.start<A&&s.end>k&&E.removeFragment(s)}})},y.removeFragment=function(k){var A=U(k);k.stats.loaded=0,k.clearElementaryStreamInfo(),delete this.fragments[A]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function W(R){var y,C;return R.buffered&&(((y=R.range.video)===null||y===void 0?void 0:y.partial)||((C=R.range.audio)===null||C===void 0?void 0:C.partial))}function U(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"STALL_MINIMUM_DURATION_MS",function(){return W}),D.d(J,"MAX_START_GAP_JUMP",function(){return U}),D.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),D.d(J,"SKIP_BUFFER_RANGE_START",function(){return y}),D.d(J,"default",function(){return C});var $=D("./src/utils/buffer-helper.ts"),O=D("./src/errors.ts"),M=D("./src/events.ts"),z=D("./src/utils/logger.ts"),W=250,U=2,R=.1,y=.05,C=function(){function k(_,E,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=_,this.media=E,this.fragmentTracker=u,this.hls=o}var A=k.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(E){var u=this.config,o=this.media,s=this.stalled,d=o.currentTime,w=o.seeking,m=this.seeking&&!w,g=!this.seeking&&w;if(this.seeking=w,d!==E){if(this.moved=!0,s!==null){if(this.stallReported){var L=self.performance.now()-s;z.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||m)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!$.BufferHelper.getBuffered(o).length)return;var b=$.BufferHelper.bufferInfo(o,d,0),c=b.len>0,p=b.nextStart||0;if(!c&&!p)return;if(w){var h=b.len>U,a=!p||p-d>U&&!this.fragmentTracker.getPartialFragment(d);if(h||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,v=Math.max(p,b.start||0)-d,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,B=S==null||((x=S.details)===null||x===void 0)?void 0:x.live,F=B?S.details.targetduration*2:U;if(v>0&&v<=F){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(s===null){this.stalled=K;return}var V=K-s;!w&&V>=W&&this._reportStall(b.len);var P=$.BufferHelper.bufferInfo(o,d,u.maxBufferHole);this._tryFixBufferStall(P,V)},A._tryFixBufferStall=function(E,u){var o=this.config,s=this.fragmentTracker,d=this.media,w=d.currentTime,m=s.getPartialFragment(w);if(m){var g=this._trySkipBufferHole(m);if(g)return}E.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(E){var u=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+E+")"),u.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},A._trySkipBufferHole=function(E){for(var u=this.config,o=this.hls,s=this.media,d=s.currentTime,w=0,m=$.BufferHelper.getBuffered(s),g=0;g<m.length;g++){var L=m.start(g);if(d+u.maxBufferHole>=w&&d<L){var b=Math.max(L+y,s.currentTime+R);return z.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,E&&o.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:E}),b}w=m.end(g)}return 0},A._tryNudgeBuffer=function(){var E=this.config,u=this.hls,o=this.media,s=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<E.nudgeMaxRetry){var w=s+d*E.nudgeOffset;z.logger.warn("Nudging 'currentTime' from "+s+" to "+w),o.currentTime=w,u.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else z.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+E.nudgeMaxRetry+" nudges"),u.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},k}()},"./src/controller/id3-track-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/events.ts"),O=D("./src/utils/texttrack-utils.ts"),M=D("./src/demux/id3.ts"),z=.25,W=function(){function U(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var R=U.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var C=this.hls;C.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),C.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var C=this.hls;C.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),C.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(C,k){this.media=k.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(O.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(C){if(!this.media)return;for(var k=0;k<C.length;k++){var A=C[k];if(A.kind==="metadata"&&A.label==="id3")return Object(O.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(C,k){if(!this.media)return;var A=k.frag,_=k.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<_.length;u++){var o=M.getID3Frames(_[u].data);if(o){var s=_[u].pts,d=u<_.length-1?_[u+1].pts:A.end,w=d-s;w<=0&&(d=s+z);for(var m=0;m<o.length;m++){var g=o[m];if(!M.isTimeStampFrame(g)){var L=new E(s,d,"");L.value=g,this.id3Track.addCue(L)}}}}},R.onBufferFlushing=function(C,k){var A=k.startOffset,_=k.endOffset,E=k.type;if(!E||E==="audio"){var u=this.id3Track;u&&Object(O.removeCuesInRange)(u,A,_)}},U}();J.default=W},"./src/controller/latency-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return U});var $=D("./src/errors.ts"),O=D("./src/events.ts"),M=D("./src/utils/logger.ts");function z(R,y){for(var C=0;C<y.length;C++){var k=y[C];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(R,k.key,k)}}function W(R,y,C){return y&&z(R.prototype,y),C&&z(R,C),R}var U=function(){function R(C){var k=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return k.timeupdate()},this.hls=C,this.config=C.config,this.registerListeners()}var y=R.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(O.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(O.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(O.Events.ERROR,this.onError)},y.onMediaAttached=function(k,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(k,A){var _=A.details;this.levelDetails=_,_.advanced&&this.timeupdate(),!_.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(k,A){if(A.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var k=this.media,A=this.levelDetails;if(!k||!A)return;this.currentTime=k.currentTime;var _=this.computeLatency();if(_===null)return;this._latency=_;var E=this.config,u=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!u||o===1)return;var s=this.targetLatency;if(s===null)return;var d=_-s,w=Math.min(this.maxLatency,s+A.targetduration),m=d<w;if(A.live&&m&&d>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;k.playbackRate=Math.min(g,Math.max(1,L))}else k.playbackRate!==1&&k.playbackRate!==0&&(k.playbackRate=1)},y.estimateLiveEdge=function(){var k=this.levelDetails;return k===null?null:k.edge+k.age},y.computeLatency=function(){var k=this.estimateLiveEdge();return k===null?null:k-this.currentTime},W(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var k=this.config,A=this.levelDetails;return k.liveMaxLatencyDuration!==void 0?k.liveMaxLatencyDuration:A?k.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var k=this.levelDetails;if(k===null)return null;var A=k.holdBack,_=k.partHoldBack,E=k.targetduration,u=this.config,o=u.liveSyncDuration,s=u.liveSyncDurationCount,d=u.lowLatencyMode,w=this.hls.userConfig,m=d&&_||A;(w.liveSyncDuration||w.liveSyncDurationCount||m===0)&&(m=o!==void 0?o:s*E);var g=E,L=1;return m+Math.min(this.stallCount*L,g)}},{key:"liveSyncPosition",get:function(){var k=this.estimateLiveEdge(),A=this.targetLatency,_=this.levelDetails;if(k===null||A===null||_===null)return null;var E=_.edge,u=k-A-this.edgeStalled,o=E-_.totalduration,s=E-(this.config.lowLatencyMode&&_.partTarget||_.targetduration);return Math.min(Math.max(o,u),s)}},{key:"drift",get:function(){var k=this.levelDetails;return k===null?1:k.drift}},{key:"edgeStalled",get:function(){var k=this.levelDetails;if(k===null)return 0;var A=(this.config.lowLatencyMode&&k.partTarget||k.targetduration)*3;return Math.max(k.age-A,0)}},{key:"forwardBufferLength",get:function(){var k=this.media,A=this.levelDetails;if(!k||!A)return 0;var _=k.buffered.length;return _?k.buffered.end(_-1):A.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var $=D("./src/types/level.ts"),O=D("./src/events.ts"),M=D("./src/errors.ts"),z=D("./src/utils/codecs.ts"),W=D("./src/controller/level-helper.ts"),U=D("./src/controller/base-playlist-controller.ts"),R=D("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var w in d)Object.prototype.hasOwnProperty.call(d,w)&&(o[w]=d[w])}return o},y.apply(this,arguments)}function C(o,s){for(var d=0;d<s.length;d++){var w=s[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function k(o,s,d){return s&&C(o.prototype,s),d&&C(o,d),o}function A(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,_(o,s)}function _(o,s){return _=Object.setPrototypeOf||function(w,m){return w.__proto__=m,w},_(o,s)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){A(s,o);function s(w){var m;return m=o.call(this,w,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var d=s.prototype;return d._registerListeners=function(){var m=this.hls;m.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(O.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var m=this.hls;m.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(O.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var m=this._levels;m.forEach(function(g){g.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(m,g){var L=[],b=[],c=[],p,h={},a,x=!1,v=!1,S=!1;if(g.levels.forEach(function(V){var P=V.attrs;x=x||!!(V.width&&V.height),v=v||!!V.videoCodec,S=S||!!V.audioCodec,E&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var I=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=h[I],a?a.url.push(V.url):(a=new $.Level(V),h[I]=a,L.push(a)),P&&(P.AUDIO&&Object(W.addGroupId)(a,"audio",P.AUDIO),P.SUBTITLES&&Object(W.addGroupId)(a,"text",P.SUBTITLES))}),(x||v)&&S&&(L=L.filter(function(V){var P=V.videoCodec,I=V.width,Y=V.height;return!!P||!!(I&&Y)})),L=L.filter(function(V){var P=V.audioCodec,I=V.videoCodec;return(!P||Object(z.isCodecSupportedInMp4)(P,"audio"))&&(!I||Object(z.isCodecSupportedInMp4)(I,"video"))}),g.audioTracks&&(b=g.audioTracks.filter(function(V){return!V.audioCodec||Object(z.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(b)),g.subtitles&&(c=g.subtitles,Object(W.assignTrackIdsByGroup)(c)),L.length>0){p=L[0].bitrate,L.sort(function(V,P){return V.bitrate-P.bitrate}),this._levels=L;for(var B=0;B<L.length;B++)if(L[B].bitrate===p){this._firstLevel=B,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+p);break}var F=S&&!v,K={levels:L,audioTracks:b,subtitleTracks:c,firstLevel:this._firstLevel,stats:g.stats,audio:S,video:v,altAudio:!F&&b.some(function(V){return!!V.url})};this.hls.trigger(O.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(m,g){if(o.prototype.onError.call(this,m,g),g.fatal)return;var L=g.context,b=this._levels[this.currentLevelIndex];if(L&&(L.type===R.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&L.groupId===b.audioGroupIds[b.urlId]||L.type===R.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&L.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,p=!0,h;switch(g.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var a=this._levels[g.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=g.frag.level)):h=g.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(p=!1),h=L.level),c=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:h=g.level,c=!0;break}h!==void 0&&this.recoverLevel(g,h,c,p)},d.recoverLevel=function(m,g,L,b){var c=m.details,p=this._levels[g];if(p.loadError++,L){var h=this.retryLoadingOrFail(m);if(h)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=p.url.length;if(a>1&&p.loadError<a)m.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var x=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(c+": switch to "+x),m.levelRetry=!0,this.hls.nextAutoLevel=x)}}},d.redundantFailover=function(m){var g=this._levels[m],L=g.url.length;if(L>1){var b=(g.urlId+1)%L;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(c){c.urlId=b}),this.level=m}},d.onFragLoaded=function(m,g){var L=g.frag;if(L!==void 0&&L.type===R.PlaylistLevelType.MAIN){var b=this._levels[L.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(m,g){var L,b=g.level,c=g.details,p=this._levels[b];if(!p){var h;this.warn("Invalid level index "+b),(h=g.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(c.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(b,g,p.details)):(L=g.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(c.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(m,g){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var b=-1,c=this.hls.audioTracks[g.id].groupId,p=0;p<L.audioGroupIds.length;p++)if(L.audioGroupIds[p]===c){b=p;break}b!==L.urlId&&(L.urlId=b,this.startLoad())}},d.loadPlaylist=function(m){var g=this.currentLevelIndex,L=this._levels[g];if(this.canLoad&&L&&L.url.length>0){var b=L.urlId,c=L.url[b];if(m)try{c=m.addDirectives(c)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+g+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+b+" "+c),this.clearTimer(),this.hls.trigger(O.Events.LEVEL_LOADING,{url:c,level:g,id:b,deliveryDirectives:m||null})}},d.removeLevel=function(m,g){var L=function(p,h){return h!==g},b=this._levels.filter(function(c,p){return p!==m?!0:c.url.length>1&&g!==void 0?(c.url=c.url.filter(L),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(L)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(L)),c.urlId=0,!0):!1}).map(function(c,p){var h=c.details;return h!=null&&h.fragments&&h.fragments.forEach(function(a){a.level=p}),c});this._levels=b,this.hls.trigger(O.Events.LEVELS_UPDATED,{levels:b})},k(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var g,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===m&&(g=L[m])!==null&&g!==void 0&&g.details)return;if(m<0||m>=L.length){var b=m<0;if(this.hls.trigger(O.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:b,reason:"invalid level idx"}),b)return;m=Math.min(m,L.length-1)}this.clearTimer();var c=this.currentLevelIndex,p=L[c],h=L[m];this.log("switching to level "+m+" from "+c),this.currentLevelIndex=m;var a=y({},h,{level:m,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete a._urlId,this.hls.trigger(O.Events.LEVEL_SWITCHING,a);var x=h.details;if(!x||x.live){var v=this.switchParams(h.uri,p==null?void 0:p.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),s}(U.default)},"./src/controller/level-helper.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"addGroupId",function(){return M}),D.d(J,"assignTrackIdsByGroup",function(){return z}),D.d(J,"updatePTS",function(){return W}),D.d(J,"updateFragPTSDTS",function(){return R}),D.d(J,"mergeDetails",function(){return y}),D.d(J,"mapPartIntersection",function(){return C}),D.d(J,"mapFragmentIntersection",function(){return k}),D.d(J,"adjustSliding",function(){return A}),D.d(J,"addSliding",function(){return _}),D.d(J,"computeReloadInterval",function(){return E}),D.d(J,"getFragmentWithSN",function(){return u}),D.d(J,"getPartWith",function(){return o});var $=D("./src/polyfills/number.ts"),O=D("./src/utils/logger.ts");function M(s,d,w){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(w);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(w);break}}function z(s){var d={};s.forEach(function(w){var m=w.groupId||"";w.id=d[m]=d[m]||0,d[m]++})}function W(s,d,w){var m=s[d],g=s[w];U(m,g)}function U(s,d){var w=d.startPTS;if(Object($.isFiniteNumber)(w)){var m=0,g;d.sn>s.sn?(m=w-s.start,g=s):(m=s.start-w,g=d),g.duration!==m&&(g.duration=m)}else if(d.sn>s.sn){var L=s.cc===d.cc;L&&s.minEndPTS?d.start=s.start+(s.minEndPTS-s.start):d.start=s.start+s.duration}else d.start=Math.max(s.start-d.duration,0)}function R(s,d,w,m,g,L){var b=m-w;b<=0&&(O.logger.warn("Fragment should have a positive duration",d),m=w+d.duration,L=g+d.duration);var c=w,p=m,h=d.startPTS,a=d.endPTS;if(Object($.isFiniteNumber)(h)){var x=Math.abs(h-w);Object($.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(x,d.deltaPTS):d.deltaPTS=x,c=Math.max(w,h),w=Math.min(w,h),g=Math.min(g,d.startDTS),p=Math.min(m,a),m=Math.max(m,a),L=Math.max(L,d.endDTS)}d.duration=m-w;var v=w-d.start;d.appendedPTS=m,d.start=d.startPTS=w,d.maxStartPTS=c,d.startDTS=g,d.endPTS=m,d.minEndPTS=p,d.endDTS=L;var S=d.sn;if(!s||S<s.startSN||S>s.endSN)return 0;var B,F=S-s.startSN,K=s.fragments;for(K[F]=d,B=F;B>0;B--)U(K[B],K[B-1]);for(B=F;B<K.length-1;B++)U(K[B],K[B+1]);return s.fragmentHint&&U(K[K.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,v}function y(s,d){for(var w=null,m=s.fragments,g=m.length-1;g>=0;g--){var L=m[g].initSegment;if(L){w=L;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,c;if(k(s,d,function(B,F){B.relurl&&(b=B.cc-F.cc),Object($.isFiniteNumber)(B.startPTS)&&Object($.isFiniteNumber)(B.endPTS)&&(F.start=F.startPTS=B.startPTS,F.startDTS=B.startDTS,F.appendedPTS=B.appendedPTS,F.maxStartPTS=B.maxStartPTS,F.endPTS=B.endPTS,F.endDTS=B.endDTS,F.minEndPTS=B.minEndPTS,F.duration=B.endPTS-B.startPTS,F.duration&&(c=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=B.elementaryStreams,F.loader=B.loader,F.stats=B.stats,F.urlId=B.urlId,B.initSegment&&(F.initSegment=B.initSegment,w=B.initSegment)}),w){var p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;p.forEach(function(B){var F;(!B.initSegment||B.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(B.initSegment=w)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(B){return!B}),d.deltaUpdateFailed)){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=d.skippedSegments;h--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),C(s.partList,d.partList,function(B,F){F.elementaryStreams=B.elementaryStreams,F.stats=B.stats}),c?R(d,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):A(s,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var v=d.advancedDateTime;if(d.advanced&&v){var S=d.edge;d.driftStart||(d.driftStartTime=v,d.driftStart=S),d.driftEndTime=v,d.driftEnd=S}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function C(s,d,w){if(s&&d)for(var m=0,g=0,L=s.length;g<=L;g++){var b=s[g],c=d[g+m];b&&c&&b.index===c.index&&b.fragment.sn===c.fragment.sn?w(b,c):m--}}function k(s,d,w){for(var m=d.skippedSegments,g=Math.max(s.startSN,d.startSN)-d.startSN,L=(s.fragmentHint?1:0)+(m?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,b=d.startSN-s.startSN,c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,p=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,h=g;h<=L;h++){var a=p[b+h],x=c[h];m&&!x&&h<m&&(x=d.fragments[h]=a),a&&x&&w(a,x)}}function A(s,d){var w=d.startSN+d.skippedSegments-s.startSN,m=s.fragments;if(w<0||w>=m.length)return;_(d,m[w].start)}function _(s,d){if(d){for(var w=s.fragments,m=s.skippedSegments;m<w.length;m++)w[m].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function E(s,d){var w=1e3*s.levelTargetDuration,m=w/2,g=s.age,L=g>0&&g<w*3,b=d.loading.end-d.loading.start,c,p=s.availabilityDelay;if(s.updated===!1)if(L){var h=333*s.misses;c=Math.max(Math.min(m,b*2),h),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=m;else L?(p=Math.min(p||w/2,g),s.availabilityDelay=p,c=p+w-g):c=w-b;return Math.round(c)}function u(s,d,w){if(!s||!s.details)return null;var m=s.details,g=m.fragments[d-m.startSN];return g||(g=m.fragmentHint,g&&g.sn===d?g:d<m.startSN&&w&&w.sn===d?w:null)}function o(s,d,w){if(!s||!s.details)return null;var m=s.details.partList;if(m)for(var g=m.length;g--;){var L=m[g];if(L.index===w&&L.fragment.sn===d)return L}return null}},"./src/controller/stream-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return m});var $=D("./src/polyfills/number.ts"),O=D("./src/controller/base-stream-controller.ts"),M=D("./src/is-supported.ts"),z=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),U=D("./src/controller/fragment-tracker.ts"),R=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),C=D("./src/demux/transmuxer-interface.ts"),k=D("./src/types/transmuxer.ts"),A=D("./src/controller/gap-controller.ts"),_=D("./src/errors.ts"),E=D("./src/utils/logger.ts");function u(g,L){for(var b=0;b<L.length;b++){var c=L[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(g,c.key,c)}}function o(g,L,b){return L&&u(g.prototype,L),b&&u(g,b),g}function s(g,L){g.prototype=Object.create(L.prototype),g.prototype.constructor=g,d(g,L)}function d(g,L){return d=Object.setPrototypeOf||function(c,p){return c.__proto__=p,c},d(g,L)}var w=100,m=function(g){s(L,g);function L(c,p){var h;return h=g.call(this,c,p,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var b=L.prototype;return b._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)},b._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)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(p){if(this.levels){var h=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}h>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),p=h),this.state=O.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=O.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_LEVEL:{var p,h=this.levels,a=this.level,x=h==null||((p=h[a])===null||p===void 0)?void 0:p.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=O.State.IDLE;break}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var v,S=self.performance.now(),B=this.retryDate;(!B||S>=B||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=O.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var p,h,a=this.hls,x=this.levelLastLoaded,v=this.levels,S=this.media,B=a.config,F=a.nextLoadLevel;if(x===null||!S&&(this.startFragRequested||!B.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[F])return;var K=v[F];this.level=a.nextLoadLevel=F;var V=K.details;if(!V||this.state===O.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==F){this.state=O.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,R.PlaylistLevelType.MAIN);if(P===null)return;var I=P.len,Y=this.getMaxBufferLength(K.maxBitrate);if(I>=Y)return;if(this._streamEnded(P,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,ee),this.state=O.State.ENDED;return}var oe=P.end,pe=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&pe&&pe.sn!=="initSegment"){var Oe=pe.sn-V.startSN;Oe>1&&(pe=V.fragments[Oe-1],this.fragmentTracker.removeFragment(pe))}if(pe&&this.fragmentTracker.getState(pe)===U.FragmentState.OK&&this.nextLoadPosition>oe){var xe=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,xe,R.PlaylistLevelType.MAIN),pe=this.getNextFragment(this.nextLoadPosition,V)}if(!pe)return;pe.initSegment&&!pe.initSegment.data&&!this.bitrateTest&&(pe=pe.initSegment),((p=pe.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((h=pe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(pe,V):this.loadFragment(pe,V,oe)},b.loadFragment=function(p,h,a){var x,v=this.fragmentTracker.getState(p);if(this.fragCurrent=p,v===U.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(p);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else v=U.FragmentState.NOT_LOADED}v===U.FragmentState.NOT_LOADED||v===U.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,g.prototype.loadFragment.call(this,p,h,a)):v===U.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(p){var h=this.fragmentTracker.getAppendedFrag(p,R.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},b.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,R.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var p=this.levels,h=this.media;if(h!=null&&h.readyState){var a,x=this.getAppendedFrag(h.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!h.paused&&p){var v=this.hls.nextLoadLevel,S=p[v],B=this.fragLastKbps;B&&this.fragCurrent?a=this.fragCurrent.duration*S.maxBitrate/(1e3*B)+1:a=0}else a=0;var F=this.getBufferedFrag(h.currentTime+a);if(F){var K=this.followingBufferedFrag(F);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,P=K.duration,I=Math.max(F.end,V+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===O.State.KEY_LOADING&&(this.state=O.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(p,h){g.prototype.flushMainBuffer.call(this,p,h,this.altAudio?"video":null)},b.onMediaAttached=function(p,h){g.prototype.onMediaAttached.call(this,p,h);var a=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,a,this.fragmentTracker,this.hls)},b.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),g.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var p=this.media,h=p?p.currentTime:null;Object($.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},b.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},b.onManifestParsed=function(p,h){var a=!1,x=!1,v;h.levels.forEach(function(S){v=S.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},b.onLevelLoading=function(p,h){var a=this.levels;if(!a||this.state!==O.State.IDLE)return;var x=a[h.level];(!x.details||x.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(x.details))&&(this.state=O.State.WAITING_LEVEL)},b.onLevelLoaded=function(p,h){var a,x=this.levels,v=h.level,S=h.details,B=S.totalduration;if(!x){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+B);var F=this.fragCurrent;F&&(this.state===O.State.FRAG_LOADING||this.state===O.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==h.level&&F.loader&&(this.state=O.State.IDLE,F.loader.abort()));var K=x[v],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=v,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:S,level:v}),this.state===O.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=O.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,V),this.tick()},b._handleFragmentLoadProgress=function(p){var h,a=p.frag,x=p.part,v=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 B=S[a.level],F=B.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=B.videoCodec,V=F.PTSKnown||!F.live,P=(h=a.initSegment)===null||h===void 0?void 0:h.data,I=this._getAudioCodec(B),Y=this.transmuxer=this.transmuxer||new C.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=x?x.index:-1,oe=ee!==-1,pe=new k.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,ee,oe),Oe=this.initPTS[a.cc];Y.push(v,P,I,K,a,x,F.totalduration,V,pe,Oe)},b.onAudioTrackSwitching=function(p,h){var a=this.altAudio,x=!!h.url,v=h.id;if(!x){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 B=this.hls;a&&B.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),B.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:v})}},b.onAudioTrackSwitched=function(p,h){var a=h.id,x=!!this.hls.audioTracks[a].url;if(x){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=x,this.tick()},b.onBufferCreated=function(p,h){var a=h.tracks,x,v,S=!1;for(var B in a){var F=a[B];if(F.id==="main"){if(v=B,x=F,B==="video"){var K=a[B];K&&(this.videoBuffer=K.buffer)}}else S=!0}S&&x?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(p,h){var a=h.frag,x=h.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===O.State.PARSED&&(this.state=O.State.IDLE);return}var v=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},b.onError=function(p,h){switch(h.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,h);break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==O.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=O.State.ERROR):!h.levelRetry&&this.state===O.State.WAITING_LEVEL&&(this.state=O.State.IDLE));break;case _.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var p=this.media,h=this.gapController;if(!p||!h||!p.readyState)return;var a=W.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=O.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(p,h){var a=h.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,R.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(p,h){this.levels=h.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var p=this.media,h=p.currentTime,a=this.startPosition;if(a>=0&&h<a){if(p.seeking){E.logger.log("could not seek to "+a+", already seeking at "+h);return}var x=W.BufferHelper.getBuffered(p),v=x.length?x.start(0):0,S=v-a;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+S+" to match buffer start"),a+=S,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+h),p.currentTime=a}},b._getAudioCodec=function(p){var h=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},b._loadBitrateTestFrag=function(p){var h=this;this._doFragLoad(p).then(function(a){var x=h.hls;if(!a||x.nextLoadLevel||h.fragContextChanged(p))return;h.fragLoadError=0,h.state=O.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var v=p.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),x.trigger(z.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(p){var h,a="main",x=this.hls,v=p.remuxResult,S=p.chunkMeta,B=this.getCurrentContext(S);if(!B){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 F=B.frag,K=B.part,V=B.level,P=v.video,I=v.text,Y=v.id3,ee=v.initSegment,oe=this.altAudio?void 0:v.audio;if(this.fragContextChanged(F))return;if(this.state=O.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,F,S),x.trigger(z.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:ee.tracks}));var pe=ee.initPTS,Oe=ee.timescale;Object($.isFiniteNumber)(pe)&&(this.initPTS[F.cc]=pe,x.trigger(z.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:pe,timescale:Oe}))}if(P&&v.independent!==!1){if(V.details){var xe=P.startPTS,_e=P.endPTS,Te=P.startDTS,Ce=P.endDTS;if(K)K.elementaryStreams[P.type]={startPTS:xe,endPTS:_e,startDTS:Te,endDTS:Ce};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<xe){this.backtrack(F);return}F.setElementaryStreamInfo(P.type,F.start,_e,F.start,Ce,!0)}F.setElementaryStreamInfo(P.type,xe,_e,Te,Ce),this.bufferFragmentData(P,F,K,S)}}else if(v.independent===!1){this.backtrack(F);return}if(oe){var le=oe.startPTS,te=oe.endPTS,ce=oe.startDTS,ae=oe.endDTS;K&&(K.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:te,startDTS:ce,endDTS:ae}),F.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,le,te,ce,ae),this.bufferFragmentData(oe,F,K,S)}if(Y!=null&&(h=Y.samples)!==null&&h!==void 0&&h.length){var Le={frag:F,id:a,samples:Y.samples};x.trigger(z.Events.FRAG_PARSING_METADATA,Le)}if(I){var Re={frag:F,id:a,samples:I.samples};x.trigger(z.Events.FRAG_PARSING_USERDATA,Re)}},b._bufferInitSegment=function(p,h,a,x){var v=this;if(this.state!==O.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var S=h.audio,B=h.video,F=h.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+"]")}B&&(B.levelCodec=p.videoCodec,B.id="main",this.log("Init video buffer, container:"+B.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+B.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(z.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(P){var I=h[P],Y=I.initSegment;Y!=null&&Y.byteLength&&v.hls.trigger(z.Events.BUFFER_APPENDING,{type:P,data:Y,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},b.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var h=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,h?this.resetFragmentLoading(p):this.state=O.State.BACKTRACKING},b.checkFragmentChanged=function(){var p=this.media,h=null;if(p&&p.readyState>1&&p.seeking===!1){var a=p.currentTime;if(W.BufferHelper.isBuffered(p,a)?h=this.getAppendedFrag(a):W.BufferHelper.isBuffered(p,a+.1)&&(h=this.getAppendedFrag(a+.1)),h){var x=this.fragPlaying,v=h.level;(!x||h.sn!==x.sn||x.level!==v||h.urlId!==x.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:h}),(!x||x.level!==v)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=h)}}},o(L,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var h=this.getAppendedFrag(p.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var h=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(O.default)},"./src/controller/subtitle-stream-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"SubtitleStreamController",function(){return s});var $=D("./src/events.ts"),O=D("./src/utils/logger.ts"),M=D("./src/utils/buffer-helper.ts"),z=D("./src/controller/fragment-finders.ts"),W=D("./src/utils/discontinuities.ts"),U=D("./src/controller/level-helper.ts"),R=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/base-stream-controller.ts"),C=D("./src/types/loader.ts"),k=D("./src/types/level.ts");function A(d,w){for(var m=0;m<w.length;m++){var g=w[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(d,g.key,g)}}function _(d,w,m){return w&&A(d.prototype,w),m&&A(d,m),d}function E(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,u(d,w)}function u(d,w){return u=Object.setPrototypeOf||function(g,L){return g.__proto__=L,g},u(d,w)}var o=500,s=function(d){E(w,d);function w(g,L){var b;return b=d.call(this,g,L,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var m=w.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var L=this.hls;L.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on($.Events.ERROR,this.onError,this),L.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var L=this.hls;L.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off($.Events.ERROR,this.onError,this),L.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(L,b){this.mainDetails=b.details},m.onSubtitleFragProcessed=function(L,b){var c=b.frag,p=b.success;if(this.fragPrevious=c,this.state=y.State.IDLE,!p)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var a,x=c.start,v=0;v<h.length;v++)if(x>=h[v].start&&x<=h[v].end){a=h[v];break}var S=c.start+c.duration;a?a.end=S:(a={start:x,end:S},h.push(a)),this.fragmentTracker.fragBuffered(c)},m.onBufferFlushing=function(L,b){var c=b.startOffset,p=b.endOffset;if(c===0&&p!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var x=a[h].details,v=x.targetduration,S=p-v;if(S<=0)return;b.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(B){for(var F=0;F<B.length;){if(B[F].end<=S){B.shift();continue}else if(B[F].start<S)B[F].start=S;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(c,S,C.PlaylistLevelType.SUBTITLE)}},m.onError=function(L,b){var c,p=b.frag;if(!p||p.type!==C.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},m.onSubtitleTracksUpdated=function(L,b){var c=this,p=b.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(h){return new k.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){c.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(L,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(o)},m.onSubtitleTrackLoaded=function(L,b){var c,p=b.details,h=b.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var v=x[a];if(h>=x.length||h!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(c=v.details)!==null&&c!==void 0&&c.live){var S=this.mainDetails;if(p.deltaUpdateFailed||!S)return;var B=S.fragments[0];if(!v.details)p.hasProgramDateTime&&S.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(p,S):B&&Object(U.addSliding)(p,B.start);else{var F=this.alignPlaylists(p,v.details);F===0&&B&&Object(U.addSliding)(p,B.start)}}if(v.details=p,this.levelLastLoaded=h,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var K=Object(z.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},m._handleFragmentLoadComplete=function(L){var b=L.frag,c=L.payload,p=b.decryptdata,h=this.hls;if(this.fragContextChanged(b))return;if(c&&c.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),p.key.buffer,p.iv.buffer).then(function(x){var v=performance.now();h.trigger($.Events.FRAG_DECRYPTED,{frag:b,payload:x,stats:{tstart:a,tdecrypt:v}})})}},m.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var L,b=this.currentTrackId,c=this.levels;if(!c.length||!c[b]||!c[b].details)return;var p=c[b].details,h=p.targetduration,a=this.config,x=this.media,v=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-h,a.maxBufferHole),S=v.end,B=v.len,F=this.getMaxBufferLength()+h;if(B>F)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var K=p.fragments,V=K.length,P=p.edge,I,Y=this.fragPrevious;if(S<P){var ee=a.maxFragLookUpTolerance;Y&&p.hasProgramDateTime&&(I=Object(z.findFragmentByPDT)(K,Y.endProgramDateTime,ee)),I||(I=Object(z.findFragmentByPTS)(Y,K,S,ee),!I&&Y&&Y.start<K[0].start&&(I=K[0]))}else I=K[V-1];(L=I)!==null&&L!==void 0&&L.encrypted?(O.logger.log("Loading key for "+I.sn),this.state=y.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===R.FragmentState.NOT_LOADED&&this.loadFragment(I,p,S)}},m.loadFragment=function(L,b,c){this.fragCurrent=L,d.prototype.loadFragment.call(this,L,b,c)},_(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(y.default)},"./src/controller/subtitle-track-controller.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/events.ts"),O=D("./src/utils/texttrack-utils.ts"),M=D("./src/controller/base-playlist-controller.ts"),z=D("./src/types/loader.ts");function W(A,_){for(var E=0;E<_.length;E++){var u=_[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(A,u.key,u)}}function U(A,_,E){return _&&W(A.prototype,_),E&&W(A,E),A}function R(A,_){A.prototype=Object.create(_.prototype),A.prototype.constructor=A,y(A,_)}function y(A,_){return y=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},y(A,_)}var C=function(A){R(_,A);function _(u){var o;return o=A.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var E=_.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},E.registerListeners=function(){var o=this.hls;o.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on($.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var o=this.hls;o.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off($.Events.ERROR,this.onError,this)},E.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.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=k(this.media.textTracks);o.forEach(function(s){Object(O.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},E.onSubtitleTrackLoaded=function(o,s){var d=s.id,w=s.details,m=this.trackId,g=this.tracksInGroup[m];if(!g){this.warn("Invalid subtitle track id "+d);return}var L=g.details;g.details=s.details,this.log("subtitle track "+d+" loaded ["+w.startSN+"-"+w.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,L))},E.onLevelLoading=function(o,s){this.switchLevel(s.level)},E.onLevelSwitching=function(o,s){this.switchLevel(s.level)},E.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var d=s.textGroupIds[s.urlId];if(this.groupId!==d){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=m;var g=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=d;var L={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger($.Events.SUBTITLE_TRACKS_UPDATED,L),g!==-1&&this.setSubtitleTrack(g,w)}},E.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var w=s[d];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},E.onError=function(o,s){if(A.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===z.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},E.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var d=s.id,w=s.groupId,m=s.url;if(o)try{m=o.addDirectives(m)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:m,id:d,groupId:w,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var s=this,d=this.media,w=this.subtitleDisplay,m=this.trackId;if(!d)return;var g=k(d.textTracks),L=g.filter(function(p){return p.groupId===s.groupId});if(o===-1)[].slice.call(g).forEach(function(p){p.mode="disabled"});else{var b=L[m];b&&(b.mode="disabled")}var c=L[o];c&&(c.mode=w?"showing":"hidden")},E.setSubtitleTrack=function(o,s){var d,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=w[o])!==null&&d!==void 0&&d.details)||o<-1||o>=w.length)return;this.clearTimer();var m=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,m){var g=m.id,L=m.groupId,b=L===void 0?"":L,c=m.name,p=m.type,h=m.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:b,name:c,type:p,url:h});var a=this.switchParams(m.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=k(this.media.textTracks),d=0;d<s.length;d++)if(s[d].mode==="hidden")o=d;else if(s[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},U(_,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),_}(M.default);function k(A){for(var _=[],E=0;E<A.length;E++){var u=A[E];u.kind==="subtitles"&&u.label&&_.push(A[E])}return _}J.default=C},"./src/controller/timeline-controller.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"TimelineController",function(){return k});var $=D("./src/polyfills/number.ts"),O=D("./src/events.ts"),M=D("./src/utils/cea-608-parser.ts"),z=D("./src/utils/output-filter.ts"),W=D("./src/utils/webvtt-parser.ts"),U=D("./src/utils/texttrack-utils.ts"),R=D("./src/utils/imsc1-ttml-parser.ts"),y=D("./src/types/loader.ts"),C=D("./src/utils/logger.ts"),k=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new z.default(this,"textTrack1"),w=new z.default(this,"textTrack2"),m=new z.default(this,"textTrack3"),g=new z.default(this,"textTrack4");this.cea608Parser1=new M.default(1,d,w),this.cea608Parser2=new M.default(3,m,g)}s.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(O.Events.FRAG_LOADING,this.onFragLoading,this),s.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var d=this.hls;d.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,w,m,g,L){for(var b=!1,c=L.length;c--;){var p=L[c],h=_(p[0],p[1],w,m);if(h>=0&&(p[0]=Math.min(p[0],w),p[1]=Math.max(p[1],m),b=!0,h/(m-w)>.5))return}if(b||L.push([w,m]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,w,m,g)}else{var x=this.Cues.newCue(null,w,m,g);this.hls.trigger(O.Events.CUES_PARSED,{type:"captions",cues:x,track:d})}},o.onInitPtsFound=function(d,w){var m=this,g=w.frag,L=w.id,b=w.initPTS,c=w.timescale,p=this.unparsedVttFrags;L==="main"&&(this.initPTS[g.cc]=b,this.timescale[g.cc]=c),p.length&&(this.unparsedVttFrags=[],p.forEach(function(h){m.onFragLoaded(O.Events.FRAG_LOADED,h)}))},o.getExistingTrack=function(d){var w=this.media;if(w)for(var m=0;m<w.textTracks.length;m++){var g=w.textTracks[m];if(g[d])return g}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var w=this.captionsProperties,m=this.captionsTracks,g=this.media,L=w[d],b=L.label,c=L.languageCode,p=this.getExistingTrack(d);if(p)m[d]=p,Object(U.clearCurrentCues)(m[d]),Object(U.sendAddTrackEvent)(m[d],g);else{var h=this.createTextTrack("captions",b,c);h&&(h[d]=!0,m[d]=h)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var w=this.captionsProperties[d];if(!w)return;var m=w.label,g={_id:d,label:m,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[d]=g,this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},o.createTextTrack=function(d,w,m){var g=this.media;return g?g.addTextTrack(d,w,m):void 0},o.onMediaAttaching=function(d,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(w){Object(U.clearCurrentCues)(d[w]),delete d[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var w=d.textTracks;if(w)for(var m=0;m<w.length;m++)Object(U.clearCurrentCues)(w[m])},o.onSubtitleTracksUpdated=function(d,w){var m=this;this.textTracks=[];var g=w.subtitleTracks||[],L=g.some(function(h){return h.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var b=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,a){var x;if(a<c.length){for(var v=null,S=0;S<c.length;S++)if(A(c[S],h)){v=c[S];break}v&&(x=v)}x?Object(U.clearCurrentCues)(x):(x=m.createTextTrack("subtitles",h.name,h.lang),x&&(x.mode="disabled")),x&&(x.groupId=h.groupId,m.textTracks.push(x))})}else if(!b&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},o.onManifestLoaded=function(d,w){var m=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(g){var L=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!L)return;var b="textTrack"+L[1],c=m.captionsProperties[b];if(!c)return;c.label=g.name,g.lang&&(c.languageCode=g.lang),c.media=g})},o.onFragLoading=function(d,w){var m=this.cea608Parser1,g=this.cea608Parser2,L=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(m&&g))return;if(w.frag.type===y.PlaylistLevelType.MAIN){var c,p,h=w.frag.sn,a=(c=w==null||((p=w.part)===null||p===void 0)?void 0:p.index)!=null?c:-1;h===L+1||h===L&&a===b+1||(m.reset(),g.reset()),this.lastSn=h,this.lastPartIndex=a}},o.onFragLoaded=function(d,w){var m=w.frag,g=w.payload,L=this.initPTS,b=this.unparsedVttFrags;if(m.type===y.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object($.isFiniteNumber)(L[m.cc])){b.push(w),L.length&&this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var c=m.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var p=this.tracks[m.level],h=this.vttCCs;h[m.cc]||(h[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),p&&p.textCodec===R.IMSC1_CODEC?this._parseIMSC1(m,g):this._parseVTTs(m,g,h)}}else this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,w){var m=this,g=this.hls;Object(R.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(L){m._appendCues(L,d.level),g.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(L){C.logger.log("Failed to parse IMSC1: "+L),g.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:L})})},o._parseVTTs=function(d,w,m){var g=this,L=this.hls;Object(W.parseWebVTT)(w,this.initPTS[d.cc],this.timescale[d.cc],m,d.cc,d.start,function(b){g._appendCues(b,d.level),L.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){g._fallbackToIMSC1(d,w),C.logger.log("Failed to parse VTT cue: "+b),L.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,w){var m=this,g=this.tracks[d.level];g.textCodec||Object(R.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(){g.textCodec=R.IMSC1_CODEC,m._parseIMSC1(d,w)},function(){g.textCodec="wvtt"})},o._appendCues=function(d,w){var m=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[w];if(g.mode==="disabled")return;d.forEach(function(c){return Object(U.addCueToTrack)(g,c)})}else{var L=this.tracks[w],b=L.default?"default":"subtitles"+w;m.trigger(O.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,w){var m=w.frag;if(m.type===y.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(O.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,w){var m=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(m&&g))return;for(var L=0;L<w.samples.length;L++){var b=w.samples[L].bytes;if(b){var c=this.extractCea608Data(b);m.addData(w.samples[L].pts,c[0]),g.addData(w.samples[L].pts,c[1])}}},o.onBufferFlushing=function(d,w){var m=w.startOffset,g=w.endOffset,L=w.endOffsetSubtitles,b=w.type,c=this.media;if(!c||c.currentTime<g)return;if(!b||b==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(a){return Object(U.removeCuesInRange)(p[a],m,g)})}if(this.config.renderTextTracksNatively&&(m===0&&L!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(a){return Object(U.removeCuesInRange)(h[a],m,L)})}},o.extractCea608Data=function(d){for(var w=d[0]&31,m=2,g=[[],[]],L=0;L<w;L++){var b=d[m++],c=127&d[m++],p=127&d[m++],h=(4&b)!==0,a=3&b;if(c===0&&p===0)continue;h&&((a===0||a===1)&&(g[a].push(c),g[a].push(p)))}return g},u}();function A(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function _(u,o,s,d){return Math.min(o,d)-Math.max(u,s)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return $});var $=function(){function O(z,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=z,this.aesIV=W}var M=O.prototype;return M.decrypt=function(W,U){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},U,W)},O}()},"./src/crypt/aes-decryptor.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"removePadding",function(){return O}),D.d(J,"default",function(){return M});var $=D("./src/utils/typed-array.ts");function O(z){var W=z.byteLength,U=W&&new DataView(z.buffer).getUint8(W-1);return U?Object($.sliceUint8)(z,0,W-U):z}var M=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 W=z.prototype;return W.uint8ArrayToUint32Array_=function(R){for(var y=new DataView(R),C=new Uint32Array(4),k=0;k<4;k++)C[k]=y.getUint32(k*4);return C},W.initTable=function(){var R=this.sBox,y=this.invSBox,C=this.subMix,k=C[0],A=C[1],_=C[2],E=C[3],u=this.invSubMix,o=u[0],s=u[1],d=u[2],w=u[3],m=new Uint32Array(256),g=0,L=0,b=0;for(b=0;b<256;b++)b<128?m[b]=b<<1:m[b]=b<<1^283;for(b=0;b<256;b++){var c=L^L<<1^L<<2^L<<3^L<<4;c=c>>>8^c&255^99,R[g]=c,y[c]=g;var p=m[g],h=m[p],a=m[h],x=m[c]*257^c*16843008;k[g]=x<<24|x>>>8,A[g]=x<<16|x>>>16,_[g]=x<<8|x>>>24,E[g]=x,x=a*16843009^h*65537^p*257^g*16843008,o[c]=x<<24|x>>>8,s[c]=x<<16|x>>>16,d[c]=x<<8|x>>>24,w[c]=x,g?(g=p^m[m[m[a^p]]],L^=m[m[L]]):g=L=1}},W.expandKey=function(R){for(var y=this.uint8ArrayToUint32Array_(R),C=!0,k=0;k<y.length&&C;)C=y[k]===this.key[k],k++;if(C)return;this.key=y;var A=this.keySize=y.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var _=this.ksRows=(A+6+1)*4,E,u,o=this.keySchedule=new Uint32Array(_),s=this.invKeySchedule=new Uint32Array(_),d=this.sBox,w=this.rcon,m=this.invSubMix,g=m[0],L=m[1],b=m[2],c=m[3],p,h;for(E=0;E<_;E++){if(E<A){p=o[E]=y[E];continue}h=p,E%A===0?(h=h<<8|h>>>24,h=d[h>>>24]<<24|d[h>>>16&255]<<16|d[h>>>8&255]<<8|d[h&255],h^=w[E/A|0]<<24):A>6&&E%A===4&&(h=d[h>>>24]<<24|d[h>>>16&255]<<16|d[h>>>8&255]<<8|d[h&255]),o[E]=p=(o[E-A]^h)>>>0}for(u=0;u<_;u++)E=_-u,u&3?h=o[E]:h=o[E-4],u<4||E<=4?s[u]=h:s[u]=g[d[h>>>24]]^L[d[h>>>16&255]]^b[d[h>>>8&255]]^c[d[h&255]],s[u]=s[u]>>>0},W.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},W.decrypt=function(R,y,C){for(var k=this.keySize+6,A=this.invKeySchedule,_=this.invSBox,E=this.invSubMix,u=E[0],o=E[1],s=E[2],d=E[3],w=this.uint8ArrayToUint32Array_(C),m=w[0],g=w[1],L=w[2],b=w[3],c=new Int32Array(R),p=new Int32Array(c.length),h,a,x,v,S,B,F,K,V,P,I,Y,ee,oe,pe=this.networkToHostOrderSwap;y<c.length;){for(V=pe(c[y]),P=pe(c[y+1]),I=pe(c[y+2]),Y=pe(c[y+3]),S=V^A[0],B=Y^A[1],F=I^A[2],K=P^A[3],ee=4,oe=1;oe<k;oe++)h=u[S>>>24]^o[B>>16&255]^s[F>>8&255]^d[K&255]^A[ee],a=u[B>>>24]^o[F>>16&255]^s[K>>8&255]^d[S&255]^A[ee+1],x=u[F>>>24]^o[K>>16&255]^s[S>>8&255]^d[B&255]^A[ee+2],v=u[K>>>24]^o[S>>16&255]^s[B>>8&255]^d[F&255]^A[ee+3],S=h,B=a,F=x,K=v,ee=ee+4;h=_[S>>>24]<<24^_[B>>16&255]<<16^_[F>>8&255]<<8^_[K&255]^A[ee],a=_[B>>>24]<<24^_[F>>16&255]<<16^_[K>>8&255]<<8^_[S&255]^A[ee+1],x=_[F>>>24]<<24^_[K>>16&255]<<16^_[S>>8&255]<<8^_[B&255]^A[ee+2],v=_[K>>>24]<<24^_[S>>16&255]<<16^_[B>>8&255]<<8^_[F&255]^A[ee+3],p[y]=pe(h^m),p[y+1]=pe(v^g),p[y+2]=pe(x^L),p[y+3]=pe(a^b),m=V,g=P,L=I,b=Y,y=y+4}return p.buffer},z}()},"./src/crypt/decrypter.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return y});var $=D("./src/crypt/aes-crypto.ts"),O=D("./src/crypt/fast-aes-key.ts"),M=D("./src/crypt/aes-decryptor.ts"),z=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),U=D("./src/utils/typed-array.ts"),R=16,y=function(){function C(A,_,E){var u=E===void 0?{}:E,o=u.removePKCS7Padding,s=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=A,this.config=_,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var k=C.prototype;return k.destroy=function(){this.observer=null},k.isSync=function(){return this.config.enableSoftwareAES},k.flush=function(){var _=this.currentResult;if(!_){this.reset();return}var E=new Uint8Array(_);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(E):E},k.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},k.decrypt=function(_,E,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(_),E,u);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(_),E,u).then(o)},k.softwareDecrypt=function(_,E,u){var o=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(_=Object(W.appendUint8Array)(d,_),this.remainderData=null);var w=this.getValidChunk(_);if(!w.length)return null;o&&(u=o);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new M.default),m.expandKey(E);var g=s;return this.currentResult=m.decrypt(w.buffer,0,u),this.currentIV=Object(U.sliceUint8)(w,-16).buffer,g||null},k.webCryptoDecrypt=function(_,E,u){var o=this,s=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new O.default(s,E)),this.fastAesKey.expandKey().then(function(d){if(!s)return Promise.reject(new Error("web crypto not initialized"));var w=new $.default(s,u);return w.decrypt(_.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,_,E,u)})},k.onWebCryptoError=function(_,E,u,o){return z.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",_),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,u,o)},k.getValidChunk=function(_){var E=_,u=_.length-_.length%R;return u!==_.length&&(E=Object(U.sliceUint8)(_,0,u),this.remainderData=Object(U.sliceUint8)(_,u)),E},k.logOnce=function(_){if(!this.logEnabled)return;z.logger.log("[decrypter.ts]: "+_),this.logEnabled=!1},C}()},"./src/crypt/fast-aes-key.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return $});var $=function(){function O(z,W){this.subtle=void 0,this.key=void 0,this.subtle=z,this.key=W}var M=O.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},O}()},"./src/demux/aacdemuxer.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/demux/base-audio-demuxer.ts"),O=D("./src/demux/adts.ts"),M=D("./src/utils/logger.ts"),z=D("./src/demux/id3.ts");function W(y,C){y.prototype=Object.create(C.prototype),y.prototype.constructor=y,U(y,C)}function U(y,C){return U=Object.setPrototypeOf||function(A,_){return A.__proto__=_,A},U(y,C)}var R=function(y){W(C,y);function C(A,_){var E;return E=y.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=A,E.config=_,E}var k=C.prototype;return k.resetInitSegment=function(_,E,u){y.prototype.resetInitSegment.call(this,_,E,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:_,duration:u,inputTimeScale:9e4,dropped:0}},C.probe=function(_){if(!_)return!1;for(var E=z.getID3Data(_,0)||[],u=E.length,o=_.length;u<o;u++)if(O.probe(_,u))return M.logger.log("ADTS sync word found !"),!0;return!1},k.canParse=function(_,E){return O.canParse(_,E)},k.appendFrame=function(_,E,u){O.initTrackConfig(_,this.observer,E,u,_.manifestCodec);var o=O.appendFrame(_,E,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},C}($.default);R.minProbeByteLength=9,J.default=R},"./src/demux/adts.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"getAudioConfig",function(){return z}),D.d(J,"isHeaderPattern",function(){return W}),D.d(J,"getHeaderLength",function(){return U}),D.d(J,"getFullFrameLength",function(){return R}),D.d(J,"canGetFrameLength",function(){return y}),D.d(J,"isHeader",function(){return C}),D.d(J,"canParse",function(){return k}),D.d(J,"probe",function(){return A}),D.d(J,"initTrackConfig",function(){return _}),D.d(J,"getFrameDuration",function(){return E}),D.d(J,"parseFrameHeader",function(){return u}),D.d(J,"appendFrame",function(){return o});var $=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),M=D("./src/events.ts");function z(s,d,w,m){var g,L,b,c,p=navigator.userAgent.toLowerCase(),h=m,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((d[w+2]&192)>>>6)+1;var x=(d[w+2]&60)>>>2;if(x>a.length-1){s.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return b=(d[w+2]&1)<<2,b|=(d[w+3]&192)>>>6,$.logger.log("manifest codec:"+m+", ADTS type:"+g+", samplingIndex:"+x),/firefox/i.test(p)?x>=6?(g=5,c=new Array(4),L=x-3):(g=2,c=new Array(2),L=x):p.indexOf("android")!==-1?(g=2,c=new Array(2),L=x):(g=5,c=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&x>=6?L=x-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(x>=6&&b===1||/vivaldi/i.test(p))||!m&&b===1)&&(g=2,c=new Array(2)),L=x)),c[0]=g<<3,c[0]|=(x&14)>>1,c[1]|=(x&1)<<7,c[1]|=b<<3,g===5&&(c[1]|=(L&14)>>1,c[2]=(L&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:a[x],channelCount:b,codec:"mp4a.40."+g,manifestCodec:h}}function W(s,d){return s[d]===255&&(s[d+1]&246)===240}function U(s,d){return s[d+1]&1?7:9}function R(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function y(s,d){return d+5<s.length}function C(s,d){return d+1<s.length&&W(s,d)}function k(s,d){return y(s,d)&&W(s,d)&&R(s,d)<=s.length-d}function A(s,d){if(C(s,d)){var w=U(s,d);if(d+w>=s.length)return!1;var m=R(s,d);if(m<=w)return!1;var g=d+m;return g===s.length||C(s,g)}return!1}function _(s,d,w,m,g){if(!s.samplerate){var L=z(d,w,m,g);if(!L)return;s.config=L.config,s.samplerate=L.samplerate,s.channelCount=L.channelCount,s.codec=L.codec,s.manifestCodec=L.manifestCodec,$.logger.log("parsed codec:"+s.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function E(s){return 1024*9e4/s}function u(s,d,w,m,g){var L=U(s,d),b=R(s,d);if(b-=L,b>0){var c=w+m*g;return{headerLength:L,frameLength:b,stamp:c}}}function o(s,d,w,m,g){var L=E(s.samplerate),b=u(d,w,m,g,L);if(b){var c=b.frameLength,p=b.headerLength,h=b.stamp,a=p+c,x=Math.max(0,w+a-d.length),v;x?(v=new Uint8Array(a-p),v.set(d.subarray(w+p,d.length),0)):v=d.subarray(w+p,w+a);var S={unit:v,pts:h};return x||s.samples.push(S),{sample:S,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"initPTSFn",function(){return R});var $=D("./src/polyfills/number.ts"),O=D("./src/demux/id3.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),z=D("./src/utils/mp4-tools.ts"),W=D("./src/utils/typed-array.ts"),U=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var C=y.prototype;return C.resetInitSegment=function(A,_,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},C.resetTimeStamp=function(){},C.resetContiguity=function(){},C.canParse=function(A,_){return!1},C.appendFrame=function(A,_,E){},C.demux=function(A,_){this.cachedData&&(A=Object(z.appendUint8Array)(this.cachedData,A),this.cachedData=null);var E=O.getID3Data(A,0),u=E?E.length:0,o,s,d=this._audioTrack,w=this._id3Track,m=E?O.getTimeStamp(E):void 0,g=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(m,_)),E&&E.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),s=this.initPTS;u<g;){if(this.canParse(A,u)){var L=this.appendFrame(d,A,u);L?(this.frameIndex++,s=L.sample.pts,u+=L.length,o=u):u=g}else O.canParse(A,u)?(E=O.getID3Data(A,u),w.samples.push({pts:s,dts:s,data:E}),u+=E.length,o=u):u++;if(u===g&&o!==g){var b=Object(W.sliceUint8)(A,o);this.cachedData?this.cachedData=Object(z.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(M.dummyTrack)(),id3Track:w,textTrack:Object(M.dummyTrack)()}},C.demuxSampleAes=function(A,_,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},C.flush=function(A){var _=this.cachedData;return _&&(this.cachedData=null,this.demux(_,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},C.destroy=function(){},y}(),R=function(C,k){return Object($.isFiniteNumber)(C)?C*90:k*9e4};J.default=U},"./src/demux/chunk-cache.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return $});var $=function(){function M(){this.chunks=[],this.dataLength=0}var z=M.prototype;return z.push=function(U){this.chunks.push(U),this.dataLength+=U.length},z.flush=function(){var U=this.chunks,R=this.dataLength,y;if(U.length)U.length===1?y=U[0]:y=O(U,R);else return new Uint8Array(0);return this.reset(),y},z.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function O(M,z){for(var W=new Uint8Array(z),U=0,R=0;R<M.length;R++){var y=M[R];W.set(y,U),U+=y.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"dummyTrack",function(){return $});function $(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/utils/logger.ts"),O=function(){function M(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var z=M.prototype;return z.loadWord=function(){var U=this.data,R=this.bytesAvailable,y=U.byteLength-R,C=new Uint8Array(4),k=Math.min(4,R);if(k===0)throw new Error("no bytes available");C.set(U.subarray(y,y+k)),this.word=new DataView(C.buffer).getUint32(0),this.bitsAvailable=k*8,this.bytesAvailable-=k},z.skipBits=function(U){var R;this.bitsAvailable>U?(this.word<<=U,this.bitsAvailable-=U):(U-=this.bitsAvailable,R=U>>3,U-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=U,this.bitsAvailable-=U)},z.readBits=function(U){var R=Math.min(this.bitsAvailable,U),y=this.word>>>32-R;return U>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=U-R,R>0&&this.bitsAvailable?y<<R|this.readBits(R):y},z.skipLZ=function(){var U;for(U=0;U<this.bitsAvailable;++U)if((this.word&2147483648>>>U)!==0)return this.word<<=U,this.bitsAvailable-=U,U;return this.loadWord(),U+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var U=this.skipLZ();return this.readBits(U+1)-1},z.readEG=function(){var U=this.readUEG();return 1&U?1+U>>>1:-1*(U>>>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(U){for(var R=8,y=8,C,k=0;k<U;k++)y!==0&&(C=this.readEG(),y=(R+C+256)%256),R=y===0?R:y},z.readSPS=function(){var U=0,R=0,y=0,C=0,k,A,_,E=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),w=this.skipEG.bind(this),m=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);E();var L=E();if(u(5),d(3),E(),m(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var b=o();if(b===3&&d(1),m(),m(),d(1),s())for(A=b!==3?8:12,_=0;_<A;_++)s()&&(_<6?g(16):g(64))}m();var c=o();if(c===0)o();else if(c===1)for(d(1),w(),w(),k=o(),_=0;_<k;_++)w();m(),d(1);var p=o(),h=o(),a=u(1);a===0&&d(1),d(1),s()&&(U=o(),R=o(),y=o(),C=o());var x=[1,1];if(s()&&s()){var v=E();switch(v){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((p+1)*16-U*2-R*2),height:(2-a)*(h+1)*16-(a?2:4)*(y+C),pixelRatio:x}},z.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();J.default=O},"./src/demux/id3.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"isHeader",function(){return $}),D.d(J,"isFooter",function(){return O}),D.d(J,"getID3Data",function(){return M}),D.d(J,"canParse",function(){return W}),D.d(J,"getTimeStamp",function(){return U}),D.d(J,"isTimeStampFrame",function(){return R}),D.d(J,"getID3Frames",function(){return C}),D.d(J,"decodeFrame",function(){return k}),D.d(J,"utf8ArrayToStr",function(){return o}),D.d(J,"testables",function(){return s});var $=function(g,L){return L+10<=g.length&&(g[L]===73&&g[L+1]===68&&g[L+2]===51&&(g[L+3]<255&&g[L+4]<255&&(g[L+6]<128&&g[L+7]<128&&g[L+8]<128&&g[L+9]<128)))},O=function(g,L){return L+10<=g.length&&(g[L]===51&&g[L+1]===68&&g[L+2]===73&&(g[L+3]<255&&g[L+4]<255&&(g[L+6]<128&&g[L+7]<128&&g[L+8]<128&&g[L+9]<128)))},M=function(g,L){for(var b=L,c=0;$(g,L);){c+=10;var p=z(g,L+6);c+=p,O(g,L+10)&&(c+=10),L+=c}return c>0?g.subarray(b,b+c):void 0},z=function(g,L){var b=0;return b=(g[L]&127)<<21,b|=(g[L+1]&127)<<14,b|=(g[L+2]&127)<<7,b|=g[L+3]&127,b},W=function(g,L){return $(g,L)&&z(g,L+6)+10<=g.length-L},U=function(g){for(var L=C(g),b=0;b<L.length;b++){var c=L[b];if(R(c))return u(c)}return},R=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},y=function(g){var L=String.fromCharCode(g[0],g[1],g[2],g[3]),b=z(g,4),c=10;return{type:L,size:b,data:g.subarray(c,c+b)}},C=function(g){for(var L=0,b=[];$(g,L);){var c=z(g,L+6);L+=10;for(var p=L+c;L+8<p;){var h=y(g.subarray(L)),a=k(h);a&&b.push(a),L+=h.size+10}O(g,L)&&(L+=10)}return b},k=function(g){return g.type==="PRIV"?A(g):g.type[0]==="W"?E(g):_(g)},A=function(g){if(g.size<2)return;var L=o(g.data,!0),b=new Uint8Array(g.data.subarray(L.length+1));return{key:g.type,info:L,data:b.buffer}},_=function(g){if(g.size<2)return;if(g.type==="TXXX"){var L=1,b=o(g.data.subarray(L),!0);L+=b.length+1;var c=o(g.data.subarray(L));return{key:g.type,info:b,data:c}}var p=o(g.data.subarray(1));return{key:g.type,data:p}},E=function(g){if(g.type==="WXXX"){if(g.size<2)return;var L=1,b=o(g.data.subarray(L),!0);L+=b.length+1;var c=o(g.data.subarray(L));return{key:g.type,info:b,data:c}}var p=o(g.data);return{key:g.type,data:p}},u=function(g){if(g.data.byteLength===8){var L=new Uint8Array(g.data),b=L[3]&1,c=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return c/=45,b&&(c+=4772185884e-2),Math.round(c)}return},o=function(g,L){L===void 0&&(L=!1);var b=w();if(b){var c=b.decode(g);if(L){var p=c.indexOf("\0");return p!==-1?c.substring(0,p):c}return c.replace(/\0/g,"")}for(var h=g.length,a,x,v,S="",B=0;B<h;){if(a=g[B++],a===0&&L)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:x=g[B++],S+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=g[B++],v=g[B++],S+=String.fromCharCode((a&15)<<12|(x&63)<<6|(v&63)<<0);break;default:}}return S},s={decodeTextFrame:_},d;function w(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/demux/base-audio-demuxer.ts"),O=D("./src/demux/id3.ts"),M=D("./src/utils/logger.ts"),z=D("./src/demux/mpegaudio.ts");function W(y,C){y.prototype=Object.create(C.prototype),y.prototype.constructor=y,U(y,C)}function U(y,C){return U=Object.setPrototypeOf||function(A,_){return A.__proto__=_,A},U(y,C)}var R=function(y){W(C,y);function C(){return y.apply(this,arguments)||this}var k=C.prototype;return k.resetInitSegment=function(_,E,u){y.prototype.resetInitSegment.call(this,_,E,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:_,duration:u,inputTimeScale:9e4,dropped:0}},C.probe=function(_){if(!_)return!1;for(var E=O.getID3Data(_,0)||[],u=E.length,o=_.length;u<o;u++)if(z.probe(_,u))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},k.canParse=function(_,E){return z.canParse(_,E)},k.appendFrame=function(_,E,u){return this.initPTS===null?void 0:z.appendFrame(_,E,u,this.initPTS,this.frameIndex)},C}($.default);R.minProbeByteLength=4,J.default=R},"./src/demux/mp4demuxer.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/utils/mp4-tools.ts"),O=D("./src/demux/dummy-demuxed-track.ts"),M=function(){function z(U,R){this.remainderData=null,this.config=void 0,this.config=R}var W=z.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},z.probe=function(R){return Object($.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},W.demux=function(R){var y=R,C=Object(O.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object($.appendUint8Array)(this.remainderData,R));var k=Object($.segmentValidRange)(y);this.remainderData=k.remainder,C.samples=k.valid||new Uint8Array}else C.samples=y;return{audioTrack:Object(O.dummyTrack)(),avcTrack:C,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},W.flush=function(){var R=Object(O.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(O.dummyTrack)(),avcTrack:R,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},W.demuxSampleAes=function(R,y,C){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},z}();M.minProbeByteLength=1024,J.default=M},"./src/demux/mpegaudio.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"appendFrame",function(){return U}),D.d(J,"parseHeader",function(){return R}),D.d(J,"isHeaderPattern",function(){return y}),D.d(J,"isHeader",function(){return C}),D.d(J,"canParse",function(){return k}),D.d(J,"probe",function(){return A});var $=null,O=[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],M=[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]],W=[0,1,1,4];function U(_,E,u,o,s){if(u+24>E.length)return;var d=R(E,u);if(d&&u+d.frameLength<=E.length){var w=d.samplesPerFrame*9e4/d.sampleRate,m=o+s*w,g={unit:E.subarray(u,u+d.frameLength),pts:m,dts:m};return _.config=[],_.channelCount=d.channelCount,_.samplerate=d.sampleRate,_.samples.push(g),{sample:g,length:d.frameLength,missing:0}}}function R(_,E){var u=_[E+1]>>3&3,o=_[E+1]>>1&3,s=_[E+2]>>4&15,d=_[E+2]>>2&3;if(u!==1&&s!==0&&s!==15&&d!==3){var w=_[E+2]>>1&1,m=_[E+3]>>6,g=u===3?3-o:o===3?3:4,L=O[g*14+s-1]*1e3,b=u===3?0:u===2?1:2,c=M[b*3+d],p=m===3?1:2,h=z[u][o],a=W[o],x=h*8*a,v=Math.floor(h*L/c+w)*a;if($===null){var S=navigator.userAgent||"",B=S.match(/Chrome\/(\d+)/i);$=B?parseInt(B[1]):0}var F=!!$&&$<=87;return F&&o===2&&L>=224e3&&m===0&&(_[E+3]=_[E+3]|128),{sampleRate:c,channelCount:p,frameLength:v,samplesPerFrame:x}}}function y(_,E){return _[E]===255&&(_[E+1]&224)===224&&(_[E+1]&6)!==0}function C(_,E){return E+1<_.length&&y(_,E)}function k(_,E){var u=4;return y(_,E)&&u<=_.length-E}function A(_,E){if(E+1<_.length&&y(_,E)){var u=4,o=R(_,E),s=u;o!=null&&o.frameLength&&(s=o.frameLength);var d=E+s;return d===_.length||C(_,d)}return!1}},"./src/demux/sample-aes.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/crypt/decrypter.ts"),O=D("./src/demux/tsdemuxer.ts"),M=function(){function z(U,R,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new $.default(U,R,{removePKCS7Padding:!1})}var W=z.prototype;return W.decryptBuffer=function(R,y){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,y)},W.decryptAacSample=function(R,y,C,k){var A=R[y].unit,_=A.subarray(16,A.length-A.length%16),E=_.buffer.slice(_.byteOffset,_.byteOffset+_.length),u=this;this.decryptBuffer(E,function(o){var s=new Uint8Array(o);A.set(s,16),k||u.decryptAacSamples(R,y+1,C)})},W.decryptAacSamples=function(R,y,C){for(;;y++){if(y>=R.length){C();return}if(R[y].unit.length<32)continue;var k=this.decrypter.isSync();if(this.decryptAacSample(R,y,C,k),!k)return}},W.getAvcEncryptedData=function(R){for(var y=Math.floor((R.length-48)/160)*16+16,C=new Int8Array(y),k=0,A=32;A<=R.length-16;A+=160,k+=16)C.set(R.subarray(A,A+16),k);return C},W.getAvcDecryptedUnit=function(R,y){for(var C=new Uint8Array(y),k=0,A=32;A<=R.length-16;A+=160,k+=16)R.set(C.subarray(k,k+16),A);return R},W.decryptAvcSample=function(R,y,C,k,A,_){var E=Object(O.discardEPB)(A.data),u=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(u.buffer,function(s){A.data=o.getAvcDecryptedUnit(E,s),_||o.decryptAvcSamples(R,y,C+1,k)})},W.decryptAvcSamples=function(R,y,C,k){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,C=0){if(y>=R.length){k();return}for(var A=R[y].units;!(C>=A.length);C++){var _=A[C];if(_.data.length<=48||_.type!==1&&_.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(R,y,C,k,_,E),!E)return}}},z}();J.default=M},"./src/demux/transmuxer-interface.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return A});var $=D("./node_modules/webworkify-webpack/index.js"),O=D.n($),M=D("./src/events.ts"),z=D("./src/demux/transmuxer.ts"),W=D("./src/utils/logger.ts"),U=D("./src/errors.ts"),R=D("./src/utils/mediasource-helper.ts"),y=D("./node_modules/eventemitter3/index.js"),C=D.n(y),k=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function _(u,o,s,d){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var m=u.config,g=function(h,a){a=a||{},a.frag=w.frag,a.id=w.id,u.trigger(h,a)};this.observer=new y.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,g),this.observer.on(M.Events.ERROR,g);var L={mp4:k.isTypeSupported("video/mp4"),mpeg:k.isTypeSupported("audio/mpeg"),mp3:k.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var c;try{c=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(p){u.trigger(M.Events.ERROR,{type:U.ErrorTypes.OTHER_ERROR,details:U.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},c.postMessage({cmd:"init",typeSupported:L,vendor:b,id:o,config:JSON.stringify(m)})}catch(p){W.logger.warn("Error in worker:",p),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new z.default(this.observer,L,m,b,o),this.worker=null}}else this.transmuxer=new z.default(this.observer,L,m,b,o)}var E=_.prototype;return E.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},E.push=function(o,s,d,w,m,g,L,b,c,p){var h=this;c.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,v=g?g.start:m.start,S=m.decryptdata,B=this.frag,F=!(B&&m.cc===B.cc),K=!(B&&c.level===B.level),V=B?c.sn-B.sn:-1,P=this.part?c.part-this.part.index:1,I=!K&&(V===1||V===0&&P===1),Y=self.performance.now();(K||V||m.stats.parsing.start===0)&&(m.stats.parsing.start=Y),g&&(P||!I)&&(g.stats.parsing.start=Y);var ee=new z.TransmuxState(F,I,b,K,v);if(!I||F){W.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
discontinuity: `+F+`
trackSwitch: `+K+`
contiguous: `+I+`
accurateTimeOffset: `+b+`
timeOffset: `+v);var oe=new z.TransmuxConfig(d,w,s,L,p);this.configureTransmuxer(oe)}if(this.frag=m,this.part=g,x)x.postMessage({cmd:"demux",data:o,decryptdata:S,chunkMeta:c,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var pe=a.push(o,S,c,ee);Object(z.isPromise)(pe)?pe.then(function(Oe){h.handleTransmuxComplete(Oe)}):this.handleTransmuxComplete(pe)}},E.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(d){var m=d.flush(o);Object(z.isPromise)(m)?m.then(function(g){s.handleFlushResult(g,o)}):this.handleFlushResult(m,o)}},E.handleFlushResult=function(o,s){var d=this;o.forEach(function(w){d.handleTransmuxComplete(w)}),this.onFlush(s)},E.onWorkerMessage=function(o){var s=o.data,d=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,d.trigger(s.event,s.data);break}}},E.configureTransmuxer=function(o){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},_}()},"./src/demux/transmuxer-worker.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return U});var $=D("./src/demux/transmuxer.ts"),O=D("./src/events.ts"),M=D("./src/utils/logger.ts"),z=D("./node_modules/eventemitter3/index.js"),W=D.n(z);function U(A){var _=new z.EventEmitter,E=function(o,s){A.postMessage({event:o,data:s})};_.on(O.Events.FRAG_DECRYPTED,E),_.on(O.Events.ERROR,E),A.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);A.transmuxer=new $.default(_,o.typeSupported,s,o.vendor,o.id),Object(M.enableLogs)(s.debug),E("init",null);break}case"configure":{A.transmuxer.configure(o.config);break}case"demux":{var d=A.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object($.isPromise)(d)?d.then(function(g){R(A,g)}):R(A,d);break}case"flush":{var w=o.chunkMeta,m=A.transmuxer.flush(w);Object($.isPromise)(m)?m.then(function(g){C(A,g,w)}):C(A,m,w);break}default:break}})}function R(A,_){if(k(_.remuxResult))return;var E=[],u=_.remuxResult,o=u.audio,s=u.video;o&&y(E,o),s&&y(E,s),A.postMessage({event:"transmuxComplete",data:_},E)}function y(A,_){_.data1&&A.push(_.data1.buffer),_.data2&&A.push(_.data2.buffer)}function C(A,_,E){_.forEach(function(u){R(A,u)}),A.postMessage({event:"flush",data:E})}function k(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return s}),D.d(J,"isPromise",function(){return m}),D.d(J,"TransmuxConfig",function(){return g}),D.d(J,"TransmuxState",function(){return L});var $=D("./src/events.ts"),O=D("./src/errors.ts"),M=D("./src/crypt/decrypter.ts"),z=D("./src/demux/aacdemuxer.ts"),W=D("./src/demux/mp4demuxer.ts"),U=D("./src/demux/tsdemuxer.ts"),R=D("./src/demux/mp3demuxer.ts"),y=D("./src/remux/mp4-remuxer.ts"),C=D("./src/remux/passthrough-remuxer.ts"),k=D("./src/demux/chunk-cache.ts"),A=D("./src/utils/mp4-tools.ts"),_=D("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(b){_.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var u=[{demux:U.default,remux:y.default},{demux:W.default,remux:C.default},{demux:z.default,remux:y.default},{demux:R.default,remux:y.default}],o=1024;u.forEach(function(b){var c=b.demux;o=Math.max(o,c.minProbeByteLength)});var s=function(){function b(p,h,a,x,v){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new k.default,this.observer=p,this.typeSupported=h,this.config=a,this.vendor=x,this.id=v}var c=b.prototype;return c.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},c.push=function(h,a,x,v){var S=this,B=x.transmuxing;B.executeStart=E();var F=new Uint8Array(h),K=this.cache,V=this.config,P=this.currentTransmuxState,I=this.transmuxConfig;v&&(this.currentTransmuxState=v);var Y=d(F,a);if(Y&&Y.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(F,Y.key.buffer,Y.iv.buffer);if(!oe)return B.executeEnd=E(),w(x);F=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(F,Y.key.buffer,Y.iv.buffer).then(function(De){var Me=S.push(De,null,x);return S.decryptionPromise=null,Me}),this.decryptionPromise}var pe=v||P,Oe=pe.contiguous,xe=pe.discontinuity,_e=pe.trackSwitch,Te=pe.accurateTimeOffset,Ce=pe.timeOffset,me=I.audioCodec,le=I.videoCodec,te=I.defaultInitPts,ce=I.duration,ae=I.initSegmentData;if((xe||_e)&&this.resetInitSegment(ae,me,le,ce),xe&&this.resetInitialTimestamp(te),Oe||this.resetContiguity(),this.needsProbing(F,xe,_e)){if(K.dataLength){var Le=K.flush();F=Object(A.appendUint8Array)(Le,F)}this.configureTransmuxer(F,I)}var Re=this.transmux(F,Y,Ce,Te,x),Se=this.currentTransmuxState;return Se.contiguous=!0,Se.discontinuity=!1,Se.trackSwitch=!1,B.executeEnd=E(),Re},c.flush=function(h){var a=this,x=h.transmuxing;x.executeStart=E();var v=this.decrypter,S=this.cache,B=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(h)});var K=[],V=B.timeOffset;if(v){var P=v.flush();P&&K.push(this.push(P,null,h))}var I=S.dataLength;S.reset();var Y=this.demuxer,ee=this.remuxer;if(!Y||!ee)return I>=o&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=E(),[w(h)];var oe=Y.flush(V);return m(oe)?oe.then(function(pe){return a.flushRemux(K,pe,h),K}):(this.flushRemux(K,oe,h),K)},c.flushRemux=function(h,a,x){var v=a.audioTrack,S=a.avcTrack,B=a.id3Track,F=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,P=K.timeOffset;_.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var I=this.remuxer.remux(v,S,B,F,P,V,!0,this.id);h.push({remuxResult:I,chunkMeta:x}),x.transmuxing.executeEnd=E()},c.resetInitialTimestamp=function(h){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(h),x.resetTimeStamp(h)},c.resetContiguity=function(){var h=this.demuxer,a=this.remuxer;if(!h||!a)return;h.resetContiguity(),a.resetNextTimestamp()},c.resetInitSegment=function(h,a,x,v){var S=this.demuxer,B=this.remuxer;if(!S||!B)return;S.resetInitSegment(a,x,v),B.resetInitSegment(h,a,x)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(h,a,x,v,S){var B;return a&&a.method==="SAMPLE-AES"?B=this.transmuxSampleAes(h,a,x,v,S):B=this.transmuxUnencrypted(h,x,v,S),B},c.transmuxUnencrypted=function(h,a,x,v){var S=this.demuxer.demux(h,a,!1,!this.config.progressive),B=S.audioTrack,F=S.avcTrack,K=S.id3Track,V=S.textTrack,P=this.remuxer.remux(B,F,K,V,a,x,!1,this.id);return{remuxResult:P,chunkMeta:v}},c.transmuxSampleAes=function(h,a,x,v,S){var B=this;return this.demuxer.demuxSampleAes(h,a,x).then(function(F){var K=B.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,x,v,!1,B.id);return{remuxResult:K,chunkMeta:S}})},c.configureTransmuxer=function(h,a){for(var x=this.config,v=this.observer,S=this.typeSupported,B=this.vendor,F=a.audioCodec,K=a.defaultInitPts,V=a.duration,P=a.initSegmentData,I=a.videoCodec,Y,ee=0,oe=u.length;ee<oe;ee++)if(u[ee].demux.probe(h)){Y=u[ee];break}Y||(_.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:W.default,remux:C.default});var pe=this.demuxer,Oe=this.remuxer,xe=Y.remux,_e=Y.demux;(!Oe||!(Oe instanceof xe))&&(this.remuxer=new xe(v,x,S,B)),(!pe||!(pe instanceof _e))&&(this.demuxer=new _e(v,x,S),this.probe=_e.probe),this.resetInitSegment(P,F,I,V),this.resetInitialTimestamp(K)},c.needsProbing=function(h,a,x){return!this.demuxer||!this.remuxer||a||x},c.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new M.default(this.observer,this.config)),h},b}();function d(b,c){var p=null;return b.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(p=c),p}var w=function(c){return{remuxResult:{},chunkMeta:c}};function m(b){return"then"in b&&b.then instanceof Function}var g=function(c,p,h,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=p,this.initSegmentData=h,this.duration=a,this.defaultInitPts=x},L=function(c,p,h,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=p,this.accurateTimeOffset=h,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"discardEPB",function(){return w});var $=D("./src/demux/adts.ts"),O=D("./src/demux/mpegaudio.ts"),M=D("./src/demux/exp-golomb.ts"),z=D("./src/demux/id3.ts"),W=D("./src/demux/sample-aes.ts"),U=D("./src/events.ts"),R=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),C=D("./src/errors.ts"),k={video:1,audio:2,id3:3,text:4},A=function(){function m(L,b,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=b,this.typeSupported=c}m.probe=function(b){var c=m.syncOffset(b);return c<0?!1:(c&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},m.syncOffset=function(b){for(var c=Math.min(1e3,b.length-3*188),p=0;p<c;){if(b[p]===71&&b[p+188]===71&&b[p+2*188]===71)return p;p++}return-1},m.createTrack=function(b,c){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:k[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?c:void 0}};var g=m.prototype;return g.resetInitSegment=function(b,c,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",p),this._audioTrack=m.createTrack("audio",p),this._id3Track=m.createTrack("id3",p),this._txtTrack=m.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=c,this._duration=p},g.resetTimeStamp=function(){},g.resetContiguity=function(){var b=this._audioTrack,c=this._avcTrack,p=this._id3Track;b&&(b.pesData=null),c&&(c.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(b,c,p,h){p===void 0&&(p=!1),h===void 0&&(h=!1),p||(this.sampleAes=null);var a,x=this._avcTrack,v=this._audioTrack,S=this._id3Track,B=x.pid,F=x.pesData,K=v.pid,V=S.pid,P=v.pesData,I=S.pesData,Y=!1,ee=this.pmtParsed,oe=this._pmtId,pe=b.length;if(this.remainderData&&(b=Object(R.appendUint8Array)(this.remainderData,b),pe=b.length,this.remainderData=null),pe<188&&!h)return this.remainderData=b,{audioTrack:v,avcTrack:x,id3Track:S,textTrack:this._txtTrack};var Oe=Math.max(0,m.syncOffset(b));pe-=(pe+Oe)%188,pe<b.byteLength&&!h&&(this.remainderData=new Uint8Array(b.buffer,pe,b.buffer.byteLength-pe));for(var xe=Oe;xe<pe;xe+=188)if(b[xe]===71){var _e=!!(b[xe+1]&64),Te=((b[xe+1]&31)<<8)+b[xe+2],Ce=(b[xe+3]&48)>>4,me=void 0;if(Ce>1){if(me=xe+5+b[xe+4],me===xe+188)continue}else me=xe+4;switch(Te){case B:_e&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(b.subarray(me,xe+188)),F.size+=xe+188-me);break;case K:_e&&(P&&(a=o(P))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),P={data:[],size:0}),P&&(P.data.push(b.subarray(me,xe+188)),P.size+=xe+188-me);break;case V:_e&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(b.subarray(me,xe+188)),I.size+=xe+188-me);break;case 0:_e&&(me+=b[me]+1),oe=this._pmtId=E(b,me);break;case oe:{_e&&(me+=b[me]+1);var le=u(b,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);B=le.avc,B>0&&(x.pid=B),K=le.audio,K>0&&(v.pid=K,v.isAAC=le.isAAC),V=le.id3,V>0&&(S.pid=V),Y&&!ee&&(y.logger.log("reparse from beginning"),Y=!1,xe=Oe-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=F,v.pesData=P,S.pesData=I;var te={audioTrack:v,avcTrack:x,id3Track:S,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(te),te},g.flush=function(){var b=this.remainderData;this.remainderData=null;var c;return b?c=this.demux(b,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},g.extractRemainingSamples=function(b){var c=b.audioTrack,p=b.avcTrack,h=b.id3Track,a=p.pesData,x=c.pesData,v=h.pesData,S;a&&(S=o(a))?(this.parseAVCPES(S,!0),p.pesData=null):p.pesData=a,x&&(S=o(x))?(c.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),c.pesData=null):(x!=null&&x.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=x),v&&(S=o(v))?(this.parseID3PES(S),h.pesData=null):h.pesData=v},g.demuxSampleAes=function(b,c,p){var h=this.demux(b,p,!0,!this.config.progressive),a=this.sampleAes=new W.default(this.observer,this.config,c);return this.decrypt(h,a)},g.decrypt=function(b,c){return new Promise(function(p){var h=b.audioTrack,a=b.avcTrack;h.samples&&h.isAAC?c.decryptAacSamples(h.samples,0,function(){a.samples?c.decryptAvcSamples(a.samples,0,0,function(){p(b)}):p(b)}):a.samples&&c.decryptAvcSamples(a.samples,0,0,function(){p(b)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(b,c){var p=this,h=this._avcTrack,a=this.parseAVCNALu(b.data),x=!1,v=this.avcSample,S,B=!1;b.data=null,v&&a.length&&!h.audFound&&(s(v,h),v=this.avcSample=_(!1,b.pts,b.dts,"")),a.forEach(function(F){switch(F.type){case 1:{S=!0,v||(v=p.avcSample=_(!0,b.pts,b.dts,"")),x&&(v.debug+="NDR "),v.frame=!0;var K=F.data;if(B&&K.length>4){var V=new M.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(v.key=!0)}break}case 5:S=!0,v||(v=p.avcSample=_(!0,b.pts,b.dts,"")),x&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{S=!0,x&&v&&(v.debug+="SEI ");var P=new M.default(w(F.data));P.readUByte();for(var I=0,Y=0,ee=!1,oe=0;!ee&&P.bytesAvailable>1;){I=0;do oe=P.readUByte(),I+=oe;while(oe===255);Y=0;do oe=P.readUByte(),Y+=oe;while(oe===255);if(I===4&&P.bytesAvailable!==0){ee=!0;var pe=P.readUByte();if(pe===181){var Oe=P.readUShort();if(Oe===49){var xe=P.readUInt();if(xe===1195456820){var _e=P.readUByte();if(_e===3){for(var Te=P.readUByte(),Ce=P.readUByte(),me=31&Te,le=[Te,Ce],te=0;te<me;te++)le.push(P.readUByte()),le.push(P.readUByte()),le.push(P.readUByte());d(p._txtTrack.samples,{type:3,pts:b.pts,bytes:le})}}}}}else if(I===5&&P.bytesAvailable!==0){if(ee=!0,Y>16){for(var ce=[],ae=0;ae<16;ae++)ce.push(P.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&ce.push("-");for(var Le=Y-16,Re=new Uint8Array(Le),Se=0;Se<Le;Se++)Re[Se]=P.readUByte();d(p._txtTrack.samples,{pts:b.pts,payloadType:I,uuid:ce.join(""),userData:Object(z.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if(Y<P.bytesAvailable)for(var De=0;De<Y;De++)P.readUByte()}break}case 7:if(S=!0,B=!0,x&&v&&(v.debug+="SPS "),!h.sps){var Me=new M.default(F.data),je=Me.readSPS();h.width=je.width,h.height=je.height,h.pixelRatio=je.pixelRatio,h.sps=[F.data],h.duration=p._duration;for(var We=F.data.subarray(1,4),Be="avc1.",Ue=0;Ue<3;Ue++){var ot=We[Ue].toString(16);ot.length<2&&(ot="0"+ot),Be+=ot}h.codec=Be}break;case 8:S=!0,x&&v&&(v.debug+="PPS "),h.pps||(h.pps=[F.data]);break;case 9:S=!1,h.audFound=!0,v&&s(v,h),v=p.avcSample=_(!1,b.pts,b.dts,x?"AUD ":"");break;case 12:S=!1;break;default:S=!1,v&&(v.debug+="unknown NAL "+F.type+" ");break}if(v&&S){var et=v.units;et.push(F)}}),c&&v&&(s(v,h),this.avcSample=null)},g.getLastNalUnit=function(){var b,c=this.avcSample,p;if(!c||c.units.length===0){var h=this._avcTrack.samples;c=h[h.length-1]}if((b=c)!==null&&b!==void 0&&b.units){var a=c.units;p=a[a.length-1]}return p},g.parseAVCNALu=function(b){var c=b.byteLength,p=this._avcTrack,h=p.naluState||0,a=h,x=[],v=0,S,B,F,K=-1,V=0;for(h===-1&&(K=0,V=b[0]&31,h=0,v=1);v<c;){if(S=b[v++],!h){h=S?0:1;continue}if(h===1){h=S?0:2;continue}if(!S)h=3;else if(S===1){if(K>=0){var P={data:b.subarray(K,v-h-1),type:V};x.push(P)}else{var I=this.getLastNalUnit();if(I&&(a&&v<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),B=v-h-1,B>0)){var Y=new Uint8Array(I.data.byteLength+B);Y.set(I.data,0),Y.set(b.subarray(0,B),I.data.byteLength),I.data=Y,I.state=0}}v<c?(F=b[v]&31,K=v,V=F,h=0):h=-1}else h=0}if(K>=0&&h>=0){var ee={data:b.subarray(K,c),type:V,state:h};x.push(ee)}if(x.length===0){var oe=this.getLastNalUnit();if(oe){var pe=new Uint8Array(oe.data.byteLength+b.byteLength);pe.set(oe.data,0),pe.set(b,oe.data.byteLength),oe.data=pe}}return p.naluState=h,x},g.parseAACPES=function(b){var c=0,p=this._audioTrack,h=this.aacOverFlow,a=b.data;if(h){this.aacOverFlow=null;var x=h.sample.unit.byteLength,v=Math.min(h.missing,x),S=x-v;h.sample.unit.set(a.subarray(0,v),S),p.samples.push(h.sample),c=h.missing}var B,F;for(B=c,F=a.length;B<F-1&&!$.isHeader(a,B);B++);if(B!==c){var K,V;if(B<F-1?(K="AAC PES did not start with ADTS header,offset:"+B,V=!1):(K="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+K),this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}$.initTrackConfig(p,this.observer,a,B,this.audioCodec);var P;if(b.pts!==void 0)P=b.pts;else if(h){var I=$.getFrameDuration(p.samplerate);P=h.sample.pts+I}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;B<F;)if($.isHeader(a,B)){if(B+5<F){var ee=$.appendFrame(p,a,B,P,Y);if(ee)if(ee.missing)this.aacOverFlow=ee;else{B+=ee.length,Y++;continue}}break}else B++},g.parseMPEGPES=function(b){var c=b.data,p=c.length,h=0,a=0,x=b.pts;if(x===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<p;)if(O.isHeader(c,a)){var v=O.appendFrame(this._audioTrack,c,a,x,h);if(v)a+=v.length,h++;else break}else a++},g.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},m}();A.minProbeByteLength=188;function _(m,g,L,b){return{key:m,frame:!1,pts:g,dts:L,units:[],debug:b,length:0}}function E(m,g){return(m[g+10]&31)<<8|m[g+11]}function u(m,g,L,b){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(m[g+1]&15)<<8|m[g+2],h=g+3+p-4,a=(m[g+10]&15)<<8|m[g+11];for(g+=12+a;g<h;){var x=(m[g+1]&31)<<8|m[g+2];switch(m[g]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=x);break;case 21:c.id3===-1&&(c.id3=x);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=x);break;case 3:case 4:L?c.audio===-1&&(c.audio=x,c.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((m[g+3]&15)<<8|m[g+4])+5}return c}function o(m){var g=0,L,b,c,p,h,a=m.data;if(!m||m.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}L=a[0];var v=(L[0]<<16)+(L[1]<<8)+L[2];if(v===1){if(b=(L[4]<<8)+L[5],b&&b>m.size-6)return null;var S=L[7];S&192&&(p=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,S&64?(h=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,p-h>60*9e4&&(y.logger.warn(Math.round((p-h)/9e4)+"s delta between PTS and DTS, align them"),p=h)):h=p),c=L[8];var B=c+9;if(m.size<=B)return null;m.size-=B;for(var F=new Uint8Array(m.size),K=0,V=a.length;K<V;K++){L=a[K];var P=L.byteLength;if(B)if(B>P){B-=P;continue}else L=L.subarray(B),P-=B,B=0;F.set(L,g),g+=P}return b&&(b-=c+3),{data:F,pts:p,dts:h,len:b}}return null}function s(m,g){if(m.units.length&&m.frame){if(m.pts===void 0){var L=g.samples,b=L.length;if(b){var c=L[b-1];m.pts=c.pts,m.dts=c.dts}else{g.dropped++;return}}g.samples.push(m)}m.debug.length&&y.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function d(m,g){var L=m.length;if(L>0){if(g.pts>=m[L-1].pts)m.push(g);else for(var b=L-1;b>=0;b--)if(g.pts<m[b].pts){m.splice(b,0,g);break}}else m.push(g)}function w(m){for(var g=m.byteLength,L=[],b=1;b<g-2;)m[b]===0&&m[b+1]===0&&m[b+2]===3?(L.push(b+2),b+=2):b++;if(L.length===0)return m;var c=g-L.length,p=new Uint8Array(c),h=0;for(b=0;b<c;h++,b++)h===L[0]&&(h++,L.shift()),p[b]=m[h];return p}J.default=A},"./src/errors.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"ErrorTypes",function(){return $}),D.d(J,"ErrorDetails",function(){return O});var $;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})($||($={}));var O;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(O||(O={}))},"./src/events.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"Events",function(){return $});var $;(function(O){O.MEDIA_ATTACHING="hlsMediaAttaching",O.MEDIA_ATTACHED="hlsMediaAttached",O.MEDIA_DETACHING="hlsMediaDetaching",O.MEDIA_DETACHED="hlsMediaDetached",O.BUFFER_RESET="hlsBufferReset",O.BUFFER_CODECS="hlsBufferCodecs",O.BUFFER_CREATED="hlsBufferCreated",O.BUFFER_APPENDING="hlsBufferAppending",O.BUFFER_APPENDED="hlsBufferAppended",O.BUFFER_EOS="hlsBufferEos",O.BUFFER_FLUSHING="hlsBufferFlushing",O.BUFFER_FLUSHED="hlsBufferFlushed",O.MANIFEST_LOADING="hlsManifestLoading",O.MANIFEST_LOADED="hlsManifestLoaded",O.MANIFEST_PARSED="hlsManifestParsed",O.LEVEL_SWITCHING="hlsLevelSwitching",O.LEVEL_SWITCHED="hlsLevelSwitched",O.LEVEL_LOADING="hlsLevelLoading",O.LEVEL_LOADED="hlsLevelLoaded",O.LEVEL_UPDATED="hlsLevelUpdated",O.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",O.LEVELS_UPDATED="hlsLevelsUpdated",O.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",O.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",O.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",O.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",O.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",O.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",O.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",O.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",O.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",O.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",O.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",O.CUES_PARSED="hlsCuesParsed",O.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",O.INIT_PTS_FOUND="hlsInitPtsFound",O.FRAG_LOADING="hlsFragLoading",O.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",O.FRAG_LOADED="hlsFragLoaded",O.FRAG_DECRYPTED="hlsFragDecrypted",O.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",O.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",O.FRAG_PARSING_METADATA="hlsFragParsingMetadata",O.FRAG_PARSED="hlsFragParsed",O.FRAG_BUFFERED="hlsFragBuffered",O.FRAG_CHANGED="hlsFragChanged",O.FPS_DROP="hlsFpsDrop",O.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",O.ERROR="hlsError",O.DESTROYING="hlsDestroying",O.KEY_LOADING="hlsKeyLoading",O.KEY_LOADED="hlsKeyLoaded",O.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",O.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return m});var $=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n($),M=D("./src/loader/playlist-loader.ts"),z=D("./src/loader/key-loader.ts"),W=D("./src/controller/id3-track-controller.ts"),U=D("./src/controller/latency-controller.ts"),R=D("./src/controller/level-controller.ts"),y=D("./src/controller/fragment-tracker.ts"),C=D("./src/controller/stream-controller.ts"),k=D("./src/is-supported.ts"),A=D("./src/utils/logger.ts"),_=D("./src/config.ts"),E=D("./node_modules/eventemitter3/index.js"),u=D.n(E),o=D("./src/events.ts"),s=D("./src/errors.ts");function d(g,L){for(var b=0;b<L.length;b++){var c=L[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(g,c.key,c)}}function w(g,L,b){return L&&d(g.prototype,L),b&&d(g,b),g}var m=function(){g.isSupported=function(){return Object(k.isSupported)()};function g(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.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 c=this.config=Object(_.mergeConfig)(g.DefaultConfig,b);this.userConfig=b,Object(A.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(_.enableStreamingMode)(c);var p=c.abrController,h=c.bufferController,a=c.capLevelController,x=c.fpsController,v=this.abrController=new p(this),S=this.bufferController=new h(this),B=this.capLevelController=new a(this),F=new x(this),K=new M.default(this),V=new z.default(this),P=new W.default(this),I=this.levelController=new R.default(this),Y=new y.FragmentTracker(this),ee=this.streamController=new C.default(this,Y);B.setStreamController(ee),F.setStreamController(ee);var oe=[I,ee];this.networkControllers=oe;var pe=[K,V,v,S,B,F,P,Y];this.audioTrackController=this.createController(c.audioTrackController,null,oe),this.createController(c.audioStreamController,Y,oe),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,oe),this.createController(c.subtitleStreamController,Y,oe),this.createController(c.timelineController,null,pe),this.emeController=this.createController(c.emeController,null,pe),this.cmcdController=this.createController(c.cmcdController,null,pe),this.latencyController=this.createController(U.default,null,pe),this.coreComponents=pe}var L=g.prototype;return L.createController=function(c,p,h){if(c){var a=p?new c(this,p):new c(this);return h&&h.push(a),a}return null},L.on=function(c,p,h){h===void 0&&(h=this),this._emitter.on(c,p,h)},L.once=function(c,p,h){h===void 0&&(h=this),this._emitter.once(c,p,h)},L.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},L.off=function(c,p,h,a){h===void 0&&(h=this),this._emitter.off(c,p,h,a)},L.listeners=function(c){return this._emitter.listeners(c)},L.emit=function(c,p,h){return this._emitter.emit(c,p,h)},L.trigger=function(c,p){if(this.config.debug)return this.emit(c,c,p);try{return this.emit(c,c,p)}catch(h){A.logger.error("An internal error happened while handling event "+c+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:h})}return!1},L.listenerCount=function(c){return this._emitter.listenerCount(c)},L.destroy=function(){A.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},L.attachMedia=function(c){A.logger.log("attachMedia"),this._media=c,this.trigger(o.Events.MEDIA_ATTACHING,{media:c})},L.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(c){this.stopLoad();var p=this.media,h=this.url,a=this.url=$.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});A.logger.log("loadSource:"+a),p&&h&&h!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(o.Events.MANIFEST_LOADING,{url:c})},L.startLoad=function(c){c===void 0&&(c=-1),A.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(p){p.startLoad(c)})},L.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},L.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){A.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},L.removeLevel=function(c,p){p===void 0&&(p=0),this.levelController.removeLevel(c,p)},w(g,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){A.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){A.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){A.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){A.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){A.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var p=!!c;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(c){this._autoLevelCapping!==c&&(A.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,p=this.config.minAutoBitrate;if(!c)return 0;for(var h=c.length,a=0;a<h;a++)if(c[a].maxBitrate>p)return a;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,p=this.autoLevelCapping,h;return p===-1&&c&&c.length?h=c.length-1:h=p,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var p=this.audioTrackController;p&&(p.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var p=this.subtitleTrackController;p&&(p.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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 s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:_.hlsDefaultConfig},set:function(c){g.defaultConfig=c}}]),g}();m.defaultConfig=void 0},"./src/is-supported.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"isSupported",function(){return M}),D.d(J,"changeTypeSupported",function(){return z});var $=D("./src/utils/mediasource-helper.ts");function O(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var W=Object($.getMediaSource)();if(!W)return!1;var U=O(),R=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!U||U.prototype&&typeof U.prototype.appendBuffer=="function"&&typeof U.prototype.remove=="function";return!!R&&!!y}function z(){var W,U=O();return typeof(U==null||((W=U.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return A}),D.d(J,"LoadError",function(){return E});var $=D("./src/polyfills/number.ts"),O=D("./src/errors.ts");function M(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,y(u,o)}function z(u){var o=typeof Map=="function"?new Map:void 0;return z=function(d){if(d===null||!R(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,w)}function w(){return W(d,arguments,C(this).constructor)}return w.prototype=Object.create(d.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),y(w,d)},z(u)}function W(u,o,s){return U()?W=Reflect.construct:W=function(w,m,g){var L=[null];L.push.apply(L,m);var b=Function.bind.apply(w,L),c=new b;return g&&y(c,g.prototype),c},W.apply(null,arguments)}function U(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function R(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function y(u,o){return y=Object.setPrototypeOf||function(d,w){return d.__proto__=w,d},y(u,o)}function C(u){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},C(u)}var k=Math.pow(2,17),A=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,w){var m=this,g=d.url;if(!g)return Promise.reject(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var L=this.config,b=L.fLoader,c=L.loader;return new Promise(function(p,h){m.loader&&m.loader.destroy();var a=m.loader=d.loader=b?new b(L):new c(L),x=_(d),v={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:k};d.stats=a.stats,a.load(x,v,{onSuccess:function(B,F,K,V){m.resetLoader(d,a),p({frag:d,part:null,payload:B.data,networkDetails:V})},onError:function(B,F,K){m.resetLoader(d,a),h(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:B,networkDetails:K}))},onAbort:function(B,F,K){m.resetLoader(d,a),h(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:K}))},onTimeout:function(B,F,K){m.resetLoader(d,a),h(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:K}))},onProgress:function(B,F,K,V){w&&w({frag:d,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(d,w,m){var g=this;this.abort();var L=this.config,b=L.fLoader,c=L.loader;return new Promise(function(p,h){g.loader&&g.loader.destroy();var a=g.loader=d.loader=b?new b(L):new c(L),x=_(d,w),v={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:k};w.stats=a.stats,a.load(x,v,{onSuccess:function(B,F,K,V){g.resetLoader(d,a),g.updateStatsFromPart(d,w);var P={frag:d,part:w,payload:B.data,networkDetails:V};m(P),p(P)},onError:function(B,F,K){g.resetLoader(d,a),h(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:w,response:B,networkDetails:K}))},onAbort:function(B,F,K){d.stats.aborted=w.stats.aborted,g.resetLoader(d,a),h(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:w,networkDetails:K}))},onTimeout:function(B,F,K){g.resetLoader(d,a),h(new E({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:w,networkDetails:K}))}})})},o.updateStatsFromPart=function(d,w){var m=d.stats,g=w.stats,L=g.total;if(m.loaded+=g.loaded,L){var b=Math.round(d.duration/w.duration),c=Math.min(Math.round(m.loaded/L),b),p=b-c,h=p*Math.round(m.loaded/c);m.total=m.loaded+h}else m.total=Math.max(m.loaded,m.total);var a=m.loading,x=g.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(d,w){d.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},u}();function _(u,o){o===void 0&&(o=null);var s=o||u,d={frag:u,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},w=s.byteRangeStartOffset,m=s.byteRangeEndOffset;return Object($.isFiniteNumber)(w)&&Object($.isFiniteNumber)(m)&&(d.rangeStart=w,d.rangeEnd=m),d}var E=function(u){M(o,u);function o(s){for(var d,w=arguments.length,m=new Array(w>1?w-1:0),g=1;g<w;g++)m[g-1]=arguments[g];return d=u.call.apply(u,[this].concat(m))||this,d.data=void 0,d.data=s,d}return o}(z(Error))},"./src/loader/fragment.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"ElementaryStreamTypes",function(){return A}),D.d(J,"BaseSegment",function(){return _}),D.d(J,"Fragment",function(){return E}),D.d(J,"Part",function(){return u});var $=D("./src/polyfills/number.ts"),O=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(O),z=D("./src/utils/logger.ts"),W=D("./src/loader/level-key.ts"),U=D("./src/loader/load-stats.ts");function R(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,y(o,s)}function y(o,s){return y=Object.setPrototypeOf||function(w,m){return w.__proto__=m,w},y(o,s)}function C(o,s){for(var d=0;d<s.length;d++){var w=s[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function k(o,s,d){return s&&C(o.prototype,s),d&&C(o,d),o}var A;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(A||(A={}));var _=function(){function o(d){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[A.AUDIO]=null,w[A.VIDEO]=null,w[A.AUDIOVIDEO]=null,w),this.baseurl=d}var s=o.prototype;return s.setByteRange=function(w,m){var g=w.split("@",2),L=[];g.length===1?L[0]=m?m.byteRangeEndOffset:0:L[0]=parseInt(g[1]),L[1]=parseInt(g[0])+L[0],this._byteRange=L},k(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(O.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),E=function(o){R(s,o);function s(w,m){var g;return g=o.call(this,m)||this,g._decryptdata=null,g.rawProgramDateTime=null,g.programDateTime=null,g.tagList=[],g.duration=0,g.sn=0,g.levelkey=void 0,g.type=void 0,g.loader=null,g.level=-1,g.cc=0,g.startPTS=void 0,g.endPTS=void 0,g.appendedPTS=void 0,g.startDTS=void 0,g.endDTS=void 0,g.start=0,g.deltaPTS=void 0,g.maxStartPTS=void 0,g.minEndPTS=void 0,g.stats=new U.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=w,g}var d=s.prototype;return d.createInitializationVector=function(m){for(var g=new Uint8Array(16),L=12;L<16;L++)g[L]=m>>8*(15-L)&255;return g},d.setDecryptDataFromLevelKey=function(m,g){var L=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(L=W.LevelKey.fromURI(m.uri),L.method=m.method,L.iv=this.createInitializationVector(g),L.keyFormat="identity"),L},d.setElementaryStreamInfo=function(m,g,L,b,c,p){p===void 0&&(p=!1);var h=this.elementaryStreams,a=h[m];if(!a){h[m]={startPTS:g,endPTS:L,startDTS:b,endDTS:c,partial:p};return}a.startPTS=Math.min(a.startPTS,g),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,c)},d.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[A.AUDIO]=null,m[A.VIDEO]=null,m[A.AUDIOVIDEO]=null},k(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="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'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object($.isFiniteNumber)(this.programDateTime))return null;var m=Object($.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),s}(_),u=function(o){R(s,o);function s(d,w,m,g,L){var b;b=o.call(this,m)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new U.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=w,b.index=g;var c=d.enumeratedString("BYTERANGE");return c&&b.setByteRange(c,L),L&&(b.fragOffset=L.fragOffset+L.duration),b}return k(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),s}(_)},"./src/loader/key-loader.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return z});var $=D("./src/events.ts"),O=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),z=function(){function W(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var U=W.prototype;return U._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},U._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},U.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var C=this.loaders[y];C&&C.destroy()}this.loaders={}},U.onKeyLoading=function(y,C){var k=C.frag,A=k.type,_=this.loaders[A];if(!k.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=k.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(_&&(M.logger.warn("abort previous key loader for type:"+A),_.abort()),!E){M.logger.warn("key uri is falsy");return}var o=u.loader,s=k.loader=this.loaders[A]=new o(u);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:k,responseType:"arraybuffer"},w={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,w,m)}else this.decryptkey&&(k.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:k}))},U.loadsuccess=function(y,C,k){var A=k.frag;if(!A.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(y.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger($.Events.KEY_LOADED,{frag:A})},U.loaderror=function(y,C){var k=C.frag,A=k.loader;A&&A.abort(),delete this.loaders[k.type],this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:k,response:y})},U.loadtimeout=function(y,C){var k=C.frag,A=k.loader;A&&A.abort(),delete this.loaders[k.type],this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:k})},W}()},"./src/loader/level-details.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"LevelDetails",function(){return W});var $=D("./src/polyfills/number.ts");function O(U,R){for(var y=0;y<R.length;y++){var C=R[y];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(U,C.key,C)}}function M(U,R,y){return R&&O(U.prototype,R),y&&O(U,y),U}var z=10,W=function(){function U(y){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=y}var R=U.prototype;return R.reloaded=function(C){if(!C){this.advanced=!0,this.updated=!0;return}var k=this.lastPartSn-C.lastPartSn,A=this.lastPartIndex-C.lastPartIndex;this.updated=this.endSN!==C.endSN||!!A||!!k,this.advanced=this.endSN>C.endSN||k>0||k===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(C.misses*.6):this.misses=C.misses+1,this.availabilityDelay=C.availabilityDelay},M(U,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object($.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var C=this.driftEndTime-this.driftStartTime;if(C>0){var k=this.driftEnd-this.driftStart;return k*1e3/C}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var C;return(C=this.fragments)!==null&&C!==void 0&&C.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 C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),U}()},"./src/loader/level-key.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"LevelKey",function(){return W});var $=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n($);function M(U,R){for(var y=0;y<R.length;y++){var C=R[y];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(U,C.key,C)}}function z(U,R,y){return R&&M(U.prototype,R),y&&M(U,y),U}var W=function(){U.fromURL=function(y,C){return new U(y,C)},U.fromURI=function(y){return new U(y)};function U(R,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object($.buildAbsoluteURL)(R,y,{alwaysNormalize:!0}):this._uri=R}return z(U,[{key:"uri",get:function(){return this._uri}}]),U}()},"./src/loader/load-stats.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"LoadStats",function(){return $});var $=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(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return s});var $=D("./src/polyfills/number.ts"),O=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(O),z=D("./src/loader/fragment.ts"),W=D("./src/loader/level-details.ts"),U=D("./src/loader/level-key.ts"),R=D("./src/utils/attr-list.ts"),y=D("./src/utils/logger.ts"),C=D("./src/utils/codecs.ts"),k=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,_=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var b,c;return u.test((b=(c=O.parseURL(L))===null||c===void 0?void 0:c.path)!=null?b:"")}var s=function(){function L(){}return L.findGroup=function(c,p){for(var h=0;h<c.length;h++){var a=c[h];if(a.id===p)return a}},L.convertAVC1ToAVCOTI=function(c){var p=c.split(".");if(p.length>2){var h=p.shift()+".";return h+=parseInt(p.shift()).toString(16),h+=("000"+parseInt(p.shift()).toString(16)).substr(-4),h}return c},L.resolve=function(c,p){return O.buildAbsoluteURL(p,c,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(c,p){var h=[],a={},x=!1;k.lastIndex=0;for(var v;(v=k.exec(c))!=null;)if(v[1]){var S=new R.AttrList(v[1]),B={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:L.resolve(v[2],p)},F=S.decimalResolution("RESOLUTION");F&&(B.width=F.width,B.height=F.height),d((S.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),B),B.videoCodec&&B.videoCodec.indexOf("avc1")!==-1&&(B.videoCodec=L.convertAVC1ToAVCOTI(B.videoCodec)),h.push(B)}else if(v[3]){var K=new R.AttrList(v[3]);K["DATA-ID"]&&(x=!0,a[K["DATA-ID"]]=K)}return{levels:h,sessionData:x?a:null}},L.parseMasterPlaylistMedia=function(c,p,h,a){a===void 0&&(a=[]);var x,v=[],S=0;for(A.lastIndex=0;(x=A.exec(c))!==null;){var B=new R.AttrList(x[1]);if(B.TYPE===h){var F={attrs:B,bitrate:0,id:S++,groupId:B["GROUP-ID"],instreamId:B["INSTREAM-ID"],name:B.NAME||B.LANGUAGE||"",type:h,default:B.bool("DEFAULT"),autoselect:B.bool("AUTOSELECT"),forced:B.bool("FORCED"),lang:B.LANGUAGE,url:B.URI?L.resolve(B.URI,p):""};if(a.length){var K=L.findGroup(a,F.groupId)||a[0];w(F,K,"audioCodec"),w(F,K,"textCodec")}v.push(F)}}return v},L.parseLevelPlaylist=function(c,p,h,a,x){var v=new W.LevelDetails(p),S=v.fragments,B=null,F=0,K=0,V=0,P=0,I=null,Y=new z.Fragment(a,p),ee,oe,pe,Oe=-1,xe=!1;for(_.lastIndex=0,v.m3u8=c;(ee=_.exec(c))!==null;){xe&&(xe=!1,Y=new z.Fragment(a,p),Y.start=V,Y.sn=F,Y.cc=P,Y.level=h,B&&(Y.initSegment=B,Y.rawProgramDateTime=B.rawProgramDateTime));var _e=ee[1];if(_e){Y.duration=parseFloat(_e);var Te=(" "+ee[2]).slice(1);Y.title=Te||null,Y.tagList.push(Te?["INF",_e,Te]:["INF",_e])}else if(ee[3])Object($.isFiniteNumber)(Y.duration)&&(Y.start=V,pe&&(Y.levelkey=pe),Y.sn=F,Y.level=h,Y.cc=P,Y.urlId=x,S.push(Y),Y.relurl=(" "+ee[3]).slice(1),g(Y,I),I=Y,V+=Y.duration,F++,K=0,xe=!0);else if(ee[4]){var Ce=(" "+ee[4]).slice(1);I?Y.setByteRange(Ce,I):Y.setByteRange(Ce)}else if(ee[5])Y.rawProgramDateTime=(" "+ee[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Oe===-1&&(Oe=S.length);else{if(ee=ee[0].match(E),!ee){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var me=(" "+ee[oe]).slice(1),le=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":v.type=le.toUpperCase();break;case"MEDIA-SEQUENCE":F=v.startSN=parseInt(le);break;case"SKIP":{var ce=new R.AttrList(le),ae=ce.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(ae)){v.skippedSegments=ae;for(var Le=ae;Le--;)S.unshift(null);F+=ae}var Re=ce.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(v.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(le);break;case"VERSION":v.version=parseInt(le);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(le||te)&&Y.tagList.push(te?[le,te]:[le]);break;case"DIS":P++;case"GAP":Y.tagList.push([me]);break;case"BITRATE":Y.tagList.push([me,le]);break;case"DISCONTINUITY-SEQ":P=parseInt(le);break;case"KEY":{var Se,De=new R.AttrList(le),Me=De.enumeratedString("METHOD"),je=De.URI,We=De.hexadecimalInteger("IV"),Be=De.enumeratedString("KEYFORMATVERSIONS"),Ue=De.enumeratedString("KEYID"),ot=(Se=De.enumeratedString("KEYFORMAT"))!=null?Se:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf(ot)>-1){y.logger.warn("Keyformat "+ot+" is not supported from the manifest");continue}else if(ot!=="identity")continue;Me&&(pe=U.LevelKey.fromURL(p,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(pe.method=Me,pe.keyFormat=ot,Ue&&(pe.keyID=Ue),Be&&(pe.keyFormatVersions=Be),pe.iv=We));break}case"START":{var Ze=new R.AttrList(le),Je=Ze.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(Je)&&(v.startTimeOffset=Je);break}case"MAP":{var pt=new R.AttrList(le);Y.relurl=pt.URI,pt.BYTERANGE&&Y.setByteRange(pt.BYTERANGE),Y.level=h,Y.sn="initSegment",pe&&(Y.levelkey=pe),Y.initSegment=null,B=Y,xe=!0;break}case"SERVER-CONTROL":{var st=new R.AttrList(le);v.canBlockReload=st.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=st.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&st.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=st.optionalFloat("PART-HOLD-BACK",0),v.holdBack=st.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var rt=new R.AttrList(le);v.partTarget=rt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=v.partList;Pe||(Pe=v.partList=[]);var dt=K>0?Pe[Pe.length-1]:void 0,lt=K++,Ne=new z.Part(new R.AttrList(le),Y,p,lt,dt);Pe.push(Ne),Y.duration+=Ne.duration;break}case"PRELOAD-HINT":{var Ke=new R.AttrList(le);v.preloadHint=Ke;break}case"RENDITION-REPORT":{var Ee=new R.AttrList(le);v.renditionReports=v.renditionReports||[],v.renditionReports.push(Ee);break}default:y.logger.warn("line parsed but not handled: "+ee);break}}}I&&!I.relurl?(S.pop(),V-=I.duration,v.partList&&(v.fragmentHint=I)):v.partList&&(g(Y,I),Y.cc=P,v.fragmentHint=Y);var ve=S.length,be=S[0],re=S[ve-1];if(V+=v.skippedSegments*v.targetduration,V>0&&ve&&re){v.averagetargetduration=V/ve;var ne=re.sn;v.endSN=ne!=="initSegment"?ne:0,be&&(v.startCC=be.cc,be.initSegment||v.fragments.every(function(de){return de.relurl&&o(de.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new z.Fragment(a,p),Y.relurl=re.relurl,Y.level=h,Y.sn="initSegment",be.initSegment=Y,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(V+=v.fragmentHint.duration),v.totalduration=V,v.endCC=P,Oe>0&&m(S,Oe),v},L}();function d(L,b){["video","audio","text"].forEach(function(c){var p=L.filter(function(a){return Object(C.isCodecType)(a,c)});if(p.length){var h=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[c+"Codec"]=h.length>0?h[0]:p[0],L=L.filter(function(a){return p.indexOf(a)===-1})}}),b.unknownCodecs=L}function w(L,b,c){var p=b[c];p&&(L[c]=p)}function m(L,b){for(var c=L[b],p=b;p--;){var h=L[p];if(!h)return;h.programDateTime=c.programDateTime-h.duration*1e3,c=h}}function g(L,b){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):b!=null&&b.programDateTime&&(L.programDateTime=b.endProgramDateTime),Object($.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/polyfills/number.ts"),O=D("./src/events.ts"),M=D("./src/errors.ts"),z=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),U=D("./src/loader/m3u8-parser.ts"),R=D("./src/types/loader.ts"),y=D("./src/utils/attr-list.ts");function C(_){var E=_.type;switch(E){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function k(_,E){var u=_.url;return(u===void 0||u.indexOf("data:")===0)&&(u=E.url),u}var A=function(){function _(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var E=_.prototype;return E.registerListeners=function(){var o=this.hls;o.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var o=this.hls;o.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(o){var s=this.hls.config,d=s.pLoader,w=s.loader,m=d||w,g=new m(s);return o.loader=g,this.loaders[o.type]=g,g},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(o,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,s){var d=s.id,w=s.level,m=s.url,g=s.deliveryDirectives;this.load({id:d,groupId:null,level:w,responseType:"text",type:R.PlaylistContextType.LEVEL,url:m,deliveryDirectives:g})},E.onAudioTrackLoading=function(o,s){var d=s.id,w=s.groupId,m=s.url,g=s.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:g})},E.onSubtitleTrackLoading=function(o,s){var d=s.id,w=s.groupId,m=s.url,g=s.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:g})},E.load=function(o){var s,d=this.hls.config,w=this.getInternalLoader(o);if(w){var m=w.context;if(m&&m.url===o.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var g,L,b,c;switch(o.type){case R.PlaylistContextType.MANIFEST:g=d.manifestLoadingMaxRetry,L=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,c=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:g=0,L=d.levelLoadingTimeOut;break;default:g=d.levelLoadingMaxRetry,L=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,c=d.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var p;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var h=p.partTarget,a=p.targetduration;h&&a&&(L=Math.min(Math.max(h*3,a*.8)*1e3,L))}}var x={timeout:L,maxRetry:g,retryDelay:b,maxRetryDelay:c,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,x,v)},E.loadsuccess=function(o,s,d,w){if(w===void 0&&(w=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,w);return}this.resetInternalLoader(d.type);var m=o.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",w);return}s.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,w):this.handleMasterPlaylist(o,s,d,w)},E.loaderror=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,o)},E.loadtimeout=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},E.handleMasterPlaylist=function(o,s,d,w){var m=this.hls,g=o.data,L=k(o,d),b=U.default.parseMasterPlaylist(g,L),c=b.levels,p=b.sessionData;if(!c.length){this.handleManifestParsingError(o,d,"no level found in manifest",w);return}var h=c.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=c.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),x=U.default.parseMasterPlaylistMedia(g,L,"AUDIO",h),v=U.default.parseMasterPlaylistMedia(g,L,"SUBTITLES",a),S=U.default.parseMasterPlaylistMedia(g,L,"CLOSED-CAPTIONS");if(x.length){var B=x.some(function(F){return!F.url});!B&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}m.trigger(O.Events.MANIFEST_LOADED,{levels:c,audioTracks:x,subtitles:v,captions:S,url:L,stats:s,networkDetails:w,sessionData:p})},E.handleTrackOrLevelPlaylist=function(o,s,d,w){var m=this.hls,g=d.id,L=d.level,b=d.type,c=k(o,d),p=Object($.isFiniteNumber)(g)?g:0,h=Object($.isFiniteNumber)(L)?L:p,a=C(d),x=U.default.parseLevelPlaylist(o.data,c,h,a,p);if(!x.fragments.length){m.trigger(O.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===R.PlaylistContextType.MANIFEST){var v={attrs:new y.AttrList({}),bitrate:0,details:x,name:"",url:c};m.trigger(O.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:c,stats:s,networkDetails:w,sessionData:null})}if(s.parsing.end=performance.now(),x.needSidxRanges){var S,B=(S=x.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:B,isSidxRequest:!0,type:b,level:L,levelDetails:x,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=x,this.handlePlaylistLoaded(o,s,d,w)},E.handleSidxRequest=function(o,s){var d=Object(W.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var w=d.references,m=s.levelDetails;w.forEach(function(g,L){var b=g.info,c=m.fragments[L];c.byteRange.length===0&&c.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),c.initSegment&&c.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,s,d,w){this.hls.trigger(O.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:w})},E.handleNetworkError=function(o,s,d,w){d===void 0&&(d=!1),z.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var m=M.ErrorDetails.UNKNOWN,g=!1,L=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:m=d?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case R.PlaylistContextType.LEVEL:m=d?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case R.PlaylistContextType.AUDIO_TRACK:m=d?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:m=d?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}L&&this.resetInternalLoader(o.type);var b={type:M.ErrorTypes.NETWORK_ERROR,details:m,fatal:g,url:o.url,loader:L,context:o,networkDetails:s};w&&(b.response=w),this.hls.trigger(O.Events.ERROR,b)},E.handlePlaylistLoaded=function(o,s,d,w){var m=d.type,g=d.level,L=d.id,b=d.groupId,c=d.loader,p=d.levelDetails,h=d.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",w);return}if(!c)return;p.live&&(c.getCacheAge&&(p.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(m){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(O.Events.LEVEL_LOADED,{details:p,level:g||0,id:L||0,stats:s,networkDetails:w,deliveryDirectives:h});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(O.Events.AUDIO_TRACK_LOADED,{details:p,id:L||0,groupId:b||"",stats:s,networkDetails:w,deliveryDirectives:h});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(O.Events.SUBTITLE_TRACK_LOADED,{details:p,id:L||0,groupId:b||"",stats:s,networkDetails:w,deliveryDirectives:h});break}},_}();J.default=A},"./src/polyfills/number.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"isFiniteNumber",function(){return $}),D.d(J,"MAX_SAFE_INTEGER",function(){return O});var $=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},O=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(se,J,D){"use strict";D.r(J);var $=function(){function O(){}return O.getSilentFrame=function(z,W){switch(z){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===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(W===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(W===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(W===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(W===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},O}();J.default=$},"./src/remux/mp4-generator.ts":function(se,J,D){"use strict";D.r(J);var $=Math.pow(2,32)-1,O=function(){function M(){}return M.init=function(){M.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 W;for(W in M.types)M.types.hasOwnProperty(W)&&(M.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var U=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:U,audio:R};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=C,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var k=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,k,_,k,A),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,y))},M.box=function(W){for(var U=8,R=arguments.length,y=new Array(R>1?R-1:0),C=1;C<R;C++)y[C-1]=arguments[C];for(var k=y.length,A=k;k--;)U+=y[k].byteLength;var _=new Uint8Array(U);for(_[0]=U>>24&255,_[1]=U>>16&255,_[2]=U>>8&255,_[3]=U&255,_.set(W,4),k=0,U=8;k<A;k++)_.set(y[k],U),U+=y[k].byteLength;return _},M.hdlr=function(W){return M.box(M.types.hdlr,M.HDLR_TYPES[W])},M.mdat=function(W){return M.box(M.types.mdat,W)},M.mdhd=function(W,U){U*=W;var R=Math.floor(U/($+1)),y=Math.floor(U%($+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,R>>24,R>>16&255,R>>8&255,R&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},M.mdia=function(W){return M.box(M.types.mdia,M.mdhd(W.timescale,W.duration),M.hdlr(W.type),M.minf(W))},M.mfhd=function(W){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},M.minf=function(W){return W.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(W)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(W))},M.moof=function(W,U,R){return M.box(M.types.moof,M.mfhd(W),M.traf(R,U))},M.moov=function(W){for(var U=W.length,R=[];U--;)R[U]=M.trak(W[U]);return M.box.apply(null,[M.types.moov,M.mvhd(W[0].timescale,W[0].duration)].concat(R).concat(M.mvex(W)))},M.mvex=function(W){for(var U=W.length,R=[];U--;)R[U]=M.trex(W[U]);return M.box.apply(null,[M.types.mvex].concat(R))},M.mvhd=function(W,U){U*=W;var R=Math.floor(U/($+1)),y=Math.floor(U%($+1)),C=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,R>>24,R>>16&255,R>>8&255,R&255,y>>24,y>>16&255,y>>8&255,y&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 M.box(M.types.mvhd,C)},M.sdtp=function(W){var U=W.samples||[],R=new Uint8Array(4+U.length),y,C;for(y=0;y<U.length;y++)C=U[y].flags,R[y+4]=C.dependsOn<<4|C.isDependedOn<<2|C.hasRedundancy;return M.box(M.types.sdtp,R)},M.stbl=function(W){return M.box(M.types.stbl,M.stsd(W),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(W){var U=[],R=[],y,C,k;for(y=0;y<W.sps.length;y++)C=W.sps[y],k=C.byteLength,U.push(k>>>8&255),U.push(k&255),U=U.concat(Array.prototype.slice.call(C));for(y=0;y<W.pps.length;y++)C=W.pps[y],k=C.byteLength,R.push(k>>>8&255),R.push(k&255),R=R.concat(Array.prototype.slice.call(C));var A=M.box(M.types.avcC,new Uint8Array([1,U[3],U[4],U[5],252|3,224|W.sps.length].concat(U).concat([W.pps.length]).concat(R))),_=W.width,E=W.height,u=W.pixelRatio[0],o=W.pixelRatio[1];return M.box(M.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,_>>8&255,_&255,E>>8&255,E&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]),A,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},M.esds=function(W){var U=W.config.length;return new Uint8Array([0,0,0,0,3,23+U,0,1,0,4,15+U,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([U]).concat(W.config).concat([6,1,2]))},M.mp4a=function(W){var U=W.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,U>>8&255,U&255,0,0]),M.box(M.types.esds,M.esds(W)))},M.mp3=function(W){var U=W.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,U>>8&255,U&255,0,0]))},M.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(W)):M.box(M.types.stsd,M.STSD,M.mp4a(W)):M.box(M.types.stsd,M.STSD,M.avc1(W))},M.tkhd=function(W){var U=W.id,R=W.duration*W.timescale,y=W.width,C=W.height,k=Math.floor(R/($+1)),A=Math.floor(R%($+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,A>>24,A>>16&255,A>>8&255,A&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,y>>8&255,y&255,0,0,C>>8&255,C&255,0,0]))},M.traf=function(W,U){var R=M.sdtp(W),y=W.id,C=Math.floor(U/($+1)),k=Math.floor(U%($+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,C>>24,C>>16&255,C>>8&255,C&255,k>>24,k>>16&255,k>>8&255,k&255])),M.trun(W,R.length+16+20+8+16+8+8),R)},M.trak=function(W){return W.duration=W.duration||4294967295,M.box(M.types.trak,M.tkhd(W),M.mdia(W))},M.trex=function(W){var U=W.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(W,U){var R=W.samples||[],y=R.length,C=12+16*y,k=new Uint8Array(C),A,_,E,u,o,s;for(U+=8+C,k.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,U>>>24&255,U>>>16&255,U>>>8&255,U&255],0),A=0;A<y;A++)_=R[A],E=_.duration,u=_.size,o=_.flags,s=_.cts,k.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*A);return M.box(M.types.trun,k)},M.initSegment=function(W){M.types||M.init();var U=M.moov(W),R=new Uint8Array(M.FTYP.byteLength+U.byteLength);return R.set(M.FTYP),R.set(U,M.FTYP.byteLength),R},M}();O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0,J.default=O},"./src/remux/mp4-remuxer.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return s}),D.d(J,"normalizePts",function(){return d});var $=D("./src/polyfills/number.ts"),O=D("./src/remux/aac-helper.ts"),M=D("./src/remux/mp4-generator.ts"),z=D("./src/events.ts"),W=D("./src/errors.ts"),U=D("./src/utils/logger.ts"),R=D("./src/types/loader.ts"),y=D("./src/utils/timescale-conversion.ts");function C(){return C=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(L[p]=c[p])}return L},C.apply(this,arguments)}var k=10*1e3,A=1024,_=1152,E=null,u=null,o=!1,s=function(){function L(c,p,h,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=c,this.config=p,this.typeSupported=h,this.ISGenerated=!1,E===null){var x=navigator.userAgent||"",v=x.match(/Chrome\/(\d+)/i);E=v?parseInt(v[1]):0}if(u===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);u=S?parseInt(S[1]):0}o=!!E&&E<75||!!u&&u<600}var b=L.prototype;return b.destroy=function(){},b.resetTimeStamp=function(p){U.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},b.resetNextTimestamp=function(){U.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){U.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(p){var h=!1,a=p.reduce(function(x,v){var S=v.pts-x;return S<-4294967296?(h=!0,d(x,v.pts)):S>0?x:v.pts},p[0].pts);return h&&U.logger.debug("PTS rollover detected"),a},b.remux=function(p,h,a,x,v,S,B,F){var K,V,P,I,Y,ee,oe=v,pe=v,Oe=p.pid>-1,xe=h.pid>-1,_e=h.samples.length,Te=p.samples.length>0,Ce=_e>1,me=(!Oe||Te)&&(!xe||Ce)||this.ISGenerated||B;if(me){this.ISGenerated||(P=this.generateIS(p,h,v));var le=this.isVideoContiguous,te=-1;if(Ce&&(te=w(h.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){U.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+_e+" video samples due to a missing keyframe");var ce=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(te),h.dropped+=te,pe+=(h.samples[0].pts-ce)/(h.timescale||9e4)}else te===-1&&(U.logger.warn("[mp4-remuxer]: No keyframe found out of "+_e+" video samples"),ee=!1);if(this.ISGenerated){if(Te&&Ce){var ae=this.getVideoStartPts(h.samples),Le=d(p.samples[0].pts,ae)-ae,Re=Le/h.inputTimeScale;oe+=Math.max(0,Re),pe+=Math.max(0,-Re)}if(Te){if(p.samplerate||(U.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(p,h,v)),V=this.remuxAudio(p,oe,this.isAudioContiguous,S,xe||Ce||F===R.PlaylistLevelType.AUDIO?pe:void 0),Ce){var Se=V?V.endPTS-V.startPTS:0;h.inputTimeScale||(U.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(p,h,v)),K=this.remuxVideo(h,pe,le,Se)}}else Ce&&(K=this.remuxVideo(h,pe,le,0));K&&(K.firstKeyFrame=te,K.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&(Y=this.remuxID3(a,v)),x.samples.length&&(I=this.remuxText(x,v))),{audio:V,video:K,initSegment:P,independent:ee,text:I,id3:Y}},b.generateIS=function(p,h,a){var x=p.samples,v=h.samples,S=this.typeSupported,B={},F=!Object($.isFiniteNumber)(this._initPTS),K="audio/mp4",V,P,I;if(F&&(V=P=Infinity),p.config&&x.length&&(p.timescale=p.samplerate,p.isAAC||(S.mpeg?(K="audio/mpeg",p.codec=""):S.mp3&&(p.codec="mp3")),B.audio={id:"audio",container:K,codec:p.codec,initSegment:!p.isAAC&&S.mpeg?new Uint8Array(0):M.default.initSegment([p]),metadata:{channelCount:p.channelCount}},F&&(I=p.inputTimeScale,V=P=x[0].pts-Math.round(I*a))),h.sps&&h.pps&&v.length&&(h.timescale=h.inputTimeScale,B.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:M.default.initSegment([h]),metadata:{width:h.width,height:h.height}},F)){I=h.inputTimeScale;var Y=this.getVideoStartPts(v),ee=Math.round(I*a);P=Math.min(P,d(v[0].dts,Y)-ee),V=Math.min(V,Y-ee)}if(Object.keys(B).length)return this.ISGenerated=!0,F&&(this._initPTS=V,this._initDTS=P),{tracks:B,initPTS:V,timescale:I}},b.remuxVideo=function(p,h,a,x){var v=p.inputTimeScale,S=p.samples,B=[],F=S.length,K=this._initPTS,V=this.nextAvcDts,P=8,I,Y,ee,oe=Number.POSITIVE_INFINITY,pe=Number.NEGATIVE_INFINITY,Oe=0,xe=!1;if(!a||V===null){var _e=h*v,Te=S[0].pts-d(S[0].dts,S[0].pts);V=_e-Te}for(var Ce=0;Ce<F;Ce++){var me=S[Ce];if(me.pts=d(me.pts-K,V),me.dts=d(me.dts-K,V),me.dts>me.pts){var le=9e4*.2;Oe=Math.max(Math.min(Oe,me.pts-me.dts),-1*le)}me.dts<S[Ce>0?Ce-1:Ce].dts&&(xe=!0)}xe&&S.sort(function(gt,at){var Qe=gt.dts-at.dts,kt=gt.pts-at.pts;return Qe||kt}),Y=S[0].dts,ee=S[S.length-1].dts;var te=Math.round((ee-Y)/(F-1));if(Oe<0){if(Oe<te*-2){U.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-te,!0)+" ms");for(var ce=Oe,ae=0;ae<F;ae++)S[ae].dts=ce=Math.max(ce,S[ae].pts-te),S[ae].pts=Math.max(ce,S[ae].pts)}else{U.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Oe,!0)+" ms to overcome this issue");for(var Le=0;Le<F;Le++)S[Le].dts=S[Le].dts+Oe}Y=S[0].dts}if(a){var Re=Y-V,Se=Re>te,De=Re<-1;if(Se||De){Se?U.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):U.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),Y=V;var Me=S[0].pts-Re;S[0].dts=Y,S[0].pts=Me,U.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Me,!0)+"/"+Object(y.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Re,!0)+" ms")}}o&&(Y=Math.max(0,Y));for(var je=0,We=0,Be=0;Be<F;Be++){for(var Ue=S[Be],ot=Ue.units,et=ot.length,Ze=0,Je=0;Je<et;Je++)Ze+=ot[Je].data.length;We+=Ze,je+=et,Ue.length=Ze,Ue.dts=Math.max(Ue.dts,Y),Ue.pts=Math.max(Ue.pts,Ue.dts,0),oe=Math.min(Ue.pts,oe),pe=Math.max(Ue.pts,pe)}ee=S[F-1].dts;var pt=We+4*je+8,st;try{st=new Uint8Array(pt)}catch(gt){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:pt,reason:"fail allocating video mdat "+pt});return}var rt=new DataView(st.buffer);rt.setUint32(0,pt),st.set(M.default.types.mdat,4);for(var Pe=0;Pe<F;Pe++){for(var dt=S[Pe],lt=dt.units,Ne=0,Ke=0,Ee=lt.length;Ke<Ee;Ke++){var ve=lt[Ke],be=ve.data,re=ve.data.byteLength;rt.setUint32(P,re),P+=4,st.set(be,P),P+=re,Ne+=4+re}if(Pe<F-1)I=S[Pe+1].dts-dt.dts;else{var ne=this.config,de=dt.dts-S[Pe>0?Pe-1:Pe].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var ue=Math.floor(ne.maxBufferHole*v),fe=(x?oe+x*v:this.nextAudioPts)-dt.pts;fe>ue?(I=fe-de,I<0&&(I=de),U.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=de}else I=de}var Ae=Math.round(dt.pts-dt.dts);B.push(new m(dt.key,I,Ne,Ae))}if(B.length&&E&&E<70){var Ie=B[0].flags;Ie.dependsOn=2,Ie.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+I,this.isVideoContiguous=!0;var Ye=M.default.moof(p.sequenceNumber++,Y,C({},p,{samples:B})),ht="video",Xe={data1:Ye,data2:st,startPTS:oe/v,endPTS:(pe+I)/v,startDTS:Y/v,endDTS:V/v,type:ht,hasAudio:!1,hasVideo:!0,nb:B.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(st.length,"MDAT length must not be zero"),Xe},b.remuxAudio=function(p,h,a,x,v){var S=p.inputTimeScale,B=p.samplerate?p.samplerate:S,F=S/B,K=p.isAAC?A:_,V=K*F,P=this._initPTS,I=!p.isAAC&&this.typeSupported.mpeg,Y=[],ee=p.samples,oe=I?0:8,pe=this.nextAudioPts||-1,Oe=h*S;if(this.isAudioContiguous=a=a||ee.length&&pe>0&&(x&&Math.abs(Oe-pe)<9e3||Math.abs(d(ee[0].pts-P,Oe)-pe)<20*V),ee.forEach(function(be){be.pts=d(be.pts-P,Oe)}),!a||pe<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;v===0?pe=0:x?pe=Math.max(0,Oe):pe=ee[0].pts}if(p.isAAC)for(var xe=v!==void 0,_e=this.config.maxAudioFramesDrift,Te=0,Ce=pe;Te<ee.length;Te++){var me=ee[Te],le=me.pts,te=le-Ce,ce=Math.abs(1e3*te/S);if(te<=-_e*V&&xe)Te===0&&(U.logger.warn("Audio frame @ "+(le/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/S)+" ms."),this.nextAudioPts=pe=Ce=le);else if(te>=_e*V&&ce<k&&xe){var ae=Math.round(te/V);Ce=le-ae*V,Ce<0&&(ae--,Ce+=V),Te===0&&(this.nextAudioPts=pe=Ce),U.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(Ce/S).toFixed(3)+"s due to "+Math.round(1e3*te/S)+" ms gap.");for(var Le=0;Le<ae;Le++){var Re=Math.max(Ce,0),Se=O.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);Se||(U.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Se=me.unit.subarray()),ee.splice(Te,0,{unit:Se,pts:Re}),Ce+=V,Te++}}me.pts=Ce,Ce+=V}for(var De=null,Me=null,je,We=0,Be=ee.length;Be--;)We+=ee[Be].unit.byteLength;for(var Ue=0,ot=ee.length;Ue<ot;Ue++){var et=ee[Ue],Ze=et.unit,Je=et.pts;if(Me!==null){var pt=Y[Ue-1];pt.duration=Math.round((Je-Me)/F)}else if(a&&p.isAAC&&(Je=pe),De=Je,We>0){We+=oe;try{je=new Uint8Array(We)}catch(be){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!I){var st=new DataView(je.buffer);st.setUint32(0,We),je.set(M.default.types.mdat,4)}}else return;je.set(Ze,oe);var rt=Ze.byteLength;oe+=rt,Y.push(new m(!0,K,rt,0)),Me=Je}var Pe=Y.length;if(!Pe)return;var dt=Y[Y.length-1];this.nextAudioPts=pe=Me+F*dt.duration;var lt=I?new Uint8Array(0):M.default.moof(p.sequenceNumber++,De/F,C({},p,{samples:Y}));p.samples=[];var Ne=De/S,Ke=pe/S,Ee="audio",ve={data1:lt,data2:je,startPTS:Ne,endPTS:Ke,startDTS:Ne,endDTS:Ke,type:Ee,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),ve},b.remuxEmptyAudio=function(p,h,a,x){var v=p.inputTimeScale,S=p.samplerate?p.samplerate:v,B=v/S,F=this.nextAudioPts,K=(F!==null?F:x.startDTS*v)+this._initDTS,V=x.endDTS*v+this._initDTS,P=B*A,I=Math.ceil((V-K)/P),Y=O.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(U.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){U.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<I;oe++){var pe=K+oe*P;ee.push({unit:Y,pts:pe,dts:pe})}return p.samples=ee,this.remuxAudio(p,h,a,!1)},b.remuxID3=function(p,h){var a=p.samples.length;if(!a)return;for(var x=p.inputTimeScale,v=this._initPTS,S=this._initDTS,B=0;B<a;B++){var F=p.samples[B];F.pts=d(F.pts-v,h*x)/x,F.dts=d(F.dts-S,h*x)/x}var K=p.samples;return p.samples=[],{samples:K}},b.remuxText=function(p,h){var a=p.samples.length;if(!a)return;for(var x=p.inputTimeScale,v=this._initPTS,S=0;S<a;S++){var B=p.samples[S];B.pts=d(B.pts-v,h*x)/x}p.samples.sort(function(K,V){return K.pts-V.pts});var F=p.samples;return p.samples=[],{samples:F}},L}();function d(L,b){var c;if(b===null)return L;for(b<L?c=-8589934592:c=8589934592;Math.abs(L-b)>4294967296;)L+=c;return L}function w(L){for(var b=0;b<L.length;b++)if(L[b].key)return b;return-1}var m=function(b,c,p,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=p,this.cts=h,this.flags=new g(b)},g=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/polyfills/number.ts"),O=D("./src/utils/mp4-tools.ts"),M=D("./src/loader/fragment.ts"),z=D("./src/utils/logger.ts"),W=function(){function y(){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 C=y.prototype;return C.destroy=function(){},C.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},C.resetNextTimestamp=function(){this.lastEndDTS=null},C.resetInitSegment=function(A,_,E){this.audioCodec=_,this.videoCodec=E,this.generateInitSegment(A),this.emitInitSegment=!0},C.generateInitSegment=function(A){var _=this.audioCodec,E=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(O.parseInitSegment)(A);_||(_=R(u.audio,M.ElementaryStreamTypes.AUDIO)),E||(E=R(u.video,M.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:_+","+E,initSegment:A,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:_,initSegment:A,id:"audio"}:u.video?o.video={container:"video/mp4",codec:E,initSegment:A,id:"main"}:z.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},C.remux=function(A,_,E,u,o){var s=this.initPTS,d=this.lastEndDTS,w={audio:void 0,video:void 0,text:u,id3:E,initSegment:void 0};Object($.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var m=_.samples;if(!m||!m.length)return w;var g={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(m),L=this.initData),!L||!L.length)return z.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(s)||(this.initPTS=g.initPTS=s=U(L,m,d));var b=Object(O.getDuration)(m,L),c=d,p=b+c;Object(O.offsetStartDTS)(L,m,s),b>0?this.lastEndDTS=p:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!L.audio,a=!!L.video,x="";h&&(x+="audio"),a&&(x+="video");var v={data1:m,startPTS:c,startDTS:c,endPTS:p,endDTS:p,type:x,hasAudio:h,hasVideo:a,nb:1,dropped:0};return w.audio=v.type==="audio"?v:void 0,w.video=v.type!=="audio"?v:void 0,w.text=u,w.id3=E,w.initSegment=g,w},y}(),U=function(C,k,A){return Object(O.getStartDTS)(C,k)-A};function R(y,C){var k=y==null?void 0:y.codec;return k&&k.length>4?k:k==="hvc1"?"hvc1.1.c.L120.90":k==="av01"?"av01.0.04M.08":k==="avc1"||C===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=W},"./src/task-loop.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return $});var $=function(){function O(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=O.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},O}()},"./src/types/cmcd.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"CMCDVersion",function(){return $}),D.d(J,"CMCDObjectType",function(){return O}),D.d(J,"CMCDStreamingFormat",function(){return M}),D.d(J,"CMCDStreamType",function(){return z});var $=1,O;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(O||(O={}));var M;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(M||(M={}));var z;(function(W){W.VOD="v",W.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"HlsSkip",function(){return M}),D.d(J,"getSkipValue",function(){return z}),D.d(J,"HlsUrlParameters",function(){return W}),D.d(J,"Level",function(){return U});function $(R,y){for(var C=0;C<y.length;C++){var k=y[C];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(R,k.key,k)}}function O(R,y,C){return y&&$(R.prototype,y),C&&$(R,C),R}var M;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(M||(M={}));function z(R,y){var C=R.canSkipUntil,k=R.canSkipDateRanges,A=R.endSN,_=y!==void 0?y-A:0;return C&&_<C?k?M.v2:M.Yes:M.No}var W=function(){function R(C,k,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=C,this.part=k,this.skip=A}var y=R.prototype;return y.addDirectives=function(k){var A=new self.URL(k);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},R}(),U=function(){function R(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(C){return C}).join(",").replace(/\.[^.,]+/g,"")}return O(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(C){var k=C%this.url.length;this._urlId!==k&&(this.details=void 0,this._urlId=k)}}]),R}()},"./src/types/loader.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"PlaylistContextType",function(){return $}),D.d(J,"PlaylistLevelType",function(){return O});var $;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var O;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(O||(O={}))},"./src/types/transmuxer.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"ChunkMetadata",function(){return $});var $=function(z,W,U,R,y,C){R===void 0&&(R=0),y===void 0&&(y=-1),C===void 0&&(C=!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=O(),this.buffering={audio:O(),video:O(),audiovideo:O()},this.level=z,this.sn=W,this.id=U,this.size=R,this.part=y,this.partial=C};function O(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"AttrList",function(){return M});var $=/^(\d+)x(\d+)$/,O=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function z(U){typeof U=="string"&&(U=z.parseAttrList(U));for(var R in U)U.hasOwnProperty(R)&&(this[R]=U[R])}var W=z.prototype;return W.decimalInteger=function(R){var y=parseInt(this[R],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},W.hexadecimalInteger=function(R){if(this[R]){var y=(this[R]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var C=new Uint8Array(y.length/2),k=0;k<y.length/2;k++)C[k]=parseInt(y.slice(k*2,k*2+2),16);return C}else return null},W.hexadecimalIntegerAsNumber=function(R){var y=parseInt(this[R],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},W.decimalFloatingPoint=function(R){return parseFloat(this[R])},W.optionalFloat=function(R,y){var C=this[R];return C?parseFloat(C):y},W.enumeratedString=function(R){return this[R]},W.bool=function(R){return this[R]==="YES"},W.decimalResolution=function(R){var y=$.exec(this[R]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},z.parseAttrList=function(R){var y,C={},k='"';for(O.lastIndex=0;(y=O.exec(R))!==null;){var A=y[2];A.indexOf(k)===0&&A.lastIndexOf(k)===A.length-1&&(A=A.slice(1,-1)),C[y[1]]=A}return C},z}()},"./src/utils/binary-search.ts":function(se,J,D){"use strict";D.r(J);var $={search:function(M,z){for(var W=0,U=M.length-1,R=null,y=null;W<=U;){R=(W+U)/2|0,y=M[R];var C=z(y);if(C>0)W=R+1;else if(C<0)U=R-1;else return y}return null}};J.default=$},"./src/utils/buffer-helper.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"BufferHelper",function(){return M});var $=D("./src/utils/logger.ts"),O={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function z(){}return z.isBuffered=function(U,R){try{if(U){for(var y=z.getBuffered(U),C=0;C<y.length;C++)if(R>=y.start(C)&&R<=y.end(C))return!0}}catch(k){}return!1},z.bufferInfo=function(U,R,y){try{if(U){var C=z.getBuffered(U),k=[],A;for(A=0;A<C.length;A++)k.push({start:C.start(A),end:C.end(A)});return this.bufferedInfo(k,R,y)}}catch(_){}return{len:0,start:R,end:R,nextStart:void 0}},z.bufferedInfo=function(U,R,y){R=Math.max(0,R),U.sort(function(g,L){var b=g.start-L.start;return b||L.end-g.end});var C=[];if(y)for(var k=0;k<U.length;k++){var A=C.length;if(A){var _=C[A-1].end;U[k].start-_<y?U[k].end>_&&(C[A-1].end=U[k].end):C.push(U[k])}else C.push(U[k])}else C=U;for(var E=0,u,o=R,s=R,d=0;d<C.length;d++){var w=C[d].start,m=C[d].end;if(R+y>=w&&R<m)o=w,s=m,E=s-R;else if(R+y<w){u=w;break}}return{len:E,start:o||0,end:s||0,nextStart:u}},z.getBuffered=function(U){try{return U.buffered}catch(R){return $.logger.log("failed to get media.buffered",R),O}},z}()},"./src/utils/cea-608-parser.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"Row",function(){return s}),D.d(J,"CaptionScreen",function(){return d});var $=D("./src/utils/logger.ts"),O={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},M=function(p){var h=p;return O.hasOwnProperty(p)&&(h=O[p]),String.fromCharCode(h)},z=15,W=100,U={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},C={25:2,26:4,29:6,30:8,31:10,27:13,28:15},k=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(A||(A={}));var _=function(){function c(){this.time=null,this.verboseLevel=A.ERROR}var p=c.prototype;return p.log=function(a,x){this.verboseLevel>=a&&$.logger.log(this.time+" ["+a+"] "+x)},c}(),E=function(p){for(var h=[],a=0;a<p.length;a++)h.push(p[a].toString(16));return h},u=function(){function c(h,a,x,v,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=a||!1,this.italics=x||!1,this.background=v||"black",this.flash=S||!1}var p=c.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 x=["foreground","underline","italics","background","flash"],v=0;v<x.length;v++){var S=x[v];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},c}(),o=function(){function c(h,a,x,v,S,B){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new u(a,x,v,S,B)}var p=c.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},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()},c}(),s=function(){function c(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<W;a++)this.chars.push(new o);this.logger=h,this.pos=0,this.currPenState=new u}var p=c.prototype;return p.equals=function(a){for(var x=!0,v=0;v<W;v++)if(!this.chars[v].equals(a.chars[v])){x=!1;break}return x},p.copy=function(a){for(var x=0;x<W;x++)this.chars[x].copy(a.chars[x])},p.isEmpty=function(){for(var a=!0,x=0;x<W;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},p.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},p.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var v=this.pos+1;v<x+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(x)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(a){a>=144&&this.backSpace();var x=M(a);if(this.pos>=W){this.logger.log(A.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(a){var x;for(x=a;x<W;x++)this.chars[x].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=[],x=!0,v=0;v<W;v++){var S=this.chars[v].uchar;S!==" "&&(x=!1),a.push(S)}return x?"":a.join("")},p.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},c}(),d=function(){function c(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<z;a++)this.rows.push(new s(h));this.logger=h,this.currRow=z-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=c.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 x=!0,v=0;v<z;v++)if(!this.rows[v].equals(a.rows[v])){x=!1;break}return x},p.copy=function(a){for(var x=0;x<z;x++)this.rows[x].copy(a.rows[x])},p.isEmpty=function(){for(var a=!0,x=0;x<z;x++)if(!this.rows[x].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 x=this.rows[this.currRow];x.insertChar(a)},p.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},p.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},p.setCursor=function(a){this.logger.log(A.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},p.setPAC=function(a){this.logger.log(A.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var v=0;v<z;v++)this.rows[v].clear();var S=this.currRow+1-this.nrRollUpRows,B=this.lastOutputScreen;if(B){var F=B.rows[S].cueStartTime,K=this.logger.time;if(F&&K!==null&&F<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[x-this.nrRollUpRows+V+1].copy(B.rows[S+V])}}this.currRow=x;var P=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,Y=Math.max(I-1,0);P.setCursor(a.indent),a.color=P.chars[Y].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},p.setBkgData=function(a){this.logger.log(A.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(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(A.INFO,"Rolling up")},p.getDisplayText=function(a){a=a||!1;for(var x=[],v="",S=-1,B=0;B<z;B++){var F=this.rows[B].getTextString();F&&(S=B+1,a?x.push("Row "+S+": '"+F+"'"):x.push(F.trim()))}return x.length>0&&(a?v="["+x.join(" | ")+"]":v=x.join(`
`)),v},p.getTextAndFormat=function(){return this.rows},c}(),w=function(){function c(h,a,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=h,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(x),this.nonDisplayedMemory=new d(x),this.lastOutputScreen=new d(x),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var p=c.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(A.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 x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(A.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(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(a){this.logger.log(A.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},p.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(A.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(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(a){this.logger.log(A.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},p.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var v=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=S[v]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},p.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),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))},c}(),m=function(){function c(h,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new _;this.channels=[null,new w(h,a,v),new w(h+1,x,v)],this.cmdHistory=b(),this.logger=v}var p=c.prototype;return p.getHandler=function(a){return this.channels[a].getHandler()},p.setHandler=function(a,x){this.channels[a].setHandler(x)},p.addData=function(a,x){var v,S,B,F=!1;this.logger.time=a;for(var K=0;K<x.length;K+=2){if(S=x[K]&127,B=x[K+1]&127,S===0&&B===0)continue;if(this.logger.log(A.DATA,"["+E([x[K],x[K+1]])+"] -> ("+E([S,B])+")"),v=this.parseCmd(S,B),v||(v=this.parseMidrow(S,B)),v||(v=this.parsePAC(S,B)),v||(v=this.parseBackgroundAttributes(S,B)),!v&&(F=this.parseChars(S,B),F)){var V=this.currentChannel;if(V&&V>0){var P=this.channels[V];P.insertChars(F)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!F&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+E([S,B])+" orig: "+E([x[K],x[K+1]]))}},p.parseCmd=function(a,x){var v=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,B=(a===23||a===31)&&x>=33&&x<=35;if(!(S||B))return!1;if(L(a,x,v))return g(null,null,v),this.logger.log(A.DEBUG,"Repeated command ("+E([a,x])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,K=this.channels[F];return a===20||a===21||a===28||a===29?x===32?K.ccRCL():x===33?K.ccBS():x===34?K.ccAOF():x===35?K.ccAON():x===36?K.ccDER():x===37?K.ccRU(2):x===38?K.ccRU(3):x===39?K.ccRU(4):x===40?K.ccFON():x===41?K.ccRDC():x===42?K.ccTR():x===43?K.ccRTD():x===44?K.ccEDM():x===45?K.ccCR():x===46?K.ccENM():x===47&&K.ccEOC():K.ccTO(x-32),g(a,x,v),this.currentChannel=F,!0},p.parseMidrow=function(a,x){var v=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[v];return S?(S.ccMIDROW(x),this.logger.log(A.DEBUG,"MIDROW ("+E([a,x])+")"),!0):!1}return!1},p.parsePAC=function(a,x){var v,S=this.cmdHistory,B=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,F=(a===16||a===24)&&x>=64&&x<=95;if(!(B||F))return!1;if(L(a,x,S))return g(null,null,S),!0;var K=a<=23?1:2;x>=64&&x<=95?v=K===1?U[a]:y[a]:v=K===1?R[a]:C[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(v,x)),g(a,x,S),this.currentChannel=K,!0):!1},p.interpretPAC=function(a,x){var v,S={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?v=x-96:v=x-64,S.underline=(v&1)===1,v<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((v-16)/2)*4,S},p.parseChars=function(a,x){var v,S=null,B=null;if(a>=25?(v=2,B=a-8):(v=1,B=a),B>=17&&B<=19){var F;B===17?F=x+80:B===18?F=x+112:F=x+144,this.logger.log(A.INFO,"Special char '"+M(F)+"' in channel "+v),S=[F]}else a>=32&&a<=127&&(S=x===0?[a]:[a,x]);if(S){var K=E(S);this.logger.log(A.DEBUG,"Char codes = "+K.join(",")),g(a,x,this.cmdHistory)}return S},p.parseBackgroundAttributes=function(a,x){var v=(a===16||a===24)&&x>=32&&x<=47,S=(a===23||a===31)&&x>=45&&x<=47;if(!(v||S))return!1;var B,F={};a===16||a===24?(B=Math.floor((x-32)/2),F.background=k[B],x%2===1&&(F.background=F.background+"_semi")):x===45?F.background="transparent":(F.foreground="black",x===47&&(F.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(F),g(a,x,this.cmdHistory),!0},p.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=b()},p.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var v=this.channels[x];v&&v.cueSplitAtTime(a)}},c}();function g(c,p,h){h.a=c,h.b=p}function L(c,p,h){return h.a===c&&h.b===p}function b(){return{a:null,b:null}}J.default=m},"./src/utils/codecs.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"isCodecType",function(){return O}),D.d(J,"isCodecSupportedInMp4",function(){return M});var $={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 O(z,W){var U=$[W];return!!U&&U[z.slice(0,4)]===!0}function M(z,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+z+'"')}},"./src/utils/cues.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/utils/vttparser.ts"),O=D("./src/utils/webvtt-parser.ts"),M=D("./src/utils/texttrack-utils.ts"),z=/\s/,W={newCue:function(R,y,C,k){for(var A=[],_,E,u,o,s,d=self.VTTCue||self.TextTrackCue,w=0;w<k.rows.length;w++)if(_=k.rows[w],u=!0,o=0,s="",!_.isEmpty()){for(var m=0;m<_.chars.length;m++)z.test(_.chars[m].uchar)&&u?o++:(s+=_.chars[m].uchar,u=!1);_.cueStartTime=y,y===C&&(C+=1e-4),o>=16?o--:o++;var g=Object($.fixLineBreaks)(s.trim()),L=Object(O.generateCueId)(y,C,g);(!R||!R.cues||!R.cues.getCueById(L))&&(E=new d(y,C,g),E.id=L,E.line=w+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),A.push(E))}return R&&A.length&&(A.sort(function(b,c){return b.line==="auto"||c.line==="auto"?0:b.line>8&&c.line>8?c.line-b.line:b.line-c.line}),A.forEach(function(b){return Object(M.addCueToTrack)(R,b)})),A}};J.default=W},"./src/utils/discontinuities.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"findFirstFragWithCC",function(){return z}),D.d(J,"shouldAlignOnDiscontinuities",function(){return W}),D.d(J,"findDiscontinuousReferenceFrag",function(){return U}),D.d(J,"adjustSlidingStart",function(){return y}),D.d(J,"alignStream",function(){return C}),D.d(J,"alignPDT",function(){return A}),D.d(J,"alignFragmentByPDTDelta",function(){return _}),D.d(J,"alignMediaPlaylistByPDT",function(){return E});var $=D("./src/polyfills/number.ts"),O=D("./src/utils/logger.ts"),M=D("./src/controller/level-helper.ts");function z(u,o){for(var s=null,d=0,w=u.length;d<w;d++){var m=u[d];if(m&&m.cc===o){s=m;break}}return s}function W(u,o,s){return!!(o.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function U(u,o){var s=u.fragments,d=o.fragments;if(!d.length||!s.length){O.logger.log("No fragments to align");return}var w=z(s,d[0].cc);if(!w||w&&!w.startPTS){O.logger.log("No frag in previous level to align on");return}return w}function R(u,o){if(u){var s=u.start+o;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function y(u,o){for(var s=o.fragments,d=0,w=s.length;d<w;d++)R(s[d],u);o.fragmentHint&&R(o.fragmentHint,u),o.alignedSliding=!0}function C(u,o,s){if(!o)return;k(u,s,o),!s.alignedSliding&&o.details&&A(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(M.adjustSliding)(o.details,s)}function k(u,o,s){if(W(u,s,o)){var d=U(s.details,o);d&&Object($.isFiniteNumber)(d.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(d.start,o))}}function A(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=u.fragments[0].programDateTime,w=(d-s)/1e3+o.fragments[0].start;w&&Object($.isFiniteNumber)(w)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+w.toFixed(3)+" "+u.url+" "),y(w,u))}function _(u,o){var s=u.programDateTime;if(!s)return;var d=(s-o)/1e3;u.start=u.startPTS=d,u.endPTS=d+u.duration}function E(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=o.fragments[0].start,w=s-d*1e3;u.fragments.forEach(function(m){_(m,w)}),u.fragmentHint&&_(u.fragmentHint,w),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/utils/ewma.ts"),O=function(){function M(W,U,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(W),this.fast_=new $.default(U)}var z=M.prototype;return z.update=function(U,R){var y=this.slow_,C=this.fast_;this.slow_.halfLife!==U&&(this.slow_=new $.default(U,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new $.default(R,C.getEstimate(),C.getTotalWeight()))},z.sample=function(U,R){U=Math.max(U,this.minDelayMs_);var y=8*R,C=U/1e3,k=y/C;this.fast_.sample(C,k),this.slow_.sample(C,k)},z.canEstimate=function(){var U=this.fast_;return U&&U.getTotalWeight()>=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},M}();J.default=O},"./src/utils/ewma.ts":function(se,J,D){"use strict";D.r(J);var $=function(){function O(z,W,U){W===void 0&&(W=0),U===void 0&&(U=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_=W,this.totalWeight_=U}var M=O.prototype;return M.sample=function(W,U){var R=Math.pow(this.alpha_,W);this.estimate_=U*(1-R)+R*this.estimate_,this.totalWeight_+=W},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},O}();J.default=$},"./src/utils/fetch-loader.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"fetchSupported",function(){return _});var $=D("./src/polyfills/number.ts"),O=D("./src/loader/load-stats.ts"),M=D("./src/demux/chunk-cache.ts");function z(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,C(d,w)}function W(d){var w=typeof Map=="function"?new Map:void 0;return W=function(g){if(g===null||!y(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(g))return w.get(g);w.set(g,L)}function L(){return U(g,arguments,k(this).constructor)}return L.prototype=Object.create(g.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),C(L,g)},W(d)}function U(d,w,m){return R()?U=Reflect.construct:U=function(L,b,c){var p=[null];p.push.apply(p,b);var h=Function.bind.apply(L,p),a=new h;return c&&C(a,c.prototype),a},U.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function y(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function C(d,w){return C=Object.setPrototypeOf||function(g,L){return g.__proto__=L,g},C(d,w)}function k(d){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},k(d)}function A(){return A=Object.assign||function(d){for(var w=1;w<arguments.length;w++){var m=arguments[w];for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(d[g]=m[g])}return d},A.apply(this,arguments)}function _(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var E=function(){function d(m){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=m.fetchSetup||o,this.controller=new self.AbortController,this.stats=new O.LoadStats}var w=d.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(g,L,b){var c=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var h=u(g,this.controller.signal),a=b.onProgress,x=g.responseType==="arraybuffer",v=x?"byteLength":"length";this.context=g,this.config=L,this.callbacks=b,this.request=this.fetchSetup(g,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),b.onTimeout(p,g,c.response)},L.timeout),self.fetch(this.request).then(function(S){if(c.response=c.loader=S,!S.ok){var B=S.status,F=S.statusText;throw new s(F||"fetch, bad network response",B,S)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object($.isFiniteNumber)(L.highWaterMark)?c.loadProgressively(S,p,g,L.highWaterMark,a):x?S.arrayBuffer():S.text()}).then(function(S){var B=c.response;self.clearTimeout(c.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=S[v];var F={url:B.url,data:S};a&&!Object($.isFiniteNumber)(L.highWaterMark)&&a(p,g,S,B),b.onSuccess(F,p,g,B)}).catch(function(S){if(self.clearTimeout(c.requestTimeout),p.aborted)return;var B=S.code||0;b.onError({code:B,text:S.message},g,S.details)})},w.getCacheAge=function(){var g=null;if(this.response){var L=this.response.headers.get("age");g=L?parseFloat(L):null}return g},w.loadProgressively=function(g,L,b,c,p){c===void 0&&(c=0);var h=new M.default,a=g.body.getReader(),x=function v(){return a.read().then(function(S){if(S.done)return h.dataLength&&p(L,b,h.flush(),g),Promise.resolve(new ArrayBuffer(0));var B=S.value,F=B.length;return L.loaded+=F,F<c||h.dataLength?(h.push(B),h.dataLength>=c&&p(L,b,h.flush(),g)):p(L,b,B,g),v()}).catch(function(){return Promise.reject()})};return x()},d}();function u(d,w){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(A({},d.headers))};return d.rangeEnd&&m.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),m}function o(d,w){return new self.Request(d.url,w)}var s=function(d){z(w,d);function w(m,g,L){var b;return b=d.call(this,m)||this,b.code=void 0,b.details=void 0,b.code=g,b.details=L,b}return w}(W(Error));J.default=E},"./src/utils/imsc1-ttml-parser.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"IMSC1_CODEC",function(){return y}),D.d(J,"parseIMSC1",function(){return _});var $=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/vttparser.ts"),M=D("./src/utils/vttcue.ts"),z=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),U=D("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(c){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var a in h)Object.prototype.hasOwnProperty.call(h,a)&&(c[a]=h[a])}return c},R.apply(this,arguments)}var y="stpp.ttml.im1t",C=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,k=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function _(c,p,h,a,x){var v=Object($.findBox)(new Uint8Array(c),["mdat"]);if(v.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var S=v[0],B=Object(z.utf8ArrayToStr)(new Uint8Array(c,S.start,S.end-S.start)),F=Object(W.toTimescaleFromScale)(p,1,h);try{a(E(B,F))}catch(K){x(K)}}function E(c,p){var h=new DOMParser,a=h.parseFromString(c,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(v).reduce(function(P,I){return P[I]=x.getAttribute("ttp:"+I)||v[I],P},{}),B=x.getAttribute("xml:space")!=="preserve",F=o(u(x,"styling","style")),K=o(u(x,"layout","region")),V=u(x,"body","[begin]");return[].map.call(V,function(P){var I=s(P,B);if(!I||!P.hasAttribute("begin"))return null;var Y=g(P.getAttribute("begin"),S),ee=g(P.getAttribute("dur"),S),oe=g(P.getAttribute("end"),S);if(Y===null)throw m(P);if(oe===null){if(ee===null)throw m(P);oe=Y+ee}var pe=new M.default(Y-p,oe-p,I);pe.id=Object(U.generateCueId)(pe.startTime,pe.endTime,pe.text);var Oe=K[P.getAttribute("region")],xe=F[P.getAttribute("style")];pe.position=10,pe.size=80;var _e=d(Oe,xe),Te=_e.textAlign;if(Te){var Ce=A[Te];Ce&&(pe.lineAlign=Ce),pe.align=Te}return R(pe,_e),pe}).filter(function(P){return P!==null})}function u(c,p,h){var a=c.getElementsByTagName(p)[0];return a?[].slice.call(a.querySelectorAll(h)):[]}function o(c){return c.reduce(function(p,h){var a=h.getAttribute("xml:id");return a&&(p[a]=h),p},{})}function s(c,p){return[].slice.call(c.childNodes).reduce(function(h,a,x){var v;return a.nodeName==="br"&&x?h+`
`:(v=a.childNodes)!==null&&v!==void 0&&v.length?s(a,p):p?h+a.textContent.trim().replace(/\s+/g," "):h+a.textContent},"")}function d(c,p){var h="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,v){var S=w(p,h,v)||w(c,h,v);return S&&(x[v]=S),x},{})}function w(c,p,h){return c.hasAttributeNS(p,h)?c.getAttributeNS(p,h):null}function m(c){return new Error("Could not parse ttml timestamp "+c)}function g(c,p){if(!c)return null;var h=Object(O.parseTimeStamp)(c);return h===null&&(C.test(c)?h=L(c,p):k.test(c)&&(h=b(c,p))),h}function L(c,p){var h=C.exec(c),a=(h[4]|0)+(h[5]|0)/p.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+a/p.frameRate}function b(c,p){var h=k.exec(c),a=Number(h[1]),x=h[2];switch(x){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(se,J,D){"use strict";D.r(J),D.d(J,"enableLogs",function(){return U}),D.d(J,"logger",function(){return R});var $=function(){},O={trace:$,debug:$,log:$,warn:$,info:$,error:$},M=O;function z(y){var C=self.console[y];return C?C.bind(self.console,"["+y+"] >"):$}function W(y){for(var C=arguments.length,k=new Array(C>1?C-1:0),A=1;A<C;A++)k[A-1]=arguments[A];k.forEach(function(_){M[_]=y[_]?y[_].bind(y):z(_)})}function U(y){if(self.console&&y===!0||typeof y=="object"){W(y,"debug","log","info","warn","error");try{M.log()}catch(C){M=O}}else M=O}var R=M},"./src/utils/mediakeys-helper.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"KeySystems",function(){return $}),D.d(J,"requestMediaKeySystemAccess",function(){return O});var $;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})($||($={}));var O=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"bin2str",function(){return W}),D.d(J,"readUint16",function(){return U}),D.d(J,"readUint32",function(){return R}),D.d(J,"writeUint32",function(){return y}),D.d(J,"findBox",function(){return C}),D.d(J,"parseSegmentIndex",function(){return k}),D.d(J,"parseInitSegment",function(){return A}),D.d(J,"getStartDTS",function(){return _}),D.d(J,"getDuration",function(){return E}),D.d(J,"computeRawDurationFromSamples",function(){return u}),D.d(J,"offsetStartDTS",function(){return o}),D.d(J,"segmentValidRange",function(){return s}),D.d(J,"appendUint8Array",function(){return d});var $=D("./src/utils/typed-array.ts"),O=D("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,z=[].push;function W(w){return String.fromCharCode.apply(null,w)}function U(w,m){"data"in w&&(m+=w.start,w=w.data);var g=w[m]<<8|w[m+1];return g<0?65536+g:g}function R(w,m){"data"in w&&(m+=w.start,w=w.data);var g=w[m]<<24|w[m+1]<<16|w[m+2]<<8|w[m+3];return g<0?4294967296+g:g}function y(w,m,g){"data"in w&&(m+=w.start,w=w.data),w[m]=g>>24,w[m+1]=g>>16&255,w[m+2]=g>>8&255,w[m+3]=g&255}function C(w,m){var g=[];if(!m.length)return g;var L,b,c;"data"in w?(L=w.data,b=w.start,c=w.end):(L=w,b=0,c=L.byteLength);for(var p=b;p<c;){var h=R(L,p),a=W(L.subarray(p+4,p+8)),x=h>1?p+h:c;if(a===m[0])if(m.length===1)g.push({data:L,start:p+8,end:x});else{var v=C({data:L,start:p+8,end:x},m.slice(1));v.length&&z.apply(g,v)}p=x}return g}function k(w){var m=C(w,["moov"]),g=m[0],L=g?g.end:null,b=C(w,["sidx"]);if(!b||!b[0])return null;var c=[],p=b[0],h=p.data[0],a=h===0?8:16,x=R(p,a);a+=4;var v=0,S=0;h===0?a+=8:a+=16,a+=2;var B=p.end+S,F=U(p,a);a+=2;for(var K=0;K<F;K++){var V=a,P=R(p,V);V+=4;var I=P&2147483647,Y=(P&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=R(p,V);V+=4,c.push({referenceSize:I,subsegmentDuration:ee,info:{duration:ee/x,start:B,end:B+I-1}}),B+=I,V+=4,a=V}return{earliestPresentationTime:v,timescale:x,version:h,referencesCount:F,references:c,moovEndOffset:L}}function A(w){for(var m=[],g=C(w,["moov","trak"]),L=0;L<g.length;L++){var b=g[L],c=C(b,["tkhd"])[0];if(c){var p=c.data[c.start],h=p===0?12:20,a=R(c,h),x=C(b,["mdia","mdhd"])[0];if(x){p=x.data[x.start],h=p===0?12:20;var v=R(x,h),S=C(b,["mdia","hdlr"])[0];if(S){var B=W(S.data.subarray(S.start+8,S.start+12)),F={soun:O.ElementaryStreamTypes.AUDIO,vide:O.ElementaryStreamTypes.VIDEO}[B];if(F){var K=C(b,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=W(K.data.subarray(K.start+12,K.start+16))),m[a]={timescale:v,type:F},m[F]={timescale:v,id:a,codec:V}}}}}}var P=C(w,["moov","mvex","trex"]);return P.forEach(function(I){var Y=R(I,4),ee=m[Y];ee&&(ee.default={duration:R(I,12),flags:R(I,20)})}),m}function _(w,m){return C(m,["moof","traf"]).reduce(function(g,L){var b=C(L,["tfdt"])[0],c=b.data[b.start],p=C(L,["tfhd"]).reduce(function(h,a){var x=R(a,4),v=w[x];if(v){var S=R(b,4);c===1&&(S*=Math.pow(2,32),S+=R(b,8));var B=v.timescale||9e4,F=S/B;if(isFinite(F)&&(h===null||F<h))return F}return h},null);return p!==null&&isFinite(p)&&(g===null||p<g)?p:g},null)||0}function E(w,m){for(var g=0,L=0,b=0,c=C(w,["moof","traf"]),p=0;p<c.length;p++){var h=c[p],a=C(h,["tfhd"])[0],x=R(a,4),v=m[x];if(!v)continue;var S=v.default,B=R(a,0)|(S==null?void 0:S.flags),F=S==null?void 0:S.duration;B&8&&(B&2?F=R(a,12):F=R(a,8));for(var K=v.timescale||9e4,V=C(h,["trun"]),P=0;P<V.length;P++){if(F){var I=R(V[P],4);g=F*I}else g=u(V[P]);v.type===O.ElementaryStreamTypes.VIDEO?L+=g/K:v.type===O.ElementaryStreamTypes.AUDIO&&(b+=g/K)}}if(L===0&&b===0){var Y=k(w);if(Y!=null&&Y.references)return Y.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return L||b}function u(w){var m=R(w,0),g=8;m&1&&(g+=4),m&4&&(g+=4);for(var L=0,b=R(w,4),c=0;c<b;c++){if(m&256){var p=R(w,g);L+=p,g+=4}m&512&&(g+=4),m&1024&&(g+=4),m&2048&&(g+=4)}return L}function o(w,m,g){C(m,["moof","traf"]).forEach(function(L){C(L,["tfhd"]).forEach(function(b){var c=R(b,4),p=w[c];if(!p)return;var h=p.timescale||9e4;C(L,["tfdt"]).forEach(function(a){var x=a.data[a.start],v=R(a,4);if(x===0)y(a,4,v-g*h);else{v*=Math.pow(2,32),v+=R(a,8),v-=g*h,v=Math.max(v,0);var S=Math.floor(v/(M+1)),B=Math.floor(v%(M+1));y(a,4,S),y(a,8,B)}})})})}function s(w){var m={valid:null,remainder:null},g=C(w,["moof"]);if(g){if(g.length<2)return m.remainder=w,m}else return m;var L=g[g.length-1];return m.valid=Object($.sliceUint8)(w,0,L.start-8),m.remainder=Object($.sliceUint8)(w,L.start-8),m}function d(w,m){var g=new Uint8Array(w.length+m.length);return g.set(w),g.set(m,w.length),g}},"./src/utils/output-filter.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"default",function(){return $});var $=function(){function O(z,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=z,this.trackName=W}var M=O.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(W,U,R){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=U,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},O}()},"./src/utils/texttrack-utils.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"sendAddTrackEvent",function(){return O}),D.d(J,"addCueToTrack",function(){return M}),D.d(J,"clearCurrentCues",function(){return z}),D.d(J,"removeCuesInRange",function(){return W}),D.d(J,"getCuesInRange",function(){return R});var $=D("./src/utils/logger.ts");function O(y,C){var k;try{k=new Event("addtrack")}catch(A){k=document.createEvent("Event"),k.initEvent("addtrack",!1,!1)}k.track=y,C.dispatchEvent(k)}function M(y,C){var k=y.mode;if(k==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(C.id))try{if(y.addCue(C),!y.cues.getCueById(C.id))throw new Error("addCue is failed for: "+C)}catch(_){$.logger.debug("[texttrack-utils]: "+_);var A=new self.TextTrackCue(C.startTime,C.endTime,C.text);A.id=C.id,y.addCue(A)}k==="disabled"&&(y.mode=k)}function z(y){var C=y.mode;if(C==="disabled"&&(y.mode="hidden"),y.cues)for(var k=y.cues.length;k--;)y.removeCue(y.cues[k]);C==="disabled"&&(y.mode=C)}function W(y,C,k){var A=y.mode;if(A==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var _=R(y.cues,C,k),E=0;E<_.length;E++)y.removeCue(_[E]);A==="disabled"&&(y.mode=A)}function U(y,C){if(C<y[0].startTime)return 0;var k=y.length-1;if(C>y[k].endTime)return-1;for(var A=0,_=k;A<=_;){var E=Math.floor((_+A)/2);if(C<y[E].startTime)_=E-1;else if(C>y[E].startTime&&A<k)A=E+1;else return E}return y[A].startTime-C<C-y[_].startTime?A:_}function R(y,C,k){var A=[],_=U(y,C);if(_>-1)for(var E=_,u=y.length;E<u;E++){var o=y[E];if(o.startTime>=C&&o.endTime<=k)A.push(o);else if(o.startTime>k)return A}return A}},"./src/utils/time-ranges.ts":function(se,J,D){"use strict";D.r(J);var $={toString:function(M){for(var z="",W=M.length,U=0;U<W;U++)z+="["+M.start(U).toFixed(3)+","+M.end(U).toFixed(3)+"]";return z}};J.default=$},"./src/utils/timescale-conversion.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"toTimescaleFromBase",function(){return O}),D.d(J,"toTimescaleFromScale",function(){return M}),D.d(J,"toMsFromMpegTsClock",function(){return z}),D.d(J,"toMpegTsClockFromTimescale",function(){return W});var $=9e4;function O(U,R,y,C){y===void 0&&(y=1),C===void 0&&(C=!1);var k=U*R*y;return C?Math.round(k):k}function M(U,R,y,C){return y===void 0&&(y=1),C===void 0&&(C=!1),O(U,R,1/y,C)}function z(U,R){return R===void 0&&(R=!1),O(U,1e3,1/$,R)}function W(U,R){return R===void 0&&(R=1),O(U,$,1/R)}},"./src/utils/typed-array.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"sliceUint8",function(){return $});function $(O,M,z){return Uint8Array.prototype.slice?O.slice(M,z):new Uint8Array(Array.prototype.slice.call(O,M,z))}},"./src/utils/vttcue.ts":function(se,J,D){"use strict";D.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],O=["start","middle","end","left","right"];function M(y,C){if(typeof C!="string")return!1;if(!Array.isArray(y))return!1;var k=C.toLowerCase();return~y.indexOf(k)?k:!1}function z(y){return M($,y)}function W(y){return M(O,y)}function U(y){for(var C=arguments.length,k=new Array(C>1?C-1:0),A=1;A<C;A++)k[A-1]=arguments[A];for(var _=1;_<arguments.length;_++){var E=arguments[_];for(var u in E)y[u]=E[u]}return y}function R(y,C,k){var A=this,_={enumerable:!0};A.hasBeenReset=!1;var E="",u=!1,o=y,s=C,d=k,w=null,m="",g=!0,L="auto",b="start",c=50,p="middle",h=50,a="middle";Object.defineProperty(A,"id",U({},_,{get:function(){return E},set:function(v){E=""+v}})),Object.defineProperty(A,"pauseOnExit",U({},_,{get:function(){return u},set:function(v){u=!!v}})),Object.defineProperty(A,"startTime",U({},_,{get:function(){return o},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",U({},_,{get:function(){return s},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",U({},_,{get:function(){return d},set:function(v){d=""+v,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",U({},_,{get:function(){return w},set:function(v){w=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",U({},_,{get:function(){return m},set:function(v){var S=z(v);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=S,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",U({},_,{get:function(){return g},set:function(v){g=!!v,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",U({},_,{get:function(){return L},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",U({},_,{get:function(){return b},set:function(v){var S=W(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");b=S,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",U({},_,{get:function(){return c},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",U({},_,{get:function(){return p},set:function(v){var S=W(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");p=S,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",U({},_,{get:function(){return h},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");h=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",U({},_,{get:function(){return a},set:function(v){var S=W(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),A.displayState=void 0}return R.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"parseTimeStamp",function(){return M}),D.d(J,"fixLineBreaks",function(){return C}),D.d(J,"VTTParser",function(){return k});var $=D("./src/utils/vttcue.ts"),O=function(){function A(){}var _=A.prototype;return _.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},A}();function M(A){function _(u,o,s,d){return(u|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var E=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?_(E[2],E[3],0,E[4]):_(E[1],E[2],E[3],E[4]):null}var z=function(){function A(){this.values=Object.create(null)}var _=A.prototype;return _.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},_.get=function(u,o,s){return s?this.has(u)?this.values[u]:o[s]:this.has(u)?this.values[u]:o},_.has=function(u){return u in this.values},_.alt=function(u,o,s){for(var d=0;d<s.length;++d)if(o===s[d]){this.set(u,o);break}},_.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},_.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},A}();function W(A,_,E,u){var o=u?A.split(u):[A];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(E);if(d.length!==2)continue;var w=d[0],m=d[1];_(w,m)}}var U=new $.default(0,0,""),R=U.align==="middle"?"middle":"center";function y(A,_,E){var u=A;function o(){var w=M(A);if(w===null)throw new Error("Malformed timestamp: "+u);return A=A.replace(/^[^\sa-zA-Z-]+/,""),w}function s(w,m){var g=new z;W(w,function(c,p){var h;switch(c){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===p){g.set(c,E[a].region);break}break;case"vertical":g.alt(c,p,["rl","lr"]);break;case"line":h=p.split(","),g.integer(c,h[0]),g.percent(c,h[0])&&g.set("snapToLines",!1),g.alt(c,h[0],["auto"]),h.length===2&&g.alt("lineAlign",h[1],["start",R,"end"]);break;case"position":h=p.split(","),g.percent(c,h[0]),h.length===2&&g.alt("positionAlign",h[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":g.percent(c,p);break;case"align":g.alt(c,p,["start",R,"end","left","right"]);break}},/:/,/\s/),m.region=g.get("region",null),m.vertical=g.get("vertical","");var L=g.get("line","auto");L==="auto"&&U.line===-1&&(L=-1),m.line=L,m.lineAlign=g.get("lineAlign","start"),m.snapToLines=g.get("snapToLines",!0),m.size=g.get("size",100),m.align=g.get("align",R);var b=g.get("position","auto");b==="auto"&&U.position===50&&(b=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=b}function d(){A=A.replace(/^\s+/,"")}if(d(),_.startTime=o(),d(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);A=A.substr(3),d(),_.endTime=o(),d(),s(A,_)}function C(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var k=function(){function A(){this.state="INITIAL",this.buffer="",this.decoder=new O,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var _=A.prototype;return _.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function s(){var b=o.buffer,c=0;for(b=C(b);c<b.length&&b[c]!=="\r"&&b[c]!==`
`;)++c;var p=b.substr(0,c);return b[c]==="\r"&&++c,b[c]===`
`&&++c,o.buffer=b.substr(c),p}function d(b){W(b,function(c,p){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=s();var m=w.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var g=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;g?g=!1:w=s();switch(o.state){case"HEADER":/:/.test(w)?d(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new $.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(w,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(g=!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+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},_.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(se,J,D){"use strict";D.r(J),D.d(J,"generateCueId",function(){return k}),D.d(J,"parseWebVTT",function(){return _});var $=D("./src/polyfills/number.ts"),O=D("./src/utils/vttparser.ts"),M=D("./src/demux/id3.ts"),z=D("./src/utils/timescale-conversion.ts"),W=D("./src/remux/mp4-remuxer.ts"),U=/\r\n|\n\r|\n|\r/g,R=function(u,o,s){return s===void 0&&(s=0),u.substr(s,o.length)===o},y=function(u){var o=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),d=parseInt(u.substr(-9,2)),w=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object($.isFiniteNumber)(o)||!Object($.isFiniteNumber)(s)||!Object($.isFiniteNumber)(d)||!Object($.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*w,o},C=function(u){for(var o=5381,s=u.length;s;)o=o*33^u.charCodeAt(--s);return(o>>>0).toString()};function k(E,u,o){return C(E.toString())+C(u.toString())+C(o)}var A=function(u,o,s){var d=u[o],w=u[d.prevCC];if(!w||!w.new&&d.new){u.ccOffset=u.presentationOffset=d.start,d.new=!1;return}for(;(m=w)!==null&&m!==void 0&&m.new;){var m;u.ccOffset+=d.start-w.start,d.new=!1,d=w,w=u[d.prevCC]}u.presentationOffset=s};function _(E,u,o,s,d,w,m,g){var L=new O.VTTParser,b=Object(M.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(U,`
`).split(`
`),c=[],p=Object(z.toMpegTsClockFromTimescale)(u,o),h="00:00.000",a=0,x=0,v,S=!0,B=!1;L.oncue=function(F){var K=s[d],V=s.ccOffset,P=(a-p)/9e4;if(K!=null&&K.new&&(x!==void 0?V=s.ccOffset=K.start:A(s,d,P)),P&&(V=P-s.presentationOffset),B){var I=F.endTime-F.startTime,Y=Object(W.normalizePts)((F.startTime+V-x)*9e4,w*9e4)/9e4;F.startTime=Y,F.endTime=Y+I}var ee=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(ee)),F.id||(F.id=k(F.startTime,F.endTime,ee)),F.endTime>0&&c.push(F)},L.onparsingerror=function(F){v=F},L.onflush=function(){if(v){g(v);return}m(c)},b.forEach(function(F){if(S)if(R(F,"X-TIMESTAMP-MAP=")){S=!1,B=!0,F.substr(16).split(",").forEach(function(K){R(K,"LOCAL:")?h=K.substr(6):R(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{x=y(h)/1e3}catch(K){B=!1,v=K}return}else F===""&&(S=!1);L.parse(F+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(se,J,D){"use strict";D.r(J);var $=D("./src/utils/logger.ts"),O=D("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,z=function(){function W(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new O.LoadStats,this.retryDelay=0}var U=W.prototype;return U.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},U.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},U.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},U.load=function(y,C,k){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=C,this.callbacks=k,this.retryDelay=C.retryDelay,this.loadInternal()},U.loadInternal=function(){var y=this.config,C=this.context;if(!y)return;var k=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var _=this.xhrSetup;try{if(_)try{_(k,C.url)}catch(o){k.open("GET",C.url,!0),_(k,C.url)}k.readyState||k.open("GET",C.url,!0);var E=this.context.headers;if(E)for(var u in E)k.setRequestHeader(u,E[u])}catch(o){this.callbacks.onError({code:k.status,text:o.message},C,k);return}C.rangeEnd&&k.setRequestHeader("Range","bytes="+C.rangeStart+"-"+(C.rangeEnd-1)),k.onreadystatechange=this.readystatechange.bind(this),k.onprogress=this.loadprogress.bind(this),k.responseType=C.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),k.send()},U.readystatechange=function(){var y=this.context,C=this.loader,k=this.stats;if(!y||!C)return;var A=C.readyState,_=this.config;if(k.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),k.loading.first===0&&(k.loading.first=Math.max(self.performance.now(),k.loading.start)),A===4){C.onreadystatechange=null,C.onprogress=null;var E=C.status;if(E>=200&&E<300){k.loading.end=Math.max(self.performance.now(),k.loading.first);var u,o;if(y.responseType==="arraybuffer"?(u=C.response,o=u.byteLength):(u=C.responseText,o=u.length),k.loaded=k.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(k,y,u,C),!this.callbacks)return;var d={url:C.responseURL,data:u};this.callbacks.onSuccess(d,k,y,C)}else k.retry>=_.maxRetry||E>=400&&E<499?($.logger.error(E+" while loading "+y.url),this.callbacks.onError({code:E,text:C.statusText},y,C)):($.logger.warn(E+" while loading "+y.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,_.maxRetryDelay),k.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout)},U.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},U.loadprogress=function(y){var C=this.stats;C.loaded=y.loaded,y.lengthComputable&&(C.total=y.total)},U.getCacheAge=function(){var y=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var C=this.loader.getResponseHeader("age");y=C?parseFloat(C):null}return y},W}();J.default=z}}).default})},vHTk:function(ft,tt,ie){ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);