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

376 lines
1.0 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[233,5,6,7],{"+NIl":function(bt,De,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(J,O){"use strict";function $(p,m){p.cmdState.push(m)}function F(p){return p.cmdState.length>0?p.cmdState[p.cmdState.length-1]:null}function M(p){var m=p.cmdState.pop();m&&m.closeBracket()}function j(p){for(var m=p.cmdState,g=m.length-1;g>=0;g--){var a=m[g];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function U(p,m,g){return function(){this.name=p,this.bracketNo=0,this.style=m,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=U("importmodule","tag",["string","builtin"]),P.documentclass=U("documentclass","tag",["","atom"]),P.usepackage=U("usepackage","tag",["atom"]),P.begin=U("begin","tag",["atom"]),P.end=U("end","tag",["atom"]),P.label=U("label","tag",["atom"]),P.ref=U("ref","tag",["atom"]),P.eqref=U("eqref","tag",["atom"]),P.cite=U("cite","tag",["atom"]),P.bibitem=U("bibitem","tag",["atom"]),P.Bibitem=U("Bibitem","tag",["atom"]),P.RBibitem=U("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(p,m){p.f=m}function d(p,m){var g;if(p.match(/^\\[a-zA-Z@]+/)){var a=p.current().slice(1);return g=P.hasOwnProperty(a)?P[a]:P.DEFAULT,g=new g,$(m,g),A(m,T),g.style}if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/\\]/))return"tag";if(p.match("\\["))return A(m,function(s,l){return f(s,l,"\\]")}),"keyword";if(p.match("\\("))return A(m,function(s,l){return f(s,l,"\\)")}),"keyword";if(p.match("$$"))return A(m,function(s,l){return f(s,l,"$$")}),"keyword";if(p.match("$"))return A(m,function(s,l){return f(s,l,"$")}),"keyword";var i=p.next();if(i=="%")return p.skipToEnd(),"comment";if(i=="}"||i=="]"){if(g=F(m),g)g.closeBracket(i),A(m,T);else return"error";return"bracket"}else return i=="{"||i=="["?(g=P.DEFAULT,g=new g,$(m,g),"bracket"):/\d/.test(i)?(p.eatWhile(/[\w.%]/),"atom"):(p.eatWhile(/[\w\-_]/),g=j(m),g.name=="begin"&&(g.argument=p.current()),g.styleIdentifier())}function f(p,m,g){if(p.eatSpace())return null;if(g&&p.match(g))return A(m,d),"keyword";if(p.match(/^\\[a-zA-Z@]+/))return"tag";if(p.match(/^[a-zA-Z]+/))return"variable-2";if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/]/))return"tag";if(p.match(/^[\^_&]/))return"tag";if(p.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(p.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var a=p.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(p.skipToEnd(),"comment"):"error"}function T(p,m){var g=p.peek(),a;return g=="{"||g=="["?(a=F(m),a.openBracket(g),p.eat(g),A(m,d),"bracket"):/[ \t\r]/.test(g)?(p.eat(g),null):(A(m,d),M(m),d(p,m))}return{startState:function(){var p=O.inMathMode?function(m,g){return f(m,g)}:d;return{cmdState:[],f:p}},copyState:function(p){return{cmdState:p.cmdState.slice(),f:p.f}},token:function(p,m){return m.f(p,m)},blankLine:function(p){p.f=d,p.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(bt,De,q){},"/cxE":function(bt,De,q){"use strict";q.d(De,"e",function(){return O}),q.d(De,"f",function(){return $}),q.d(De,"g",function(){return F}),q.d(De,"d",function(){return j}),q.d(De,"a",function(){return U}),q.d(De,"b",function(){return P}),q.d(De,"c",function(){return A});var ue=function(){function d(){this.listeners=[],this.unexpectedErrorHandler=function(f){setTimeout(function(){throw f.stack?new Error(f.message+`
`+f.stack):f},0)}}return d.prototype.emit=function(f){this.listeners.forEach(function(T){T(f)})},d.prototype.onUnexpectedError=function(f){this.unexpectedErrorHandler(f),this.emit(f)},d.prototype.onUnexpectedExternalError=function(f){this.unexpectedErrorHandler(f)},d}(),J=new ue;function O(d){j(d)||J.onUnexpectedError(d);return}function $(d){j(d)||J.onUnexpectedExternalError(d);return}function F(d){if(d instanceof Error){var f=d.name,T=d.message,p=d.stacktrace||d.stack;return{$isError:!0,name:f,message:T,stack:p}}return d}var M="Canceled";function j(d){return d instanceof Error&&d.name===M&&d.message===M}function U(){var d=new Error(M);return d.name=d.message,d}function P(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function A(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"19Vz":function(bt,De,q){(function(ue){ue(q("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(U,P,A){var d=A&&A!=ue.Init;if(P&&!d)U.on("blur",F),U.on("change",M),U.on("swapDoc",M),ue.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){$(U)}),M(U);else if(!P&&d){U.off("blur",F),U.off("change",M),U.off("swapDoc",M),ue.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),J(U);var f=U.getWrapperElement();f.className=f.className.replace(" CodeMirror-empty","")}P&&!U.hasFocus()&&F(U)});function J(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function O(U){J(U);var P=U.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=U.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var A=U.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),P.appendChild(A),U.display.lineSpace.insertBefore(P,U.display.lineSpace.firstChild)}function $(U){setTimeout(function(){var P=!1,A=U.getInputField();A.nodeName=="TEXTAREA"?P=!A.value:U.lineCount()==1&&(P=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),P?O(U):J(U)},20)}function F(U){j(U)&&O(U)}function M(U){var P=U.getWrapperElement(),A=j(U);P.className=P.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?O(U):J(U)}function j(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(bt,De,q){(function(ue){ue(q("VrN/"))})(function(ue){"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},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function($,F){var M=$.indentUnit,j={},U=F.htmlMode?J:O;for(var P in U)j[P]=U[P];for(var P in F)j[P]=F[P];var A,d;function f(u,L){function S(B){return L.tokenize=B,B(u,L)}var D=u.next();if(D=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?S(m("atom","]]>")):null:u.match("--")?S(m("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),S(g(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),L.tokenize=m("meta","?>"),"meta"):(A=u.eat("/")?"closeTag":"openTag",L.tokenize=T,"tag bracket");if(D=="&"){var _;return u.eat("#")?u.eat("x")?_=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):_=u.eatWhile(/[\d]/)&&u.eat(";"):_=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),_?"atom":"error"}else return u.eatWhile(/[^&<]/),null}f.isInText=!0;function T(u,L){var S=u.next();if(S==">"||S=="/"&&u.eat(">"))return L.tokenize=f,A=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return A="equals",null;if(S=="<"){L.tokenize=f,L.state=l,L.tagName=L.tagStart=null;var D=L.tokenize(u,L);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(S)?(L.tokenize=p(S),L.stringStartCol=u.column(),L.tokenize(u,L)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function p(u){var L=function(S,D){for(;!S.eol();)if(S.next()==u){D.tokenize=T;break}return"string"};return L.isInAttribute=!0,L}function m(u,L){return function(S,D){for(;!S.eol();){if(S.match(L)){D.tokenize=f;break}S.next()}return u}}function g(u){return function(L,S){for(var D;(D=L.next())!=null;){if(D=="<")return S.tokenize=g(u+1),S.tokenize(L,S);if(D==">")if(u==1){S.tokenize=f;break}else return S.tokenize=g(u-1),S.tokenize(L,S)}return"meta"}}function a(u,L,S){this.prev=u.context,this.tagName=L,this.indent=u.indented,this.startOfLine=S,(j.doNotIndent.hasOwnProperty(L)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function s(u,L){for(var S;;){if(!u.context)return;if(S=u.context.tagName,!j.contextGrabbers.hasOwnProperty(S)||!j.contextGrabbers[S].hasOwnProperty(L))return;i(u)}}function l(u,L,S){return u=="openTag"?(S.tagStart=L.column(),x):u=="closeTag"?v:l}function x(u,L,S){return u=="word"?(S.tagName=L.current(),d="tag",w):j.allowMissingTagName&&u=="endTag"?(d="tag bracket",w(u,L,S)):(d="error",x)}function v(u,L,S){if(u=="word"){var D=L.current();return S.context&&S.context.tagName!=D&&j.implicitlyClosed.hasOwnProperty(S.context.tagName)&&i(S),S.context&&S.context.tagName==D||j.matchClosing===!1?(d="tag",y):(d="tag error",R)}else return j.allowMissingTagName&&u=="endTag"?(d="tag bracket",y(u,L,S)):(d="error",R)}function y(u,L,S){return u!="endTag"?(d="error",y):(i(S),l)}function R(u,L,S){return d="error",y(u,L,S)}function w(u,L,S){if(u=="word")return d="attribute",E;if(u=="endTag"||u=="selfcloseTag"){var D=S.tagName,_=S.tagStart;return S.tagName=S.tagStart=null,u=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(D)?s(S,D):(s(S,D),S.context=new a(S,D,_==S.indented)),l}return d="error",w}function E(u,L,S){return u=="equals"?C:(j.allowMissing||(d="error"),w(u,L,S))}function C(u,L,S){return u=="string"?c:u=="word"&&j.allowUnquoted?(d="string",w):(d="error",w(u,L,S))}function c(u,L,S){return u=="string"?c:w(u,L,S)}return{startState:function(u){var L={tokenize:f,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(L.baseIndent=u),L},token:function(u,L){if(!L.tagName&&u.sol()&&(L.indented=u.indentation()),u.eatSpace())return null;A=null;var S=L.tokenize(u,L);return(S||A)&&S!="comment"&&(d=null,L.state=L.state(A||S,u,L),d&&(S=d=="error"?S+" error":d)),S},indent:function(u,L,S){var D=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+M;if(D&&D.noIndent)return ue.Pass;if(u.tokenize!=T&&u.tokenize!=f)return S?S.match(/^(\s*)/)[0].length:0;if(u.tagName)return j.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+M*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(L))return 0;var _=L&&/^<(\/)?([\w_:\.-]*)/.exec(L);if(_&&_[1])for(;D;)if(D.tagName==_[2]){D=D.prev;break}else if(j.implicitlyClosed.hasOwnProperty(D.tagName))D=D.prev;else break;else if(_)for(;D;){var B=j.contextGrabbers[D.tagName];if(B&&B.hasOwnProperty(_[2]))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+M:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(u){u.state==C&&(u.state=w)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var L=[],S=u.context;S;S=S.prev)S.tagName&&L.push(S.tagName);return L.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(bt,De,q){"use strict";q.d(De,"a",function(){return O});var ue=q("JYp7"),J=function(){function $(F){this.element=F,this.next=$.Undefined,this.prev=$.Undefined}return $.Undefined=new $(void 0),$}(),O=function(){function $(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}return Object.defineProperty($.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),$.prototype.isEmpty=function(){return this._first===J.Undefined},$.prototype.clear=function(){this._first=J.Undefined,this._last=J.Undefined,this._size=0},$.prototype.unshift=function(F){return this._insert(F,!1)},$.prototype.push=function(F){return this._insert(F,!0)},$.prototype._insert=function(F,M){var j=this,U=new J(F);if(this._first===J.Undefined)this._first=U,this._last=U;else if(M){var P=this._last;this._last=U,U.prev=P,P.next=U}else{var A=this._first;this._first=U,U.next=A,A.prev=U}this._size+=1;var d=!1;return function(){d||(d=!0,j._remove(U))}},$.prototype.shift=function(){if(this._first===J.Undefined)return;var F=this._first.element;return this._remove(this._first),F},$.prototype.pop=function(){if(this._last===J.Undefined)return;var F=this._last.element;return this._remove(this._last),F},$.prototype._remove=function(F){if(F.prev!==J.Undefined&&F.next!==J.Undefined){var M=F.prev;M.next=F.next,F.next.prev=M}else F.prev===J.Undefined&&F.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):F.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):F.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1},$.prototype.iterator=function(){var F,M=this._first;return{next:function(){return M===J.Undefined?ue.c:(F?F.value=M.element:F={done:!1,value:M.element},M=M.next,F)}}},$.prototype.toArray=function(){for(var F=[],M=this._first;M!==J.Undefined;M=M.next)F.push(M.element);return F},$}()},"746U":function(bt,De,q){"use strict";q.d(De,"d",function(){return J}),q.d(De,"j",function(){return O}),q.d(De,"i",function(){return $}),q.d(De,"h",function(){return F}),q.d(De,"e",function(){return M}),q.d(De,"k",function(){return j}),q.d(De,"l",function(){return U}),q.d(De,"a",function(){return P}),q.d(De,"f",function(){return d}),q.d(De,"g",function(){return f}),q.d(De,"m",function(){return T}),q.d(De,"c",function(){return g}),q.d(De,"b",function(){return a}),q.d(De,"n",function(){return i}),q.d(De,"o",function(){return s});var ue={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function J(l){return Array.isArray?Array.isArray(l):!!(l&&typeof l.length===ue.number&&l.constructor===Array)}function O(l){return typeof l===ue.string||l instanceof String}function $(l){return typeof l===ue.object&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}function F(l){return(typeof l===ue.number||l instanceof Number)&&!isNaN(l)}function M(l){return l===!0||l===!1}function j(l){return typeof l===ue.undefined}function U(l){return j(l)||l===null}function P(l,x){if(!l)throw new Error(x?"Unexpected type, expected '"+x+"'":"Unexpected type")}var A=Object.prototype.hasOwnProperty;function d(l){if(!$(l))return!1;for(var x in l)if(A.call(l,x))return!1;return!0}function f(l){return typeof l===ue.function}function T(l,x){for(var v=Math.min(l.length,x.length),y=0;y<v;y++)p(l[y],x[y])}function p(l,x){if(O(x)){if(typeof l!==x)throw new Error("argument does not match constraint: typeof "+x)}else if(f(x)){try{if(l instanceof x)return}catch(v){}if(!U(l)&&l.constructor===x)return;if(x.length===1&&x.call(void 0,l)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function m(l){for(var x=[],v=Object.getPrototypeOf(l);Object.prototype!==v;)x=x.concat(Object.getOwnPropertyNames(v)),v=Object.getPrototypeOf(v);return x}function g(l){for(var x=[],v=0,y=m(l);v<y.length;v++){var R=y[v];typeof l[R]=="function"&&x.push(R)}return x}function a(l,x){for(var v=function(C){return function(){var c=Array.prototype.slice.call(arguments,0);return x(C,c)}},y={},R=0,w=l;R<w.length;R++){var E=w[R];y[E]=v(E)}return y}function i(l){return l===null?void 0:l}function s(l){return typeof l=="undefined"?null:l}},"7Cbv":function(bt,De,q){"use strict";var ue=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 O(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(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 F(T){return typeof T=="string"&&$.test(T)}for(var M=F,j=[],U=0;U<256;++U)j.push((U+256).toString(16).substr(1));function P(T){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=(j[T[p+0]]+j[T[p+1]]+j[T[p+2]]+j[T[p+3]]+"-"+j[T[p+4]]+j[T[p+5]]+"-"+j[T[p+6]]+j[T[p+7]]+"-"+j[T[p+8]]+j[T[p+9]]+"-"+j[T[p+10]]+j[T[p+11]]+j[T[p+12]]+j[T[p+13]]+j[T[p+14]]+j[T[p+15]]).toLowerCase();if(!M(m))throw TypeError("Stringified UUID is invalid");return m}var A=P;function d(T,p,m){T=T||{};var g=T.random||(T.rng||O)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,p){m=m||0;for(var a=0;a<16;++a)p[m+a]=g[a];return p}return A(g)}var f=De.a=d},"7ahc":function(bt,De,q){"use strict";q.d(De,"a",function(){return x});var ue=q("k1fw"),J=q("0Owb"),O=q("+L6B"),$=q("2/Rp"),F=q("y8nQ"),M=q("Vl3Y"),j=q("tJVT"),U=q("OaEy"),P=q("2fM7"),A=q("q1tI"),d=q.n(A),f=q("VrN/"),T=q.n(f),p=q("p77/"),m=q.n(p),g=q("c5Ni"),a=q.n(g),i=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={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"]};De.b=function(v){var y=v.callback,R=v.onCancel,w=Object(A.useState)("python"),E=Object(j.a)(w,2),C=E[0],c=E[1];function u(S){c(l[S][1])}function L(S){y(S)}return d.a.createElement(M.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:L}),d.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},d.a.createElement(P.a,{onChange:u},Object.keys(l).map(function(S){return d.a.createElement(i,{key:S,value:S},l[S][0])}))),d.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},d.a.createElement(x,{mode:C})),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),d.a.createElement($.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function x(v){var y=v.value,R=v.onChange,w=v.mode,E=v.options,C=E===void 0?{}:E,c=Object(A.useRef)(),u=Object(A.useState)(),L=Object(j.a)(u,2),S=L[0],D=L[1];return Object(A.useEffect)(function(){if(S){function _(B){var G=B.getValue();R&&R(G)}return S.on("change",_),function(){S.off("change",_)}}},[S,R]),Object(A.useEffect)(function(){S&&S.setOption("mode",w)},[S,w]),Object(A.useEffect)(function(){S&&((y!==S.getValue()||y==="")&&setTimeout(function(){S.setValue(y||" ")},300))},[S,y]),Object(A.useEffect)(function(){if(c.current&&!S){var _=T.a.fromTextArea(c.current,Object(ue.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},C));D(_)}},[c.current,S]),d.a.createElement("div",{className:"my-codemirror-container"},d.a.createElement("textarea",{ref:c}))}},"8EBN":function(bt,De,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";ue.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<ue.modeInfo.length;J++){var O=ue.modeInfo[J];O.mimes&&(O.mime=O.mimes[0])}ue.findModeByMIME=function($){$=$.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.mime==$)return M;if(M.mimes){for(var j=0;j<M.mimes.length;j++)if(M.mimes[j]==$)return M}}if(/\+xml$/.test($))return ue.findModeByMIME("application/xml");if(/\+json$/.test($))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function($){$=$.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.ext){for(var j=0;j<M.ext.length;j++)if(M.ext[j]==$)return M}}},ue.findModeByFileName=function($){for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.file&&M.file.test($))return M}var j=$.lastIndexOf("."),U=j>-1&&$.substring(j+1,$.length);if(U)return ue.findModeByExtension(U)},ue.findModeByName=function($){$=$.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.name.toLowerCase()==$)return M;if(M.alias){for(var j=0;j<M.alias.length;j++)if(M.alias[j].toLowerCase()==$)return M}}}})},"8HAY":function(bt,De,q){"use strict";q.d(De,"a",function(){return M}),q.d(De,"b",function(){return j});var ue=q("pmY6"),J=q("MI8n"),O=function(){var U=function(P,A){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var T in f)f.hasOwnProperty(T)&&(d[T]=f[T])},U(P,A)};return function(P,A){U(P,A);function d(){this.constructor=P}P.prototype=A===null?Object.create(A):(d.prototype=A.prototype,new d)}}(),$=function(U,P,A,d){function f(T){return T instanceof A?T:new A(function(p){p(T)})}return new(A||(A=Promise))(function(T,p){function m(i){try{a(d.next(i))}catch(s){p(s)}}function g(i){try{a(d.throw(i))}catch(s){p(s)}}function a(i){i.done?T(i.value):f(i.value).then(m,g)}a((d=d.apply(U,P||[])).next())})},F=function(U,P){var A={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},d,f,T,p;return p={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function m(a){return function(i){return g([a,i])}}function g(a){if(d)throw new TypeError("Generator is already executing.");for(;A;)try{if(d=1,f&&(T=a[0]&2?f.return:a[0]?f.throw||((T=f.return)&&T.call(f),0):f.next)&&!(T=T.call(f,a[1])).done)return T;(f=0,T)&&(a=[a[0]&2,T.value]);switch(a[0]){case 0:case 1:T=a;break;case 4:return A.label++,{value:a[1],done:!1};case 5:A.label++,f=a[1],a=[0];continue;case 7:a=A.ops.pop(),A.trys.pop();continue;default:if(!(T=A.trys,T=T.length>0&&T[T.length-1])&&(a[0]===6||a[0]===2)){A=0;continue}if(a[0]===3&&(!T||a[1]>T[0]&&a[1]<T[3])){A.label=a[1];break}if(a[0]===6&&A.label<T[1]){A.label=T[1],T=a;break}if(T&&A.label<T[2]){A.label=T[2],A.ops.push(a);break}T[2]&&A.ops.pop(),A.trys.pop();continue}a=P.call(U,A)}catch(i){a=[6,i],f=0}finally{d=T=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},M=function(U){O(P,U);function P(A,d,f,T,p){d===void 0&&(d=""),f===void 0&&(f=""),T===void 0&&(T=!0);var m=U.call(this)||this;return m._onDidChange=m._register(new J.a),m.onDidChange=m._onDidChange.event,m._enabled=!0,m._checked=!1,m._id=A,m._label=d,m._cssClass=f,m._enabled=T,m._actionCallback=p,m}return Object.defineProperty(P.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"label",{get:function(){return this._label},set:function(A){this._setLabel(A)},enumerable:!0,configurable:!0}),P.prototype._setLabel=function(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))},Object.defineProperty(P.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(A){this._setTooltip(A)},enumerable:!0,configurable:!0}),P.prototype._setTooltip=function(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))},Object.defineProperty(P.prototype,"class",{get:function(){return this._cssClass},set:function(A){this._setClass(A)},enumerable:!0,configurable:!0}),P.prototype._setClass=function(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))},Object.defineProperty(P.prototype,"enabled",{get:function(){return this._enabled},set:function(A){this._setEnabled(A)},enumerable:!0,configurable:!0}),P.prototype._setEnabled=function(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))},Object.defineProperty(P.prototype,"checked",{get:function(){return this._checked},set:function(A){this._setChecked(A)},enumerable:!0,configurable:!0}),P.prototype._setChecked=function(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))},P.prototype.run=function(A,d){return this._actionCallback?this._actionCallback(A):Promise.resolve(!0)},P}(ue.a),j=function(U){O(P,U);function P(){var A=U!==null&&U.apply(this,arguments)||this;return A._onDidBeforeRun=A._register(new J.a),A.onDidBeforeRun=A._onDidBeforeRun.event,A._onDidRun=A._register(new J.a),A.onDidRun=A._onDidRun.event,A}return P.prototype.run=function(A,d){return $(this,void 0,void 0,function(){var f,T;return F(this,function(p){switch(p.label){case 0:if(!A.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:A}),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.runAction(A,d)];case 2:return f=p.sent(),this._onDidRun.fire({action:A,result:f}),[3,4];case 3:return T=p.sent(),this._onDidRun.fire({action:A,error:T}),[3,4];case 4:return[2]}})})},P.prototype.runAction=function(A,d){var f=d?A.run(d):A.run();return Promise.resolve(f)},P}(ue.a)},"8hTe":function(bt,De,q){bt.exports={button:"button___1wy9m"}},"9Bee":function(bt,De,q){"use strict";var ue=q("DYRE"),J=q("zeV3"),O=q("+L6B"),$=q("2/Rp"),F=q("k1fw"),M=q("9og8"),j=q("tJVT"),U=q("WmNS"),P=q.n(U),A=q("q1tI"),d=q.n(A),f=q("vg9a"),T=q("DlQD"),p=q.n(T),m=q("rUJ1");function g(z,h){var b=z.match(/^(\s+)(?:```)/);if(b===null)return h;var H=b[1];return h.split(`
`).map(function(X){var K=X.match(/^\s+/);if(K===null)return X;var xe=Object(j.a)(K,1),Ge=xe[0];return Ge.length>=H.length?X.slice(H.length):X}).join(`
`)}var a=[],i=["<ul>"],s=new p.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function x(){a.length=0,i=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(z,h,b,H){if(h>=z.length||z[h].level<=b)return h;var X=z[h];H.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),h++;var K=[];return h=y(z,h,X.level,K),K.length>0&&(H.push("<ul>"),K.forEach(function(xe){H.push(xe)}),H.push("</ul>")),H.push("</li>"),h=y(z,h,b,H),h}function R(){return y(a,0,0,i),i.push("</ul>"),i.join("")}var w={heading:function(h){var b=l.exec(h);if(b)return{type:"heading",raw:b[0],depth:b[1].length,text:b[2]}},fences:function(h){var b=this.rules.block.fences.exec(h);if(b){var H=b[0],X=g(H,b[3]||""),K=b[2]?b[2].trim():b[2];if(["latex","katex","math"].indexOf(K)>=0){var xe=c(),Ge=X;X=xe,u[xe]={type:"block",expression:Ge}}return{type:"code",raw:H,lang:K,text:X}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi,C=0,c=function(){return"__special_katext_id_".concat(C++,"__")},u={};function L(){return u}function S(){C=0,u={}}function D(z){return z=z.replace(E,function(h,b){var H=c();return u[H]={type:"inline",expression:b},H}),z}var _=s.listitem;s.listitem=function(z){return _(D(z))};var B=s.paragraph;s.paragraph=function(z){return B(D(z))};var G=s.tablecell;s.tablecell=function(z,h){return G(D(z),h)},s.code=function(z,h,b){var H=(h||"").match(/\S*/)[0];return H?["latex","katex","math"].indexOf(H)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(h,'">').concat(b?z:Object(m.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(b?z:Object(m.escape)(z,!0))+"</code></pre>"},s.heading=function(z,h,b){var H=this.options.headerPrefix+b.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:H,level:h,text:z}),"<h"+h+' id="'+H+'">'+z+"</h"+h+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:w,renderer:s});var V=p.a,I=q("SJMd"),N=q("ulZh"),Y=q.n(N),ee=q("m3rI"),le=q("Oy/b"),me=q("p5ED"),Ie=q("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 Te=function(z,h){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,H){b.__proto__=H}||function(b,H){for(var X in H)Object.prototype.hasOwnProperty.call(H,X)&&(b[X]=H[X])})(z,h)};function Oe(z,h){function b(){this.constructor=z}Te(z,h),z.prototype=h===null?Object.create(h):(b.prototype=h.prototype,new b)}function Re(z,h,b,H){return new(b||(b=Promise))(function(X,K){function xe(gt){try{nt(H.next(gt))}catch(Ke){K(Ke)}}function Ge(gt){try{nt(H.throw(gt))}catch(Ke){K(Ke)}}function nt(gt){var Ke;gt.done?X(gt.value):(Ke=gt.value,Ke instanceof b?Ke:new b(function(kt){kt(Ke)})).then(xe,Ge)}nt((H=H.apply(z,h||[])).next())})}function Ee(z,h){var b,H,X,K,xe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return K={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Ge(nt){return function(gt){return function(Ke){if(b)throw new TypeError("Generator is already executing.");for(;xe;)try{if(b=1,H&&(X=2&Ke[0]?H.return:Ke[0]?H.throw||((X=H.return)&&X.call(H),0):H.next)&&!(X=X.call(H,Ke[1])).done)return X;switch(H=0,X&&(Ke=[2&Ke[0],X.value]),Ke[0]){case 0:case 1:X=Ke;break;case 4:return xe.label++,{value:Ke[1],done:!1};case 5:xe.label++,H=Ke[1],Ke=[0];continue;case 7:Ke=xe.ops.pop(),xe.trys.pop();continue;default:if(!(X=xe.trys,(X=X.length>0&&X[X.length-1])||Ke[0]!==6&&Ke[0]!==2)){xe=0;continue}if(Ke[0]===3&&(!X||Ke[1]>X[0]&&Ke[1]<X[3])){xe.label=Ke[1];break}if(Ke[0]===6&&xe.label<X[1]){xe.label=X[1],X=Ke;break}if(X&&xe.label<X[2]){xe.label=X[2],xe.ops.push(Ke);break}X[2]&&xe.ops.pop(),xe.trys.pop();continue}Ke=h.call(z,xe)}catch(kt){Ke=[6,kt],H=0}finally{b=X=0}if(5&Ke[0])throw Ke[1];return{value:Ke[0]?Ke[1]:void 0,done:!0}}([nt,gt])}}}function pe(){for(var z=0,h=0,b=arguments.length;h<b;h++)z+=arguments[h].length;var H=Array(z),X=0;for(h=0;h<b;h++)for(var K=arguments[h],xe=0,Ge=K.length;xe<Ge;xe++,X++)H[X]=K[xe];return H}var de=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(h,b){for(var H=0,X=b;H<X.length;H++){var K=X[H],xe=K[0],Ge=K[1];h.setAttribute(xe,Ge)}},z.createRect=function(h,b,H){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",h.toString()),X.setAttribute("height",b.toString()),H&&z.setAttributes(X,H),X},z.createLine=function(h,b,H,X,K){var xe=document.createElementNS("http://www.w3.org/2000/svg","line");return xe.setAttribute("x1",h.toString()),xe.setAttribute("y1",b.toString()),xe.setAttribute("x2",H.toString()),xe.setAttribute("y2",X.toString()),K&&z.setAttributes(xe,K),xe},z.createPolygon=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","polygon");return H.setAttribute("points",h),b&&z.setAttributes(H,b),H},z.createCircle=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","circle");return H.setAttribute("cx",(h/2).toString()),H.setAttribute("cy",(h/2).toString()),H.setAttribute("r",h.toString()),b&&z.setAttributes(H,b),H},z.createEllipse=function(h,b,H){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(h/2).toString()),X.setAttribute("cy",(b/2).toString()),X.setAttribute("rx",(h/2).toString()),X.setAttribute("ry",(b/2).toString()),H&&z.setAttributes(X,H),X},z.createGroup=function(h){var b=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&z.setAttributes(b,h),b},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(h,b,H,X,K,xe,Ge){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(nt,[["id",h],["orient",b],["markerWidth",H.toString()],["markerHeight",X.toString()],["refX",K.toString()],["refY",xe.toString()]]),nt.appendChild(Ge),nt},z.createText=function(h){var b=document.createElementNS("http://www.w3.org/2000/svg","text");return b.setAttribute("x","0"),b.setAttribute("y","0"),h&&z.setAttributes(b,h),b},z.createTSpan=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","tspan");return H.textContent=h,b&&z.setAttributes(H,b),H},z.createImage=function(h){var b=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&z.setAttributes(b,h),b},z.createPoint=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return H.x=h,H.y=b,H},z.createPath=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","path");return H.setAttribute("d",h),b&&z.setAttributes(H,b),H},z}(),re=function(){function z(){}return z.addKey=function(h){z.key=h},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),he=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(h,b,H){var X=this;return new Promise(function(K){var xe=H!==void 0?H:document.createElement("canvas");h===null&&(X.markersOnly=!0,X.naturalSize=!1);var Ge=document.createElementNS("http://www.w3.org/2000/svg","svg");Ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ge.setAttribute("width",b.width.baseVal.valueAsString),Ge.setAttribute("height",b.height.baseVal.valueAsString),Ge.setAttribute("viewBox","0 0 "+b.viewBox.baseVal.width.toString()+" "+b.viewBox.baseVal.height.toString()),Ge.innerHTML=b.innerHTML,X.naturalSize===!0?(Ge.width.baseVal.value=h.naturalWidth,Ge.height.baseVal.value=h.naturalHeight):X.width!==void 0&&X.height!==void 0&&(Ge.width.baseVal.value=X.width,Ge.height.baseVal.value=X.height),xe.width=Ge.width.baseVal.value,xe.height=Ge.height.baseVal.value;var nt=Ge.outerHTML,gt=xe.getContext("2d");X.markersOnly!==!0&&gt.drawImage(h,0,0,xe.width,xe.height);var Ke=window.URL,kt=new Image(xe.width,xe.height);kt.setAttribute("crossOrigin","anonymous");var Bt=new Blob([nt],{type:"image/svg+xml"}),tr=Ke.createObjectURL(Bt);kt.onload=function(){gt.drawImage(kt,0,0),Ke.revokeObjectURL(tr);var Vr=xe.toDataURL(X.imageType,X.imageQuality);K(Vr)},kt.src=tr})},z}(),se=function(){},Ae=function(){function z(h){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},z.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new ie("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ie("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ie("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ae("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ae("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),ie=function(z,h){this.selector=z,this.style=h},ae=function(z,h){this.localName=z,this.style=h},ge=function(){function z(h,b,H,X,K){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=h,this.displayMode=b,this.markerItems=H,this.uiStyleSettings=X,this.styles=K,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(h){var b=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var H=document.createElement("div");H.className=this.toolbarBlockStyleClass.name,H.style.whiteSpace="nowrap",this.uiContainer.appendChild(H),this.addActionButton(H,'<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(H,'<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(H,'<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(H,'<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(H,'<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(H,'<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(H,'<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(H,'<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(K){var xe=document.createElement("div");xe.className=""+b.toolbarButtonStyleClass.name,xe.setAttribute("data-type-name",K.typeName),xe.innerHTML=K.icon,xe.addEventListener("click",function(){b.markerToolbarButtonClicked(xe,K)}),b.buttons.push(xe),b.markerButtons.push(xe)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(h){this.buttonClickListeners.push(h)},z.prototype.removeButtonClickListener=function(h){this.buttonClickListeners.indexOf(h)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(h),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var h=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var b=0;b<this.markerButtons.length;b++)b<h||b===h&&this.markerButtons.length-1===h?this.markerButtonBlock.appendChild(this.markerButtons[b]):(b===h&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[b]))}},z.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},z.prototype.resetButtonStyles=function(){var h=this;this.buttons.forEach(function(b){b.className=b.className.replace(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name,"").trim(),b.className=b.className.replace(h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:h.toolbarActiveButtonStyleColorsClass.name,"").trim(),b.className+=" "+(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(h,b,H){var X=this,K=document.createElement("div");switch(K.className=""+this.toolbarButtonStyleClass.name,K.innerHTML=b,K.setAttribute("data-action",H),K.addEventListener("click",function(){X.actionToolbarButtonClicked(K,H)}),H){case"select":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":K.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":K.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":K.style.fill=this.uiStyleSettings.closeButtonColor}h.appendChild(K),this.buttons.push(K)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ae("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 ae("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ae("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ae("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 ae("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ae("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
padding: `+h+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ae("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ie("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ie("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(h,b){this.setActiveButton(h),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(H){return H("marker",b)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(h,b){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(H){return H("action",b)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(h){this.resetButtonStyles(),h.className=h.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),h.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(h){var b=this.markerButtons.find(function(H){return H.getAttribute("data-type-name")===h});b&&this.setActiveButton(b)},z.prototype.setCurrentMarker=function(h){var b=this;this.currentMarker=h,this.buttons.filter(function(H){return/delete|notes/.test(H.getAttribute("data-action"))}).forEach(function(H){b.currentMarker===void 0?(H.style.fillOpacity="0.4",H.style.pointerEvents="none"):(H.style.fillOpacity="1",H.style.pointerEvents="all")})},z}(),we=function(){function z(h,b,H,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=h,this.displayMode=b,this.uiStyleSettings=H,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var h;this.toolboxStyleClass=this.styles.addClass(new ae("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 ae("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var b=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ae("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ae("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ae("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 ae("toolbox-panel-row_colors",`
background-color: `+((h=this.uiStyleSettings.toolboxBackgroundColor)!==null&&h!==void 0?h:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ae("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*b)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*b)+`px;
padding: `+b+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ie("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ie("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(h){var b;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolboxStyleClass.name+" "+((b=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&b!==void 0?b:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(h){var b,H,X=this;this.panels=h,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((b=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&b!==void 0?b:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((H=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&H!==void 0?H:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(K){var xe;K.uiStyleSettings=X.uiStyleSettings;var Ge=document.createElement("div");Ge.className=X.toolboxButtonStyleClass.name+" "+((xe=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&xe!==void 0?xe:X.toolboxButtonStyleColorsClass.name),Ge.innerHTML=K.icon,Ge.title=K.title,Ge.addEventListener("click",function(){X.panelButtonClick(K)}),X.panelButtons.push(Ge),X.buttonRow.appendChild(Ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(h){var b=this,H=-1;if(h!==this.activePanel){H=this.panels.indexOf(h),this.panelRow.innerHTML="";var X=h.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=h}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){b.displayMode==="inline"?b.panelRow.style.display="none":b.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(K,xe){var Ge,nt;K.className=b.toolboxButtonStyleClass.name+" "+(xe===H?""+((Ge=b.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ge!==void 0?Ge:b.toolboxActiveButtonStyleColorsClass.name):""+((nt=b.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:b.toolboxButtonStyleColorsClass.name))})},z}(),_e=function(z,h){this.title=z,this.icon=h},Fe=function(z){function h(b,H,X,K){var xe=z.call(this,b,K||'<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 xe.colors=[],xe.addTransparent=!1,xe.colorBoxes=[],xe.colors=H,xe.currentColor=X,xe.setCurrentColor=xe.setCurrentColor.bind(xe),xe.getColorBox=xe.getColorBox.bind(xe),xe}return Oe(h,z),h.prototype.getUi=function(){var b=this,H=document.createElement("div");return H.style.overflow="hidden",H.style.whiteSpace="nowrap",this.colors.forEach(function(X){var K=b.getColorBox(X);H.appendChild(K),b.colorBoxes.push(K)}),H},h.prototype.getColorBox=function(b){var H=this,X=this.uiStyleSettings.toolbarHeight/4,K=this.uiStyleSettings.toolbarHeight-X,xe=document.createElement("div");xe.style.display="inline-block",xe.style.boxSizing="content-box",xe.style.width=K-2+"px",xe.style.height=K-2+"px",xe.style.padding="1px",xe.style.marginRight="2px",xe.style.marginBottom="2px",xe.style.borderWidth="2px",xe.style.borderStyle="solid",xe.style.borderRadius=(K+2)/2+"px",xe.style.borderColor=b===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",xe.addEventListener("click",function(){H.setCurrentColor(b,xe)});var Ge=document.createElement("div");return Ge.style.display="inline-block",Ge.style.width=K-2+"px",Ge.style.height=K-2+"px",Ge.style.backgroundColor=b,Ge.style.borderRadius=K/2+"px",b==="transparent"&&(Ge.style.fill=this.uiStyleSettings.toolboxAccentColor,Ge.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>`),xe.appendChild(Ge),xe},h.prototype.setCurrentColor=function(b,H){var X=this;this.currentColor=b,this.colorBoxes.forEach(function(K){K.style.borderColor=K===H?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(b)},h}(_e),Ue=function(){function z(h,b,H){this._state="new",this._isSelected=!1,this._container=h,this._overlayContainer=b,this.globalSettings=H,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(h){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(h,b){},z.prototype.dblClick=function(h,b){},z.prototype.manipulate=function(h){},z.prototype.pointerUp=function(h){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(h){this.container.childNodes.length>0?this.container.insertBefore(h,this.container.childNodes[0]):this.container.appendChild(h)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(h){this._state=h.state,this.notes=h.notes},z.prototype.scale=function(h,b){},z.prototype.colorChanged=function(h){this.onColorChanged&&this.onColorChanged(h),this.stateChanged()},z.prototype.fillColorChanged=function(h){this.onFillColorChanged&&this.onFillColorChanged(h),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var h=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),h.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(h)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Be=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(h){return this.topLeft.ownsTarget(h)?this.topLeft:this.topCenter.ownsTarget(h)?this.topCenter:this.topRight.ownsTarget(h)?this.topRight:this.centerLeft.ownsTarget(h)?this.centerLeft:this.centerRight.ownsTarget(h)?this.centerRight:this.bottomLeft.ownsTarget(h)?this.bottomLeft:this.bottomCenter.ownsTarget(h)?this.bottomCenter:this.bottomRight.ownsTarget(h)?this.bottomRight:void 0},z}(),Ze=function(){function z(){this.GRIP_SIZE=10,this.visual=de.createGroup(),this.visual.appendChild(de.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(de.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},z}(),et=function(){function z(){}return z.toITransformMatrix=function(h){return{a:h.a,b:h.b,c:h.c,d:h.d,e:h.e,f:h.f}},z.toSVGMatrix=function(h,b){return h.a=b.a,h.b=b.b,h.c=b.c,h.d=b.d,h.e=b.e,h.f=b.f,h},z}(),rt=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.left=0,K.top=0,K.width=0,K.height=0,K.defaultSize={x:50,y:20},K.offsetX=0,K.offsetY=0,K.rotationAngle=0,K.CB_DISTANCE=10,K._suppressMarkerCreateEvent=!1,K.container.transform.baseVal.appendItem(de.createTransform()),K.setupControlBox(),K}return Oe(h,z),Object.defineProperty(h.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"visual",{get:function(){return this._visual},set:function(b){this._visual=b;var H=de.createTransform();this._visual.transform.baseVal.appendItem(H)},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(b){return!!z.prototype.ownsTarget.call(this,b)||!!(this.controlGrips.findGripByVisual(b)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(b))},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.state==="new"&&(this.left=b.x,this.top=b.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(b);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(H),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(H)){this.activeGrip=this.rotatorGrip;var K=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=K.x-this.width/2,this.top=K.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var xe=this.container.transform.baseVal.getItem(0);xe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(xe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},h.prototype.pointerUp=function(b){var H=this.state;z.prototype.pointerUp.call(this,b),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(b),this._state="select",H==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},h.prototype.moveVisual=function(b){this.visual.style.transform="translate("+b.x+"px, "+b.y+"px)"},h.prototype.manipulate=function(b){var H=this.unrotatePoint(b);this.state==="creating"?this.resize(b):this.state==="move"?(this.left=this.manipulationStartLeft+(H.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(H.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(H):this.state==="rotate"&&this.rotate(b)},h.prototype.resize=function(b){var H=this.manipulationStartLeft,X=this.manipulationStartWidth,K=this.manipulationStartTop,xe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:H=this.manipulationStartLeft+b.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-H;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+b.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:K=this.manipulationStartTop+b.y-this.manipulationStartY,xe=this.manipulationStartHeight+this.manipulationStartTop-K;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:xe=this.manipulationStartHeight+b.y-this.manipulationStartY}X>=0?(this.left=H,this.width=X):(this.left=H+X,this.width=-X),xe>=0?(this.top=K,this.height=xe):(this.top=K+xe,this.height=-xe),this.setSize()},h.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},h.prototype.rotate=function(b){if(Math.abs(b.x-this.centerX)>.1){var H=Math.sign(b.x-this.centerX);this.rotationAngle=180*Math.atan((b.y-this.centerY)/(b.x-this.centerX))/Math.PI+90*H,this.applyRotation()}},h.prototype.applyRotation=function(){var b=this.container.transform.baseVal.getItem(0);b.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(b,0)},h.prototype.rotatePoint=function(b){if(this.rotationAngle===0)return b;var H=this.container.getCTM(),X=de.createPoint(b.x,b.y);return{x:(X=X.matrixTransform(H)).x,y:X.y}},h.prototype.unrotatePoint=function(b){if(this.rotationAngle===0)return b;var H=this.container.getCTM();H=H.inverse();var X=de.createPoint(b.x,b.y);return{x:(X=X.matrixTransform(H)).x,y:X.y}},h.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=de.createGroup();var b=de.createTransform();b.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(b),this.container.appendChild(this.controlBox),this.controlRect=de.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=de.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 Be,this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){var b=this.controlBox.transform.baseVal.getItem(0);b.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(b,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()},h.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()},h.prototype.createGrip=function(){var b=new Ze;return b.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(b.visual),b},h.prototype.positionGrips=function(){var b=this.controlGrips.topLeft.GRIP_SIZE,H=-b/2,X=H,K=(this.width+this.CB_DISTANCE)/2-b/2,xe=(this.height+this.CB_DISTANCE)/2-b/2,Ge=this.height+this.CB_DISTANCE-b/2,nt=this.width+this.CB_DISTANCE-b/2;this.positionGrip(this.controlGrips.topLeft.visual,H,X),this.positionGrip(this.controlGrips.topCenter.visual,K,X),this.positionGrip(this.controlGrips.topRight.visual,nt,X),this.positionGrip(this.controlGrips.centerLeft.visual,H,xe),this.positionGrip(this.controlGrips.centerRight.visual,nt,xe),this.positionGrip(this.controlGrips.bottomLeft.visual,H,Ge),this.positionGrip(this.controlGrips.bottomCenter.visual,K,Ge),this.positionGrip(this.controlGrips.bottomRight.visual,nt,Ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,K,X-3*this.CB_DISTANCE)},h.prototype.positionGrip=function(b,H,X){var K=b.transform.baseVal.getItem(0);K.setTranslate(H,X),b.transform.baseVal.replaceItem(K,0)},h.prototype.hideControlBox=function(){this.controlBox.style.display="none"},h.prototype.showControlBox=function(){this.controlBox.style.display=""},h.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)},z.prototype.getState.call(this))},h.prototype.restoreState=function(b){z.prototype.restoreState.call(this,b);var H=b;this.left=H.left,this.top=H.top,this.width=H.width,this.height=H.height,this.rotationAngle=H.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,H.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,H.containerTransformMatrix))},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H);var X=this.rotatePoint({x:this.left,y:this.top}),K=this.unrotatePoint({x:X.x*b,y:X.y*H});this.left=K.x,this.top=K.y,this.width=this.width*b,this.height=this.height*H,this.adjustControlBox()},h}(Ue),Ye=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.visual)},h.prototype.createVisual=function(){this.visual=de.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)},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.state==="new"&&(this.createVisual(),this.moveVisual(b),this._state="creating")},h.prototype.manipulate=function(b){z.prototype.manipulate.call(this,b)},h.prototype.resize=function(b){z.prototype.resize.call(this,b),this.setSize()},h.prototype.setSize=function(){z.prototype.setSize.call(this),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(b){z.prototype.pointerUp.call(this,b),this.setSize()},h.prototype.setStrokeColor=function(b){this.strokeColor=b,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(b),this.stateChanged()},h.prototype.setFillColor=function(b){this.fillColor=b,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},h.prototype.setStrokeWidth=function(b){this.strokeWidth=b,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(b){this.strokeDasharray=b,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},h.prototype.restoreState=function(b){var H=b;this.fillColor=H.fillColor,this.strokeColor=H.strokeColor,this.strokeWidth=H.strokeWidth,this.strokeDasharray=H.strokeDasharray,this.opacity=H.opacity,this.createVisual(),z.prototype.restoreState.call(this,b),this.setSize()},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H),this.setSize()},h.title="Rectangle marker",h}(rt),st=function(z){function h(b,H,X,K){var xe=z.call(this,b,K||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return xe.widths=[],xe.widthBoxes=[],xe.widths=H,xe.currentWidth=X,xe.setCurrentWidth=xe.setCurrentWidth.bind(xe),xe}return Oe(h,z),h.prototype.getUi=function(){var b=this,H=document.createElement("div");return H.style.display="flex",H.style.overflow="hidden",H.style.flexGrow="2",this.widths.forEach(function(X){var K=document.createElement("div");K.style.display="flex",K.style.flexGrow="2",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=X===b.currentWidth?b.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){b.setCurrentWidth(X,K)}),H.appendChild(K);var xe=document.createElement("div");xe.innerText=X.toString(),xe.style.marginRight="5px",K.appendChild(xe);var Ge=document.createElement("div");Ge.style.minHeight="20px",Ge.style.flexGrow="2",Ge.style.display="flex",Ge.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=X+"px solid "+b.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",Ge.appendChild(nt),K.appendChild(Ge),b.widthBoxes.push(K)}),H},h.prototype.setCurrentWidth=function(b,H){var X=this;this.currentWidth=b,this.widthBoxes.forEach(function(K){K.style.borderColor=K===H?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},h}(_e),Je=function(z){function h(b,H,X,K){var xe=z.call(this,b,K||'<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 xe.styles=[],xe.styleBoxes=[],xe.styles=H,xe.currentStyle=X,xe.setCurrentStyle=xe.setCurrentStyle.bind(xe),xe}return Oe(h,z),h.prototype.getUi=function(){var b=this,H=document.createElement("div");return H.style.display="flex",H.style.overflow="hidden",H.style.flexGrow="2",this.styles.forEach(function(X){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/b.styles.length-5+"%",K.style.borderColor=X===b.currentStyle?b.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){b.setCurrentStyle(X,K)}),H.appendChild(K);var xe=document.createElement("div");xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.overflow="hidden";var Ge=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+b.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;xe.innerHTML=Ge,K.appendChild(xe),b.styleBoxes.push(K)}),H},h.prototype.setCurrentStyle=function(b,H){var X=this;this.currentStyle=b,this.styleBoxes.forEach(function(K){K.style.borderColor=K===H?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},h}(_e),Qe=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.strokeColor=X.defaultColor,K.strokeWidth=X.defaultStrokeWidth,K.strokeDasharray=X.defaultStrokeDasharray,K.strokePanel=new Fe("Line color",X.defaultColorSet,X.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Je("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Oe(h,z),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=z.prototype.getState.call(this);return b.typeName=h.typeName,b},h.typeName="FrameMarker",h.title="Frame marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',h}(Ye),Me=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},$e=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.x1=0,K.y1=0,K.x2=0,K.y2=0,K.defaultLength=50,K.manipulationStartX=0,K.manipulationStartY=0,K.manipulationStartX1=0,K.manipulationStartY1=0,K.manipulationStartX2=0,K.manipulationStartY2=0,K.setupControlBox(),K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!!z.prototype.ownsTarget.call(this,b)||!(!this.grip1.ownsTarget(b)&&!this.grip2.ownsTarget(b))},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.manipulationStartX=b.x,this.manipulationStartY=b.y,this.state==="new"&&(this.x1=b.x,this.y1=b.y,this.x2=b.x,this.y2=b.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(H)?this.activeGrip=this.grip1:this.grip2.ownsTarget(H)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},h.prototype.pointerUp=function(b){var H=this.state;z.prototype.pointerUp.call(this,b),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(b),this._state="select",H==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},h.prototype.adjustVisual=function(){},h.prototype.manipulate=function(b){this.state==="creating"?this.resize(b):this.state==="move"?(this.x1=this.manipulationStartX1+b.x-this.manipulationStartX,this.y1=this.manipulationStartY1+b.y-this.manipulationStartY,this.x2=this.manipulationStartX2+b.x-this.manipulationStartX,this.y2=this.manipulationStartY2+b.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(b)},h.prototype.resize=function(b){switch(this.activeGrip){case this.grip1:this.x1=b.x,this.y1=b.y;break;case this.grip2:case void 0:this.x2=b.x,this.y2=b.y}this.adjustVisual(),this.adjustControlBox()},h.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=de.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){this.positionGrips()},h.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},h.prototype.createGrip=function(){var b=new Ze;return b.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(b.visual),b},h.prototype.positionGrips=function(){var b=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-b/2,this.y1-b/2),this.positionGrip(this.grip2.visual,this.x2-b/2,this.y2-b/2)},h.prototype.positionGrip=function(b,H,X){var K=b.transform.baseVal.getItem(0);K.setTranslate(H,X),b.transform.baseVal.replaceItem(K,0)},h.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},h.prototype.restoreState=function(b){z.prototype.restoreState.call(this,b);var H=b;this.x1=H.x1,this.y1=H.y1,this.x2=H.x2,this.y2=H.y2},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H),this.x1=this.x1*b,this.y1=this.y1*H,this.x2=this.x2*b,this.y2=this.y2*H,this.adjustVisual(),this.adjustControlBox()},h}(Ue),ut=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.strokeColor=X.defaultColor,K.strokeWidth=X.defaultStrokeWidth,K.strokeDasharray=X.defaultStrokeDasharray,K.strokePanel=new Fe("Line color",X.defaultColorSet,X.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Je("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.visual&&b!==this.selectorLine&&b!==this.visibleLine)},h.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorLine=de.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=de.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)},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},h.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()),de.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setStrokeColor=function(b){this.strokeColor=b,this.adjustVisual(),this.colorChanged(b)},h.prototype.setStrokeWidth=function(b){this.strokeWidth=b,this.adjustVisual()},h.prototype.setStrokeDasharray=function(b){this.strokeDasharray=b,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){z.prototype.restoreState.call(this,b);var H=b;this.strokeColor=H.strokeColor,this.strokeWidth=H.strokeWidth,this.strokeDasharray=H.strokeDasharray,this.createVisual(),this.adjustVisual()},h.typeName="LineMarker",h.title="Line marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',h}($e),je=function(z){function h(b,H,X,K){var xe=z.call(this,b,K||'<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 xe.fonts=[],xe.fontBoxes=[],xe.fonts=H,xe.currentFont=X,xe.setCurrentFont=xe.setCurrentFont.bind(xe),xe}return Oe(h,z),h.prototype.getUi=function(){var b=this,H=document.createElement("div");return H.style.overflow="hidden",H.style.flexGrow="2",this.fonts.forEach(function(X){var K=document.createElement("div");K.style.display="inline-block",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/b.fonts.length-5+"%",K.style.borderColor=X===b.currentFont?b.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){b.setCurrentFont(X,K)}),H.appendChild(K);var xe=document.createElement("div");xe.style.display="flex",xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.fontFamily=X,xe.style.overflow="hidden";var Ge=document.createElement("div");Ge.style.whiteSpace="nowrap",Ge.style.overflow="hidden",Ge.style.textOverflow="ellipsis",Ge.innerHTML="The quick brown fox jumps over the lazy dog",xe.appendChild(Ge),K.appendChild(xe),b.fontBoxes.push(K)}),H},h.prototype.setCurrentFont=function(b,H){var X=this;this.currentFont=b,this.fontBoxes.forEach(function(K){K.style.borderColor=K===H?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},h}(_e),Ve=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.color="transparent",K.padding=5,K.DEFAULT_TEXT="your text here",K.text=K.DEFAULT_TEXT,K.isMoved=!1,K.color=X.defaultColor,K.fontFamily=X.defaultFontFamily,K.defaultSize={x:100,y:30},K.setColor=K.setColor.bind(K),K.setFont=K.setFont.bind(K),K.renderText=K.renderText.bind(K),K.sizeText=K.sizeText.bind(K),K.textEditDivClicked=K.textEditDivClicked.bind(K),K.showTextEditor=K.showTextEditor.bind(K),K.setSize=K.setSize.bind(K),K.positionTextEditor=K.positionTextEditor.bind(K),K.colorPanel=new Fe("Color",X.defaultColorSet,X.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.fontFamilyPanel=new je("Font",X.defaultFontFamilies,X.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K}return Oe(h,z),h.prototype.ownsTarget=function(b){if(z.prototype.ownsTarget.call(this,b)||b===this.visual||b===this.textElement||b===this.bgRectangle)return!0;var H=!1;return this.textElement.childNodes.forEach(function(X){X===b&&(H=!0)}),H},h.prototype.createVisual=function(){this.visual=de.createGroup(),this.bgRectangle=de.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=de.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.isMoved=!1,this.pointerDownPoint=b,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(b),this._state="creating")},h.prototype.renderText=function(){var b=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(H){b.textElement.appendChild(de.createTSpan(H.trim()===""?" ":H.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},h.prototype.getTextScale=function(){var b=this.textElement.getBBox(),H=1;if(b.width>0&&b.height>0){var X=(1*this.width-this.width*this.padding*2/100)/b.width,K=(1*this.height-this.height*this.padding*2/100)/b.height;H=Math.min(X,K)}return H},h.prototype.getTextPosition=function(b){var H=this.textElement.getBBox(),X=0,K=0;return H.width>0&&H.height>0&&(X=(this.width-H.width*b)/2,K=this.height/2-H.height*b/2),{x:X,y:K}},h.prototype.sizeText=function(){var b=this.textElement.getBBox(),H=this.getTextScale(),X=this.getTextPosition(H);X.y-=b.y*H,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+H+", "+H+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(H,H))},h.prototype.manipulate=function(b){z.prototype.manipulate.call(this,b),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(b.x-this.pointerDownPoint.x)>5||Math.abs(b.y-this.pointerDownPoint.y)>5)},h.prototype.resize=function(b){z.prototype.resize.call(this,b),this.isMoved=!0,this.setSize(),this.sizeText()},h.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},h.prototype.pointerUp=function(b){var H=this.state;H==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,b),this.setSize(),(H==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},h.prototype.showTextEditor=function(){var b=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(H){H.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var H=Number.parseFloat(b.textEditor.style.fontSize);b.textEditor.clientWidth>=Number.parseInt(b.textEditor.style.maxWidth)&&H>.9;)H-=.1,b.textEditor.style.fontSize=Math.max(H,.9)+"em"}),this.textEditor.addEventListener("keyup",function(H){H.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(H){if(H.clipboardData){var X=H.clipboardData.getData("text"),K=window.getSelection();if(!K.rangeCount)return!1;K.deleteFromDocument(),K.getRangeAt(0).insertNode(document.createTextNode(X)),H.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){b.textEditDivClicked(b.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},h.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var b=this.getTextScale(),H=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),K={x:X.width*b,y:X.height*b};H.x-=K.x/2,H.y-=K.y/2,this.textEditor.style.top=H.y+"px",this.textEditor.style.left=H.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-H.x+"px",this.textEditor.style.fontSize=Math.max(16*b,12)+"px",this.textElement.style.display="none"}},h.prototype.textEditDivClicked=function(b){this.text=b.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},h.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},h.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},h.prototype.dblClick=function(b,H){z.prototype.dblClick.call(this,b,H),this.showTextEditor()},h.prototype.setColor=function(b){this.textElement&&de.setAttributes(this.textElement,[["fill",b]]),this.color=b,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(b)},h.prototype.setFont=function(b){this.textElement&&de.setAttributes(this.textElement,[["font-family",b]]),this.fontFamily=b,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},h.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},h.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){var H=b;this.color=H.color,this.fontFamily=H.fontFamily,this.padding=H.padding,this.text=H.text,this.createVisual(),z.prototype.restoreState.call(this,b),this.setSize()},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H),this.setSize(),this.sizeText(),this.positionTextEditor()},h.typeName="TextMarker",h.title="Text marker",h.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>',h}(rt),Se=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.color="transparent",K.lineWidth=3,K.drawing=!1,K.pixelRatio=1,K.color=X.defaultColor,K.lineWidth=X.defaultStrokeWidth,K.pixelRatio=X.freehandPixelRatio,K.setColor=K.setColor.bind(K),K.addCanvas=K.addCanvas.bind(K),K.finishCreation=K.finishCreation.bind(K),K.setLineWidth=K.setLineWidth.bind(K),K.colorPanel=new Fe("Color",X.defaultColorSet,X.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.lineWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),K.lineWidthPanel.onWidthChanged=K.setLineWidth,K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.visual&&b!==this.drawingImage)},h.prototype.createVisual=function(){this.visual=de.createGroup(),this.drawingImage=de.createImage(),this.visual.appendChild(this.drawingImage);var b=de.createTransform();this.visual.transform.baseVal.appendItem(b),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(b,H){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(b.x,b.y),this.drawing=!0):z.prototype.pointerDown.call(this,b,H)},h.prototype.manipulate=function(b){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(b.x,b.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,b)},h.prototype.resize=function(b){z.prototype.resize.call(this,b),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(b){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,b)},h.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)},h.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},h.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},h.prototype.finishCreation=function(){for(var b=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),H=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=H[0],K=H[1],xe=H[2],Ge=H[3],nt=!1,gt=0;gt<this.canvasElement.height;gt++)for(var Ke=0;Ke<this.canvasElement.width;Ke++)b.data[gt*this.canvasElement.width*4+4*Ke+3]>0&&(nt=!0,gt<K&&(K=gt),Ke<X&&(X=Ke),gt>Ge&&(Ge=gt),Ke>xe&&(xe=Ke));if(nt){this.left=X/this.pixelRatio,this.top=K/this.pixelRatio,this.width=(xe-X)/this.pixelRatio,this.height=(Ge-K)/this.pixelRatio;var kt=document.createElement("canvas");kt.width=xe-X,kt.height=Ge-K,kt.getContext("2d").putImageData(this.canvasContext.getImageData(X,K,xe-X,Ge-K),0,0),this.drawingImgUrl=kt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},h.prototype.setDrawingImage=function(){de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},h.prototype.setColor=function(b){this.color=b,this.colorChanged(b)},h.prototype.setLineWidth=function(b){this.lineWidth=b},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){this.createVisual(),z.prototype.restoreState.call(this,b),this.drawingImgUrl=b.drawingImgUrl,this.setDrawingImage()},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H),this.setDrawingImage()},h.typeName="FreehandMarker",h.title="Freehand marker",h.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>',h}(rt),be=function(z){function h(b,H,X){var K=z.call(this,b,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return K.typeBoxes=[],K.currentType=H,K.setCurrentType=K.setCurrentType.bind(K),K}return Oe(h,z),h.prototype.getUi=function(){var b=this,H=document.createElement("div");H.style.display="flex",H.style.overflow="hidden",H.style.flexGrow="2";for(var X=function(Ge){var nt="both";switch(Ge){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=nt===K.currentType?K.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){b.setCurrentType(nt,gt)}),H.appendChild(gt),nt==="both"||nt==="start"){var Ke=document.createElement("div");Ke.style.display="flex",Ke.style.alignItems="center",Ke.style.minHeight="20px",Ke.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ke.style.marginLeft="5px",gt.appendChild(Ke)}var kt=document.createElement("div");kt.style.display="flex",kt.style.alignItems="center",kt.style.minHeight="20px",kt.style.flexGrow="2";var Bt=document.createElement("hr");if(Bt.style.minWidth="20px",Bt.style.border="0px",Bt.style.borderTop="3px solid "+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee"),Bt.style.flexGrow="2",kt.appendChild(Bt),gt.appendChild(kt),nt==="both"||nt==="end"){var tr=document.createElement("div");tr.style.display="flex",tr.style.alignItems="center",tr.style.minHeight="20px",tr.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,tr.style.marginRight="5px",gt.appendChild(tr)}K.typeBoxes.push(gt)},K=this,xe=0;xe<4;xe++)X(xe);return H},h.prototype.setCurrentType=function(b,H){var X=this;this.currentType=b,this.typeBoxes.forEach(function(K){K.style.borderColor=K===H?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},h}(_e),Ce=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.arrowType="end",K.arrowBaseHeight=10,K.arrowBaseWidth=10,K.getArrowPoints=K.getArrowPoints.bind(K),K.setArrowType=K.setArrowType.bind(K),K.arrowTypePanel=new be("Arrow type","end"),K.arrowTypePanel.onArrowTypeChanged=K.setArrowType,K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.arrow1&&b!==this.arrow2)},h.prototype.getArrowPoints=function(b,H){var X=this.arrowBaseWidth+2*this.strokeWidth,K=this.arrowBaseHeight+2*this.strokeWidth;return b-X/2+","+(H+K/2)+" "+b+","+(H-K/2)+" "+(b+X/2)+","+(H+K/2)},h.prototype.createTips=function(){this.arrow1=de.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=de.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow2)},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",de.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),de.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var b=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),H=this.arrow1.transform.baseVal.getItem(0);H.setRotate(b,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(H,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(b+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},h.prototype.setArrowType=function(b){this.arrowType=b,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){z.prototype.restoreState.call(this,b);var H=b;this.arrowType=H.arrowType,this.createTips(),this.adjustVisual()},h.typeName="ArrowMarker",h.title="Arrow marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',h}(ut),ne=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.fillColor=X.defaultFillColor,K.strokeWidth=0,K.fillPanel=new Fe("Color",X.defaultColorSet,X.defaultFillColor),K.fillPanel.onColorChanged=K.setFillColor,K}return Oe(h,z),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=z.prototype.getState.call(this);return b.typeName=h.typeName,b},h.typeName="CoverMarker",h.title="Cover marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',h}(Ye),oe=function(z){function h(b,H,X,K){var xe=z.call(this,b,K||'<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 xe.opacities=[],xe.opacityBoxes=[],xe.opacities=H,xe.currentOpacity=X,xe.setCurrentOpacity=xe.setCurrentOpacity.bind(xe),xe}return Oe(h,z),h.prototype.getUi=function(){var b=this,H=document.createElement("div");return H.style.display="flex",H.style.overflow="hidden",H.style.flexGrow="2",H.style.justifyContent="space-between",this.opacities.forEach(function(X){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="center",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=X===b.currentOpacity?b.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){b.setCurrentOpacity(X,K)}),H.appendChild(K);var xe=document.createElement("div");xe.innerText=100*X+"%",K.appendChild(xe),b.opacityBoxes.push(K)}),H},h.prototype.setCurrentOpacity=function(b,H){var X=this;this.currentOpacity=b,this.opacityBoxes.forEach(function(K){K.style.borderColor=K===H?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},h}(_e),ce=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.setOpacity=K.setOpacity.bind(K),K.fillColor=X.defaultHighlightColor,K.strokeWidth=0,K.opacity=X.defaultHighlightOpacity,K.fillPanel=new Fe("Color",X.defaultColorSet,K.fillColor),K.fillPanel.onColorChanged=K.setFillColor,K.opacityPanel=new oe("Opacity",X.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return Oe(h,z),h.prototype.setOpacity=function(b){this.opacity=b,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=z.prototype.getState.call(this);return b.typeName=h.typeName,b},h.typeName="HighlightMarker",h.title="Highlight marker",h.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>',h}(ne),ve='<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>',Ne=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.bgColor="transparent",K.tipPosition={x:0,y:0},K.tipBase1Position={x:0,y:0},K.tipBase2Position={x:0,y:0},K.tipMoving=!1,K.color=X.defaultStrokeColor,K.bgColor=X.defaultFillColor,K.fontFamily=X.defaultFontFamily,K.defaultSize={x:100,y:30},K.setBgColor=K.setBgColor.bind(K),K.getTipPoints=K.getTipPoints.bind(K),K.positionTip=K.positionTip.bind(K),K.setTipPoints=K.setTipPoints.bind(K),K.colorPanel=new Fe("Text color",X.defaultColorSet,K.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>'),K.colorPanel.onColorChanged=K.setColor,K.bgColorPanel=new Fe("Fill color",X.defaultColorSet,K.bgColor,ve),K.bgColorPanel.onColorChanged=K.setBgColor,K.fontFamilyPanel=new je("Font",X.defaultFontFamilies,X.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.tipGrip=new Ze,K.tipGrip.visual.transform.baseVal.appendItem(de.createTransform()),K.controlBox.appendChild(K.tipGrip.visual),K}return Oe(h,z),h.prototype.ownsTarget=function(b){return z.prototype.ownsTarget.call(this,b)||this.tipGrip.ownsTarget(b)||this.tip===b},h.prototype.createTip=function(){de.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=de.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},h.prototype.pointerDown=function(b,H){this.state==="new"&&z.prototype.pointerDown.call(this,b,H),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(H)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,b,H)},h.prototype.pointerUp=function(b){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,b);else{var H=this.state==="creating";z.prototype.pointerUp.call(this,b),this.setTipPoints(H),this.positionTip()}},h.prototype.manipulate=function(b){if(this.tipMoving){var H=this.unrotatePoint(b);this.tipPosition={x:H.x-this.manipulationStartLeft,y:H.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,b)},h.prototype.setBgColor=function(b){this.bgRectangle&&this.tip&&(de.setAttributes(this.bgRectangle,[["fill",b]]),de.setAttributes(this.tip,[["fill",b]])),this.bgColor=b,this.fillColorChanged(b)},h.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},h.prototype.setTipPoints=function(b){b===void 0&&(b=!1);var H=Math.min(this.height/2,15),X=this.height/5;b&&(this.tipPosition={x:H+X/2,y:this.height+20});var K=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,H=Math.min(this.width/2,15),this.tipBase1Position={x:H,y:0},this.tipBase2Position={x:H+X,y:0}):(this.tipBase1Position={x:0,y:H},this.tipBase2Position={x:0,y:H+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,H=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-H-X,y:0},this.tipBase2Position={x:this.width-H,y:0}):(this.tipBase1Position={x:this.width,y:H},this.tipBase2Position={x:this.width,y:H+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?K<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,H=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-H-X,y:this.height},this.tipBase2Position={x:this.width-H,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-H-X},this.tipBase2Position={x:this.width,y:this.height-H}):K<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,H=Math.min(this.width/2,15),this.tipBase1Position={x:H,y:this.height},this.tipBase2Position={x:H+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-H},this.tipBase2Position={x:0,y:this.height-H-X})},h.prototype.resize=function(b){z.prototype.resize.call(this,b),this.positionTip()},h.prototype.positionTip=function(){de.setAttributes(this.tip,[["points",this.getTipPoints()]]);var b=this.tipGrip.visual.transform.baseVal.getItem(0);b.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(b,0)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},h.prototype.getState=function(){var b=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){var H=b;this.bgColor=H.bgColor,this.tipPosition=H.tipPosition,z.prototype.restoreState.call(this,b),this.createTip(),this.setTipPoints()},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H),this.tipPosition={x:this.tipPosition.x*b,y:this.tipPosition.y*H},this.positionTip()},h.typeName="CalloutMarker",h.title="Callout marker",h.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>',h}(Ve),Le=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.strokeColor=X.defaultColor,K.strokeWidth=X.defaultStrokeWidth,K.strokeDasharray=X.defaultStrokeDasharray,K.fillColor=X.defaultFillColor,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.setOpacity=K.setOpacity.bind(K),K.createVisual=K.createVisual.bind(K),K.strokePanel=new Fe("Line color",pe(X.defaultColorSet,["transparent"]),X.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new Fe("Fill color",pe(X.defaultColorSet,["transparent"]),K.fillColor,ve),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Je("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.opacityPanel=new oe("Opacity",X.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.visual)},h.prototype.createVisual=function(){this.visual=de.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)},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.state==="new"&&(this.createVisual(),this.moveVisual(b),this._state="creating")},h.prototype.manipulate=function(b){z.prototype.manipulate.call(this,b)},h.prototype.resize=function(b){z.prototype.resize.call(this,b),this.setSize()},h.prototype.setSize=function(){z.prototype.setSize.call(this),de.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},h.prototype.pointerUp=function(b){z.prototype.pointerUp.call(this,b),this.setSize()},h.prototype.setStrokeColor=function(b){this.strokeColor=b,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(b),this.stateChanged()},h.prototype.setFillColor=function(b){this.fillColor=b,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(b),this.stateChanged()},h.prototype.setStrokeWidth=function(b){this.strokeWidth=b,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(b){this.strokeDasharray=b,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.setOpacity=function(b){this.opacity=b,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){var H=b;this.fillColor=H.fillColor,this.strokeColor=H.strokeColor,this.strokeWidth=H.strokeWidth,this.strokeDasharray=H.strokeDasharray,this.opacity=H.opacity,this.createVisual(),z.prototype.restoreState.call(this,b),this.setSize()},h.prototype.scale=function(b,H){z.prototype.scale.call(this,b,H),this.setSize()},h.typeName="EllipseMarker",h.title="Ellipse marker",h.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>',h}(rt),ze=function(z){function h(b,H,X){return z.call(this,b,H,X)||this}return Oe(h,z),Object.defineProperty(h.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.tip1&&b!==this.tip2)},h.prototype.createTips=function(){this.tip1=de.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(de.createTransform()),this.visual.appendChild(this.tip1),this.tip2=de.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(de.createTransform()),this.visual.appendChild(this.tip2)},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(de.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()]]),de.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 b=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),H=this.tip1.transform.baseVal.getItem(0);H.setRotate(b,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(H,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(b+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=z.prototype.getState.call(this);return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){z.prototype.restoreState.call(this,b),this.createTips(),this.adjustVisual()},h.typeName="MeasurementMarker",h.title="Measurement marker",h.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>',h}(ut),it=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.strokePanel.colors=X.defaultColorSet,K.fillColor="transparent",K}return Oe(h,z),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=z.prototype.getState.call(this);return b.typeName=h.typeName,b},h.typeName="EllipseFrameMarker",h.title="Ellipse frame marker",h.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>',h}(Le),ct=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(h){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(h)||(this.undoStack.push(h),JSON.stringify(this.lastRedoStep)!==JSON.stringify(h)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(h){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=h)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var h=this.undoStack.pop();return h!==void 0&&this.redoStack.push(h),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),dt=function(z){function h(b,H,X){var K=z.call(this,b,H,X)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.curveX=0,K.curveY=0,K.manipulationStartCurveX=0,K.manipulationStartCurveY=0,K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.positionGrips=K.positionGrips.bind(K),K.addControlGrips=K.addControlGrips.bind(K),K.adjustVisual=K.adjustVisual.bind(K),K.setupControlBox=K.setupControlBox.bind(K),K.resize=K.resize.bind(K),K.strokeColor=X.defaultColor,K.strokeWidth=X.defaultStrokeWidth,K.strokeDasharray=X.defaultStrokeDasharray,K.strokePanel=new Fe("Line color",X.defaultColorSet,X.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Je("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Oe(h,z),h.prototype.ownsTarget=function(b){return!(!z.prototype.ownsTarget.call(this,b)&&b!==this.visual&&b!==this.selectorCurve&&b!==this.visibleCurve&&!this.curveGrip.ownsTarget(b))},h.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},h.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorCurve=de.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=de.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)},h.prototype.pointerDown=function(b,H){z.prototype.pointerDown.call(this,b,H),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=b.x,this.curveY=b.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(H)&&(this.activeGrip=this.curveGrip,this._state="resize")},h.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),de.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=de.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=de.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)},h.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},h.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var b=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-b/2,this.curveY-b/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()))},h.prototype.manipulate=function(b){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+b.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+b.y-this.manipulationStartY),z.prototype.manipulate.call(this,b)},h.prototype.resize=function(b){this.activeGrip===this.curveGrip&&(this.curveX=b.x,this.curveY=b.y),z.prototype.resize.call(this,b),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},h.prototype.setStrokeColor=function(b){this.strokeColor=b,this.adjustVisual(),this.colorChanged(b)},h.prototype.setStrokeWidth=function(b){this.strokeWidth=b,this.adjustVisual()},h.prototype.setStrokeDasharray=function(b){this.strokeDasharray=b,this.adjustVisual()},h.prototype.scale=function(b,H){this.curveX=this.curveX*b,this.curveY=this.curveY*H,z.prototype.scale.call(this,b,H)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var b=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return b.typeName=h.typeName,b},h.prototype.restoreState=function(b){z.prototype.restoreState.call(this,b);var H=b;this.strokeColor=H.strokeColor,this.strokeWidth=H.strokeWidth,this.strokeDasharray=H.strokeDasharray,this.curveX=H.curveX,this.curveY=H.curveY,this.createVisual(),this.adjustVisual()},h.typeName="CurveMarker",h.title="Curve marker",h.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>',h}($e),Dt=function(){function z(h,b){b===void 0&&(b=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=h,this.cancelable=b}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),At=function(z){function h(b,H,X){var K=z.call(this,b,!1)||this;return K.dataUrl=H,K.state=X,K}return Oe(h,z),h}(Dt),pt=function(z){function h(b,H,X){X===void 0&&(X=!1);var K=z.call(this,b,X)||this;return K.marker=H,K}return Oe(h,z),h}(Dt),jt=function(){function z(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return z.prototype.addEventListener=function(h,b){this[h].push(b)},z.prototype.removeEventListener=function(h,b){var H=this[h].indexOf(b);H>-1&&this[h].splice(H,1)},z}(),Et=function(){function z(h){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Me,this._isOpen=!1,this.undoRedoManager=new ct,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new jt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new Ae(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=h,this.targetRoot=document.body,this.width=h.clientWidth,this.height=h.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Qe,Se,Ce,Ve,it,Le,ce,Ne,ze,ne,ut,dt]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Qe,Se,Ce,Ve,Le,ce,Ne]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Qe,Se,Ce,Ve,ce]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(h){var b=this;this._availableMarkerTypes.splice(0),h.forEach(function(H){if(typeof H=="string"){var X=b.ALL_MARKER_TYPES.find(function(K){return K.typeName===H});X!==void 0&&b._availableMarkerTypes.push(X)}else b._availableMarkerTypes.push(H)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(h){this._zoomLevel=h,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var h=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(b){return b(new Dt(h))})},z.prototype.render=function(){return Re(this,void 0,void 0,function(){var h;return Ee(this,function(b){switch(b.label){case 0:return this.setCurrentMarker(),(h=new he).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.markersOnly=this.renderMarkersOnly,h.width=this.renderWidth,h.height=this.renderHeight,[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return b.sent(),[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,b.sent()]}})})},z.prototype.close=function(h){var b=this;if(h===void 0&&(h=!1),this.isOpen){var H=!1;h||this.eventListeners.beforeclose.forEach(function(X){var K=new Dt(b,!0);X(K),K.defaultPrevented&&(H=!0)}),H||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new Dt(b))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var h,b=[],H=0;H<arguments.length;H++)b[H]=arguments[H];(h=this._availableMarkerTypes).push.apply(h,b)},z.prototype.addRenderEventListener=function(h){this.addEventListener("render",function(b){h(b.dataUrl,b.state)})},z.prototype.removeRenderEventListener=function(h){},z.prototype.addCloseEventListener=function(h){this.addEventListener("close",function(){h()})},z.prototype.removeCloseEventListener=function(h){},z.prototype.setupResizeObserver=function(){var h=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return h.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var h=1*this.target.clientWidth/this.target.clientHeight,b=this.editorCanvas.clientWidth/h>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*h:this.editorCanvas.clientWidth,H=b<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/h;this.resize(b,H)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(h,b){this._isResizing=!0;var H=h/this.imageWidth,X=b/this.imageHeight;this.imageWidth=Math.round(h),this.imageHeight=Math.round(b),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(H,X),this._isResizing=!1},z.prototype.scaleMarkers=function(h,b){var H,X=this;this._currentMarker&&this._currentMarker instanceof Ve?this._currentMarker.scale(h,b):(H=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(K){K!==X._currentMarker&&K.scale(h,b)}),H!==void 0&&this.setCurrentMarker(H)},z.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},z.prototype.setTopLeft=function(){var h=this.editingTarget.getBoundingClientRect(),b=this.editorCanvas.getBoundingClientRect();this.left=h.left-b.left,this.top=h.top-b.top},z.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},z.prototype.addDefs=function(){for(var h,b=[],H=0;H<arguments.length;H++)b[H]=arguments[H];this.defs=de.createDefs(),this.addDefsToImage(),(h=this.defs).append.apply(h,b)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},z.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var h=document.createElement("a");h.href="https://markerjs.com/",h.target="_blank",h.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>',h.title="Powered by marker.js",h.style.display="grid",h.style.alignItems="center",h.style.justifyItems="center",h.style.padding="3px",h.style.width="20px",h.style.height="20px",this.logoUI.appendChild(h),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},z.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"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 ge(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 we(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(h){this.markerImage.removeChild(h.container),this.markers.indexOf(h)>-1&&this.markers.splice(this.markers.indexOf(h),1),h.dispose()},z.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},z.prototype.toolbarButtonClicked=function(h,b){if(h==="marker"&&b!==void 0)this.createNewMarker(b);else if(h==="action")switch(b){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},z.prototype.deleteSelectedMarker=function(){var h=this;if(this._currentMarker!==void 0){var b=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var K=new pt(h,h._currentMarker,!0);X(K),K.defaultPrevented&&(b=!0)}),!b){var H=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new pt(h,H))})}}},z.prototype.clear=function(){var h=this,b=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(xe){var Ge=new pt(h,void 0,!0);xe(Ge),Ge.defaultPrevented&&(b=!0)}),!b)){this.setCurrentMarker();for(var H=function(xe){var Ge=X.markers[xe];X.setCurrentMarker(X.markers[xe]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(nt){return nt(new pt(h,Ge))})},X=this,K=this.markers.length-1;K>=0;K--)H(K);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var h;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=(h=this._currentMarker.notes)!==null&&h!==void 0?h:"",this.overlayContainer.appendChild(this.notesArea))},z.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var h=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var b=this.getState(),H=this.undoRedoManager.getLastUndoStep();if(!H||H.width===b.width&&H.height===b.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(b),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(K){return K(new Dt(h))})}else this.undoRedoManager.replaceLastUndoStep(b),this.eventListeners.statechange.forEach(function(K){return K(new Dt(h))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var h=this,b=this.undoRedoManager.undo();b!==void 0&&(this.restoreState(b),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(H){return H(new Dt(h))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var h=this,b=this.undoRedoManager.redo();b!==void 0&&(this.restoreState(b),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(H){return H(new Dt(h))}))},z.prototype.stepZoom=function(){var h=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=h<this.zoomSteps.length-1?this.zoomSteps[h+1]:this.zoomSteps[0]},z.prototype.panTo=function(h){this.contentDiv.scrollBy({left:this.prevPanPoint.x-h.x,top:this.prevPanPoint.y-h.y}),this.prevPanPoint=h},z.prototype.startRenderAndClose=function(){return Re(this,void 0,void 0,function(){var h,b,H=this;return Ee(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return h=X.sent(),b=this.getState(),this.eventListeners.render.forEach(function(K){return K(new At(H,h,b))}),this.close(!0),[2]}})})},z.prototype.getState=function(h){h===!0&&this.setCurrentMarker();var b={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(H){return b.markers.push(H.getState())}),b},z.prototype.restoreState=function(h){var b=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);h.markers.forEach(function(H){var X=b._availableMarkerTypes.find(function(xe){return xe.typeName===H.typeName});if(X!==void 0){var K=b.addNewMarker(X);K.restoreState(H),b.markers.push(K)}}),h.width&&h.height&&(h.width!==this.imageWidth||h.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/h.width,this.imageHeight/h.height),this.eventListeners.restorestate.forEach(function(H){return H(new Dt(b))})},z.prototype.addNewMarker=function(h){var b=de.createGroup();return this.markerImage.appendChild(b),new h(b,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(h){var b,H=this;(b=typeof h=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===h}):h)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(b),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(b.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new pt(H,H._currentMarker))}))},z.prototype.markerCreated=function(h){var b=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(h),this.setCurrentMarker(h),h instanceof Se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(H){return H(new pt(b,b._currentMarker))})},z.prototype.colorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=h,this.settings.defaultStrokeColor=h)},z.prototype.fillColorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=h)},z.prototype.markerStateChanged=function(h){var b=this;this.eventListeners.markerchange.forEach(function(H){return H(new pt(b,h))})},z.prototype.setCurrentMarker=function(h){var b=this;this._currentMarker!==h&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(H){return H(new pt(b,b._currentMarker))})),this._currentMarker=h,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(H){return H(new pt(b,b._currentMarker))}))},z.prototype.onPointerDown=function(h){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||h.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var b=this.markers.find(function(H){return H.ownsTarget(h.target)});b!==void 0?(this.setCurrentMarker(b),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:h.clientX,y:h.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY))},z.prototype.onDblClick=function(h){if(this._isFocused||this.focus(),this.mode==="select"){var b=this.markers.find(function(H){return H.ownsTarget(h.target)});b!==void 0&&b!==this._currentMarker&&this.setCurrentMarker(b),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(h){this.touchPoints!==1&&h.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||h.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(h.clientX,h.clientY)):this.zoomLevel>1&&this.panTo({x:h.clientX,y:h.clientY}))},z.prototype.onPointerUp=function(h){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(h.clientX,h.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(h){this._currentMarker===void 0||this.notesArea!==void 0||h.key!=="Delete"&&h.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(h,b){var H=this.markerImage.getBoundingClientRect();return{x:(h-H.left)/this.zoomLevel,y:(b-H.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},z.prototype.addLicenseKey=function(h){re.addKey(h)},z.prototype.addEventListener=function(h,b){this.eventListeners.addEventListener(h,b)},z.prototype.removeEventListener=function(h,b){this.eventListeners.removeEventListener(h,b)},z.prototype.renderState=function(h){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(h),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var h=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(b){return b(new Dt(h))}))},z.prototype.blur=function(){var h=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(b){return b(new Dt(h))}))},z.instanceCounter=0,z}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Rt=function(z,h){return(Rt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,H){b.__proto__=H}||function(b,H){for(var X in H)Object.prototype.hasOwnProperty.call(H,X)&&(b[X]=H[X])})(z,h)};function Ot(z,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function b(){this.constructor=z}Rt(z,h),z.prototype=h===null?Object.create(h):(b.prototype=h.prototype,new b)}function tt(z,h,b,H){return new(b||(b=Promise))(function(X,K){function xe(gt){try{nt(H.next(gt))}catch(Ke){K(Ke)}}function Ge(gt){try{nt(H.throw(gt))}catch(Ke){K(Ke)}}function nt(gt){var Ke;gt.done?X(gt.value):(Ke=gt.value,Ke instanceof b?Ke:new b(function(kt){kt(Ke)})).then(xe,Ge)}nt((H=H.apply(z,h||[])).next())})}function Tr(z,h){var b,H,X,K,xe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return K={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Ge(nt){return function(gt){return function(Ke){if(b)throw new TypeError("Generator is already executing.");for(;xe;)try{if(b=1,H&&(X=2&Ke[0]?H.return:Ke[0]?H.throw||((X=H.return)&&X.call(H),0):H.next)&&!(X=X.call(H,Ke[1])).done)return X;switch(H=0,X&&(Ke=[2&Ke[0],X.value]),Ke[0]){case 0:case 1:X=Ke;break;case 4:return xe.label++,{value:Ke[1],done:!1};case 5:xe.label++,H=Ke[1],Ke=[0];continue;case 7:Ke=xe.ops.pop(),xe.trys.pop();continue;default:if(!(X=xe.trys,(X=X.length>0&&X[X.length-1])||Ke[0]!==6&&Ke[0]!==2)){xe=0;continue}if(Ke[0]===3&&(!X||Ke[1]>X[0]&&Ke[1]<X[3])){xe.label=Ke[1];break}if(Ke[0]===6&&xe.label<X[1]){xe.label=X[1],X=Ke;break}if(X&&xe.label<X[2]){xe.label=X[2],xe.ops.push(Ke);break}X[2]&&xe.ops.pop(),xe.trys.pop();continue}Ke=h.call(z,xe)}catch(kt){Ke=[6,kt],H=0}finally{b=X=0}if(5&Ke[0])throw Ke[1];return{value:Ke[0]?Ke[1]:void 0,done:!0}}([nt,gt])}}}var wr=function(){function z(){}return z.addKey=function(h){z.key=h},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),St=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(h,b){for(var H=0,X=b;H<X.length;H++){var K=X[H],xe=K[0],Ge=K[1];h.setAttribute(xe,Ge)}},z.createRect=function(h,b,H){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",h.toString()),X.setAttribute("height",b.toString()),H&&z.setAttributes(X,H),X},z.createLine=function(h,b,H,X,K){var xe=document.createElementNS("http://www.w3.org/2000/svg","line");return xe.setAttribute("x1",h.toString()),xe.setAttribute("y1",b.toString()),xe.setAttribute("x2",H.toString()),xe.setAttribute("y2",X.toString()),K&&z.setAttributes(xe,K),xe},z.createPolygon=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","polygon");return H.setAttribute("points",h),b&&z.setAttributes(H,b),H},z.createCircle=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","circle");return H.setAttribute("cx",(h/2).toString()),H.setAttribute("cy",(h/2).toString()),H.setAttribute("r",h.toString()),b&&z.setAttributes(H,b),H},z.createEllipse=function(h,b,H){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(h/2).toString()),X.setAttribute("cy",(b/2).toString()),X.setAttribute("rx",(h/2).toString()),X.setAttribute("ry",(b/2).toString()),H&&z.setAttributes(X,H),X},z.createGroup=function(h){var b=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&z.setAttributes(b,h),b},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(h,b,H,X,K,xe,Ge){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(nt,[["id",h],["orient",b],["markerWidth",H.toString()],["markerHeight",X.toString()],["refX",K.toString()],["refY",xe.toString()]]),nt.appendChild(Ge),nt},z.createText=function(h){var b=document.createElementNS("http://www.w3.org/2000/svg","text");return b.setAttribute("x","0"),b.setAttribute("y","0"),h&&z.setAttributes(b,h),b},z.createTSpan=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","tspan");return H.textContent=h,b&&z.setAttributes(H,b),H},z.createImage=function(h){var b=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&z.setAttributes(b,h),b},z.createPoint=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return H.x=h,H.y=b,H},z.createPath=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg","path");return H.setAttribute("d",h),b&&z.setAttributes(H,b),H},z.createElement=function(h,b){var H=document.createElementNS("http://www.w3.org/2000/svg",h);return b&&z.setAttributes(H,b),H},z.getHollowRectanglePath=function(h,b,H,X,K,xe,Ge,nt){return"M"+h+","+b+"V"+(b+X)+"H"+(h+H)+"V"+b+"H"+K+"V"+xe+"H"+(K+Ge)+"V"+(xe+nt)+"H"+K+"V"+b+"Z"},z}(),mt=function(){function z(h){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},z.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new lt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new lt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new lt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ct("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ct("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),lt=function(z,h){this.selector=z,this.style=h},Ct=function(z,h){this.localName=z,this.style=h},$t=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(h){h.className=this.blockClassName,h.buttonClassName=this.buttonClassName,h.buttonColorsClassName=this.buttonColorsClassName,h.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(h)},z.prototype.addElementBlock=function(h){h.className===void 0&&(h.className=this.blockClassName),this.blocks.push(h)},z.prototype.getUI=function(){var h=document.createElement("div");return h.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,h.style.display=this.display,this.blocks.forEach(function(b){return h.appendChild(b.getUI())}),h},z}(),Jt=function(){function z(){}return z.prototype.getUI=function(){var h=document.createElement("div");if(h.className=this.className,this.minWidth!==void 0&&(h.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":h.style.justifyContent="flex-start";break;case"center":h.style.justifyContent="center";break;case"end":h.style.justifyContent="flex-end"}return h.style.whiteSpace="nowrap",h},z}(),nr=function(z){function h(){var b=z!==null&&z.apply(this,arguments)||this;return b.buttons=[],b}return Ot(h,z),h.prototype.addButton=function(b){b.className=this.buttonClassName,b.colorsClassName=this.buttonColorsClassName,b.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(b)},h.prototype.getUI=function(){var b=z.prototype.getUI.call(this);return this.buttons.forEach(function(H){return b.appendChild(H.getUI())}),b},h}(Jt),Pt=function(){function z(h,b){this._isActive=!1,this._isHidden=!1,this._icon=h,this.title=b,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(h){this._icon=h,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(h){this._isActive=h,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var h=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 h.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),yt=function(z){function h(){var b=z!==null&&z.apply(this,arguments)||this;return b.elements=[],b}return Ot(h,z),h.prototype.addElement=function(b){this.elements.push(b)},h.prototype.getUI=function(){var b=z.prototype.getUI.call(this);return this.elements.forEach(function(H){return b.appendChild(H)}),b},h}(Jt),Mr=function(){function z(h,b){this.horizontal=h,this.vertical=b}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(h){return h/this.ratio},z.prototype.getHorizontalLength=function(h){return h*this.ratio},z}(),tn=function(){function z(){}return z.getIcon=function(h,b){if(h>0&&b>0){var H=new Mr(h,b),X=H.ratio>=1?20:H.getHorizontalLength(20),K=H.ratio<1?20:H.getVerticalLength(20),xe=document.createElementNS("http://www.w3.org/2000/svg","svg");xe.setAttribute("xmlns","http://www.w3.org/2000/svg"),xe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(xe);var Ge=St.createDefs();xe.appendChild(Ge);var nt=St.createElement("clipPath",[["id","text-bg-clip"]]);Ge.appendChild(nt);var gt=St.createPath(St.getHollowRectanglePath((24-X)/2,(24-K)/2,X,K,(24-X)/2+2,(24-K)/2+2,X-4,K-4));xe.appendChild(gt);var Ke=St.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ke.appendChild(St.createTSpan(h+":"+b)),xe.appendChild(Ke);var kt=Ke.getBBox();St.setAttributes(Ke,[["x",((24-kt.width)/2).toString()],["y",((24-kt.height)/2-kt.y).toString()]]);var Bt=St.createPath(St.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(kt.width))/2,(24-Math.ceil(kt.height))/2,Math.ceil(kt.width),Math.ceil(kt.height)));return nt.appendChild(Bt),St.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(xe),xe.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},z}(),Ar=function(z){function h(b,H,X){var K=z.call(this,b,H)||this;return K.isDropdownOpen=!1,K.onClick=K.dropdownButtonClicked,K.dropdownButtons=X,K}return Ot(h,z),h.prototype.setupDropdown=function(){var b=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(H){H.className=b.className,H.colorsClassName=b.colorsClassName,b.dropdownBlock.appendChild(H.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},h.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},h.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},h.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},h.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},h.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},h}(Pt),It=function(){function z(h,b){this.GRIP_SIZE=10,this.color=h,this.fillColor=b,this.visual=St.createGroup(),this.visual.appendChild(St.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(St.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},z.prototype.setCenter=function(h,b){this.visual.childNodes.forEach(function(H){return St.setAttributes(H,[["cx",h.toString()],["cy",b.toString()]])})},z}(),kr=function(){function z(h,b,H,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=h,this.canvasHeight=b,this.margin=H,this.container=X,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(h){this._aspectRatio=h,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(h){this._isGridVisible=h,this.gridContainer&&St.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(h){this._zoomFactor=h,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var h=this;this.cropShadeElement=St.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=St.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var b=0;b<this.numberOfGridLines;b++)this.horizontalGridLines.push(St.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(St.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(H){return h.gridContainer.appendChild(H)}),this.verticalGridLines.forEach(function(H){return h.gridContainer.appendChild(H)}),this.cropRectElement=St.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(h){this.cropRect=h;var b=Object.assign({},this.cropRect);this.zoomFactor!==1&&(b.width=this.cropRect.width*this.zoomFactor,b.height=this.cropRect.height*this.zoomFactor,b.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-b.width/2,b.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-b.height/2),St.setAttributes(this.cropRectElement,[["x",b.x.toString()],["y",b.y.toString()],["width",b.width.toString()],["height",b.height.toString()]]);var H=b.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(K,xe){var Ge=b.y+H*(xe+1);St.setAttributes(K,[["x1",""+b.x],["y1",""+Ge],["x2",""+(b.x+b.width)],["y2",""+Ge]])});var X=b.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(K,xe){var Ge=b.x+X*(xe+1);St.setAttributes(K,[["x1",""+Ge],["y1",""+b.y],["x2",""+Ge],["y2",""+(b.y+b.height)]])}),St.setAttributes(this.cropShadeElement,[["d",St.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,b.x,b.y,b.width,b.height)]]),this.topLeftGrip.setCenter(b.x,b.y),this.topRightGrip.setCenter(b.x+b.width,b.y),this.bottomLeftGrip.setCenter(b.x,b.y+b.height),this.bottomRightGrip.setCenter(b.x+b.width,b.y+b.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},z.prototype.clientToLocalCoordinates=function(h,b){var H=this.container.getBoundingClientRect();return{x:h-H.left+this.margin,y:b-H.top+this.margin}},z.prototype.onPointerDown=function(h){this.container.setPointerCapture(h.pointerId),this.previousPoint=this.clientToLocalCoordinates(h.clientX,h.clientY),this.cropRectElement===h.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(h.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(h.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(h.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(h.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(h){if(this.isMoving)this.move(this.clientToLocalCoordinates(h.clientX,h.clientY));else if(this.activeGrip){var b=this.clientToLocalCoordinates(h.clientX,h.clientY);this.resize(b)}h.preventDefault()},z.prototype.onPointerUp=function(h){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(h.pointerId)},z.prototype.move=function(h){var b=h.x-this.previousPoint.x,H=h.y-this.previousPoint.y;this.zoomFactor!==1&&(b=-b/this.zoomFactor,H=-H/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+b),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+H),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=h},z.prototype.resize=function(h){var b=Object.assign({},this.cropRect),H=h.x-this.previousPoint.x,X=h.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:b.x+H<this.margin&&(H=this.margin-b.x),b.x+=H,b.width=this.cropRect.x+this.cropRect.width-b.x;break;case this.bottomRightGrip:case this.topRightGrip:b.width+H>this.canvasWidth*this.zoomFactor&&(H=this.canvasWidth*this.zoomFactor-b.width),b.width+=H}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(b.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(H),b.height=this.aspectRatio.getVerticalLength(b.width)):(b.y+=X,b.height=this.cropRect.y+this.cropRect.height-b.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?b.height=this.aspectRatio.getVerticalLength(b.width):b.height+=X}b.width<10&&(b.x=this.cropRect.x,b.width=10),b.height<10&&(b.y=this.cropRect.y,b.height=10),this.previousPoint=h,b.x>=this.margin&&b.y>=this.margin&&b.x-this.margin+b.width<=this.canvasWidth&&b.y-this.margin+b.height<=this.canvasHeight&&(this.cropRect=b,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var h=this.cropRect.x+this.cropRect.width/2,b=this.cropRect.y+this.cropRect.height/2,H=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);H/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=H:this.cropRect.height=X,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=h-this.cropRect.width/2,this.cropRect.y=b-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},z.prototype.getRescaledRect=function(h,b,H,X,K,xe){var Ge=H/h,nt=X/b;return{x:(K.x-xe)*Ge+xe,y:(K.y-xe)*nt+xe,width:K.width*Ge,height:K.height*nt}},z.prototype.scaleCanvas=function(h,b){var H=this.getRescaledRect(this.canvasWidth,this.canvasHeight,h,b,this.cropRect,this.margin);this.canvasWidth=h,this.canvasHeight=b,this.onCropChange&&this.onCropChange(H),this.setCropRectangle(H)},z}(),Kr=function(){function z(h){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=h,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(z.prototype,"angle",{get:function(){return this._angle},set:function(h){this._angle=h,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},z.prototype.onPointerDown=function(h){this.controlContainer.setPointerCapture(h.pointerId),this.isDragging=!0,this.previousPoint={x:h.clientX,y:h.clientY}},z.prototype.onPointerMove=function(h){this.isDragging&&(this.onAngleChange&&this.onAngleChange((h.clientX-this.previousPoint.x)/5),this.previousPoint.x=h.clientX)},z.prototype.onPointerUp=function(h){this.isDragging&&this.onAngleChange&&this.onAngleChange((h.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(h.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var h=this.angleLabelText.getBBox();St.setAttributes(this.angleLabelElement,[["x",((this.width-h.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var h=this.scaleShape.transform.baseVal.getItem(0);h.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(h,0)}},z.prototype.getVisual=function(){var h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("width",this.width+"px"),h.setAttribute("height",this.height+"px"),h.setAttribute("viewBox","0 0 "+this.width+" "+this.height),h.style.flexShrink="0",document.body.appendChild(h);for(var b="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,H=1;H<=this.width/5+10;H++){var X=H%5==0?this.height/3:this.height/6;b+="h4v"+-X+"h1v"+X}b+="v1H0Z",this.scaleShape=St.createPath(b);var K=St.createTransform();this.scaleShape.transform.baseVal.appendItem(K),h.appendChild(this.scaleShape),this.angleLabelElement=St.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=St.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var xe=St.createTSpan("");return xe.innerHTML="&deg;",this.angleLabelElement.appendChild(xe),h.appendChild(this.angleLabelElement),document.body.removeChild(h),h},z}(),rn=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(h,b,H,X,K,xe,Ge){var nt=this;return new Promise(function(gt){var Ke=document.createElement("canvas");Ke.width=h.width.baseVal.value-2*X,Ke.height=h.height.baseVal.value-2*X;var kt=1,Bt=1;nt.naturalSize===!0?(kt=b.naturalWidth/(h.width.baseVal.value-2*X)/xe,Bt=b.naturalHeight/(h.height.baseVal.value-2*X)/Ge,Ke.width=b.naturalWidth/xe,Ke.height=b.naturalHeight/Ge):nt.width!==void 0&&nt.height!==void 0&&(kt=nt.width/H.width,Bt=nt.height/H.height,Ke.width*=kt,Ke.height*=Bt);var tr=Ke.getContext("2d");tr.translate(Ke.width/2,Ke.height/2),tr.rotate(K*Math.PI/180),tr.scale(xe,Ge),tr.translate(-Ke.width/2,-Ke.height/2),tr.drawImage(b,0,0,Ke.width,Ke.height);var Vr=document.createElement("canvas");Vr.width=H.width*kt,Vr.height=H.height*Bt,Vr.getContext("2d").putImageData(tr.getImageData((H.x-X)*kt,(H.y-X)*Bt,H.width*kt,H.height*Bt),0,0),gt(Vr.toDataURL(nt.imageType,nt.imageQuality))})},z}(),He=function(){function z(h){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=z.instanceCounter++,this.styles=new mt(this.instanceNo),this.target=h,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(h){this._zoomToCropEnabled=h,h?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(h){this._isGridVisible=h,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(h){this._gridLines=h,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(h){this._rotationAngle=h,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var h;return(h=this._aspectRatio)!==null&&h!==void 0?h:this.aspectRatios[0]},set:function(h){this._aspectRatio=h},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(h){h===void 0&&(h=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),h||this.closeEventListeners.forEach(function(b){return b()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(h){this.renderEventListeners.push(h)},z.prototype.removeRenderEventListener=function(h){this.renderEventListeners.indexOf(h)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(h),1)},z.prototype.addCloseEventListener=function(h){this.closeEventListeners.push(h)},z.prototype.removeCloseEventListener=function(h){this.closeEventListeners.indexOf(h)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(h),1)},z.prototype.setupResizeObserver=function(){var h=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var h=1*this.target.clientWidth/this.target.clientHeight,b=this.contentDiv.clientWidth/h>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*h:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,H=b+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/h;this.resize(b,H)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",St.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(h,b){this.imageWidth=Math.round(h),this.imageHeight=Math.round(b),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},z.prototype.setEditingTarget=function(){var h=document.createElement("canvas");h.width=this.target.naturalWidth,h.height=this.target.naturalHeight,h.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var b=h.toDataURL();St.setAttributes(this.editingTarget,[["href",b]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var h=this.target.getBoundingClientRect(),b=this.editorCanvas.getBoundingClientRect();this.left=h.left-b.left-this.CANVAS_MARGIN,this.top=h.top-b.top-this.CANVAS_MARGIN},z.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=St.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=St.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=St.createGroup(),this.editingTargetRotationScaleContainer=St.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var h=St.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(h);var b=St.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(b),this.editingTargetContainer=St.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=St.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new kr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},z.prototype.zoomToCrop=function(){if(this.cropRect){var h=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,b=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=h+"px "+b+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-h+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-b+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},z.prototype.cropRectChanged=function(h){this.cropRect=h,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var h=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,b=this.target.offsetTop>h+this.CANVAS_MARGIN?this.target.offsetTop-(h+this.CANVAS_MARGIN):0;this.coverDiv.style.top=b+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var h=this;this.topToolbar=new $t,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 b=new nr;b.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(b);var H=[];this.aspectRatios.forEach(function(Bt){var tr=new Pt(tn.getIcon(Bt.horizontal,Bt.vertical),Bt.horizontal===0&&Bt.vertical===0?"FREE":Bt.horizontal+":"+Bt.vertical);tr.onClick=function(){return h.ratioButtonClicked(Bt)},H.push(tr)}),this.aspectRatioButton=new Ar(tn.getIcon(0,0),"Aspect ratio",H),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,b.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Pt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){h.isGridVisible=!h.isGridVisible,X.isActive=h.isGridVisible},b.addButton(X);var K=new Pt('<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(K.isActive=this.zoomToCropEnabled,K.onClick=function(){h.zoomToCropEnabled=!h.zoomToCropEnabled,K.isActive=h.zoomToCropEnabled},b.addButton(K),!wr.isLicensed){var xe=new yt;this.topToolbar.addElementBlock(xe);var Ge=document.createElement("div");Ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var nt=document.createElement("a");nt.style.color="currentColor",nt.href="https://markerjs.com/products/cropro",nt.target="_blank",nt.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>',Ge.appendChild(nt),xe.addElement(Ge)}var gt=new nr;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var Ke=new Pt('<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");Ke.onClick=this.startRenderAndClose,gt.addButton(Ke),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ke.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var kt=new Pt('<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");kt.onClick=this.close,gt.addButton(kt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(kt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var h=this;this.bottomToolbar=new $t,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 b=new nr;b.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(b);var H=new Pt('<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");H.onClick=this.rotateLeftButtonClicked,b.addButton(H);var X=new Pt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");X.onClick=this.rotateRightButtonClicked,b.addButton(X);var K=new yt;K.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(K),this.straightener=new Kr("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(gt){h.rotateBy(gt),h.straightener.angle=h.rotationAngle},K.addElement(this.straightener.getUI());var xe=new nr;xe.minWidth=2*this.toolbarHeight+"px",xe.contentAlign="end",this.bottomToolbar.addButtonBlock(xe);var Ge=new Pt('<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");Ge.onClick=this.flipHorizontallyButtonClicked,xe.addButton(Ge);var nt=new Pt('<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");nt.onClick=this.flipVerticallyButtonClicked,xe.addButton(nt)},z.prototype.ratioButtonClicked=function(h){this.aspectRatio=h,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Mr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(h){if(h){var b=this.cropLayer.getRescaledRect(h.width,h.height,this.imageWidth,this.imageHeight,h.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(b),this.cropRectChanged(b),this.flippedHorizontally=h.flippedHorizontally,this.flippedVertically=h.flippedVertically,this.applyFlip(),this.rotationAngle=h.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(h,b){var H=this.cropImage.getBoundingClientRect();return{x:h-H.left,y:b-H.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var h=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=h+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},z.prototype.rotateLeftButtonClicked=function(){var h=this.rotationAngle-90;this.rotationAngle%90!=0&&(h+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(h)},z.prototype.rotateRightButtonClicked=function(){var h=this.rotationAngle+90;this.rotationAngle%90!=0&&(h-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(h)},z.prototype.rotateTo=function(h){h=(h=h>180?h-360:h)<=-180?h+360:h,this.rotationAngle=h,this.applyRotation()},z.prototype.rotateBy=function(h){this.rotateTo((this.rotationAngle+h)%360)},z.prototype.applyRotation=function(){var h=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var b=this.editingTargetRotationContainer.transform.baseVal.getItem(0);b.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(b,0);var H=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/H.width,this.imageHeight/H.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=h},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return tt(this,void 0,void 0,function(){var h,b;return Tr(this,function(H){switch(H.label){case 0:return[4,this.render()];case 1:return h=H.sent(),b=this.getState(),this.renderEventListeners.forEach(function(X){return X(h,b)}),this.close(!0),[2]}})})},z.prototype.render=function(){return tt(this,void 0,void 0,function(){var h;return Tr(this,function(b){switch(b.label){case 0:return(h=new rn).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.width=this.renderWidth,h.height=this.renderHeight,this.unzoomFromCrop(),St.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,h.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 b.sent(),[4,h.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,b.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ct("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var h=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ct("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*h)+`px;
height: `+(this.toolbarHeight-2*h)+`px;
padding: `+h+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new lt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new lt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*h)+`px;
padding: `+h+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ct("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),ht=q("8hTe"),Nt=q.n(ht),Vt=/<pre[^>]*>/g;function Qt(z){var h=document.createElement("div");return h.innerHTML=z,h.childNodes.length===0?"":h.childNodes[0].nodeValue}var er=De.a=function(z){var h=z.value,b=h===void 0?"":h,H=z.edit,X=H===void 0?!1:H,K=z.className,xe=z.showTextOnly,Ge=z.showLines,nt=z.replaces,gt=z.zoomImg,Ke=z.hasMask,kt=z.style,Bt=kt===void 0?{}:kt,tr=z.stylesPrev,Vr=tr===void 0?{}:tr,Xr=String(b),pr=Object(A.useRef)(),Zr=Object(A.useRef)(),Gn=Object(A.useState)(""),Pr=Object(j.a)(Gn,2),Yr=Pr[0],Wr=Pr[1],bn=Object(A.useState)("office"),nn=Object(j.a)(bn,2),mn=nn[0],dn=nn[1],hi=function(){var Gt=new He(Zr.current);Gt.displayMode="popup",Gt.addRenderEventListener(function(){var Er=Object(M.a)(P.a.mark(function Ht(dr){var Xt;return P.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return pr.current.style.display="none",lr.next=3,Object(Ie.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr}});case 3:Xt=lr.sent,Xt!=null&&Xt.id&&nt(Zr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 5:case"end":return lr.stop()}},Ht)}));return function(Ht){return Er.apply(this,arguments)}}()),Gt.show()},zn=function(){var Gt=new Et(Zr.current);Gt.settings.displayMode="popup",Gt.addEventListener("render",function(){var Er=Object(M.a)(P.a.mark(function Ht(dr){var Xt;return P.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:if(pr.current.style.display="none",!Zr.current){lr.next=6;break}return lr.next=4,Object(Ie.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr.dataUrl}});case 4:Xt=lr.sent,Xt!=null&&Xt.id&&nt(Zr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 6:case"end":return lr.stop()}},Ht)}));return function(Ht){return Er.apply(this,arguments)}}()),Gt.show(),window.markerArea=Gt},an=Object(A.useMemo)(function(){try{var or=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Gt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Er=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Xr=Xr.replace(or,"("+ee.a.API_SERVER+"/api/attachments/").replace(Gt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(Er,'"'+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,`
`),Xr=Xr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(hn){}var Ht=V(Xr),dr=L();if(Xr.match(/\[TOC\]/)&&(Ht=Ht.replace("<p>[TOC]</p>",R()),x()),Ht=Ht.replace(/(__special_katext_id_\d+__)/g,function(hn,lr){var Ir=dr[lr],Kn=Ir.type,Vn=Ir.expression;return Object(le.renderToString)(Qt(Vn)||"",{displayMode:Kn==="block",throwOnError:!1,output:"html"})}),Ht=Ht.replace(/▁/g,"\u2581\u2581\u2581"),S(),xe){var Xt=document.createElement("div");return Xt.innerHTML=Ht,Xt.innerText}return setTimeout(function(){return On()},500),Ht},[Xr]),$r=Object(A.useRef)();v.WebkitLineClamp=Ge,Ge&&(Bt=Object(F.a)(Object(F.a)({},Bt),v));function Rn(or){var Gt=or.target;if(Gt.tagName.toUpperCase()==="IMG"){if(gt){var Er=Gt.getAttribute("src");Wr(Er),dn("image")}}else if(Gt.tagName.toUpperCase()==="A"){var Ht=Gt.getAttribute("href");if(Ht.indexOf("office")>-1)or.preventDefault(),Wr(Ht),dn("office");else if(Ht.indexOf("application/pdf")>-1)or.preventDefault(),Wr(Ht),dn("pdf");else if(Ht.indexOf("type=text")>-1)or.preventDefault(),Wr(Ht),dn("html");else if(Ht.startsWith("#")){or.preventDefault();var dr=document.getElementById(Ht.replace("#",""));dr&&dr.scrollIntoView(!0)}}}var On=function(){var Gt,Er=(Gt=$r.current)===null||Gt===void 0?void 0:Gt.querySelectorAll("video");Er==null||Er.forEach(function(Ht){if(Ht.oncontextmenu=function(){return!1},Ht.src.indexOf(".m3u8")>-1&&!Ht.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var dr=new Y.a;dr.loadSource(Ht.src),dr.attachMedia(Ht)}}})};Object(A.useEffect)(function(){if($r.current&&an&&(an.match(Vt)&&window.PR.prettyPrint()),$r.current)return $r.current.addEventListener("click",Rn),function(){$r.current.removeEventListener("click",Rn),S(),x()}},[an,$r.current,Rn]);var ci=function(Gt){if(!X)return;Gt.target.nodeName==="IMG"?(pr.current.style.display="flex",pr.current.style.width=Gt.target.clientWidth+"px",pr.current.style.height=Gt.target.clientHeight+"px",pr.current.style.top=Gt.target.offsetTop+"px",pr.current.style.left=Gt.target.offsetLeft+"px",Zr.current.src=Gt.target.getAttribute("src")):pr.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:$r,style:Object(F.a)({},Bt),className:"".concat(K||""," markdown-body ").concat(Nt.a.mdBody),onMouseOver:ci,dangerouslySetInnerHTML:{__html:an}}),d.a.createElement("div",{ref:pr,className:Nt.a.button},d.a.createElement(J.a,null,d.a.createElement($.a,{onClick:function(){return hi()}},"\u88C1\u526A"),d.a.createElement($.a,{onClick:function(){return zn()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:Zr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),d.a.createElement(me.a,{close:!0,data:Yr,hasMask:Ke,type:Yr!=null&&Yr.length?mn:"",style:Object(F.a)({},Vr),onClose:function(){return Wr("")}}))}},"9VGf":function(bt,De,q){"use strict";q.d(De,"a",function(){return O});var ue=q("q1tI"),J=q.n(ue);function O($,F){var M=Object(ue.useRef)();Object(ue.useEffect)(function(){M.current=$}),Object(ue.useEffect)(function(){function j(){M.current()}if(F!==null){var U=setInterval(j,F);return function(){return clearInterval(U)}}},[F])}},BU3w:function(bt,De,q){"use strict";q.d(De,"a",function(){return M});var ue=q("MNnm"),J="rc-util-key";function O(j){if(j.attachTo)return j.attachTo;var U=document.querySelector("head");return U||document.body}function $(j){var U,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var A=document.createElement("style");if((U=P.csp)===null||U===void 0?void 0:U.nonce){var d;A.nonce=(d=P.csp)===null||d===void 0?void 0:d.nonce}A.innerHTML=j;var f=O(P),T=f.firstChild;return P.prepend&&f.prepend?f.prepend(A):P.prepend&&T?f.insertBefore(A,T):f.appendChild(A),A}var F=new Map;function M(j,U){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=O(P);if(!F.has(A)){var d=$("",P),f=d.parentNode;F.set(A,f),f.removeChild(d)}var T=Array.from(F.get(A).children).find(function(i){return i.tagName==="STYLE"&&i[J]===U});if(T){var p,m;if(((p=P.csp)===null||p===void 0?void 0:p.nonce)&&T.nonce!==((m=P.csp)===null||m===void 0?void 0:m.nonce)){var g;T.nonce=(g=P.csp)===null||g===void 0?void 0:g.nonce}return T.innerHTML!==j&&(T.innerHTML=j),T}var a=$(j,P);return a[J]=U,a}},Bd2K:function(bt,De,q){(function(ue){ue(q("VrN/"),q("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(P,A,d){if(d!=ue.Init&&d&&P.removeKeyMap("autoCloseTags"),!A)return;var f={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(f["'/'"]=function(T){return M(T)}),(typeof A!="object"||A.whenOpening!==!1)&&(f["'>'"]=function(T){return $(T)}),P.addKeyMap(f)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["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 $(P){if(P.getOption("disableInput"))return ue.Pass;for(var A=P.listSelections(),d=[],f=P.getOption("autoCloseTags"),T=0;T<A.length;T++){if(!A[T].empty())return ue.Pass;var p=A[T].head,m=P.getTokenAt(p),g=ue.innerMode(P.getMode(),m.state),a=g.state,i=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(a),s=i&&i.name;if(!s)return ue.Pass;var l=g.mode.configuration=="html",x=typeof f=="object"&&f.dontCloseTags||l&&J,v=typeof f=="object"&&f.indentTags||l&&O;m.end>p.ch&&(s=s.slice(0,s.length-m.end+p.ch));var y=s.toLowerCase();if(!s||m.type=="string"&&(m.end!=p.ch||!/[\"\']/.test(m.string.charAt(m.string.length-1))||m.string.length==1)||m.type=="tag"&&i.close||m.string.indexOf("/")==p.ch-m.start-1||x&&j(x,y)>-1||U(P,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(a)||[],s,p,!0))return ue.Pass;var R=typeof f=="object"&&f.emptyTags;if(R&&j(R,s)>-1){d[T]={text:"/>",newPos:ue.Pos(p.line,p.ch+2)};continue}var w=v&&j(v,y)>-1;d[T]={indent:w,text:">"+(w?`
`:"")+"</"+s+">",newPos:w?ue.Pos(p.line+1,0):ue.Pos(p.line,p.ch+1)}}for(var E=typeof f=="object"&&f.dontIndentOnAutoClose,T=A.length-1;T>=0;T--){var C=d[T];P.replaceRange(C.text,A[T].head,A[T].anchor,"+insert");var c=P.listSelections().slice(0);c[T]={head:C.newPos,anchor:C.newPos},P.setSelections(c),!E&&C.indent&&(P.indentLine(C.newPos.line,null,!0),P.indentLine(C.newPos.line+1,null,!0))}}function F(P,A){for(var d=P.listSelections(),f=[],T=A?"/":"</",p=P.getOption("autoCloseTags"),m=typeof p=="object"&&p.dontIndentOnSlash,g=0;g<d.length;g++){if(!d[g].empty())return ue.Pass;var a=d[g].head,i=P.getTokenAt(a),s=ue.innerMode(P.getMode(),i.state),l=s.state;if(A&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=a.ch-1))return ue.Pass;var x,v=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(v&&s.mode.name=="javascript")x=T+"script";else if(v&&s.mode.name=="css")x=T+"style";else{var y=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!y||y.length&&U(P,y,y[y.length-1],a))return ue.Pass;x=T+y[y.length-1]}P.getLine(a.line).charAt(i.end)!=">"&&(x+=">"),f[g]=x}if(P.replaceSelections(f),d=P.listSelections(),!m)for(var g=0;g<d.length;g++)(g==d.length-1||d[g].head.line<d[g+1].head.line)&&P.indentLine(d[g].head.line)}function M(P){return P.getOption("disableInput")?ue.Pass:F(P,!0)}ue.commands.closeTag=function(P){return F(P)};function j(P,A){if(P.indexOf)return P.indexOf(A);for(var d=0,f=P.length;d<f;++d)if(P[d]==A)return d;return-1}function U(P,A,d,f,T){if(!ue.scanForClosingTag)return!1;var p=Math.min(P.lastLine()+1,f.line+500),m=ue.scanForClosingTag(P,f,null,p);if(!m||m.tag!=d)return!1;for(var g=T?1:0,a=A.length-1;a>=0&&A[a]==d;a--)++g;f=m.to;for(var a=1;a<g;a++){var i=ue.scanForClosingTag(P,f,null,p);if(!i||i.tag!=d)return!1;f=i.to}return!0}})},BjJ7:function(bt,De,q){"use strict";q.d(De,"d",function(){return J}),q.d(De,"c",function(){return O}),q.d(De,"e",function(){return $}),q.d(De,"b",function(){return F}),q.d(De,"a",function(){return j});var ue=q("m3rI");function J(U){var P=!0;if(U.length>0){for(var A=0;A<U.length;A++)if(U[A].compile_success==0||!U[A].compile_success){P=!1;break}}else P=!1;return P}function O(U){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],d=0;d<U.length;d++){var f=U[d],T=P?"".concat(P,"/").concat(f.name):"".concat(f.name);A.push({title:f.name,isLeaf:!(f.type==="tree"),key:T})}return A}function $(U,P,A){for(var d=0;d<U.length;d++){var f=U[d];if(f.key===P){f.children=A;break}f.children&&$(f.children,P,A)}return U}function F(U,P,A){var d;return function(){var f=this,T=arguments,p=function(){d=null,A||U.apply(f,T)},m=A&&!d;clearTimeout(d),d=setTimeout(p,P),m&&U.apply(f,T)}}var M=!0,j=ue.a.API_SERVER},"C+DQ":function(bt,De,q){},"C/vA":function(bt,De,q){"use strict";q.d(De,"a",function(){return ue});function ue(J){var O=this,$=!1,F;return function(){return $||($=!0,F=J.apply(O,arguments)),F}}},"Cg/j":function(bt,De,q){"use strict";q.d(De,"b",function(){return ue}),q.d(De,"a",function(){return J}),q.d(De,"c",function(){return $}),q.d(De,"d",function(){return F});var ue;(function(M){M.serviceIds=new Map,M.DI_TARGET="$di$target",M.DI_DEPENDENCIES="$di$dependencies";function j(U){return U[M.DI_DEPENDENCIES]||[]}M.getServiceDependencies=j})(ue||(ue={}));var J=$("instantiationService");function O(M,j,U,P){j[ue.DI_TARGET]===j?j[ue.DI_DEPENDENCIES].push({id:M,index:U,optional:P}):(j[ue.DI_DEPENDENCIES]=[{id:M,index:U,optional:P}],j[ue.DI_TARGET]=j)}function $(M){if(ue.serviceIds.has(M))return ue.serviceIds.get(M);var j=function(U,P,A){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");O(j,U,A,!1)};return j.toString=function(){return M},ue.serviceIds.set(M,j),j}function F(M){return function(j,U,P){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");O(M,j,P,!0)}}},DlQD:function(bt,De,q){(function(ue,J){bt.exports=J()})(this,function(){"use strict";function ue(Se,be){for(var Ce=0;Ce<be.length;Ce++){var ne=be[Ce];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(Se,ne.key,ne)}}function J(Se,be,Ce){return be&&ue(Se.prototype,be),Ce&&ue(Se,Ce),Se}function O(Se,be){if(!Se)return;if(typeof Se=="string")return $(Se,be);var Ce=Object.prototype.toString.call(Se).slice(8,-1);if(Ce==="Object"&&Se.constructor&&(Ce=Se.constructor.name),Ce==="Map"||Ce==="Set")return Array.from(Se);if(Ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ce))return $(Se,be)}function $(Se,be){(be==null||be>Se.length)&&(be=Se.length);for(var Ce=0,ne=new Array(be);Ce<be;Ce++)ne[Ce]=Se[Ce];return ne}function F(Se,be){var Ce;if(typeof Symbol=="undefined"||Se[Symbol.iterator]==null){if(Array.isArray(Se)||(Ce=O(Se))||be&&Se&&typeof Se.length=="number"){Ce&&(Se=Ce);var ne=0;return function(){return ne>=Se.length?{done:!0}:{done:!1,value:Se[ne++]}}}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 Ce=Se[Symbol.iterator](),Ce.next.bind(Ce)}function M(Se,be){return be={exports:{}},Se(be,be.exports),be.exports}var j=M(function(Se){function be(){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 Ce(ne){Se.exports.defaults=ne}Se.exports={defaults:be(),getDefaults:be,changeDefaults:Ce}}),U=j.defaults,P=j.getDefaults,A=j.changeDefaults,d=/[&<>"']/,f=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,p=/[<>"']|&(?!#?\w+;)/g,m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=function(be){return m[be]};function a(Se,be){if(be){if(d.test(Se))return Se.replace(f,g)}else if(T.test(Se))return Se.replace(p,g);return Se}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Se){return Se.replace(i,function(be,Ce){return Ce=Ce.toLowerCase(),Ce==="colon"?":":Ce.charAt(0)==="#"?Ce.charAt(1)==="x"?String.fromCharCode(parseInt(Ce.substring(2),16)):String.fromCharCode(+Ce.substring(1)):""})}var l=/(^|[^\[])\^/g;function x(Se,be){Se=Se.source||Se,be=be||"";var Ce={replace:function(oe,ce){return ce=ce.source||ce,ce=ce.replace(l,"$1"),Se=Se.replace(oe,ce),Ce},getRegex:function(){return new RegExp(Se,be)}};return Ce}var v=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Se,be,Ce){if(Se){var ne;try{ne=decodeURIComponent(s(Ce)).replace(v,"").toLowerCase()}catch(oe){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}be&&!y.test(Ce)&&(Ce=u(be,Ce));try{Ce=encodeURI(Ce).replace(/%25/g,"%")}catch(oe){return null}return Ce}var w={},E=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Se,be){w[" "+Se]||(E.test(Se)?w[" "+Se]=Se+"/":w[" "+Se]=_(Se,"/",!0)),Se=w[" "+Se];var Ce=Se.indexOf(":")===-1;return be.substring(0,2)==="//"?Ce?be:Se.replace(C,"$1")+be:be.charAt(0)==="/"?Ce?be:Se.replace(c,"$1")+be:Se+be}var L={exec:function(){}};function S(Se){for(var be=1,Ce,ne;be<arguments.length;be++){Ce=arguments[be];for(ne in Ce)Object.prototype.hasOwnProperty.call(Ce,ne)&&(Se[ne]=Ce[ne])}return Se}function D(Se,be){var Ce=Se.replace(/\|/g,function(ce,ve,Ne){for(var Le=!1,ze=ve;--ze>=0&&Ne[ze]==="\\";)Le=!Le;return Le?"|":" |"}),ne=Ce.split(/ \|/),oe=0;if(ne.length>be)ne.splice(be);else for(;ne.length<be;)ne.push("");for(;oe<ne.length;oe++)ne[oe]=ne[oe].trim().replace(/\\\|/g,"|");return ne}function _(Se,be,Ce){var ne=Se.length;if(ne===0)return"";for(var oe=0;oe<ne;){var ce=Se.charAt(ne-oe-1);if(ce===be&&!Ce)oe++;else if(ce!==be&&Ce)oe++;else break}return Se.substr(0,ne-oe)}function B(Se,be){if(Se.indexOf(be[1])===-1)return-1;for(var Ce=Se.length,ne=0,oe=0;oe<Ce;oe++)if(Se[oe]==="\\")oe++;else if(Se[oe]===be[0])ne++;else if(Se[oe]===be[1]&&(ne--,ne<0))return oe;return-1}function G(Se){Se&&Se.sanitize&&!Se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:a,unescape:s,edit:x,cleanUrl:R,resolveUrl:u,noopTest:L,merge:S,splitCells:D,rtrim:_,findClosingBracket:B,checkSanitizeDeprecation:G},I=j.defaults,N=V.rtrim,Y=V.splitCells,ee=V.escape,le=V.findClosingBracket;function me(Se,be,Ce){var ne=be.href,oe=be.title?ee(be.title):null,ce=Se[1].replace(/\\([\[\]])/g,"$1");return Se[0].charAt(0)!=="!"?{type:"link",raw:Ce,href:ne,title:oe,text:ce}:{type:"image",raw:Ce,href:ne,title:oe,text:ee(ce)}}function Ie(Se,be){var Ce=Se.match(/^(\s+)(?:```)/);if(Ce===null)return be;var ne=Ce[1];return be.split(`
`).map(function(oe){var ce=oe.match(/^\s+/);if(ce===null)return oe;var ve=ce[0];return ve.length>=ne.length?oe.slice(ne.length):oe}).join(`
`)}var Te=function(){function Se(Ce){this.options=Ce||I}var be=Se.prototype;return be.space=function(ne){var oe=this.rules.block.newline.exec(ne);if(oe)return oe[0].length>1?{type:"space",raw:oe[0]}:{raw:`
`}},be.code=function(ne,oe){var ce=this.rules.block.code.exec(ne);if(ce){var ve=oe[oe.length-1];if(ve&&ve.type==="paragraph")return{raw:ce[0],text:ce[0].trimRight()};var Ne=ce[0].replace(/^ {4}/gm,"");return{type:"code",raw:ce[0],codeBlockStyle:"indented",text:this.options.pedantic?Ne:N(Ne,`
`)}}},be.fences=function(ne){var oe=this.rules.block.fences.exec(ne);if(oe){var ce=oe[0],ve=Ie(ce,oe[3]||"");return{type:"code",raw:ce,lang:oe[2]?oe[2].trim():oe[2],text:ve}}},be.heading=function(ne){var oe=this.rules.block.heading.exec(ne);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},be.nptable=function(ne){var oe=this.rules.block.nptable.exec(ne);if(oe){var ce={type:"table",header:Y(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[],raw:oe[0]};if(ce.header.length===ce.align.length){var ve=ce.align.length,Ne;for(Ne=0;Ne<ve;Ne++)/^ *-+: *$/.test(ce.align[Ne])?ce.align[Ne]="right":/^ *:-+: *$/.test(ce.align[Ne])?ce.align[Ne]="center":/^ *:-+ *$/.test(ce.align[Ne])?ce.align[Ne]="left":ce.align[Ne]=null;for(ve=ce.cells.length,Ne=0;Ne<ve;Ne++)ce.cells[Ne]=Y(ce.cells[Ne],ce.header.length);return ce}}},be.hr=function(ne){var oe=this.rules.block.hr.exec(ne);if(oe)return{type:"hr",raw:oe[0]}},be.blockquote=function(ne){var oe=this.rules.block.blockquote.exec(ne);if(oe){var ce=oe[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:oe[0],text:ce}}},be.list=function(ne){var oe=this.rules.block.list.exec(ne);if(oe){for(var ce=oe[0],ve=oe[2],Ne=ve.length>1,Le=ve[ve.length-1]===")",ze={type:"list",raw:ce,ordered:Ne,start:Ne?+ve.slice(0,-1):"",loose:!1,items:[]},it=oe[0].match(this.rules.block.item),ct=!1,dt,Dt,At,pt,jt,Et,Rt,Ot=it.length,tt=0;tt<Ot;tt++)dt=it[tt],ce=dt,Dt=dt.length,dt=dt.replace(/^ *([*+-]|\d+[.)]) */,""),~dt.indexOf(`
`)&&(Dt-=dt.length,dt=this.options.pedantic?dt.replace(/^ {1,4}/gm,""):dt.replace(new RegExp("^ {1,"+Dt+"}","gm"),"")),tt!==Ot-1&&(At=this.rules.block.bullet.exec(it[tt+1])[0],(Ne?At.length===1||!Le&&At[At.length-1]===")":At.length>1||this.options.smartLists&&At!==ve)&&(pt=it.slice(tt+1).join(`
`),ze.raw=ze.raw.substring(0,ze.raw.length-pt.length),tt=Ot-1)),jt=ct||/\n\n(?!\s*$)/.test(dt),tt!==Ot-1&&(ct=dt.charAt(dt.length-1)===`
`,jt||(jt=ct)),jt&&(ze.loose=!0),Et=/^\[[ xX]\] /.test(dt),Rt=void 0,Et&&(Rt=dt[1]!==" ",dt=dt.replace(/^\[[ xX]\] +/,"")),ze.items.push({type:"list_item",raw:ce,task:Et,checked:Rt,loose:jt,text:dt});return ze}},be.html=function(ne){var oe=this.rules.block.html.exec(ne);if(oe)return{type:this.options.sanitize?"paragraph":"html",raw:oe[0],pre:!this.options.sanitizer&&(oe[1]==="pre"||oe[1]==="script"||oe[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):ee(oe[0]):oe[0]}},be.def=function(ne){var oe=this.rules.block.def.exec(ne);if(oe){oe[3]&&(oe[3]=oe[3].substring(1,oe[3].length-1));var ce=oe[1].toLowerCase().replace(/\s+/g," ");return{tag:ce,raw:oe[0],href:oe[2],title:oe[3]}}},be.table=function(ne){var oe=this.rules.block.table.exec(ne);if(oe){var ce={type:"table",header:Y(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[]};if(ce.header.length===ce.align.length){ce.raw=oe[0];var ve=ce.align.length,Ne;for(Ne=0;Ne<ve;Ne++)/^ *-+: *$/.test(ce.align[Ne])?ce.align[Ne]="right":/^ *:-+: *$/.test(ce.align[Ne])?ce.align[Ne]="center":/^ *:-+ *$/.test(ce.align[Ne])?ce.align[Ne]="left":ce.align[Ne]=null;for(ve=ce.cells.length,Ne=0;Ne<ve;Ne++)ce.cells[Ne]=Y(ce.cells[Ne].replace(/^ *\| *| *\| *$/g,""),ce.header.length);return ce}}},be.lheading=function(ne){var oe=this.rules.block.lheading.exec(ne);if(oe)return{type:"heading",raw:oe[0],depth:oe[2].charAt(0)==="="?1:2,text:oe[1]}},be.paragraph=function(ne){var oe=this.rules.block.paragraph.exec(ne);if(oe)return{type:"paragraph",raw:oe[0],text:oe[1].charAt(oe[1].length-1)===`
`?oe[1].slice(0,-1):oe[1]}},be.text=function(ne,oe){var ce=this.rules.block.text.exec(ne);if(ce){var ve=oe[oe.length-1];return ve&&ve.type==="text"?{raw:ce[0],text:ce[0]}:{type:"text",raw:ce[0],text:ce[0]}}},be.escape=function(ne){var oe=this.rules.inline.escape.exec(ne);if(oe)return{type:"escape",raw:oe[0],text:ee(oe[1])}},be.tag=function(ne,oe,ce){var ve=this.rules.inline.tag.exec(ne);if(ve)return!oe&&/^<a /i.test(ve[0])?oe=!0:oe&&/^<\/a>/i.test(ve[0])&&(oe=!1),!ce&&/^<(pre|code|kbd|script)(\s|>)/i.test(ve[0])?ce=!0:ce&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ve[0])&&(ce=!1),{type:this.options.sanitize?"text":"html",raw:ve[0],inLink:oe,inRawBlock:ce,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):ee(ve[0]):ve[0]}},be.link=function(ne){var oe=this.rules.inline.link.exec(ne);if(oe){var ce=le(oe[2],"()");if(ce>-1){var ve=oe[0].indexOf("!")===0?5:4,Ne=ve+oe[1].length+ce;oe[2]=oe[2].substring(0,ce),oe[0]=oe[0].substring(0,Ne).trim(),oe[3]=""}var Le=oe[2],ze="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);it?(Le=it[1],ze=it[3]):ze=""}else ze=oe[3]?oe[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=me(oe,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:ze&&ze.replace(this.rules.inline._escapes,"$1")},oe[0]);return ct}},be.reflink=function(ne,oe){var ce;if((ce=this.rules.inline.reflink.exec(ne))||(ce=this.rules.inline.nolink.exec(ne))){var ve=(ce[2]||ce[1]).replace(/\s+/g," ");if(ve=oe[ve.toLowerCase()],!ve||!ve.href){var Ne=ce[0].charAt(0);return{type:"text",raw:Ne,text:Ne}}var Le=me(ce,ve,ce[0]);return Le}},be.strong=function(ne,oe,ce){ce===void 0&&(ce="");var ve=this.rules.inline.strong.start.exec(ne);if(ve&&(!ve[1]||ve[1]&&(ce===""||this.rules.inline.punctuation.exec(ce)))){oe=oe.slice(-1*ne.length);var Ne=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ne.lastIndex=0;for(var Le;(ve=Ne.exec(oe))!=null;)if(Le=this.rules.inline.strong.middle.exec(oe.slice(0,ve.index+3)),Le)return{type:"strong",raw:ne.slice(0,Le[0].length),text:ne.slice(2,Le[0].length-2)}}},be.em=function(ne,oe,ce){ce===void 0&&(ce="");var ve=this.rules.inline.em.start.exec(ne);if(ve&&(!ve[1]||ve[1]&&(ce===""||this.rules.inline.punctuation.exec(ce)))){oe=oe.slice(-1*ne.length);var Ne=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ne.lastIndex=0;for(var Le;(ve=Ne.exec(oe))!=null;)if(Le=this.rules.inline.em.middle.exec(oe.slice(0,ve.index+2)),Le)return{type:"em",raw:ne.slice(0,Le[0].length),text:ne.slice(1,Le[0].length-1)}}},be.codespan=function(ne){var oe=this.rules.inline.code.exec(ne);if(oe){var ce=oe[2].replace(/\n/g," "),ve=/[^ ]/.test(ce),Ne=ce.startsWith(" ")&&ce.endsWith(" ");return ve&&Ne&&(ce=ce.substring(1,ce.length-1)),ce=ee(ce,!0),{type:"codespan",raw:oe[0],text:ce}}},be.br=function(ne){var oe=this.rules.inline.br.exec(ne);if(oe)return{type:"br",raw:oe[0]}},be.del=function(ne){var oe=this.rules.inline.del.exec(ne);if(oe)return{type:"del",raw:oe[0],text:oe[1]}},be.autolink=function(ne,oe){var ce=this.rules.inline.autolink.exec(ne);if(ce){var ve,Ne;return ce[2]==="@"?(ve=ee(this.options.mangle?oe(ce[1]):ce[1]),Ne="mailto:"+ve):(ve=ee(ce[1]),Ne=ve),{type:"link",raw:ce[0],text:ve,href:Ne,tokens:[{type:"text",raw:ve,text:ve}]}}},be.url=function(ne,oe){var ce;if(ce=this.rules.inline.url.exec(ne)){var ve,Ne;if(ce[2]==="@")ve=ee(this.options.mangle?oe(ce[0]):ce[0]),Ne="mailto:"+ve;else{var Le;do Le=ce[0],ce[0]=this.rules.inline._backpedal.exec(ce[0])[0];while(Le!==ce[0]);ve=ee(ce[0]),ce[1]==="www."?Ne="http://"+ve:Ne=ve}return{type:"link",raw:ce[0],text:ve,href:Ne,tokens:[{type:"text",raw:ve,text:ve}]}}},be.inlineText=function(ne,oe,ce){var ve=this.rules.inline.text.exec(ne);if(ve){var Ne;return oe?Ne=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):ee(ve[0]):ve[0]:Ne=ee(this.options.smartypants?ce(ve[0]):ve[0]),{type:"text",raw:ve[0],text:Ne}}},Se}(),Oe=V.noopTest,Re=V.edit,Ee=V.merge,pe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Oe,table:Oe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Re(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Re(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Re(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Re(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Re(pe._paragraph).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.blockquote=Re(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=Ee({},pe),pe.gfm=Ee({},pe.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),pe.gfm.nptable=Re(pe.gfm.nptable).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.gfm.table=Re(pe.gfm.table).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.pedantic=Ee({},pe.normal,{html:Re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Oe,paragraph:Re(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Oe,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:Oe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};de._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",de.punctuation=Re(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=Re(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=Re(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=Re(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=Re(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=Re(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=Re(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=Re(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=Re(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=Re(de._blockSkip,"g").getRegex(),de.overlapSkip=Re(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._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])?)+(?![-_])/,de.autolink=Re(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=Re(de.tag).replace("comment",pe._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=Re(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=Re(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=Re(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=Ee({},de),de.pedantic=Ee({},de.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:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=Ee({},de.normal,{escape:Re(de.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),de.gfm.url=Re(de.gfm.url,"i").replace("email",de.gfm._extended_email).getRegex(),de.breaks=Ee({},de.gfm,{br:Re(de.br).replace("{2,}","*").getRegex(),text:Re(de.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var re={block:pe,inline:de},he=j.defaults,se=re.block,Ae=re.inline;function ie(Se){return Se.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ae(Se){var be="",Ce,ne,oe=Se.length;for(Ce=0;Ce<oe;Ce++)ne=Se.charCodeAt(Ce),Math.random()>.5&&(ne="x"+ne.toString(16)),be+="&#"+ne+";";return be}var ge=function(){function Se(Ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ce||he,this.options.tokenizer=this.options.tokenizer||new Te,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:se.normal,inline:Ae.normal};this.options.pedantic?(ne.block=se.pedantic,ne.inline=Ae.pedantic):this.options.gfm&&(ne.block=se.gfm,this.options.breaks?ne.inline=Ae.breaks:ne.inline=Ae.gfm),this.tokenizer.rules=ne}Se.lex=function(ne,oe){var ce=new Se(oe);return ce.lex(ne)};var be=Se.prototype;return be.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},be.blockTokens=function(ne,oe,ce){oe===void 0&&(oe=[]),ce===void 0&&(ce=!0),ne=ne.replace(/^ +$/gm,"");for(var ve,Ne,Le,ze;ne;){if(ve=this.tokenizer.space(ne)){ne=ne.substring(ve.raw.length),ve.type&&oe.push(ve);continue}if(ve=this.tokenizer.code(ne,oe)){ne=ne.substring(ve.raw.length),ve.type?oe.push(ve):(ze=oe[oe.length-1],ze.raw+=`
`+ve.raw,ze.text+=`
`+ve.text);continue}if(ve=this.tokenizer.fences(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.heading(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.nptable(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.hr(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.blockquote(ne)){ne=ne.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],ce),oe.push(ve);continue}if(ve=this.tokenizer.list(ne)){for(ne=ne.substring(ve.raw.length),Le=ve.items.length,Ne=0;Ne<Le;Ne++)ve.items[Ne].tokens=this.blockTokens(ve.items[Ne].text,[],!1);oe.push(ve);continue}if(ve=this.tokenizer.html(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ce&&(ve=this.tokenizer.def(ne))){ne=ne.substring(ve.raw.length),this.tokens.links[ve.tag]||(this.tokens.links[ve.tag]={href:ve.href,title:ve.title});continue}if(ve=this.tokenizer.table(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.lheading(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ce&&(ve=this.tokenizer.paragraph(ne))){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.text(ne,oe)){ne=ne.substring(ve.raw.length),ve.type?oe.push(ve):(ze=oe[oe.length-1],ze.raw+=`
`+ve.raw,ze.text+=`
`+ve.text);continue}if(ne){var it="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return oe},be.inline=function(ne){var oe,ce,ve,Ne,Le,ze,it=ne.length;for(oe=0;oe<it;oe++){ze=ne[oe];switch(ze.type){case"paragraph":case"text":case"heading":{ze.tokens=[],this.inlineTokens(ze.text,ze.tokens);break}case"table":{for(ze.tokens={header:[],cells:[]},Ne=ze.header.length,ce=0;ce<Ne;ce++)ze.tokens.header[ce]=[],this.inlineTokens(ze.header[ce],ze.tokens.header[ce]);for(Ne=ze.cells.length,ce=0;ce<Ne;ce++)for(Le=ze.cells[ce],ze.tokens.cells[ce]=[],ve=0;ve<Le.length;ve++)ze.tokens.cells[ce][ve]=[],this.inlineTokens(Le[ve],ze.tokens.cells[ce][ve]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(Ne=ze.items.length,ce=0;ce<Ne;ce++)this.inline(ze.items[ce].tokens);break}}}return ne},be.inlineTokens=function(ne,oe,ce,ve,Ne){oe===void 0&&(oe=[]),ce===void 0&&(ce=!1),ve===void 0&&(ve=!1),Ne===void 0&&(Ne="");var Le,ze=ne,it;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(it=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)ct.includes(it[0].slice(it[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(it=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(Le=this.tokenizer.escape(ne)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.tag(ne,ce,ve)){ne=ne.substring(Le.raw.length),ce=Le.inLink,ve=Le.inRawBlock,oe.push(Le);continue}if(Le=this.tokenizer.link(ne)){ne=ne.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ve)),oe.push(Le);continue}if(Le=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ve)),oe.push(Le);continue}if(Le=this.tokenizer.strong(ne,ze,Ne)){ne=ne.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ce,ve),oe.push(Le);continue}if(Le=this.tokenizer.em(ne,ze,Ne)){ne=ne.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ce,ve),oe.push(Le);continue}if(Le=this.tokenizer.codespan(ne)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.br(ne)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.del(ne)){ne=ne.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ce,ve),oe.push(Le);continue}if(Le=this.tokenizer.autolink(ne,ae)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(!ce&&(Le=this.tokenizer.url(ne,ae))){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.inlineText(ne,ve,ie)){ne=ne.substring(Le.raw.length),Ne=Le.raw.slice(-1),oe.push(Le);continue}if(ne){var dt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(dt);break}else throw new Error(dt)}}return oe},J(Se,null,[{key:"rules",get:function(){return{block:se,inline:Ae}}}]),Se}(),we=j.defaults,_e=V.cleanUrl,Fe=V.escape,Ue=function(){function Se(Ce){this.options=Ce||we}var be=Se.prototype;return be.code=function(ne,oe,ce){var ve=(oe||"").match(/\S*/)[0];if(this.options.highlight){var Ne=this.options.highlight(ne,ve);Ne!=null&&Ne!==ne&&(ce=!0,ne=Ne)}return ve?'<pre><code class="'+this.options.langPrefix+Fe(ve,!0)+'">'+(ce?ne:Fe(ne,!0))+`</code></pre>
`:"<pre><code>"+(ce?ne:Fe(ne,!0))+`</code></pre>
`},be.blockquote=function(ne){return`<blockquote>
`+ne+`</blockquote>
`},be.html=function(ne){return ne},be.heading=function(ne,oe,ce,ve){return this.options.headerIds?"<h"+oe+' id="'+this.options.headerPrefix+ve.slug(ce)+'">'+ne+"</h"+oe+`>
`:"<h"+oe+">"+ne+"</h"+oe+`>
`},be.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},be.list=function(ne,oe,ce){var ve=oe?"ol":"ul",Ne=oe&&ce!==1?' start="'+ce+'"':"";return"<"+ve+Ne+`>
`+ne+"</"+ve+`>
`},be.listitem=function(ne){return"<li>"+ne+`</li>
`},be.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},be.paragraph=function(ne){return"<p>"+ne+`</p>
`},be.table=function(ne,oe){return oe&&(oe="<tbody>"+oe+"</tbody>"),`<table>
<thead>
`+ne+`</thead>
`+oe+`</table>
`},be.tablerow=function(ne){return`<tr>
`+ne+`</tr>
`},be.tablecell=function(ne,oe){var ce=oe.header?"th":"td",ve=oe.align?"<"+ce+' align="'+oe.align+'">':"<"+ce+">";return ve+ne+"</"+ce+`>
`},be.strong=function(ne){return"<strong>"+ne+"</strong>"},be.em=function(ne){return"<em>"+ne+"</em>"},be.codespan=function(ne){return"<code>"+ne+"</code>"},be.br=function(){return this.options.xhtml?"<br/>":"<br>"},be.del=function(ne){return"<del>"+ne+"</del>"},be.link=function(ne,oe,ce){if(ne=_e(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ce;var ve='<a href="'+Fe(ne)+'"';return oe&&(ve+=' title="'+oe+'"'),ve+=">"+ce+"</a>",ve},be.image=function(ne,oe,ce){if(ne=_e(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ce;var ve='<img src="'+ne+'" alt="'+ce+'"';return oe&&(ve+=' title="'+oe+'"'),ve+=this.options.xhtml?"/>":">",ve},be.text=function(ne){return ne},Se}(),Be=function(){function Se(){}var be=Se.prototype;return be.strong=function(ne){return ne},be.em=function(ne){return ne},be.codespan=function(ne){return ne},be.del=function(ne){return ne},be.html=function(ne){return ne},be.text=function(ne){return ne},be.link=function(ne,oe,ce){return""+ce},be.image=function(ne,oe,ce){return""+ce},be.br=function(){return""},Se}(),Ze=function(){function Se(){this.seen={}}var be=Se.prototype;return be.slug=function(ne){var oe=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(oe)){var ce=oe;do this.seen[ce]++,oe=ce+"-"+this.seen[ce];while(this.seen.hasOwnProperty(oe))}return this.seen[oe]=0,oe},Se}(),et=j.defaults,rt=V.unescape,Ye=function(){function Se(Ce){this.options=Ce||et,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new Ze}Se.parse=function(ne,oe){var ce=new Se(oe);return ce.parse(ne)};var be=Se.prototype;return be.parse=function(ne,oe){oe===void 0&&(oe=!0);var ce="",ve,Ne,Le,ze,it,ct,dt,Dt,At,pt,jt,Et,Rt,Ot,tt,Tr,wr,St,mt=ne.length;for(ve=0;ve<mt;ve++){pt=ne[ve];switch(pt.type){case"space":continue;case"hr":{ce+=this.renderer.hr();continue}case"heading":{ce+=this.renderer.heading(this.parseInline(pt.tokens),pt.depth,rt(this.parseInline(pt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ce+=this.renderer.code(pt.text,pt.lang,pt.escaped);continue}case"table":{for(Dt="",dt="",ze=pt.header.length,Ne=0;Ne<ze;Ne++)dt+=this.renderer.tablecell(this.parseInline(pt.tokens.header[Ne]),{header:!0,align:pt.align[Ne]});for(Dt+=this.renderer.tablerow(dt),At="",ze=pt.cells.length,Ne=0;Ne<ze;Ne++){for(ct=pt.tokens.cells[Ne],dt="",it=ct.length,Le=0;Le<it;Le++)dt+=this.renderer.tablecell(this.parseInline(ct[Le]),{header:!1,align:pt.align[Le]});At+=this.renderer.tablerow(dt)}ce+=this.renderer.table(Dt,At);continue}case"blockquote":{At=this.parse(pt.tokens),ce+=this.renderer.blockquote(At);continue}case"list":{for(jt=pt.ordered,Et=pt.start,Rt=pt.loose,ze=pt.items.length,At="",Ne=0;Ne<ze;Ne++)tt=pt.items[Ne],Tr=tt.checked,wr=tt.task,Ot="",tt.task&&(St=this.renderer.checkbox(Tr),Rt?tt.tokens.length>0&&tt.tokens[0].type==="text"?(tt.tokens[0].text=St+" "+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=St+" "+tt.tokens[0].tokens[0].text)):tt.tokens.unshift({type:"text",text:St}):Ot+=St),Ot+=this.parse(tt.tokens,Rt),At+=this.renderer.listitem(Ot,wr,Tr);ce+=this.renderer.list(At,jt,Et);continue}case"html":{ce+=this.renderer.html(pt.text);continue}case"paragraph":{ce+=this.renderer.paragraph(this.parseInline(pt.tokens));continue}case"text":{for(At=pt.tokens?this.parseInline(pt.tokens):pt.text;ve+1<mt&&ne[ve+1].type==="text";)pt=ne[++ve],At+=`
`+(pt.tokens?this.parseInline(pt.tokens):pt.text);ce+=oe?this.renderer.paragraph(At):At;continue}default:{var lt='Token with "'+pt.type+'" type was not found.';if(this.options.silent){console.error(lt);return}else throw new Error(lt)}}}return ce},be.parseInline=function(ne,oe){oe=oe||this.renderer;var ce="",ve,Ne,Le=ne.length;for(ve=0;ve<Le;ve++){Ne=ne[ve];switch(Ne.type){case"escape":{ce+=oe.text(Ne.text);break}case"html":{ce+=oe.html(Ne.text);break}case"link":{ce+=oe.link(Ne.href,Ne.title,this.parseInline(Ne.tokens,oe));break}case"image":{ce+=oe.image(Ne.href,Ne.title,Ne.text);break}case"strong":{ce+=oe.strong(this.parseInline(Ne.tokens,oe));break}case"em":{ce+=oe.em(this.parseInline(Ne.tokens,oe));break}case"codespan":{ce+=oe.codespan(Ne.text);break}case"br":{ce+=oe.br();break}case"del":{ce+=oe.del(this.parseInline(Ne.tokens,oe));break}case"text":{ce+=oe.text(Ne.text);break}default:{var ze='Token with "'+Ne.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}}return ce},Se}(),st=V.merge,Je=V.checkSanitizeDeprecation,Qe=V.escape,Me=j.getDefaults,$e=j.changeDefaults,ut=j.defaults;function je(Se,be,Ce){if(typeof Se=="undefined"||Se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");if(typeof be=="function"&&(Ce=be,be=null),be=st({},je.defaults,be||{}),Je(be),Ce){var ne=be.highlight,oe;try{oe=ge.lex(Se,be)}catch(Le){return Ce(Le)}var ce=function(ze){var it;if(!ze)try{it=Ye.parse(oe,be)}catch(ct){ze=ct}return be.highlight=ne,ze?Ce(ze):Ce(null,it)};if(!ne||ne.length<3)return ce();if(delete be.highlight,!oe.length)return ce();var ve=0;je.walkTokens(oe,function(Le){Le.type==="code"&&(ve++,setTimeout(function(){ne(Le.text,Le.lang,function(ze,it){if(ze)return ce(ze);it!=null&&it!==Le.text&&(Le.text=it,Le.escaped=!0),ve--,ve===0&&ce()})},0))}),ve===0&&ce();return}try{var Ne=ge.lex(Se,be);return be.walkTokens&&je.walkTokens(Ne,be.walkTokens),Ye.parse(Ne,be)}catch(Le){if(Le.message+=`
Please report this to https://github.com/markedjs/marked.`,be.silent)return"<p>An error occurred:</p><pre>"+Qe(Le.message+"",!0)+"</pre>";throw Le}}je.options=je.setOptions=function(Se){return st(je.defaults,Se),$e(je.defaults),je},je.getDefaults=Me,je.defaults=ut,je.use=function(Se){var be=st({},Se);if(Se.renderer&&function(){var ne=je.defaults.renderer||new Ue,oe=function(Ne){var Le=ne[Ne];ne[Ne]=function(){for(var ze=arguments.length,it=new Array(ze),ct=0;ct<ze;ct++)it[ct]=arguments[ct];var dt=Se.renderer[Ne].apply(ne,it);return dt===!1&&(dt=Le.apply(ne,it)),dt}};for(var ce in Se.renderer)oe(ce);be.renderer=ne}(),Se.tokenizer&&function(){var ne=je.defaults.tokenizer||new Te,oe=function(Ne){var Le=ne[Ne];ne[Ne]=function(){for(var ze=arguments.length,it=new Array(ze),ct=0;ct<ze;ct++)it[ct]=arguments[ct];var dt=Se.tokenizer[Ne].apply(ne,it);return dt===!1&&(dt=Le.apply(ne,it)),dt}};for(var ce in Se.tokenizer)oe(ce);be.tokenizer=ne}(),Se.walkTokens){var Ce=je.defaults.walkTokens;be.walkTokens=function(ne){Se.walkTokens(ne),Ce&&Ce(ne)}}je.setOptions(be)},je.walkTokens=function(Se,be){for(var Ce=F(Se),ne;!(ne=Ce()).done;){var oe=ne.value;be(oe);switch(oe.type){case"table":{for(var ce=F(oe.tokens.header),ve;!(ve=ce()).done;){var Ne=ve.value;je.walkTokens(Ne,be)}for(var Le=F(oe.tokens.cells),ze;!(ze=Le()).done;)for(var it=ze.value,ct=F(it),dt;!(dt=ct()).done;){var Dt=dt.value;je.walkTokens(Dt,be)}break}case"list":{je.walkTokens(oe.items,be);break}default:oe.tokens&&je.walkTokens(oe.tokens,be)}}},je.Parser=Ye,je.parser=Ye.parse,je.Renderer=Ue,je.TextRenderer=Be,je.Lexer=ge,je.lexer=ge.lex,je.Tokenizer=Te,je.Slugger=Ze,je.parse=je;var Ve=je;return Ve})},ELLl:function(bt,De,q){(function(ue){ue(q("VrN/"))})(function(ue){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(m,g,a){a&&a!=ue.Init&&(m.removeKeyMap(F),m.state.closeBrackets=null),g&&(M($(g,"pairs")),m.state.closeBrackets=g,m.addKeyMap(F))});function $(m,g){return g=="pairs"&&typeof m=="string"?m:typeof m=="object"&&m[g]!=null?m[g]:J[g]}var F={Backspace:P,Enter:A};function M(m){for(var g=0;g<m.length;g++){var a=m.charAt(g),i="'"+a+"'";F[i]||(F[i]=j(a))}}M(J.pairs+"`");function j(m){return function(g){return f(g,m)}}function U(m){var g=m.state.closeBrackets;if(!g||g.override)return g;var a=m.getModeAt(m.getCursor());return a.closeBrackets||g}function P(m){var g=U(m);if(!g||m.getOption("disableInput"))return ue.Pass;for(var a=$(g,"pairs"),i=m.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var l=T(m,i[s].head);if(!l||a.indexOf(l)%2!=0)return ue.Pass}for(var s=i.length-1;s>=0;s--){var x=i[s].head;m.replaceRange("",O(x.line,x.ch-1),O(x.line,x.ch+1),"+delete")}}function A(m){var g=U(m),a=g&&$(g,"explode");if(!a||m.getOption("disableInput"))return ue.Pass;for(var i=m.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var l=T(m,i[s].head);if(!l||a.indexOf(l)%2!=0)return ue.Pass}m.operation(function(){var x=m.lineSeparator()||`
`;m.replaceSelection(x+x,null),m.execCommand("goCharLeft"),i=m.listSelections();for(var v=0;v<i.length;v++){var y=i[v].head.line;m.indentLine(y,null,!0),m.indentLine(y+1,null,!0)}})}function d(m){var g=ue.cmpPos(m.anchor,m.head)>0;return{anchor:new O(m.anchor.line,m.anchor.ch+(g?-1:1)),head:new O(m.head.line,m.head.ch+(g?1:-1))}}function f(m,g){var a=U(m);if(!a||m.getOption("disableInput"))return ue.Pass;var i=$(a,"pairs"),s=i.indexOf(g);if(s==-1)return ue.Pass;for(var l=$(a,"closeBefore"),x=$(a,"triples"),v=i.charAt(s+1)==g,y=m.listSelections(),R=s%2==0,w,E=0;E<y.length;E++){var C=y[E],c=C.head,u,L=m.getRange(c,O(c.line,c.ch+1));if(R&&!C.empty())u="surround";else if((v||!R)&&L==g)v&&p(m,c)?u="both":x.indexOf(g)>=0&&m.getRange(c,O(c.line,c.ch+3))==g+g+g?u="skipThree":u="skip";else if(v&&c.ch>1&&x.indexOf(g)>=0&&m.getRange(O(c.line,c.ch-2),c)==g+g){if(c.ch>2&&/\bstring/.test(m.getTokenTypeAt(O(c.line,c.ch-2))))return ue.Pass;u="addFour"}else if(v){var S=c.ch==0?" ":m.getRange(O(c.line,c.ch-1),c);if(!ue.isWordChar(L)&&S!=g&&!ue.isWordChar(S))u="both";else return ue.Pass}else if(R&&(L.length===0||/\s/.test(L)||l.indexOf(L)>-1))u="both";else return ue.Pass;if(!w)w=u;else if(w!=u)return ue.Pass}var D=s%2?i.charAt(s-1):g,_=s%2?g:i.charAt(s+1);m.operation(function(){if(w=="skip")m.execCommand("goCharRight");else if(w=="skipThree")for(var B=0;B<3;B++)m.execCommand("goCharRight");else if(w=="surround"){for(var G=m.getSelections(),B=0;B<G.length;B++)G[B]=D+G[B]+_;m.replaceSelections(G,"around"),G=m.listSelections().slice();for(var B=0;B<G.length;B++)G[B]=d(G[B]);m.setSelections(G)}else w=="both"?(m.replaceSelection(D+_,null),m.triggerElectric(D+_),m.execCommand("goCharLeft")):w=="addFour"&&(m.replaceSelection(D+D+D+D,"before"),m.execCommand("goCharRight"))})}function T(m,g){var a=m.getRange(O(g.line,g.ch-1),O(g.line,g.ch+1));return a.length==2?a:null}function p(m,g){var a=m.getTokenAt(O(g.line,g.ch+1));return/\bstring/.test(a.type)&&a.start==g.ch&&(g.ch==0||!/\bstring/.test(m.getTokenTypeAt(g)))}})},GfqC:function(bt,De,q){"use strict";var ue=q("q1tI"),J=q.n(ue),O=q("TSYQ"),$=q.n(O);function F(V,I){var N="cannot "+V.method+" "+V.action+" "+I.status+"'",Y=new Error(N);return Y.status=I.status,Y.method=V.method,Y.url=V.action,Y}function M(V){var I=V.responseText||V.response;if(!I)return I;try{return JSON.parse(I)}catch(N){return I}}function j(V){var I=new XMLHttpRequest;V.onProgress&&I.upload&&(I.upload.onprogress=function(le){le.total>0&&(le.percent=le.loaded/le.total*100),V.onProgress(le)});var N=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var le=V.data[ee];if(Array.isArray(le)){le.forEach(function(me){N.append(ee+"[]",me)});return}N.append(ee,V.data[ee])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.append(V.filename,V.file),I.onerror=function(le){V.onError(le)},I.onload=function(){return I.status<200||I.status>=300?V.onError(F(V,I),M(I)):V.onSuccess(M(I),I)},I.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var Y=V.headers||{};return Y["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(ee){Y[ee]!==null&&I.setRequestHeader(ee,Y[ee])}),I.send(N),{abort:function(){I.abort()}}}var U=+new Date,P=0;function A(){return"rc-upload-"+U+"-"+ ++P}function d(V,I){return V.indexOf(I,V.length-I.length)!==-1}var f=function(V,I){if(V&&I){var N=Array.isArray(I)?I:I.split(","),Y=V.name||"",ee=V.type||"",le=ee.replace(/\/.*$/,"");return N.some(function(me){var Ie=me.trim();return Ie.charAt(0)==="."?d(Y.toLowerCase(),Ie.toLowerCase()):/\/\*$/.test(Ie)?le===Ie.replace(/\/.*$/,""):ee===Ie})}return!0};function T(V,I){var N=V.createReader(),Y=[];function ee(){N.readEntries(function(le){var me=Array.prototype.slice.apply(le);Y=Y.concat(me);var Ie=!me.length;Ie?I(Y):ee()})}ee()}var p=function(I,N,Y){var ee=function le(me,Ie){Ie=Ie||"",me.isFile?me.file(function(Te){Y(Te)&&(me.fullPath&&!Te.webkitRelativePath&&(Object.defineProperties(Te,{webkitRelativePath:{writable:!0}}),Te.webkitRelativePath=me.fullPath.replace(/^\//,""),Object.defineProperties(Te,{webkitRelativePath:{writable:!1}})),N([Te]))}):me.isDirectory&&T(me,function(Te){Te.forEach(function(Oe){le(Oe,""+Ie+me.name+"/")})})};I.forEach(function(le){ee(le.webkitGetAsEntry())})},m=p,g=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(V[Y]=N[Y])}return V},a=function(){function V(I,N){var Y=[],ee=!0,le=!1,me=void 0;try{for(var Ie=I[Symbol.iterator](),Te;!(ee=(Te=Ie.next()).done)&&!(Y.push(Te.value),N&&Y.length===N);ee=!0);}catch(Oe){le=!0,me=Oe}finally{try{!ee&&Ie.return&&Ie.return()}finally{if(le)throw me}}return Y}return function(I,N){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return V(I,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function V(I,N){for(var Y=0;Y<N.length;Y++){var ee=N[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(I,ee.key,ee)}}return function(I,N,Y){return N&&V(I.prototype,N),Y&&V(I,Y),I}}();function s(V,I,N){return I in V?Object.defineProperty(V,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[I]=N,V}function l(V,I){var N={};for(var Y in V){if(I.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,Y))continue;N[Y]=V[Y]}return N}function x(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function v(V,I){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:V}function y(V,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);V.prototype=Object.create(I&&I.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(V,I):V.__proto__=I)}var R=function(I){return Object.keys(I).reduce(function(N,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(N[Y]=I[Y]),N},{})},w=function(V){y(I,V);function I(){var N,Y,ee,le;x(this,I);for(var me=arguments.length,Ie=Array(me),Te=0;Te<me;Te++)Ie[Te]=arguments[Te];return le=(Y=(ee=v(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ie))),ee),ee.state={uid:A()},ee.reqs={},ee.onChange=function(Oe){var Re=Oe.target.files;ee.uploadFiles(Re),ee.reset()},ee.onClick=function(Oe){var Re=ee.fileInput;if(!Re)return;var Ee=ee.props,pe=Ee.children,de=Ee.onClick;pe&&pe.type==="button"&&(Re.parentNode.focus(),Re.parentNode.querySelector("button").blur()),Re.click(),de&&de(Oe)},ee.onKeyDown=function(Oe){Oe.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Oe){var Re=ee.props.multiple;if(Oe.preventDefault(),Oe.type==="dragover")return;if(ee.props.directory)m(Array.prototype.slice.call(Oe.dataTransfer.items),ee.uploadFiles,function(pe){return f(pe,ee.props.accept)});else{var Ee=Array.prototype.slice.call(Oe.dataTransfer.files).filter(function(pe){return f(pe,ee.props.accept)});Re===!1&&(Ee=Ee.slice(0,1)),ee.uploadFiles(Ee)}},ee.uploadFiles=function(Oe){var Re=Array.prototype.slice.call(Oe);Re.map(function(Ee){return Ee.uid=A(),Ee}).forEach(function(Ee){ee.upload(Ee,Re)})},ee.saveFileInput=function(Oe){ee.fileInput=Oe},Y),v(ee,le)}return i(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,ee){var le=this,me=this.props;if(!me.beforeUpload)return setTimeout(function(){return le.post(Y)},0);var Ie=me.beforeUpload(Y,ee);Ie&&Ie.then?Ie.then(function(Te){var Oe=Object.prototype.toString.call(Te);return Oe==="[object File]"||Oe==="[object Blob]"?le.post(Te):le.post(Y)}).catch(function(Te){console.log(Te)}):Ie!==!1&&setTimeout(function(){return le.post(Y)},0);return}},{key:"post",value:function(Y){var ee=this;if(!this._isMounted)return;var le=this.props,me=le.onStart,Ie=le.onProgress,Te=le.transformFile,Oe=Te===void 0?function(Re){return Re}:Te;new Promise(function(Re){var Ee=le.action;return typeof Ee=="function"&&(Ee=Ee(Y)),Re(Ee)}).then(function(Re){var Ee=Y.uid,pe=le.customRequest||j,de=Promise.resolve(Oe(Y)).then(function(re){var he=le.data;return typeof he=="function"&&(he=he(re)),Promise.all([re,he])}).catch(function(re){console.error(re)});de.then(function(re){var he=a(re,2),se=he[0],Ae=he[1],ie={action:Re,filename:le.name,data:Ae,file:se,headers:le.headers,withCredentials:le.withCredentials,method:le.method||"post",onProgress:Ie?function(ae){Ie(ae,Y)}:null,onSuccess:function(ge,we){delete ee.reqs[Ee],le.onSuccess(ge,Y,we)},onError:function(ge,we){delete ee.reqs[Ee],le.onError(ge,we,Y)}};me(Y),ee.reqs[Ee]=pe(ie)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(Y){var ee=this.reqs;if(Y){var le=Y;Y&&Y.uid&&(le=Y.uid),ee[le]&&ee[le].abort&&ee[le].abort(),delete ee[le]}else Object.keys(ee).forEach(function(me){ee[me]&&ee[me].abort&&ee[me].abort(),delete ee[me]})}},{key:"render",value:function(){var Y,ee=this.props,le=ee.component,me=ee.prefixCls,Ie=ee.className,Te=ee.disabled,Oe=ee.id,Re=ee.style,Ee=ee.multiple,pe=ee.accept,de=ee.children,re=ee.directory,he=ee.openFileDialogOnClick,se=ee.onMouseEnter,Ae=ee.onMouseLeave,ie=l(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ae=$()((Y={},s(Y,me,!0),s(Y,me+"-disabled",Te),s(Y,Ie,Ie),Y)),ge=Te?{}:{onClick:he?this.onClick:function(){},onKeyDown:he?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:Ae,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(le,g({},ge,{className:ae,role:"button",style:Re}),J.a.createElement("input",g({},R(ie),{id:Oe,type:"file",ref:this.saveFileInput,onClick:function(_e){return _e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:pe,directory:re?"directory":null,webkitdirectory:re?"webkitdirectory":null,multiple:Ee,onChange:this.onChange})),de)}}]),I}(ue.Component),E=w,C=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(V[Y]=N[Y])}return V},c=function(){function V(I,N){for(var Y=0;Y<N.length;Y++){var ee=N[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(I,ee.key,ee)}}return function(I,N,Y){return N&&V(I.prototype,N),Y&&V(I,Y),I}}();function u(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function L(V,I){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:V}function S(V,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);V.prototype=Object.create(I&&I.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(V,I):V.__proto__=I)}function D(){}var _=function(V){S(I,V);function I(){var N,Y,ee,le;u(this,I);for(var me=arguments.length,Ie=Array(me),Te=0;Te<me;Te++)Ie[Te]=arguments[Te];return le=(Y=(ee=L(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ie))),ee),ee.saveUploader=function(Oe){ee.uploader=Oe},Y),L(ee,le)}return c(I,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return J.a.createElement(E,C({},this.props,{ref:this.saveUploader}))}}]),I}(ue.Component);_.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:D,onError:D,onSuccess:D,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var B=_,G=De.a=B},HmJG:function(bt,De,q){},JYp7:function(bt,De,q){"use strict";q.d(De,"c",function(){return J}),q.d(De,"d",function(){return O}),q.d(De,"f",function(){return F}),q.d(De,"a",function(){return M}),q.d(De,"b",function(){return j}),q.d(De,"e",function(){return U});var ue=function(){var P=function(A,d){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,T){f.__proto__=T}||function(f,T){for(var p in T)T.hasOwnProperty(p)&&(f[p]=T[p])},P(A,d)};return function(A,d){P(A,d);function f(){this.constructor=A}A.prototype=d===null?Object.create(d):(f.prototype=d.prototype,new f)}}(),J={done:!0,value:void 0},O;(function(P){var A={next:function(){return J}};function d(){return A}P.empty=d;function f(v){var y=!1;return{next:function(){return y?J:(y=!0,{done:!1,value:v})}}}P.single=f;function T(v,y,R){return y===void 0&&(y=0),R===void 0&&(R=v.length),{next:function(){return y>=R?J:{done:!1,value:v[y++]}}}}P.fromArray=T;function p(v){return{next:function(){var y=v.next();return y.done?J:{done:!1,value:y.value}}}}P.fromNativeIterator=p;function m(v){return v?Array.isArray(v)?P.fromArray(v):v:P.empty()}P.from=m;function g(v,y){return{next:function(){var R=v.next();return R.done?J:{done:!1,value:y(R.value)}}}}P.map=g;function a(v,y){return{next:function(){for(;;){var R=v.next();if(R.done)return J;if(y(R.value))return{done:!1,value:R.value}}}}}P.filter=a;function i(v,y){for(var R=v.next();!R.done;R=v.next())y(R.value)}P.forEach=i;function s(v,y){y===void 0&&(y=Number.POSITIVE_INFINITY);var R=[];if(y===0)return R;for(var w=0,E=v.next();!E.done&&!(R.push(E.value),++w>=y);E=v.next());return R}P.collect=s;function l(){for(var v=[],y=0;y<arguments.length;y++)v[y]=arguments[y];var R=0;return{next:function(){if(R>=v.length)return J;var w=v[R],E=w.next();return E.done?(R++,this.next()):E}}}P.concat=l;function x(v){return new $(v)}P.chain=x})(O||(O={}));var $=function(){function P(A){this.it=A}return P.prototype.next=function(){return this.it.next()},P}();function F(P){return Array.isArray(P)?O.fromArray(P):P||O.empty()}var M=function(){function P(A,d,f,T){d===void 0&&(d=0),f===void 0&&(f=A.length),T===void 0&&(T=d-1),this.items=A,this.start=d,this.end=f,this.index=T}return P.prototype.first=function(){return this.index=this.start,this.current()},P.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},P.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},P}(),j=function(P){ue(A,P);function A(d,f,T,p){return f===void 0&&(f=0),T===void 0&&(T=d.length),p===void 0&&(p=f-1),P.call(this,d,f,T,p)||this}return A.prototype.current=function(){return P.prototype.current.call(this)},A.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},A.prototype.first=function(){return this.index=this.start,this.current()},A.prototype.last=function(){return this.index=this.end-1,this.current()},A.prototype.parent=function(){return null},A}(M),U=function(){function P(A,d){this.iterator=A,this.fn=d}return P.prototype.next=function(){return this.fn(this.iterator.next())},P}()},LdHM:function(bt,De,q){"use strict";q.d(De,"b",function(){return l}),q.d(De,"a",function(){return v});var ue=q("1OyB"),J=q("vuIU"),O=q("Ji7U"),$=q("LK+K"),F=q("q1tI"),M=q("rePB"),j=q("Ff2n"),U=q("ODXe"),P=q("4IlW"),A=q("bX4T"),d=q("YrtM"),f=q("TSYQ"),T=q.n(f),p=q("+nKL"),m=q("8OUc"),g=function(Y,ee){var le=Y.prefixCls,me=Y.id,Ie=Y.flattenOptions,Te=Y.childrenAsData,Oe=Y.values,Re=Y.searchValue,Ee=Y.multiple,pe=Y.defaultActiveFirstOption,de=Y.height,re=Y.itemHeight,he=Y.notFoundContent,se=Y.open,Ae=Y.menuItemSelectedIcon,ie=Y.virtual,ae=Y.onSelect,ge=Y.onToggleOpen,we=Y.onActiveValue,_e=Y.onScroll,Fe=Y.onMouseEnter,Ue="".concat(le,"-item"),Be=Object(d.a)(function(){return Ie},[se,Ie],function(Ve,Se){return Se[0]&&Ve[1]!==Se[1]}),Ze=F.useRef(null),et=function(Se){Se.preventDefault()},rt=function(Se){Ze.current&&Ze.current.scrollTo({index:Se})},Ye=function(Se){for(var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ce=Be.length,ne=0;ne<Ce;ne+=1){var oe=(Se+ne*be+Ce)%Ce,ce=Be[oe],ve=ce.group,Ne=ce.data;if(!ve&&!Ne.disabled)return oe}return-1},st=F.useState(function(){return Ye(0)}),Je=Object(U.a)(st,2),Qe=Je[0],Me=Je[1],$e=function(Se){Me(Se);var be=Be[Se];if(!be){we(null,-1);return}we(be.data.value,Se)};F.useEffect(function(){$e(pe!==!1?Ye(0):-1)},[Be.length,Re]),F.useEffect(function(){var Ve=setTimeout(function(){if(!Ee&&se&&Oe.size===1){var Se=Array.from(Oe)[0],be=Be.findIndex(function(Ce){var ne=Ce.data;return ne.value===Se});$e(be),rt(be)}});return function(){return clearTimeout(Ve)}},[se]);var ut=function(Se){Se!==void 0&&ae(Se,{selected:!Oe.has(Se)}),Ee||ge(!1)};if(F.useImperativeHandle(ee,function(){return{onKeyDown:function(Se){var be=Se.which;switch(be){case P.a.UP:case P.a.DOWN:{var Ce=0;if(be===P.a.UP?Ce=-1:be===P.a.DOWN&&(Ce=1),Ce!==0){var ne=Ye(Qe+Ce,Ce);rt(ne),$e(ne)}break}case P.a.ENTER:{var oe=Be[Qe];oe&&!oe.data.disabled?ut(oe.data.value):ut(void 0),se&&Se.preventDefault();break}case P.a.ESC:ge(!1)}},onKeyUp:function(){},scrollTo:function(Se){rt(Se)}}}),Be.length===0)return F.createElement("div",{role:"listbox",id:"".concat(me,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:et},he);function je(Ve){var Se=Be[Ve];if(!Se)return null;var be=Se.data||{},Ce=be.value,ne=be.label,oe=be.children,ce=Object(A.a)(be,!0),ve=Te?oe:ne;return Se?F.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},ce,{key:Ve,role:"option",id:"".concat(me,"_list_").concat(Ve),"aria-selected":Oe.has(Ce)}),Ce):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(me,"_list"),style:{height:0,width:0,overflow:"hidden"}},je(Qe-1),je(Qe),je(Qe+1)),F.createElement(p.a,{itemKey:"key",ref:Ze,data:Be,height:de,itemHeight:re,fullHeight:!1,onMouseDown:et,onScroll:_e,virtual:ie,onMouseEnter:Fe},function(Ve,Se){var be,Ce=Ve.group,ne=Ve.groupOption,oe=Ve.data,ce=oe.label,ve=oe.key;if(Ce)return F.createElement("div",{className:T()(Ue,"".concat(Ue,"-group"))},ce!==void 0?ce:ve);var Ne=oe.disabled,Le=oe.value,ze=oe.title,it=oe.children,ct=oe.style,dt=oe.className,Dt=Object(j.a)(oe,["disabled","value","title","children","style","className"]),At=Oe.has(Le),pt="".concat(Ue,"-option"),jt=T()(Ue,pt,dt,(be={},Object(M.a)(be,"".concat(pt,"-grouped"),ne),Object(M.a)(be,"".concat(pt,"-active"),Qe===Se&&!Ne),Object(M.a)(be,"".concat(pt,"-disabled"),Ne),Object(M.a)(be,"".concat(pt,"-selected"),At),be)),Et=Te?it:ce,Rt=!Ae||typeof Ae=="function"||At;return F.createElement("div",Object.assign({},Dt,{"aria-selected":At,className:jt,title:ze,onMouseMove:function(){if(Qe===Se||Ne)return;$e(Se)},onClick:function(){Ne||ut(Le)},style:ct}),F.createElement("div",{className:"".concat(pt,"-content")},Et||Le),F.isValidElement(Ae)||At,Rt&&F.createElement(m.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Ae,customizeIconProps:{isSelected:At}},At?"\u2713":null))}))},a=F.forwardRef(g);a.displayName="OptionList";var i=a,s=function(){return null};s.isSelectOption=!0;var l=s,x=function(){return null};x.isSelectOptGroup=!0;var v=x,y=q("VTBJ"),R=q("Zm9Q");function w(N){var Y=N.key,ee=N.props,le=ee.children,me=ee.value,Ie=Object(j.a)(ee,["children","value"]);return Object(y.a)({key:Y,value:me!==void 0?me:Y,children:le},Ie)}function E(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(N).map(function(ee,le){if(!F.isValidElement(ee)||!ee.type)return null;var me=ee.type.isSelectOptGroup,Ie=ee.key,Te=ee.props,Oe=Te.children,Re=Object(j.a)(Te,["children"]);return Y||!me?w(ee):Object(y.a)(Object(y.a)({key:"__RC_SELECT_GRP__".concat(Ie===null?le:Ie,"__"),label:Ie},Re),{},{options:E(Oe)})}).filter(function(ee){return ee})}var C=q("2Qr1"),c=q("qNPg"),u=q("U8pU"),L=q("Kwbf"),S=q("WKfj");function D(N){var Y=N.mode,ee=N.options,le=N.children,me=N.backfill,Ie=N.allowClear,Te=N.placeholder,Oe=N.getInputElement,Re=N.showSearch,Ee=N.onSearch,pe=N.defaultOpen,de=N.autoFocus,re=N.labelInValue,he=N.value,se=N.inputValue,Ae=N.optionLabelProp,ie=Y==="multiple"||Y==="tags",ae=Re!==void 0?Re:ie||Y==="combobox",ge=ee||E(le);if(Object(L.a)(Y!=="tags"||ge.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var we=ge.some(function(Ue){return Ue.options?Ue.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(L.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(L.a)(Y!=="combobox"||!Ae,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(L.a)(Y==="combobox"||!me,"`backfill` only works with `combobox` mode."),Object(L.a)(Y==="combobox"||!Oe,"`getInputElement` only work with `combobox` mode."),Object(L.b)(Y!=="combobox"||!Oe||!Ie||!Te,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ee&&!ae&&Y!=="combobox"&&Y!=="tags"&&Object(L.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(L.b)(!pe||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var _e=Object(S.d)(he);Object(L.a)(!re||_e.every(function(Ue){return Object(u.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(L.a)(!ie||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(le){var Fe=null;Object(R.a)(le).some(function(Ue){if(!F.isValidElement(Ue)||!Ue.type)return!1;var Be=Ue.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var Ze=Object(R.a)(Ue.props.children).every(function(et){return!F.isValidElement(et)||!Ue.type||et.type.isSelectOption?!0:(Fe=et.type,!1)});return!Ze}return Fe=Be,!0}),Fe&&Object(L.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(L.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var _=D,B=Object(c.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:E,flattenOptions:C.d,getLabeledValue:C.e,filterOptions:C.b,isValueDisabled:C.g,findValueOption:C.c,warningProps:_,fillOptionsWithMissingValue:C.a}),G=function(N){Object(O.a)(ee,N);var Y=Object($.a)(ee);function ee(){var le;return Object(ue.a)(this,ee),le=Y.apply(this,arguments),le.selectRef=F.createRef(),le.focus=function(){le.selectRef.current.focus()},le.blur=function(){le.selectRef.current.blur()},le}return Object(J.a)(ee,[{key:"render",value:function(){return F.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),ee}(F.Component);G.Option=l,G.OptGroup=v;var V=G,I=De.c=V},M8RZ:function(bt,De,q){"use strict";q.d(De,"a",function(){return P});var ue=q("fWQN"),J=q("mtLc"),O=q("yKVA"),$=q("879j"),F=q("q1tI"),M=q.n(F),j=q("i8i4"),U=q.n(j),P=function(A){Object(O.a)(f,A);var d=Object($.a)(f);function f(T){var p;Object(ue.a)(this,f),p=d.call(this,T);var m=window.document;return p.node=m.createElement("div"),m.body.appendChild(p.node),p}return Object(J.a)(f,[{key:"render",value:function(){var p=this.props.children;return Object(j.createPortal)(p,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),f}(M.a.Component)},MI8n:function(bt,De,q){"use strict";q.d(De,"b",function(){return M}),q.d(De,"a",function(){return P}),q.d(De,"e",function(){return A}),q.d(De,"d",function(){return d}),q.d(De,"c",function(){return f}),q.d(De,"f",function(){return T});var ue=q("/cxE"),J=q("C/vA"),O=q("pmY6"),$=q("24hK"),F=function(){var p=function(m,g){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var s in i)i.hasOwnProperty(s)&&(a[s]=i[s])},p(m,g)};return function(m,g){p(m,g);function a(){this.constructor=m}m.prototype=g===null?Object.create(g):(a.prototype=g.prototype,new a)}}(),M;(function(p){p.None=function(){return O.a.None};function m(_){return function(B,G,V){G===void 0&&(G=null);var I=!1,N;return N=_(function(Y){return I?void 0:(N?N.dispose():I=!0,B.call(G,Y))},null,V),I&&N.dispose(),N}}p.once=m;function g(_,B){return v(function(G,V,I){return V===void 0&&(V=null),_(function(N){return G.call(V,B(N))},null,I)})}p.map=g;function a(_,B){return v(function(G,V,I){return V===void 0&&(V=null),_(function(N){B(N),G.call(V,N)},null,I)})}p.forEach=a;function i(_,B){return v(function(G,V,I){return V===void 0&&(V=null),_(function(N){return B(N)&&G.call(V,N)},null,I)})}p.filter=i;function s(_){return _}p.signal=s;function l(){for(var _=[],B=0;B<arguments.length;B++)_[B]=arguments[B];return function(G,V,I){return V===void 0&&(V=null),O.e.apply(void 0,_.map(function(N){return N(function(Y){return G.call(V,Y)},null,I)}))}}p.any=l;function x(_,B,G){var V=G;return g(_,function(I){return V=B(V,I),V})}p.reduce=x;function v(_){var B,G=new P({onFirstListenerAdd:function(){B=_(G.fire,G)},onLastListenerRemove:function(){B.dispose()}});return G.event}p.snapshot=v;function y(_,B,G,V,I){G===void 0&&(G=100),V===void 0&&(V=!1);var N,Y=void 0,ee=void 0,le=0,me=new P({leakWarningThreshold:I,onFirstListenerAdd:function(){N=_(function(Ie){le++,Y=B(Y,Ie),V&&!ee&&(me.fire(Y),Y=void 0),clearTimeout(ee),ee=setTimeout(function(){var Te=Y;Y=void 0,ee=void 0,(!V||le>1)&&me.fire(Te),le=0},G)})},onLastListenerRemove:function(){N.dispose()}});return me.event}p.debounce=y;function R(_){var B=new Date().getTime();return g(m(_),function(G){return new Date().getTime()-B})}p.stopwatch=R;function w(_){var B=!0,G;return i(_,function(V){var I=B||V!==G;return B=!1,G=V,I})}p.latch=w;function E(_,B,G){B===void 0&&(B=!1),G===void 0&&(G=[]);var V=G.slice(),I=_(function(ee){V?V.push(ee):Y.fire(ee)}),N=function(){V&&V.forEach(function(ee){return Y.fire(ee)}),V=null},Y=new P({onFirstListenerAdd:function(){I||(I=_(function(ee){return Y.fire(ee)}))},onFirstListenerDidAdd:function(){V&&(B?setTimeout(N):N())},onLastListenerRemove:function(){I&&I.dispose(),I=null}});return Y.event}p.buffer=E;var C=function(){function _(B){this.event=B}return _.prototype.map=function(B){return new _(g(this.event,B))},_.prototype.forEach=function(B){return new _(a(this.event,B))},_.prototype.filter=function(B){return new _(i(this.event,B))},_.prototype.reduce=function(B,G){return new _(x(this.event,B,G))},_.prototype.latch=function(){return new _(w(this.event))},_.prototype.debounce=function(B,G,V,I){return G===void 0&&(G=100),V===void 0&&(V=!1),new _(y(this.event,B,G,V,I))},_.prototype.on=function(B,G,V){return this.event(B,G,V)},_.prototype.once=function(B,G,V){return m(this.event)(B,G,V)},_}();function c(_){return new C(_)}p.chain=c;function u(_,B,G){G===void 0&&(G=function(ee){return ee});var V=function(){for(var ee=[],le=0;le<arguments.length;le++)ee[le]=arguments[le];return Y.fire(G.apply(void 0,ee))},I=function(){return _.on(B,V)},N=function(){return _.removeListener(B,V)},Y=new P({onFirstListenerAdd:I,onLastListenerRemove:N});return Y.event}p.fromNodeEventEmitter=u;function L(_,B,G){G===void 0&&(G=function(ee){return ee});var V=function(){for(var ee=[],le=0;le<arguments.length;le++)ee[le]=arguments[le];return Y.fire(G.apply(void 0,ee))},I=function(){return _.addEventListener(B,V)},N=function(){return _.removeEventListener(B,V)},Y=new P({onFirstListenerAdd:I,onLastListenerRemove:N});return Y.event}p.fromDOMEventEmitter=L;function S(_){var B=new P,G=!1;return _.then(void 0,function(){return null}).then(function(){G?B.fire(void 0):setTimeout(function(){return B.fire(void 0)},0)}),G=!0,B.event}p.fromPromise=S;function D(_){return new Promise(function(B){return m(_)(B)})}p.toPromise=D})(M||(M={}));var j=-1,U=function(){function p(m,g){g===void 0&&(g=Math.random().toString(18).slice(2,5)),this.customThreshold=m,this.name=g,this._warnCountdown=0}return p.prototype.dispose=function(){this._stacks&&this._stacks.clear()},p.prototype.check=function(m){var g=this,a=j;if(typeof this.customThreshold=="number"&&(a=this.customThreshold),a<=0||m<a)return;this._stacks||(this._stacks=new Map);var i=new Error().stack.split(`
`).slice(3).join(`
`),s=this._stacks.get(i)||0;if(this._stacks.set(i,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;var l,x=0;this._stacks.forEach(function(v,y){(!l||x<v)&&(l=y,x=v)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+m+" listeners already. MOST frequent listener ("+x+"):"),console.warn(l)}return function(){var v=g._stacks.get(i)||0;g._stacks.set(i,v-1)}},p}(),P=function(){function p(m){this._disposed=!1,this._options=m,this._leakageMon=j>0?new U(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(p.prototype,"event",{get:function(){var m=this;return this._event||(this._event=function(g,a,i){m._listeners||(m._listeners=new $.a);var s=m._listeners.isEmpty();s&&m._options&&m._options.onFirstListenerAdd&&m._options.onFirstListenerAdd(m);var l=m._listeners.push(a?[g,a]:g);s&&m._options&&m._options.onFirstListenerDidAdd&&m._options.onFirstListenerDidAdd(m),m._options&&m._options.onListenerDidAdd&&m._options.onListenerDidAdd(m,g,a);var x;m._leakageMon&&(x=m._leakageMon.check(m._listeners.size));var v;return v={dispose:function(){if(x&&x(),v.dispose=p._noop,!m._disposed&&(l(),m._options&&m._options.onLastListenerRemove)){var y=m._listeners&&!m._listeners.isEmpty();y||m._options.onLastListenerRemove(m)}}},i instanceof O.b?i.add(v):Array.isArray(i)&&i.push(v),v}),this._event},enumerable:!0,configurable:!0}),p.prototype.fire=function(m){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new $.a);for(var g=this._listeners.iterator(),a=g.next();!a.done;a=g.next())this._deliveryQueue.push([a.value,m]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),s=i[0],l=i[1];try{typeof s=="function"?s.call(void 0,l):s[0].call(s[1],l)}catch(x){Object(ue.e)(x)}}}},p.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},p._noop=function(){},p}(),A=function(p){F(m,p);function m(g){var a=p.call(this,g)||this;return a._isPaused=0,a._eventQueue=new $.a,a._mergeFn=g&&g.merge,a}return m.prototype.pause=function(){this._isPaused++},m.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var g=this._eventQueue.toArray();this._eventQueue.clear(),p.prototype.fire.call(this,this._mergeFn(g))}else for(;!this._isPaused&&this._eventQueue.size!==0;)p.prototype.fire.call(this,this._eventQueue.shift())},m.prototype.fire=function(g){this._listeners&&(this._isPaused!==0?this._eventQueue.push(g):p.prototype.fire.call(this,g))},m}(P),d=function(){function p(){var m=this;this.hasListeners=!1,this.events=[],this.emitter=new P({onFirstListenerAdd:function(){return m.onFirstListenerAdd()},onLastListenerRemove:function(){return m.onLastListenerRemove()}})}return Object.defineProperty(p.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),p.prototype.add=function(m){var g=this,a={event:m,listener:null};this.events.push(a),this.hasListeners&&this.hook(a);var i=function(){g.hasListeners&&g.unhook(a);var s=g.events.indexOf(a);g.events.splice(s,1)};return Object(O.h)(Object(J.a)(i))},p.prototype.onFirstListenerAdd=function(){var m=this;this.hasListeners=!0,this.events.forEach(function(g){return m.hook(g)})},p.prototype.onLastListenerRemove=function(){var m=this;this.hasListeners=!1,this.events.forEach(function(g){return m.unhook(g)})},p.prototype.hook=function(m){var g=this;m.listener=m.event(function(a){return g.emitter.fire(a)})},p.prototype.unhook=function(m){m.listener&&m.listener.dispose(),m.listener=null},p.prototype.dispose=function(){this.emitter.dispose()},p}(),f=function(){function p(){this.buffers=[]}return p.prototype.wrapEvent=function(m){var g=this;return function(a,i,s){return m(function(l){var x=g.buffers[g.buffers.length-1];x?x.push(function(){return a.call(i,l)}):a.call(i,l)},void 0,s)}},p.prototype.bufferEvents=function(m){var g=[];this.buffers.push(g);var a=m();return this.buffers.pop(),g.forEach(function(i){return i()}),a},p}(),T=function(){function p(){var m=this;this.listening=!1,this.inputEvent=M.None,this.inputEventListener=O.a.None,this.emitter=new P({onFirstListenerDidAdd:function(){m.listening=!0,m.inputEventListener=m.inputEvent(m.emitter.fire,m.emitter)},onLastListenerRemove:function(){m.listening=!1,m.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(p.prototype,"input",{set:function(m){this.inputEvent=m,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=m(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),p.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},p}()},N0LK:function(bt,De,q){"use strict";q.d(De,"x",function(){return ue}),q.d(De,"F",function(){return J}),q.d(De,"r",function(){return $}),q.d(De,"o",function(){return F}),q.d(De,"p",function(){return M}),q.d(De,"Q",function(){return j}),q.d(De,"K",function(){return P}),q.d(De,"k",function(){return A}),q.d(De,"N",function(){return d}),q.d(De,"m",function(){return f}),q.d(De,"l",function(){return T}),q.d(De,"I",function(){return p}),q.d(De,"H",function(){return m}),q.d(De,"q",function(){return g}),q.d(De,"t",function(){return a}),q.d(De,"D",function(){return i}),q.d(De,"e",function(){return s}),q.d(De,"f",function(){return l}),q.d(De,"B",function(){return x}),q.d(De,"C",function(){return v}),q.d(De,"n",function(){return R}),q.d(De,"O",function(){return E}),q.d(De,"c",function(){return C}),q.d(De,"d",function(){return c}),q.d(De,"z",function(){return u}),q.d(De,"A",function(){return L}),q.d(De,"u",function(){return S}),q.d(De,"E",function(){return _}),q.d(De,"G",function(){return B}),q.d(De,"i",function(){return V}),q.d(De,"g",function(){return N}),q.d(De,"v",function(){return ee}),q.d(De,"h",function(){return le}),q.d(De,"y",function(){return me}),q.d(De,"w",function(){return Ie}),q.d(De,"a",function(){return Te}),q.d(De,"P",function(){return Oe}),q.d(De,"L",function(){return Re}),q.d(De,"J",function(){return Ee}),q.d(De,"j",function(){return pe}),q.d(De,"M",function(){return de}),q.d(De,"s",function(){return re}),q.d(De,"b",function(){return he});function ue(ie){return!ie||typeof ie!="string"?!0:ie.trim().length===0}function J(ie,ae,ge){ge===void 0&&(ge="0");for(var we=""+ie,_e=[we],Fe=we.length;Fe<ae;Fe++)_e.push(ge);return _e.reverse().join("")}var O=/{(\d+)}/g;function $(ie){for(var ae=[],ge=1;ge<arguments.length;ge++)ae[ge-1]=arguments[ge];return ae.length===0?ie:ie.replace(O,function(we,_e){var Fe=parseInt(_e,10);return isNaN(Fe)||Fe<0||Fe>=ae.length?we:ae[Fe]})}function F(ie){return ie.replace(/[<>&]/g,function(ae){switch(ae){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ae}})}function M(ie){return ie.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function j(ie,ae){ae===void 0&&(ae=" ");var ge=U(ie,ae);return P(ge,ae)}function U(ie,ae){if(!ie||!ae)return ie;var ge=ae.length;if(ge===0||ie.length===0)return ie;for(var we=0;ie.indexOf(ae,we)===we;)we=we+ge;return ie.substring(we)}function P(ie,ae){if(!ie||!ae)return ie;var ge=ae.length,we=ie.length;if(ge===0||we===0)return ie;for(var _e=we,Fe=-1;!(Fe=ie.lastIndexOf(ae,_e-1),Fe===-1||Fe+ge!==_e);){if(Fe===0)return"";_e=Fe}return ie.substring(0,_e)}function A(ie){return ie.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(ie,ae){if(ie.length<ae.length)return!1;if(ie===ae)return!0;for(var ge=0;ge<ae.length;ge++)if(ie[ge]!==ae[ge])return!1;return!0}function f(ie,ae){var ge=ie.length-ae.length;return ge>0?ie.indexOf(ae,ge)===ge:ge===0?ie===ae:!1}function T(ie,ae,ge){if(ge===void 0&&(ge={}),!ie)throw new Error("Cannot create regex from empty string");ae||(ie=M(ie)),ge.wholeWord&&(/\B/.test(ie.charAt(0))||(ie="\\b"+ie),/\B/.test(ie.charAt(ie.length-1))||(ie=ie+"\\b"));var we="";return ge.global&&(we+="g"),ge.matchCase||(we+="i"),ge.multiline&&(we+="m"),ge.unicode&&(we+="u"),new RegExp(ie,we)}function p(ie){if(ie.source==="^"||ie.source==="^$"||ie.source==="$"||ie.source==="^\\s*$")return!1;var ae=ie.exec("");return!!(ae&&ie.lastIndex===0)}function m(ie){return(ie.global?"g":"")+(ie.ignoreCase?"i":"")+(ie.multiline?"m":"")+(ie.unicode?"u":"")}function g(ie){for(var ae=0,ge=ie.length;ae<ge;ae++){var we=ie.charCodeAt(ae);if(we!==32&&we!==9)return ae}return-1}function a(ie,ae,ge){ae===void 0&&(ae=0),ge===void 0&&(ge=ie.length);for(var we=ae;we<ge;we++){var _e=ie.charCodeAt(we);if(_e!==32&&_e!==9)return ie.substring(ae,we)}return ie.substring(ae,ge)}function i(ie,ae){ae===void 0&&(ae=ie.length-1);for(var ge=ae;ge>=0;ge--){var we=ie.charCodeAt(ge);if(we!==32&&we!==9)return ge}return-1}function s(ie,ae){return ie<ae?-1:ie>ae?1:0}function l(ie,ae){for(var ge=Math.min(ie.length,ae.length),we=0;we<ge;we++){var _e=ie.charCodeAt(we),Fe=ae.charCodeAt(we);if(_e===Fe)continue;v(_e)&&(_e+=32),v(Fe)&&(Fe+=32);var Ue=_e-Fe;if(Ue===0)continue;return x(_e)&&x(Fe)?Ue:s(ie.toLowerCase(),ae.toLowerCase())}return ie.length<ae.length?-1:ie.length>ae.length?1:0}function x(ie){return ie>=97&&ie<=122}function v(ie){return ie>=65&&ie<=90}function y(ie){return x(ie)||v(ie)}function R(ie,ae){return ie.length===ae.length&&w(ie,ae)}function w(ie,ae,ge){ge===void 0&&(ge=ie.length);for(var we=0;we<ge;we++){var _e=ie.charCodeAt(we),Fe=ae.charCodeAt(we);if(_e===Fe)continue;if(y(_e)&&y(Fe)){var Ue=Math.abs(_e-Fe);if(Ue!==0&&Ue!==32)return!1}else if(String.fromCharCode(_e).toLowerCase()!==String.fromCharCode(Fe).toLowerCase())return!1}return!0}function E(ie,ae){var ge=ae.length;return ae.length>ie.length?!1:w(ie,ae,ge)}function C(ie,ae){var ge,we=Math.min(ie.length,ae.length);for(ge=0;ge<we;ge++)if(ie.charCodeAt(ge)!==ae.charCodeAt(ge))return ge;return we}function c(ie,ae){var ge,we=Math.min(ie.length,ae.length),_e=ie.length-1,Fe=ae.length-1;for(ge=0;ge<we;ge++)if(ie.charCodeAt(_e-ge)!==ae.charCodeAt(Fe-ge))return ge;return we}function u(ie){return 55296<=ie&&ie<=56319}function L(ie){return 56320<=ie&&ie<=57343}function S(ie,ae,ge){var we=ie.charCodeAt(ge);if(u(we)&&ge+1<ae){var _e=ie.charCodeAt(ge+1);if(L(_e))return(we-55296<<10)+(_e-56320)+65536}return we}function D(ie,ae){var ge=ie.charCodeAt(ae-1);if(L(ge)&&ae>1){var we=ie.charCodeAt(ae-2);if(u(we))return(we-55296<<10)+(ge-56320)+65536}return ge}function _(ie,ae){var ge=se.getInstance(),we=ae,_e=ie.length,Fe=S(ie,_e,ae);ae+=Fe>=65536?2:1;for(var Ue=ge.getGraphemeBreakType(Fe);ae<_e;){var Be=S(ie,_e,ae),Ze=ge.getGraphemeBreakType(Be);if(he(Ue,Ze))break;ae+=Be>=65536?2:1,Ue=Ze}return ae-we}function B(ie,ae){var ge=se.getInstance(),we=ae,_e=D(ie,ae);ae-=_e>=65536?2:1;for(var Fe=ge.getGraphemeBreakType(_e);ae>0;){var Ue=D(ie,ae),Be=ge.getGraphemeBreakType(Ue);if(he(Be,Fe))break;ae-=Ue>=65536?2:1,Fe=Be}return we-ae}var G=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function V(ie){return G.test(ie)}var I=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function N(ie){return I.test(ie)}var Y=/^[\t\n\r\x20-\x7E]*$/;function ee(ie){return Y.test(ie)}function le(ie){for(var ae=0,ge=ie.length;ae<ge;ae++)if(me(ie.charCodeAt(ae)))return!0;return!1}function me(ie){return ie=+ie,ie>=11904&&ie<=55215||ie>=63744&&ie<=64255||ie>=65281&&ie<=65374}function Ie(ie){return ie>=127462&&ie<=127487||ie>=9728&&ie<=10175||ie>=127744&&ie<=128591||ie>=128640&&ie<=128764||ie>=128992&&ie<=129003||ie>=129280&&ie<=129535||ie>=129648&&ie<=129651||ie>=129656&&ie<=129666||ie>=129680&&ie<=129685}var Te=String.fromCharCode(65279);function Oe(ie){return!!(ie&&ie.length>0&&ie.charCodeAt(0)===65279)}function Re(ie){return btoa(encodeURIComponent(ie))}function Ee(ie,ae){for(var ge="",we=0;we<ae;we++)ge+=ie;return ge}function pe(ie,ae){return ae===void 0&&(ae=!1),ie?(ae&&(ie=ie.replace(/\\./g,"")),ie.toLowerCase()!==ie):!1}function de(ie){var ae=90-65+1;return ie=ie%(2*ae),ie<ae?String.fromCharCode(97+ie):String.fromCharCode(65+ie-ae)}function re(ie){var ae=se.getInstance();return ae.getGraphemeBreakType(ie)}function he(ie,ae){return ie===0?ae!==5&&ae!==7:ie===2&&ae===3?!1:ie===4||ie===2||ie===3||(ae===4||ae===2||ae===3)?!0:ie===8&&(ae===8||ae===9||ae===11||ae===12)||((ie===11||ie===9)&&(ae===9||ae===10)||((ie===12||ie===10)&&ae===10||(ae===5||ae===13||(ae===7||(ie===1||ie===13&&ae===14)))))?!1:!(ie===6&&ae===6)}var se=function(){function ie(){this._data=Ae()}return ie.getInstance=function(){return ie._INSTANCE||(ie._INSTANCE=new ie),ie._INSTANCE},ie.prototype.getGraphemeBreakType=function(ae){if(ae<32)return ae===10?3:ae===13?2:4;if(ae<127)return 0;for(var ge=this._data,we=ge.length/3,_e=1;_e<=we;)if(ae<ge[3*_e])_e=2*_e;else if(ae>ge[3*_e+1])_e=2*_e+1;else return ge[3*_e+2];return 0},ie._INSTANCE=null,ie}();function Ae(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},Ot1p:function(bt,De,q){"use strict";var ue=q("2qtc"),J=q("kLXV"),O=q("rAM+"),$=q("miYZ"),F=q("tsqr"),M=q("9og8"),j=q("tJVT"),U=q("jrin"),P=q("WmNS"),A=q.n(P),d=q("q1tI"),f=q.n(d),T=q("VrN/"),p=q.n(T),m=q("bdgK"),g=q("p77/"),a=q("Bd2K"),i=q("ELLl"),s=q("19Vz"),l=q("lZu9"),x=q("+NIl"),v=q("kSUc"),y=q("9Bee"),R=function(Le){var ze=Le.value,it=ze===void 0?"":ze,ct=Le.className,dt=Le.showTextOnly,Dt=Le.showLines,At=Le.style,pt=At===void 0?{}:At,jt=Object(d.useMemo)(function(){return""},[it]);return f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{dangerouslySetInnerHTML:{__html:jt}}))},w=q("0Owb"),E=q("dejd"),C=q("C+DQ"),c=q("1vsH"),u=q("m3rI"),L=[{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 S(Le){var ze=Le.onActionCallback,it=Le.title,ct=Le.icon,dt=Le.actionName,Dt=Le.className,At=Dt===void 0?"":Dt,pt=Le.children;function jt(){ze(dt)}return f.a.createElement("a",{title:it,className:At,onClick:jt},f.a.createElement("i",{className:"md-iconfont ".concat(ct)}),pt)}var D=function(Le){var ze=Le.watch,it=Le.showNullButton,ct=Le.onActionCallback,dt=Le.fullScreen,Dt=Le.insertTemp,At=Le.hidetoolBar,pt=Le.uuid,jt=Le.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(c.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.D)("_educoder_session"),"&key=").concat(pt,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Et=[].concat(L,[{title:"".concat(ze?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ze?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return f.a.createElement("ul",{className:"markdown-toolbar-container"},!At&&Et.map(function(Rt,Ot){return f.a.createElement("li",{key:Ot},Rt.actionName?f.a.createElement(S,Object(w.a)({},Rt,{onActionCallback:ct})):f.a.createElement("span",{className:"v-line"}))}),it?f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ct},f.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Dt&&f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Dt),onActionCallback:ct},f.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),f.a.createElement("li",{className:"btn-full-screen"},f.a.createElement(S,{icon:"".concat(dt?"icon-shrink":"icon-enlarge"),title:dt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ct})))},_=q("M8RZ"),B=q("+L6B"),G=q("2/Rp"),V=q("y8nQ"),I=q("Vl3Y"),N=q("5NDa"),Y=q("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},le=function(Le){var ze=Le.callback,it=Le.onCancel;function ct(dt){ze(dt)}return f.a.createElement(I.a,Object(w.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ct}),f.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},f.a.createElement(Y.a,null)),f.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},f.a.createElement(Y.a,null)),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(G.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},me=q("7ahc"),Ie=q("k1fw"),Te=q("HmJG"),Oe=q("BjJ7"),Re=I.a.useForm,Ee={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},de=function(Le){var ze=Le.callback,it=Le.onCancel,ct=Re(),dt=Object(j.a)(ct,1),Dt=dt[0],At=Object(d.useRef)();function pt(Rt){ze(Object(Ie.a)(Object(Ie.a)({},Rt),{},{name:At.current}))}function jt(Rt,Ot){Dt.setFieldsValue({src:"/api/attachments/".concat(Rt.id,"?type=").concat(Rt.content_type),type:Ot.type})}function Et(Rt){var Ot=Rt.target.files[0];At.current=Ot.name,he(Ot,jt)}return f.a.createElement(I.a,Object(w.a)({form:Dt},pe,{className:"upload-image-panel",onFinish:pt}),f.a.createElement(I.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},f.a.createElement("div",{className:"flex-container"},f.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},f.a.createElement(Y.a,{style:Ee})),f.a.createElement(re,{onFileChange:Et}))),f.a.createElement(I.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},f.a.createElement(Y.a,{style:{width:264}})),f.a.createElement(I.a.Item,{style:{textAlign:"right"}},f.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(G.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function re(Le){var ze=Le.onFileChange;return f.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",f.a.createElement("input",{type:"file",onChange:ze}))}function he(Le,ze){if(!Le)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",Le),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var ct=new window.XMLHttpRequest;ct.withCredentials=!0,ct.addEventListener("load",function(dt){ze(JSON.parse(dt.target.responseText),Le)},!1),ct.addEventListener("error",function(dt){console.error(dt)},!1),ct.open("POST","".concat(Oe.a,"/api/attachments.json")),ct.send(it)}var se=q("giR+"),Ae=q("fyUT"),ie=q("7Kak"),ae=q("9yH6"),ge=ae.a.Group,we={margin:"0 8px"},_e=function(Le){var ze=Le.callback,it=Le.onCancel;function ct(dt){ze(dt)}return f.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ct},f.a.createElement("div",{className:"flex-container"},f.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),f.a.createElement("span",{style:we},"\u884C\u6570"),f.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},f.a.createElement(Ae.a,null)),f.a.createElement("span",{style:we},"\u5217\u6570"),f.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},f.a.createElement(Ae.a,null))),f.a.createElement("div",{className:"flex-container",style:{marginTop:12}},f.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),f.a.createElement(I.a.Item,{name:"align"},f.a.createElement(ge,null,f.a.createElement(ae.a,{value:"default"},f.a.createElement("i",{className:"fa fa-align-justify"})),f.a.createElement(ae.a,{value:"left"},f.a.createElement("i",{className:"fa fa-align-left"})),f.a.createElement(ae.a,{value:"center"},f.a.createElement("i",{className:"fa fa-align-center"})),f.a.createElement(ae.a,{value:"right"},f.a.createElement("i",{className:"fa fa-align-right"}))))),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(G.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},Fe=q("ErOA"),Ue=q("7Cbv"),Be="link",Ze="upload-image",et="code-block",rt="add-table",Ye="------------",st={default:Ye,left:":".concat(Ye),center:":".concat(Ye,":"),right:"".concat(Ye,":")},Je=q("9VGf"),Qe,Me;function $e(){}var ut=0,je=1e4,Ve="\u2581",Se=`
**\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 be(Le){return/^\d+$/.test(Le)?"".concat(Le,"px"):Le}var Ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,ne=Ce?"Cmd":"Ctrl",oe=["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"],ce=(Qe={},Object(U.a)(Qe,ne+"-B","bold"),Object(U.a)(Qe,ne+"-I","italic"),Qe),ve=(Me={},Object(U.a)(Me,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Me,et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Me,Ze,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Me,rt,"\u6DFB\u52A0\u8868\u683C"),Me),Ne=De.a=function(Le){var ze=Le.defaultValue,it=ze===void 0?"":ze,ct=Le.onChange,dt=Le.width,Dt=dt===void 0?"100%":dt,At=Le.height,pt=At===void 0?400:At,jt=Le.miniToolbar,Et=jt===void 0?!1:jt,Rt=Le.isFocus,Ot=Rt===void 0?!1:Rt,tt=Le.watch,Tr=Le.insertTemp,wr=Le.mode,St=wr===void 0?"markdown":wr,mt=Le.id,lt=mt===void 0?"markdown-editor-id":mt,Ct=Le.showResizeBar,$t=Ct===void 0?!1:Ct,Jt=Le.noStorage,nr=Jt===void 0?!1:Jt,Pt=Le.showNullButton,yt=Pt===void 0?!1:Pt,Mr=Le.hidetoolBar,tn=Mr===void 0?!1:Mr,Ar=Le.fullScreen,It=Ar===void 0?!1:Ar,kr=Le.onBlur,Kr=Le.onCMBeforeChange,rn=Le.onFullScreen,He=Le.className,ht=He===void 0?"":He,Nt=Le.disablePaste,Vt=Nt===void 0?!1:Nt,Qt=Le.placeholder,er=Qt===void 0?"":Qt,z=Le.values,h=z===void 0?"":z,b=Object(d.useState)(null),H=Object(j.a)(b,2),X=H[0],K=H[1],xe=Object(d.useState)(it),Ge=Object(j.a)(xe,2),nt=Ge[0],gt=Ge[1],Ke=Object(d.useState)(tt),kt=Object(j.a)(Ke,2),Bt=kt[0],tr=kt[1],Vr=Object(d.useState)(It),Xr=Object(j.a)(Vr,2),pr=Xr[0],Zr=Xr[1],Gn=Object(d.useState)(""),Pr=Object(j.a)(Gn,2),Yr=Pr[0],Wr=Pr[1],bn=Object(d.useState)(0),nn=Object(j.a)(bn,2),mn=nn[0],dn=nn[1],hi=Object(d.useState)(pt),zn=Object(j.a)(hi,2),an=zn[0],$r=zn[1],Rn=Object(d.useState)(!1),On=Object(j.a)(Rn,2),ci=On[0],or=On[1],Gt=Object(d.useRef)(Object(Ue.a)()),Er=Object(d.useRef)(!1),Ht=Object(d.useRef)(),dr=Object(d.useRef)(),Xt=Object(d.useRef)(),hn=Object(d.useRef)(),lr=Object(d.useRef)(),Ir=function(){var xt=Object(M.a)(A.a.mark(function Mt(){var wt,Ft;return A.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Object(Fe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Gt.current}});case 2:Ft=Zt.sent,Ft!=null&&(wt=Ft.attachments)!==null&&wt!==void 0&&wt.length&&(console.log("cm:",X,dr),Ft.attachments.map(function(Wt){Wt.content_type.indexOf("image")>-1?X.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):Wt.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Wt.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):X.replaceSelection("[".concat(Wt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}));case 4:case"end":return Zt.stop()}},Mt)}));return function(){return xt.apply(this,arguments)}}();Object(d.useEffect)(function(){gt(h),X==null||X.setValue(h)},[h]),Object(d.useEffect)(function(){rn==null||rn(pr)},[pr]),Object(d.useEffect)(function(){if(dr.current){var xt=p.a.fromTextArea(dr.current,{mode:St,lineNumbers:!Et,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Ot&&xt.focus();function Mt(wt,Ft){if(Vt){Ft.preventDefault();return}var zt=Ft.clipboardData;if(zt){var Zt=zt.types.toString(),Wt=zt.items;if(Zt==="Files"||zt.types.indexOf("Files")>-1){if(Ft.preventDefault(),St=="stex")return;try{var hr,_r=Wt[1];((hr=Wt[0])===null||hr===void 0?void 0:hr.kind)==="file"&&(_r=Wt[0]);var Ut=_r.getAsFile(),En=Ut.name.split(".").pop();he(Ut,function(Kt){if(Kt.id){var gr,qr,en;(Ut==null||((gr=Ut.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?xt.replaceSelection("![,](/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type,")")):(Ut==null||((qr=Ut.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?xt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,'"></video>')):(Ut==null||((en=Ut.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Ut.type,'&disposition=inline" target="_blank">').concat(Ut.name,"</a>")):oe.includes(En)?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,'?type=office&disposition=inline" target="_blank">').concat(Ut.name,"</a>")):xt.replaceSelection("[".concat(Ut.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,")"))}else(Kt==null?void 0:Kt.status)===401&&(document.location.href="/user/login")})}catch(Kt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return xt.on("paste",Mt),xt.on("dragleave",function(wt,Ft){Xt.current.classList.remove("mouse-hover-md")}),xt.on("dragover",function(wt,Ft){Xt.current.classList.add("mouse-hover-md")}),xt.on("drop",function(wt,Ft){Xt.current.classList.add("mouse-hover-md");var zt;if(zt=Ft.dataTransfer.files,zt.length>0){Ft.preventDefault(),Ft.stopPropagation();for(var Zt=function(_r){var Ut=zt[_r],En=Ut.name.split(".").pop();he(Ut,function(Kt){if(Kt.id){var gr,qr,en;(Ut==null||((gr=Ut.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?xt.replaceSelection("![,](/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type,")")):(Ut==null||((qr=Ut.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?xt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,'"></video>')):(Ut==null||((en=Ut.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Ut.type,'&disposition=inline" target="_blank">').concat(Ut.name,"</a>")):oe.includes(En)?xt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,'?type=office&disposition=inline" target="_blank">').concat(Ut.name,"</a>")):xt.replaceSelection("[".concat(Ut.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,")"))}else(Kt==null?void 0:Kt.status)===401&&(document.location.href="/user/login")})},Wt=0;Wt<zt.length;Wt++)Zt(Wt)}}),K(xt),function(){xt.off("paste",Mt)}}},[]);var Kn=Object(d.useCallback)(function(){if(Xt.current)try{}catch(xt){console.log(xt,"---- to set md editor body height")}},[an,Xt,pr]);Object(d.useEffect)(function(){function xt(){var wt=new m.default(function(Ft){var zt=Object(O.a)(Ft),Zt;try{for(zt.s();!(Zt=zt.n()).done;){var Wt=Zt.value;(Wt.target.offsetHeight>0||Wt.target.offsetWidth>0)&&(Kn(),X.setSize("100%","100%"),X.refresh())}}catch(hr){zt.e(hr)}finally{zt.f()}});return wt.observe(dr.current.parentElement),wt}if(X){var Mt=xt();return function(){Mt.unobserve(dr.current.parentElement)}}},[X,Kn]),Object(d.useEffect)(function(){if(X){for(var xt=[],Mt=function(){var Wt=Ft[wt];zt=Object(j.a)(Wt,2);var hr=zt[0],_r=zt[1],Ut=Object(U.a)({},hr,function(){Vn(_r)});xt.push(Ut),X.addKeyMap(Ut)},wt=0,Ft=Object.entries(ce);wt<Ft.length;wt++){var zt;Mt()}return Ht.current=setInterval(function(){Er.current&&Ir()},4e3),function(){clearInterval(Ht.current);var Zt=Object(O.a)(xt),Wt;try{for(Zt.s();!(Wt=Zt.n()).done;){var hr=Wt.value;X.removeKeyMap(hr)}}catch(_r){Zt.e(_r)}finally{Zt.f()}}}},[X]),Object(d.useEffect)(function(){It!==pr&&Zr(It)},[It]),Object(Je.a)(function(){if(!nr&&mn>0){var xt=new Date().getTime(),Mt=window.sessionStorage.getItem(lt);xt>=mn+je&&(!Mt||Mt!==nt)&&(window.sessionStorage.setItem(lt,nt),or(!0))}},je),Object(d.useEffect)(function(){tr(tt)},[X,tt]),Object(d.useEffect)(function(){X&&(Ot&&X.focus())},[X,Ot]),Object(d.useEffect)(function(){if(Bt&&X){var xt=X.getScrollerElement();function Mt(wt){var Ft=wt.target;if(lr.current){var zt=Ft.scrollTop/Ft.scrollHeight;lr.current.scrollTop=lr.current.scrollHeight*zt}}return xt.addEventListener("scroll",Mt),function(){xt.removeEventListener("scroll",Mt)}}},[X,Bt]),Object(d.useEffect)(function(){if(X&&Kr){function xt(Mt,wt){Kr(Mt,wt)}return X.on("beforeChange",xt),function(){X.off("beforeChange",xt)}}},[X,Kr]),Object(d.useEffect)(function(){if(X&&kr){function xt(){kr(X.getValue())}return X.on("blur",xt),function(){X.off("blur",xt)}}},[X,kr]),Object(d.useEffect)(function(){if(X){function xt(Mt){var wt=Mt.getValue();gt(wt),dn(new Date().getTime()),Mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ct&&ct(wt)}return X.on("change",xt),function(){X.off("change",xt)}}},[X,ct]),Object(d.useEffect)(function(){X&&(it==null?(X.setValue(""),gt("")):it!==X.getValue()&&(X.setValue(it),gt(it),X.setCursor(X.lineCount(),0)))},[X,it]);var Vn=Object(d.useCallback)(function(xt){var Mt=X.getCursor(),wt=X.getSelection(),Ft=wt.split(`
`);switch(xt){case"bold":return X.replaceSelection("**"+wt+"**"),wt===""&&X.setCursor(Mt.line,Mt.ch+2),X.focus();case"italic":return X.replaceSelection("*"+wt+"*"),wt===""&&X.setCursor(Mt.line,Mt.ch+1),X.focus();case"code":return X.replaceSelection("`"+wt+"`"),wt===""&&X.setCursor(Mt.line,Mt.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+wt+"$$`"),wt===""&&X.setCursor(Mt.line,Mt.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+wt+"\n```"),X.setCursor(Mt.line+1,wt.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
`),X.focus();case"list-ul":return wt===""?X.replaceSelection("- "+wt):X.replaceSelection(Ft.map(function(zt){return zt===""?"":"- ".concat(zt)}).join(`
`)),X.focus();case"list-ol":return wt===""?X.replaceSelection("1. "+wt):X.replaceSelection(Ft.map(function(zt,Zt){return zt===""?"":"".concat(Zt+1,". ").concat(zt)}).join(`
`)),X.focus();case"add-null-ch":return wt===""&&X.setCursor(Mt.line,Mt.ch+1),X.replaceSelection(Ve),X.focus();case"inster-template-1":return wt===""&&X.setCursor(Mt.line,Mt.ch),X.replaceSelection(Se),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return tr(!Bt),X.focus();case"trigger-full-screen":return Zr(!pr),X.focus();case Be:Wr(Be);return;case et:Wr(et);return;case Ze:Wr(Ze);return;case rt:Wr(rt);return;default:throw new Error}},[X,Bt,pr]),xn=Object(d.useCallback)(function(xt){Wr("");switch(Yr){case Be:var Mt=xt.title,wt=xt.link;return X.replaceSelection("[".concat(Mt,"](").concat(wt,")")),X.focus();case et:var Ft=xt.language,zt=xt.content;return X.replaceSelection(["```"+Ft,zt,"```"].join(`
`)),X.focus();case Ze:var Zt=xt.src,Wt=xt.alt,hr=xt.name;return Zt.indexOf("type=image")>-1?X.replaceSelection("![ ".concat(Wt||""," ]( ").concat(Zt,' "').concat(Wt||"",'" )')):Zt.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat(Zt,'&disposition=inline" target="_blank">').concat(hr,"</a>")):X.replaceSelection('<a href="'.concat(Zt,'" target="_blank">').concat(hr,"</a>")),X.focus();case rt:for(var _r=xt.row,Ut=xt.col,En=xt.align,Kt=`
`,gr=0;gr<_r;gr++){for(var qr=[],en=[],Wi=0;Wi<Ut;Wi++)gr===1&&en.push(st[En]),qr.push(" ");gr===1&&(Kt+="| ".concat(en.join(" | "),` |
`)),Kt+="| ".concat(qr.join(Ut===1?"":" | "),` |
`)}return X.replaceSelection(Kt+`
`),X.focus();default:throw new Error}},[X,Yr]),Ui=Object(d.useMemo)(function(){switch(Yr){case Be:return f.a.createElement(le,{callback:xn,onCancel:Hr});case et:return f.a.createElement(me.b,{callback:xn,onCancel:Hr});case Ze:return f.a.createElement(de,{callback:xn,onCancel:Hr});case rt:return f.a.createElement(_e,{callback:xn,onCancel:Hr});default:return null}},[Yr]);function Hr(){Wr("")}Object(d.useEffect)(function(){if(hn.current){var xt=hn.current,Mt=!1,wt=0;function Ft(Wt){Mt=!0,wt=Wt.pageY}function zt(){Mt=!1}function Zt(Wt){if(Mt){var hr=Wt.pageY-wt;hr<0&&(hr=0),hr>300&&(hr=300);var _r=pt+hr+"px";$r(_r)}}return xt.addEventListener("mousedown",Ft),document.addEventListener("mousemove",Zt),document.addEventListener("mouseup",zt),function(){xt.removeEventListener("mousedown",Ft),document.removeEventListener("mousemove",Zt),document.removeEventListener("mouseup",zt)}}},[X,hn]),Object(d.useEffect)(function(){$r(pt)},[pt]);var fi=be(Dt),on=be(an),Xn={width:fi,height:on},ji=Object(d.useMemo)(function(){if(mn){var xt=new Date(mn),Mt=xt.getHours(),wt=xt.getMinutes(),Ft=xt.getSeconds();return Mt=Mt<10?"0"+Mt:Mt,wt=wt<10?"0"+wt:wt,Ft=Ft<10?"0"+Ft:Ft,"".concat(Mt,":").concat(wt,":").concat(Ft)}return 0},[mn]);function Mn(){window.sessionStorage.removeItem(lt),or(!1),dn(0)}function $a(){or(!1),dn(0),X.setValue(window.sessionStorage.getItem(lt))}function da(xt,Mt){var wt=X.getValue();wt=wt.replace(xt,Mt),gt(wt),X==null||X.setValue(wt)}return f.a.createElement(d.Fragment,null,f.a.createElement("div",{className:"markdown-editor-wrapper",ref:Xt},f.a.createElement("div",{className:"markdown-editor-container ".concat(ht," ").concat(Bt?"on-preview":""," ").concat(Et?"mini":""," ").concat(pr?"full-screen":""),style:Xn},f.a.createElement(D,{insertTemp:Tr,watch:Bt,fullScreen:pr,showNullButton:yt,onActionCallback:Vn,hidetoolBar:tn,uuid:Gt.current,setOpenPhones:function(){Er.current=!0}}),f.a.createElement("div",{className:"markdown-editor-body"},f.a.createElement("div",{className:"codemirror-container"},f.a.createElement("textarea",{ref:dr,placeholder:er})),Bt?f.a.createElement("div",{ref:lr,className:"preview-container"},St==="stex"&&f.a.createElement(R,{value:nt}),St!=="stex"&&f.a.createElement(y.a,{edit:!0,value:nt,replaces:da})):null))),$t?f.a.createElement("a",{ref:hn,className:"editor-resize"}):null,f.a.createElement(_.a,null,ve[Yr]?f.a.createElement(J.a,{centered:!0,title:ve[Yr],visible:!0,onCancel:Hr,footer:null},Ui):null))}},QDVR:function(bt,De,q){"use strict";q.d(De,"e",function(){return J}),q.d(De,"d",function(){return O}),q.d(De,"c",function(){return j}),q.d(De,"b",function(){return U}),q.d(De,"a",function(){return A});var ue=function(){var d=function(f,T){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,m){p.__proto__=m}||function(p,m){for(var g in m)m.hasOwnProperty(g)&&(p[g]=m[g])},d(f,T)};return function(f,T){d(f,T);function p(){this.constructor=f}f.prototype=T===null?Object.create(T):(p.prototype=T.prototype,new p)}}();function J(d){var f=[];return d.forEach(function(T){return f.push(T)}),f}function O(d){var f=[];return d.forEach(function(T,p){return f.push(p)}),f}var $=function(){function d(){this._value="",this._pos=0}return d.prototype.reset=function(f){return this._value=f,this._pos=0,this},d.prototype.next=function(){return this._pos+=1,this},d.prototype.hasNext=function(){return this._pos<this._value.length-1},d.prototype.cmp=function(f){var T=f.charCodeAt(0),p=this._value.charCodeAt(this._pos);return T-p},d.prototype.value=function(){return this._value[this._pos]},d}(),F=function(){function d(f){f===void 0&&(f=!0),this._splitOnBackslash=f}return d.prototype.reset=function(f){return this._value=f.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},d.prototype.hasNext=function(){return this._to<this._value.length},d.prototype.next=function(){this._from=this._to;for(var f=!0;this._to<this._value.length;this._to++){var T=this._value.charCodeAt(this._to);if(T===47||this._splitOnBackslash&&T===92)if(f)this._from++;else break;else f=!1}return this},d.prototype.cmp=function(f){for(var T=0,p=f.length,m=this._from;T<p&&m<this._to;){var g=f.charCodeAt(T)-this._value.charCodeAt(m);if(g!==0)return g;T+=1,m+=1}return p===this._to-this._from?0:T<p?-1:1},d.prototype.value=function(){return this._value.substring(this._from,this._to)},d}(),M=function(){function d(){}return d}(),j=function(){function d(f){this._iter=f}return d.forPaths=function(){return new d(new F)},d.forStrings=function(){return new d(new $)},d.prototype.clear=function(){this._root=void 0},d.prototype.set=function(f,T){var p=this._iter.reset(f),m;for(this._root||(this._root=new M,this._root.segment=p.value()),m=this._root;;){var g=p.cmp(m.segment);if(g>0)m.left||(m.left=new M,m.left.segment=p.value()),m=m.left;else if(g<0)m.right||(m.right=new M,m.right.segment=p.value()),m=m.right;else if(p.hasNext())p.next(),m.mid||(m.mid=new M,m.mid.segment=p.value()),m=m.mid;else break}var a=m.value;return m.value=T,m.key=f,a},d.prototype.get=function(f){for(var T=this._iter.reset(f),p=this._root;p;){var m=T.cmp(p.segment);if(m>0)p=p.left;else if(m<0)p=p.right;else if(T.hasNext())T.next(),p=p.mid;else break}return p?p.value:void 0},d.prototype.findSubstr=function(f){for(var T=this._iter.reset(f),p=this._root,m=void 0;p;){var g=T.cmp(p.segment);if(g>0)p=p.left;else if(g<0)p=p.right;else if(T.hasNext())T.next(),m=p.value||m,p=p.mid;else break}return p&&p.value||m},d.prototype.forEach=function(f){this._forEach(this._root,f)},d.prototype._forEach=function(f,T){f&&(this._forEach(f.left,T),f.value&&T(f.value,f.key),this._forEach(f.mid,T),this._forEach(f.right,T))},d}(),U=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(f,T){this.map.set(this.toKey(f),T)},d.prototype.get=function(f){return this.map.get(this.toKey(f))},d.prototype.toKey=function(f){var T=f.toString();return this.ignoreCase&&(T=T.toLowerCase()),T},d}(),P=function(){function d(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return d.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(d.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),d.prototype.get=function(f,T){T===void 0&&(T=0);var p=this._map.get(f);return p?(T!==0&&this.touch(p,T),p.value):void 0},d.prototype.set=function(f,T,p){p===void 0&&(p=0);var m=this._map.get(f);if(m)m.value=T,p!==0&&this.touch(m,p);else{m={key:f,value:T,next:void 0,previous:void 0};switch(p){case 0:this.addItemLast(m);break;case 1:this.addItemFirst(m);break;case 2:this.addItemLast(m);break;default:this.addItemLast(m);break}this._map.set(f,m),this._size++}},d.prototype.delete=function(f){return!!this.remove(f)},d.prototype.remove=function(f){var T=this._map.get(f);return T?(this._map.delete(f),this.removeItem(T),this._size--,T.value):void 0},d.prototype.forEach=function(f,T){for(var p=this._head;p;)T?f.bind(T)(p.value,p.key,this):f(p.value,p.key,this),p=p.next},d.prototype.trimOld=function(f){if(f>=this.size)return;if(f===0){this.clear();return}for(var T=this._head,p=this.size;T&&p>f;)this._map.delete(T.key),T=T.next,p--;this._head=T,this._size=p,T&&(T.previous=void 0)},d.prototype.addItemFirst=function(f){if(!this._head&&!this._tail)this._tail=f;else if(this._head)f.next=this._head,this._head.previous=f;else throw new Error("Invalid list");this._head=f},d.prototype.addItemLast=function(f){if(!this._head&&!this._tail)this._head=f;else if(this._tail)f.previous=this._tail,this._tail.next=f;else throw new Error("Invalid list");this._tail=f},d.prototype.removeItem=function(f){if(f===this._head&&f===this._tail)this._head=void 0,this._tail=void 0;else if(f===this._head){if(!f.next)throw new Error("Invalid list");f.next.previous=void 0,this._head=f.next}else if(f===this._tail){if(!f.previous)throw new Error("Invalid list");f.previous.next=void 0,this._tail=f.previous}else{var T=f.next,p=f.previous;if(!T||!p)throw new Error("Invalid list");T.previous=p,p.next=T}f.next=void 0,f.previous=void 0},d.prototype.touch=function(f,T){if(!this._head||!this._tail)throw new Error("Invalid list");if(T!==1&&T!==2)return;if(T===1){if(f===this._head)return;var p=f.next,m=f.previous;f===this._tail?(m.next=void 0,this._tail=m):(p.previous=m,m.next=p),f.previous=void 0,f.next=this._head,this._head.previous=f,this._head=f}else if(T===2){if(f===this._tail)return;var p=f.next,m=f.previous;f===this._head?(p.previous=void 0,this._head=p):(p.previous=m,m.next=p),f.next=void 0,f.previous=this._tail,this._tail.next=f,this._tail=f}},d.prototype.toJSON=function(){var f=[];return this.forEach(function(T,p){f.push([p,T])}),f},d}(),A=function(d){ue(f,d);function f(T,p){p===void 0&&(p=1);var m=d.call(this)||this;return m._limit=T,m._ratio=Math.min(Math.max(0,p),1),m}return f.prototype.get=function(T){return d.prototype.get.call(this,T,2)},f.prototype.peek=function(T){return d.prototype.get.call(this,T,0)},f.prototype.set=function(T,p){d.prototype.set.call(this,T,p,2),this.checkTrim()},f.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},f}(P)},SJMd:function(bt,De){/**
* @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 q,ue,J,O=!1,$,F;window.PR_SHOULD_USE_CONTINUATION=!0;var M,j;(function(){var U=window,P=["break,continue,do,else,for,if,return,while"],A=[P,"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"],d=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],f=[d,"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"],T=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[d,"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"],m="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",g=[d,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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",i=[P,"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=[P,"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"],l=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[f,p,T,g,a,i,s,l],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,y="str",R="kwd",w="com",E="typ",C="lit",c="pun",u="pln",L="tag",S="dec",D="src",_="atn",B="atv",G="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(ae){for(var ge=0,we=!1,_e=!1,Fe=0,Ue=ae.length;Fe<Ue;++Fe){var Be=ae[Fe];if(Be.ignoreCase)_e=!0;else if(/[a-z]/i.test(Be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,_e=!1;break}}var Ze={b:8,t:9,n:10,v:11,f:12,r:13};function et(Qe){var Me=Qe.charCodeAt(0);if(Me!==92)return Me;var $e=Qe.charAt(1);return Me=Ze[$e],Me||("0"<=$e&&$e<="7"?parseInt(Qe.substring(1),8):$e==="u"||$e==="x"?parseInt(Qe.substring(2),16):Qe.charCodeAt(1))}function rt(Qe){if(Qe<32)return(Qe<16?"\\x0":"\\x")+Qe.toString(16);var Me=String.fromCharCode(Qe);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function Ye(Qe){var Me=Qe.substring(1,Qe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),$e=[],ut=Me[0]==="^",je=["["];ut&&je.push("^");for(var Ve=ut?1:0,Se=Me.length;Ve<Se;++Ve){var be=Me[Ve];if(/\\[bdsw]/i.test(be))je.push(be);else{var Ce=et(be),ne;Ve+2<Se&&Me[Ve+1]==="-"?(ne=et(Me[Ve+2]),Ve+=2):ne=Ce,$e.push([Ce,ne]),ne<65||Ce>122||(ne<65||Ce>90||$e.push([Math.max(65,Ce)|32,Math.min(ne,90)|32]),ne<97||Ce>122||$e.push([Math.max(97,Ce)&~32,Math.min(ne,122)&~32]))}}$e.sort(function(Ne,Le){return Ne[0]-Le[0]||Le[1]-Ne[1]});for(var oe=[],ce=[],Ve=0;Ve<$e.length;++Ve){var ve=$e[Ve];ve[0]<=ce[1]+1?ce[1]=Math.max(ce[1],ve[1]):oe.push(ce=ve)}for(var Ve=0;Ve<oe.length;++Ve){var ve=oe[Ve];je.push(rt(ve[0])),ve[1]>ve[0]&&(ve[1]+1>ve[0]&&je.push("-"),je.push(rt(ve[1])))}return je.push("]"),je.join("")}function st(Qe){for(var Me=Qe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),$e=Me.length,ut=[],je=0,Ve=0;je<$e;++je){var Se=Me[je];if(Se==="(")++Ve;else if(Se.charAt(0)==="\\"){var be=+Se.substring(1);be&&(be<=Ve?ut[be]=-1:Me[je]=rt(be))}}for(var je=1;je<ut.length;++je)ut[je]===-1&&(ut[je]=++ge);for(var je=0,Ve=0;je<$e;++je){var Se=Me[je];if(Se==="(")++Ve,ut[Ve]||(Me[je]="(?:");else if(Se.charAt(0)==="\\"){var be=+Se.substring(1);be&&be<=Ve&&(Me[je]="\\"+ut[be])}}for(var je=0;je<$e;++je)Me[je]==="^"&&Me[je+1]!=="^"&&(Me[je]="");if(Qe.ignoreCase&&we)for(var je=0;je<$e;++je){var Se=Me[je],Ce=Se.charAt(0);Se.length>=2&&Ce==="["?Me[je]=Ye(Se):Ce!=="\\"&&(Me[je]=Se.replace(/[a-zA-Z]/g,function(ce){var ve=ce.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return Me.join("")}for(var Je=[],Fe=0,Ue=ae.length;Fe<Ue;++Fe){var Be=ae[Fe];if(Be.global||Be.multiline)throw new Error(""+Be);Je.push("(?:"+st(Be)+")")}return new RegExp(Je.join("|"),_e?"gi":"g")}function N(ae,ge){var we=/(?:^|\s)nocode(?:\s|$)/,_e=[],Fe=0,Ue=[],Be=0;function Ze(et){var rt=et.nodeType;if(rt==1){if(we.test(et.className))return;for(var Ye=et.firstChild;Ye;Ye=Ye.nextSibling)Ze(Ye);var st=et.nodeName.toLowerCase();(st==="br"||st==="li")&&(_e[Be]=`
`,Ue[Be<<1]=Fe++,Ue[Be++<<1|1]=et)}else if(rt==3||rt==4){var Je=et.nodeValue;Je.length&&(ge?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),_e[Be]=Je,Ue[Be<<1]=Fe,Fe+=Je.length,Ue[Be++<<1|1]=et)}}return Ze(ae),{sourceCode:_e.join("").replace(/\n$/,""),spans:Ue}}function Y(ae,ge,we,_e,Fe){if(!we)return;var Ue={sourceNode:ae,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:ge,decorations:null};_e(Ue),Fe.push.apply(Fe,Ue.decorations)}var ee=/\S/;function le(ae){for(var ge=void 0,we=ae.firstChild;we;we=we.nextSibling){var _e=we.nodeType;ge=_e===1?ge?ae:we:_e===3&&ee.test(we.nodeValue)?ae:ge}return ge===ae?void 0:ge}function me(ae,ge){var we={},_e;(function(){for(var Be=ae.concat(ge),Ze=[],et={},rt=0,Ye=Be.length;rt<Ye;++rt){var st=Be[rt],Je=st[3];if(Je)for(var Qe=Je.length;--Qe>=0;)we[Je.charAt(Qe)]=st;var Me=st[1],$e=""+Me;et.hasOwnProperty($e)||(Ze.push(Me),et[$e]=null)}Ze.push(/[\0-\uffff]/),_e=I(Ze)})();var Fe=ge.length,Ue=function(Be){for(var Ze=Be.sourceCode,et=Be.basePos,rt=Be.sourceNode,Ye=[et,u],st=0,Je=Ze.match(_e)||[],Qe={},Me=0,$e=Je.length;Me<$e;++Me){var ut=Je[Me],je=Qe[ut],Ve=void 0,Se;if(typeof je=="string")Se=!1;else{var be=we[ut.charAt(0)];if(be)Ve=ut.match(be[1]),je=be[0];else{for(var Ce=0;Ce<Fe;++Ce)if(be=ge[Ce],Ve=ut.match(be[1]),Ve){je=be[0];break}Ve||(je=u)}Se=je.length>=5&&je.substring(0,5)==="lang-",Se&&!(Ve&&typeof Ve[1]=="string")&&(Se=!1,je=D),Se||(Qe[ut]=je)}var ne=st;if(st+=ut.length,!Se)Ye.push(et+ne,je);else{var oe=Ve[1],ce=ut.indexOf(oe),ve=ce+oe.length;Ve[2]&&(ve=ut.length-Ve[2].length,ce=ve-oe.length);var Ne=je.substring(5);Y(rt,et+ne,ut.substring(0,ce),Ue,Ye),Y(rt,et+ne+ce,oe,de(Ne,oe),Ye),Y(rt,et+ne+ve,ut.substring(ve),Ue,Ye)}}Be.decorations=Ye};return Ue}function Ie(ae){var ge=[],we=[];ae.tripleQuotedStrings?ge.push([y,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ae.multiLineStrings?ge.push([y,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ge.push([y,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ae.verbatimStrings&&we.push([y,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var _e=ae.hashComments;_e&&(ae.cStyleComments?(_e>1?ge.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ge.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([y,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ge.push([w,/^#[^\r\n]*/,null,"#"])),ae.cStyleComments&&(we.push([w,/^\/\/[^\r\n]*/,null]),we.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=ae.regexLiterals;if(Fe){var Ue=Fe>1?"":`
\r`,Be=Ue?".":"[\\S\\s]",Ze="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+V+"("+Ze+")")])}var et=ae.types;et&&we.push([E,et]);var rt=(""+ae.keywords).replace(/^ | $/g,"");rt.length&&we.push([R,new RegExp("^(?:"+rt.replace(/[\s,]+/g,"|")+")\\b"),null]),ge.push([u,/^\s+/,null,` \r
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return ae.regexLiterals&&(Ye+="(?!s*/)"),we.push([C,/^@[a-z_$][a-z_$@0-9]*/i,null],[E,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[C,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[c,new RegExp(Ye),null]),me(ge,we)}var Te=Ie({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Oe(ae,ge,we){for(var _e=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ue=ae.ownerDocument,Be=Ue.createElement("li");ae.firstChild;)Be.appendChild(ae.firstChild);var Ze=[Be];function et(Me){var $e=Me.nodeType;if($e==1&&!_e.test(Me.className))if(Me.nodeName==="br")rt(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var ut=Me.firstChild;ut;ut=ut.nextSibling)et(ut);else if(($e==3||$e==4)&&we){var je=Me.nodeValue,Ve=je.match(Fe);if(Ve){var Se=je.substring(0,Ve.index);Me.nodeValue=Se;var be=je.substring(Ve.index+Ve[0].length);if(be){var Ce=Me.parentNode;Ce.insertBefore(Ue.createTextNode(be),Me.nextSibling)}rt(Me),Se||Me.parentNode.removeChild(Me)}}}function rt(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)return;function $e(Ve,Se){var be=Se?Ve.cloneNode(!1):Ve,Ce=Ve.parentNode;if(Ce){var ne=$e(Ce,1),oe=Ve.nextSibling;ne.appendChild(be);for(var ce=oe;ce;ce=oe)oe=ce.nextSibling,ne.appendChild(ce)}return be}for(var ut=$e(Me.nextSibling,0),je;(je=ut.parentNode)&&je.nodeType===1;)ut=je;Ze.push(ut)}for(var Ye=0;Ye<Ze.length;++Ye)et(Ze[Ye]);ge===(ge|0)&&Ze[0].setAttribute("value",ge);var st=Ue.createElement("ol");st.className="linenums";for(var Je=Math.max(0,ge-1|0)||0,Ye=0,Qe=Ze.length;Ye<Qe;++Ye)Be=Ze[Ye],Be.className="L"+(Ye+Je)%10,Be.firstChild||Be.appendChild(Ue.createTextNode("\xA0")),st.appendChild(Be);ae.appendChild(st)}function Re(ae){var ge=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ge=ge&&+ge[1]<=8;var we=/\n/g,_e=ae.sourceCode,Fe=_e.length,Ue=0,Be=ae.spans,Ze=Be.length,et=0,rt=ae.decorations,Ye=rt.length,st=0;rt[Ye]=Fe;var Je,Qe;for(Qe=Je=0;Qe<Ye;)rt[Qe]!==rt[Qe+2]?(rt[Je++]=rt[Qe++],rt[Je++]=rt[Qe++]):Qe+=2;for(Ye=Je,Qe=Je=0;Qe<Ye;){for(var Me=rt[Qe],$e=rt[Qe+1],ut=Qe+2;ut+2<=Ye&&rt[ut+1]===$e;)ut+=2;rt[Je++]=Me,rt[Je++]=$e,Qe=ut}Ye=rt.length=Je;var je=ae.sourceNode,Ve="";je&&(Ve=je.style.display,je.style.display="none");try{for(var Se=null;et<Ze;){var be=Be[et],Ce=Be[et+2]||Fe,ne=rt[st+2]||Fe,ut=Math.min(Ce,ne),oe=Be[et+1],ce;if(oe.nodeType!==1&&(ce=_e.substring(Ue,ut))){ge&&(ce=ce.replace(we,"\r")),oe.nodeValue=ce;var ve=oe.ownerDocument,Ne=ve.createElement("span");Ne.className=rt[st+1];var Le=oe.parentNode;Le.replaceChild(Ne,oe),Ne.appendChild(oe),Ue<Ce&&(Be[et+1]=oe=ve.createTextNode(_e.substring(ut,Ce)),Le.insertBefore(oe,Ne.nextSibling))}Ue=ut,Ue>=Ce&&(et+=2),Ue>=ne&&(st+=2)}}finally{je&&(je.style.display=Ve)}}var Ee={};function pe(ae,ge){for(var we=ge.length;--we>=0;){var _e=ge[we];Ee.hasOwnProperty(_e)?U.console&&console.warn("cannot override language handler %s",_e):Ee[_e]=ae}}function de(ae,ge){return ae&&Ee.hasOwnProperty(ae)||(ae=/^\s*</.test(ge)?"default-markup":"default-code"),Ee[ae]}pe(Te,["default-code"]),pe(me([],[[u,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[w,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[c,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),pe(me([[u,/^[\s]+/,null,` \r
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[L,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[_,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[c,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),pe(me([],[[B,/^[\s\S]+/]]),["uq.val"]),pe(Ie({keywords:f,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),pe(Ie({keywords:"null,true,false"}),["json"]),pe(Ie({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),pe(Ie({keywords:T,cStyleComments:!0}),["java"]),pe(Ie({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(Ie({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(Ie({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(Ie({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(Ie({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(Ie({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(me([],[[y,/^[\s\S]+/]]),["regex"]);function re(ae){var ge=ae.langExtension;try{var we=N(ae.sourceNode,ae.pre),_e=we.sourceCode;ae.sourceCode=_e,ae.spans=we.spans,ae.basePos=0,de(ge,_e)(ae),Re(ae)}catch(Fe){U.console&&console.log(Fe&&Fe.stack||Fe)}}function he(ae,ge,we){var _e=we||!1,Fe=ge||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+ae+"</pre>",Ue=Ue.firstChild,_e&&Oe(Ue,_e,!0);var Be={langExtension:Fe,numberLines:_e,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return re(Be),Ue.innerHTML}function se(ae,ge){var we=ge||document.body,_e=we.ownerDocument||document;function Fe(be){return we.getElementsByTagName(be)}for(var Ue=[Fe("pre"),Fe("code"),Fe("xmp")],Be=[],Ze=0;Ze<Ue.length;++Ze)for(var et=0,rt=Ue[Ze].length;et<rt;++et)Be.push(Ue[Ze][et]);Ue=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var st=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,Qe=/\bprettyprint\b/,Me=/\bprettyprinted\b/,$e=/pre|xmp/i,ut=/^code$/i,je=/^(?:pre|code|xmp)$/i,Ve={};function Se(){for(var be=U.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:Infinity;st<Be.length&&Ye.now()<be;st++){for(var Ce=Be[st],ne=Ve,oe=Ce;oe=oe.previousSibling;){var ce=oe.nodeType,ve=(ce===7||ce===8)&&oe.nodeValue;if(ve?!/^\??prettify\b/.test(ve):ce!==3||/\S/.test(oe.nodeValue))break;if(ve){ne={},ve.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ot,tt,Tr){ne[tt]=Tr});break}}var Ne=Ce.className;if((ne!==Ve||Qe.test(Ne))&&!Me.test(Ne)){for(var Le=!1,ze=Ce.parentNode;ze;ze=ze.parentNode){var it=ze.tagName;if(je.test(it)&&ze.className&&Qe.test(ze.className)){Le=!0;break}}if(!Le){Ce.className+=" prettyprinted";var ct=ne.lang;if(!ct){ct=Ne.match(Je);var dt;!ct&&(dt=le(Ce))&&ut.test(dt.tagName)&&(ct=dt.className.match(Je)),ct&&(ct=ct[1])}var Dt;if($e.test(Ce.tagName))Dt=1;else{var At=Ce.currentStyle,pt=_e.defaultView,jt=At?At.whiteSpace:pt&&pt.getComputedStyle?pt.getComputedStyle(Ce,null).getPropertyValue("white-space"):0;Dt=jt&&jt.substring(0,3)==="pre"}var Et=ne.linenums;(Et=Et==="true"||+Et)||(Et=Ne.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&Oe(Ce,Et,Dt);var Rt={langExtension:ct,sourceNode:Ce,numberLines:Et,pre:Dt,sourceCode:null,basePos:null,spans:null,decorations:null};re(Rt)}}}st<Be.length?U.setTimeout(Se,250):typeof ae=="function"&&ae()}Se()}var Ae=U.PR={createSimpleLexer:me,registerLangHandler:pe,sourceDecorator:Ie,PR_ATTRIB_NAME:_,PR_ATTRIB_VALUE:B,PR_COMMENT:w,PR_DECLARATION:S,PR_KEYWORD:R,PR_LITERAL:C,PR_NOCODE:G,PR_PLAIN:u,PR_PUNCTUATION:c,PR_SOURCE:D,PR_STRING:y,PR_TAG:L,PR_TYPE:E,prettyPrintOne:O?U.prettyPrintOne=he:M=he,prettyPrint:j=O?U.prettyPrint=se:j=se},ie=U.define;typeof ie=="function"&&ie.amd&&ie("google-code-prettify",[],function(){return Ae})})()},"T+//":function(bt,De,q){"use strict";q.r(De);var ue=q("Q9mQ"),J=q("diRs"),O=q("2qtc"),$=q("kLXV"),F=q("miYZ"),M=q("tsqr"),j=q("9og8"),U=q("tJVT"),P=q("B9cy"),A=q("Ol7k"),d=q("lUTK"),f=q("BvKs"),T=q("WmNS"),p=q.n(T),m=q("q1tI"),g=q.n(m),a=q("m3rI"),i=q("p0QG"),s=q.n(i),l=q("ErOA"),x=q("9kvl"),v=q("RCxd"),y=q("xGfz"),R=q("xKgJ"),w=q("5NDa"),E=q("5rEg");function C(Ee){var pe=Ee.user,de=Ee.CategoryId,re=Ee.IsShow,he=Ee.setIsShow,se=Ee.dispatch,Ae=Ee.init,ie=Object(m.useState)(),ae=Object(U.a)(ie,2),ge=ae[0],we=ae[1];return g.a.createElement($.a,{title:de?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){he(!1)},onOk:Object(j.a)(p.a.mark(function _e(){var Fe;return p.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(ge){Be.next=3;break}return M.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Be.abrupt("return");case 3:return Be.next=5,Object(l.a)("/api/programas.json",{method:"post",body:{name:ge,parent_id:de}});case 5:Fe=Be.sent,Fe.status===0&&(M.b.info("\u521B\u5EFA\u6210\u529F"),he(!1),we(""),Ae());case 7:case"end":return Be.stop()}},_e)})),visible:re},g.a.createElement(E.a,{value:ge,onChange:function(Fe){return we(Fe.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var c=Object(x.a)(function(Ee){var pe=Ee.user;return{user:pe}})(C);function u(Ee){var pe=Ee.user,de=Ee.CategoryId,re=Ee.name,he=Ee.IsShow,se=Ee.setIsShow,Ae=Ee.dispatch,ie=Ee.init,ae=Object(m.useState)(),ge=Object(U.a)(ae,2),we=ge[0],_e=ge[1];return Object(m.useEffect)(function(){_e(re)},[re]),g.a.createElement($.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){se(!1)},onOk:Object(j.a)(p.a.mark(function Fe(){var Ue;return p.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(we){Ze.next=3;break}return M.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ze.abrupt("return");case 3:return Ze.next=5,Object(l.a)("/api/programas/".concat(de,"/rename.json"),{method:"put",body:{name:we,id:de}});case 5:Ue=Ze.sent,Ue.status===0&&(M.b.info("\u4FEE\u6539\u6210\u529F"),se(!1),_e(""),ie());case 7:case"end":return Ze.stop()}},Fe)})),visible:he},g.a.createElement(E.a,{value:we,onChange:function(Ue){return _e(Ue.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var L=Object(x.a)(function(Ee){var pe=Ee.user;return{user:pe}})(u),S=q("+L6B"),D=q("2/Rp"),_=q("9Bee");function B(Ee){var pe,de,re,he,se=Ee.user,Ae=Ee.ItemData,ie=Ee.setIssee,ae=Ee.dispatch,ge=Ee.init;return g.a.createElement("div",null,g.a.createElement("div",{style:{textAlign:"right"}},Object(R.v)()&&g.a.createElement(D.a,{onClick:function(){return ie(!1)}},"\u7F16\u8F91")),g.a.createElement(_.a,{value:Ae.content}),(Ae==null||((pe=Ae.attachment)===null||pe===void 0)?void 0:pe.id)&&g.a.createElement("div",null,g.a.createElement("a",{href:Ae==null||((de=Ae.attachment)===null||de===void 0)?void 0:de.url,target:"_self",download:Ae==null||((re=Ae.attachment)===null||re===void 0)?void 0:re.title},g.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),g.a.createElement("span",{style:{color:"#000000"}},Ae==null||((he=Ae.attachment)===null||he===void 0)?void 0:he.title))))}var G=Object(x.a)(function(Ee){var pe=Ee.user;return{user:pe}})(B),V=q("DZo9"),I=q("8z0m"),N=q("Ot1p"),Y=q("hJwl");function ee(Ee){var pe=Ee.user,de=Ee.ItemData,re=Ee.setIssee,he=Ee.CategoryId,se=Ee.dispatch,Ae=Ee.init,ie=Object(m.useState)([]),ae=Object(U.a)(ie,2),ge=ae[0],we=ae[1],_e=Object(m.useState)(de.content),Fe=Object(U.a)(_e,2),Ue=Fe[0],Be=Fe[1];function Ze(){var Je,Qe=[];return de==null||((Je=de.attachments)===null||Je===void 0)||Je.map(function(Me){var $e={uid:Me==null?void 0:Me.id,name:Me.title,response:{id:Me.id}};Qe.push($e)}),Qe}var et={name:"file",multiple:!0,action:a.a.API_SERVER+"/api/attachments.json",defaultFileList:Ze(),onRemove:function(Qe){Object(Y.t)({id:Qe.uid})},onChange:function(Qe){console.log("info",Qe);var Me=Qe.file.status;Me!=="uploading",Me==="removed"&&we(Qe.fileList),Me==="done"?(we(Qe.fileList),M.b.success("".concat(Qe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):Me==="error"&&M.b.error("".concat(Qe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Qe){var Me=Qe.size/1024/1024<150;return Me||M.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Me}};function rt(){return Ye.apply(this,arguments)}function Ye(){return Ye=Object(j.a)(p.a.mark(function Je(){var Qe;return p.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:return $e.next=2,Object(l.a)("/api/programas/".concat(he,"/update_content.json"),{method:"put",body:{id:he,content:Ue,attachment_id:st(ge)}});case 2:Qe=$e.sent,Qe&&(M.b.info("\u63D0\u4EA4\u6210\u529F"),re(!0));case 4:case"end":return $e.stop()}},Je)})),Ye.apply(this,arguments)}function st(Je){var Qe;return Je&&Je.map(function(Me){Qe=Me.response.id}),Qe}return g.a.createElement("div",null,g.a.createElement(N.a,{defaultValue:Ue,onChange:function(Qe){return Be(Qe)}}),g.a.createElement(I.a,et,g.a.createElement(D.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),g.a.createElement("p",{style:{marginTop:"10px"}},g.a.createElement(D.a,{style:{width:"90px"},onClick:function(){return rt()}},"\u63D0\u4EA4"),g.a.createElement(D.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return re(!0)}},"\u53D6\u6D88")))}var le=Object(x.a)(function(Ee){var pe=Ee.user;return{user:pe}})(ee),me=f.a.SubMenu,Ie=A.a.Content,Te=A.a.Sider;function Oe(Ee){var pe,de=Ee.user,re=Ee.dispatch,he=Ee.globalSetting,se=Object(m.useState)(),Ae=Object(U.a)(se,2),ie=Ae[0],ae=Ae[1],ge=Object(m.useState)(!1),we=Object(U.a)(ge,2),_e=we[0],Fe=we[1],Ue=Object(m.useState)(),Be=Object(U.a)(Ue,2),Ze=Be[0],et=Be[1],rt=Object(m.useState)(),Ye=Object(U.a)(rt,2),st=Ye[0],Je=Ye[1],Qe=Object(m.useState)(!1),Me=Object(U.a)(Qe,2),$e=Me[0],ut=Me[1],je=Object(m.useState)(""),Ve=Object(U.a)(je,2),Se=Ve[0],be=Ve[1],Ce=Object(m.useState)(""),ne=Object(U.a)(Ce,2),oe=ne[0],ce=ne[1],ve=Object(m.useState)(!0),Ne=Object(U.a)(ve,2),Le=Ne[0],ze=Ne[1];Object(m.useEffect)(function(){it()},[]),console.log("globalSetting",he);function it(){return ct.apply(this,arguments)}function ct(){return ct=Object(j.a)(p.a.mark(function Et(){var Rt;return p.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return tt.next=2,Object(l.a)("/api/programas.json",{method:"get"});case 2:Rt=tt.sent,Rt&&et(Rt==null?void 0:Rt.programas);case 4:case"end":return tt.stop()}},Et)})),ct.apply(this,arguments)}var dt=function(){var Et=Object(j.a)(p.a.mark(function Rt(Ot,tt,Tr){var wr;return p.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:mt.t0=Ot,mt.next=mt.t0===1?3:mt.t0===2?6:mt.t0===3?10:mt.t0===4?15:17;break;case 3:return Je(tt==null?void 0:tt.id),Fe(!0),mt.abrupt("break",17);case 6:return Je(tt==null?void 0:tt.id),ut(!0),be(tt==null?void 0:tt.name),mt.abrupt("break",17);case 10:return mt.next=12,Object(l.a)("/api/programas/".concat(tt==null?void 0:tt.id,"/top.json"),{method:"post",body:{id:tt==null?void 0:tt.id}});case 12:return wr=mt.sent,wr.status===0&&it(),mt.abrupt("break",17);case 15:return Dt(g.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",g.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(j.a)(p.a.mark(function lt(){var Ct;return p.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(l.a)("/api/programas/".concat(tt==null?void 0:tt.id,".json"),{method:"delete",body:{id:tt==null?void 0:tt.id}});case 2:Ct=Jt.sent,Ct.status===0&&(M.b.info("\u5220\u9664\u6210\u529F"),it());case 4:case"end":return Jt.stop()}},lt)}))),mt.abrupt("break",17);case 17:case"end":return mt.stop()}},Rt)}));return function(Ot,tt,Tr){return Et.apply(this,arguments)}}(),Dt=function(Rt,Ot){$.a.confirm({centered:!0,title:"\u63D0\u793A",icon:g.a.createElement(v.a,null),content:Rt,okText:"\u786E\u8BA4",onOk:function(){return Ot()},cancelText:"\u53D6\u6D88"})},At=function(Rt,Ot){return g.a.createElement("div",{className:s.a.leftMenuActions},Ot===1&&g.a.createElement("p",{className:"current",onClick:function(){return dt(1,Rt,Ot)}},"\u65B0\u5EFA"),g.a.createElement("p",{className:"current",onClick:function(){return dt(2,Rt,Ot)}},"\u91CD\u547D\u540D"),g.a.createElement("p",{className:"current",onClick:function(){return dt(3,Rt,Ot)}},"\u7F6E\u9876"),g.a.createElement("p",{className:"current",onClick:function(){return dt(4,Rt,Ot)}},"\u5220\u9664"))};function pt(){return jt.apply(this,arguments)}function jt(){return jt=Object(j.a)(p.a.mark(function Et(){var Rt;return p.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return tt.next=2,Object(l.a)("/api/programas/".concat(st,"/content.json"),{method:"get",params:{id:st}});case 2:Rt=tt.sent,Rt&&ce(Rt);case 4:case"end":return tt.stop()}},Et)})),jt.apply(this,arguments)}return g.a.createElement("div",{style:{marginBottom:"40px"}},g.a.createElement("img",{style:{width:"100%"},src:a.a.IMG_SERVER+"/".concat(he==null||((pe=he.setting)===null||pe===void 0)?void 0:pe.shixun_banner_url)}),g.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},g.a.createElement(Te,{width:244,className:s.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},g.a.createElement(f.a,{mode:"inline"},Ze==null?void 0:Ze.map(function(Et,Rt){if((Et==null?void 0:Et.children.length)>0){var Ot;return g.a.createElement(me,{title:g.a.createElement("span",{className:"font16"},g.a.createElement("span",null,Et.name),!Object(R.v)()&&g.a.createElement("span",null),Object(R.v)()&&g.a.createElement(J.a,{placement:"right",content:function(){return At(Et,1)},trigger:"hover"},g.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))},Et==null||((Ot=Et.children)===null||Ot===void 0)?void 0:Ot.map(function(tt,Tr){return g.a.createElement(f.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){Je(tt==null?void 0:tt.id),st=tt==null?void 0:tt.id,pt()}},g.a.createElement("span",{style:{flex:"1"}},tt==null?void 0:tt.name),Object(R.v)()&&g.a.createElement(J.a,{placement:"right",content:function(){return At(tt,2)},trigger:"hover"},g.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}))}else return g.a.createElement(f.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){Je(Et==null?void 0:Et.id),st=Et==null?void 0:Et.id,pt()}},g.a.createElement("span",{style:{flex:"1"}},Et==null?void 0:Et.name),Object(R.v)()&&g.a.createElement(J.a,{placement:"right",content:function(){return At(Et,1)},trigger:"hover"},g.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}),g.a.createElement(f.a.Item,{onClick:function(){Je(""),st="",Fe(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:g.a.createElement(y.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),g.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Le&&g.a.createElement(G,{ItemData:oe,setIssee:ze}),Le===!1&&g.a.createElement(le,{ItemData:oe,setIssee:ze,CategoryId:st}))),g.a.createElement(c,{CategoryId:st,IsShow:_e,setIsShow:Fe,init:it}),g.a.createElement(L,{CategoryId:st,name:Se,IsShow:$e,setIsShow:ut,init:it}))}var Re=De.default=Object(x.a)(function(Ee){var pe=Ee.user,de=Ee.globalSetting;return{user:pe,globalSetting:de}})(Oe)},T8No:function(bt,De,q){"use strict";q.d(De,"a",function(){return $}),q.d(De,"b",function(){return T}),q.d(De,"d",function(){return p}),q.d(De,"c",function(){return m}),q.d(De,"e",function(){return g});var ue=q("N0LK"),J=q("Cg/j"),O=function(){var a=function(i,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,x){l.__proto__=x}||function(l,x){for(var v in x)x.hasOwnProperty(v)&&(l[v]=x[v])},a(i,s)};return function(i,s){a(i,s);function l(){this.constructor=i}i.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}}(),$=function(){function a(){}return a.has=function(i){return M.create(i)},a.equals=function(i,s){return j.create(i,s)},a.regex=function(i,s){return A.create(i,s)},a.not=function(i){return P.create(i)},a.and=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return f.create(i)},a.or=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return T.create(i)},a.deserialize=function(i,s){return s===void 0&&(s=!1),i?this._deserializeOrExpression(i,s):void 0},a._deserializeOrExpression=function(i,s){var l=this,x=i.split("||");return T.create(x.map(function(v){return l._deserializeAndExpression(v,s)}))},a._deserializeAndExpression=function(i,s){var l=this,x=i.split("&&");return f.create(x.map(function(v){return l._deserializeOne(v,s)}))},a._deserializeOne=function(i,s){if(i=i.trim(),i.indexOf("!=")>=0){var l=i.split("!=");return U.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("==")>=0){var l=i.split("==");return j.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("=~")>=0){var l=i.split("=~");return A.create(l[0].trim(),this._deserializeRegexValue(l[1],s))}return/^\!\s*/.test(i)?P.create(i.substr(1).trim()):M.create(i)},a._deserializeValue=function(i,s){if(i=i.trim(),i==="true")return!0;if(i==="false")return!1;var l=/^'([^']*)'$/.exec(i);return l?l[1].trim():i},a._deserializeRegexValue=function(i,s){if(Object(ue.x)(i)){if(s)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var l=i.indexOf("/"),x=i.lastIndexOf("/");if(l===x||l<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var v=i.slice(l+1,x),y=i[x+1]==="i"?"i":"";try{return new RegExp(v,y)}catch(R){if(s)throw new Error("bad regexp-value '"+i+"', parse error: "+R);return console.warn("bad regexp-value '"+i+"', parse error: "+R),null}},a}();function F(a,i){var s=a.getType(),l=i.getType();if(s!==l)return s-l;switch(s){case 1:return a.cmp(i);case 2:return a.cmp(i);case 3:return a.cmp(i);case 4:return a.cmp(i);case 6:return a.cmp(i);case 7:return a.cmp(i);case 5:return a.cmp(i);default:throw new Error("Unknown ContextKeyExpr!")}}var M=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 1},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return P.create(this.key)},a}(),j=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?M.create(i):P.create(i):new a(i,s)},a.prototype.getType=function(){return 3},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)==this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return U.create(this.key,this.value)},a}(),U=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?P.create(i):M.create(i):new a(i,s)},a.prototype.getType=function(){return 4},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)!=this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return j.create(this.key,this.value)},a}(),P=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 2},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return M.create(this.key)},a}(),A=function(){function a(i,s){this.key=i,this.regexp=s}return a.create=function(i,s){return new a(i,s)},a.prototype.getType=function(){return 6},a.prototype.cmp=function(i){if(this.key<i.key)return-1;if(this.key>i.key)return 1;var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return s<l?-1:s>l?1:0},a.prototype.equals=function(i){if(i instanceof a){var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return this.key===i.key&&s===l}return!1},a.prototype.evaluate=function(i){var s=i.getValue(this.key);return this.regexp?this.regexp.test(s):!1},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return d.create(this)},a}(),d=function(){function a(i){this._actual=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 7},a.prototype.cmp=function(i){return this._actual.cmp(i._actual)},a.prototype.equals=function(i){return i instanceof a?this._actual.equals(i._actual):!1},a.prototype.evaluate=function(i){return!this._actual.evaluate(i)},a.prototype.keys=function(){return this._actual.keys()},a.prototype.negate=function(){return this._actual},a}(),f=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 5},a.prototype.cmp=function(i){if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(var s=0,l=this.expr.length;s<l;s++){var x=F(this.expr[s],i.expr[s]);if(x!==0)return x}return 0},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].evaluate(i))return!1;return!0},a._normalizeArr=function(i){var s=[];if(i){for(var l=0,x=i.length;l<x;l++){var v=i[l];if(!v)continue;if(v instanceof a){s=s.concat(v.expr);continue}if(v instanceof T)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');s.push(v)}s.sort(F)}return s},a.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var x=l[s];i.push.apply(i,x.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var x=l[s];i.push(x.negate())}return T.create(i)},a}(),T=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 8},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(this.expr[s].evaluate(i))return!0;return!1},a._normalizeArr=function(i){var s=[];if(i){for(var l=0,x=i.length;l<x;l++){var v=i[l];if(!v)continue;if(v instanceof a){s=s.concat(v.expr);continue}s.push(v)}s.sort(F)}return s},a.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var x=l[s];i.push.apply(i,x.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var x=l[s];i.push(x.negate())}for(var v=function(D){return D instanceof a?D.expr:[D]};i.length>1;){for(var y=i.shift(),R=i.shift(),w=[],E=0,C=v(y);E<C.length;E++)for(var c=C[E],u=0,L=v(R);u<L.length;u++){var S=L[u];w.push($.and(c,S))}i.unshift($.or.apply($,w))}return i[0]},a}(),p=function(a){O(i,a);function i(s,l){var x=a.call(this,s)||this;return x._defaultValue=l,x}return i.prototype.bindTo=function(s){return s.createKey(this.key,this._defaultValue)},i.prototype.getValue=function(s){return s.getContextKeyValue(this.key)},i.prototype.toNegated=function(){return $.not(this.key)},i}(M),m=Object(J.c)("contextKeyService"),g="setContext"},"VrN/":function(bt,De,q){(function(ue,J){bt.exports=J()})(this,function(){"use strict";var ue=navigator.userAgent,J=navigator.platform,O=/gecko\/\d/i.test(ue),$=/MSIE \d/.test(ue),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),M=/Edge\/(\d+)/.exec(ue),j=$||F||M,U=j&&($?document.documentMode||6:+(M||F)[1]),P=!M&&/WebKit\//.test(ue),A=P&&/Qt\/\d+\.\d+/.test(ue),d=!M&&/Chrome\//.test(ue),f=/Opera\//.test(ue),T=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),m=/PhantomJS/.test(ue),g=!M&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),a=/Android/.test(ue),i=g||a||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),s=g||/Mac/.test(J),l=/\bCrOS\b/.test(ue),x=/win/i.test(J),v=f&&ue.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(f=!1,P=!0);var y=s&&(A||f&&(v==null||v<12.11)),R=O||j&&U>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E=function(e,t){var n=e.className,r=w(t).exec(n);if(r){var o=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(o?r[1]+o:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function c(e,t){return C(e).appendChild(t)}function u(e,t,n,r){var o=document.createElement(e);if(n&&(o.className=n),r&&(o.style.cssText=r),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)o.appendChild(t[k]);return o}function L(e,t,n,r){var o=u(e,t,n,r);return o.setAttribute("role","presentation"),o}var S;document.createRange?S=function(e,t,n,r){var o=document.createRange();return o.setEnd(r||e,n),o.setStart(e,t),o}:S=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(o){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function D(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 _(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function B(e,t){var n=e.className;w(t).test(n)||(e.className+=(n?" ":"")+t)}function G(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!w(n[r]).test(t)&&(t+=" "+n[r]);return t}var V=function(e){e.select()};g?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(V=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Y(e,t,n,r,o){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=r||0,W=o||0;;){var Q=e.indexOf(" ",k);if(Q<0||Q>=t)return W+(t-k);W+=Q-k,W+=n-W%n,k=Q+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function le(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var me=50,Ie={toString:function(){return"CodeMirror.Pass"}},Te={scroll:!1},Oe={origin:"*mouse"},Re={origin:"+move"};function Ee(e,t,n){for(var r=0,o=0;;){var k=e.indexOf(" ",r);k==-1&&(k=e.length);var W=k-r;if(k==e.length||o+W>=t)return r+Math.min(W,t-o);if(o+=k-r,o+=n-o%n,r=k+1,o>=t)return r}}var pe=[""];function de(e){for(;pe.length<=e;)pe.push(re(pe)+" ");return pe[e]}function re(e){return e[e.length-1]}function he(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function se(e,t,n){for(var r=0,o=n(t);r<e.length&&n(e[r])<=o;)r++;e.splice(r,0,t)}function Ae(){}function ie(e,t){var n;return Object.create?n=Object.create(e):(Ae.prototype=e,n=new Ae),t&&N(t,n),n}var ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ge(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ae.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ge(e)?!0:t.test(e):ge(e)}function _e(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ue(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Be(e,t,n){for(;(n<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=n;return t}function Ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var o=(t+n)/2,k=r<0?Math.ceil(o):Math.floor(o);if(k==t)return e(k)?t:n;e(k)?n=k:t=k+r}}function et(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var o=!1,k=0;k<e.length;++k){var W=e[k];(W.from<n&&W.to>t||t==n&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,n),W.level==1?"rtl":"ltr",k),o=!0)}o||r(t,n,"ltr")}var rt=null;function Ye(e,t,n){var r;rt=null;for(var o=0;o<e.length;++o){var k=e[o];if(k.from<t&&k.to>t)return o;k.to==t&&(k.from!=k.to&&n=="before"?r=o:rt=o),k.from==t&&(k.from!=k.to&&n!="before"?r=o:rt=o)}return r!=null?r:rt}var st=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,k=/[LRr]/,W=/[Lb1n]/,Q=/[1n]/;function Z(te,fe,ye){this.level=te,this.from=fe,this.to=ye}return function(te,fe){var ye=fe=="ltr"?"L":"R";if(te.length==0||fe=="ltr"&&!r.test(te))return!1;for(var Pe=te.length,ke=[],We=0;We<Pe;++We)ke.push(n(te.charCodeAt(We)));for(var Xe=0,qe=ye;Xe<Pe;++Xe){var at=ke[Xe];at=="m"?ke[Xe]=qe:qe=at}for(var ft=0,ot=ye;ft<Pe;++ft){var vt=ke[ft];vt=="1"&&ot=="r"?ke[ft]="n":k.test(vt)&&(ot=vt,vt=="r"&&(ke[ft]="R"))}for(var Lt=1,Tt=ke[0];Lt<Pe-1;++Lt){var _t=ke[Lt];_t=="+"&&Tt=="1"&&ke[Lt+1]=="1"?ke[Lt]="1":_t==","&&Tt==ke[Lt+1]&&(Tt=="1"||Tt=="n")&&(ke[Lt]=Tt),Tt=_t}for(var rr=0;rr<Pe;++rr){var br=ke[rr];if(br==",")ke[rr]="N";else if(br=="%"){var ar=void 0;for(ar=rr+1;ar<Pe&&ke[ar]=="%";++ar);for(var zr=rr&&ke[rr-1]=="!"||ar<Pe&&ke[ar]=="1"?"1":"N",Br=rr;Br<ar;++Br)ke[Br]=zr;rr=ar-1}}for(var cr=0,Ur=ye;cr<Pe;++cr){var Sr=ke[cr];Ur=="L"&&Sr=="1"?ke[cr]="L":k.test(Sr)&&(Ur=Sr)}for(var mr=0;mr<Pe;++mr)if(o.test(ke[mr])){var fr=void 0;for(fr=mr+1;fr<Pe&&o.test(ke[fr]);++fr);for(var sr=(mr?ke[mr-1]:ye)=="L",jr=(fr<Pe?ke[fr]:ye)=="L",ui=sr==jr?sr?"L":"R":ye,kn=mr;kn<fr;++kn)ke[kn]=ui;mr=fr-1}for(var Dr=[],pn,xr=0;xr<Pe;)if(W.test(ke[xr])){var Xa=xr;for(++xr;xr<Pe&&W.test(ke[xr]);++xr);Dr.push(new Z(0,Xa,xr))}else{var yn=xr,Wn=Dr.length,Hn=fe=="rtl"?1:0;for(++xr;xr<Pe&&ke[xr]!="L";++xr);for(var Or=yn;Or<xr;)if(Q.test(ke[Or])){yn<Or&&(Dr.splice(Wn,0,new Z(1,yn,Or)),Wn+=Hn);var di=Or;for(++Or;Or<xr&&Q.test(ke[Or]);++Or);Dr.splice(Wn,0,new Z(2,di,Or)),Wn+=Hn,yn=Or}else++Or;yn<xr&&Dr.splice(Wn,0,new Z(1,yn,xr))}return fe=="ltr"&&(Dr[0].level==1&&(pn=te.match(/^\s+/))&&(Dr[0].from=pn[0].length,Dr.unshift(new Z(0,0,pn[0].length))),re(Dr).level==1&&(pn=te.match(/\s+$/))&&(re(Dr).to-=pn[0].length,Dr.push(new Z(0,Pe-pn[0].length,Pe)))),fe=="rtl"?Dr.reverse():Dr}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=st(e.text,t)),n}var Qe=[],Me=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Qe).concat(n)}};function $e(e,t){return e._handlers&&e._handlers[t]||Qe}function ut(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,o=r&&r[t];if(o){var k=le(o,n);k>-1&&(r[t]=o.slice(0,k).concat(o.slice(k+1)))}}}function je(e,t){var n=$e(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),o=0;o<n.length;++o)n[o].apply(null,r)}function Ve(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),je(e,n||t.type,e,t),ce(t)||t.codemirrorIgnore}function Se(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)le(n,t[r])==-1&&n.push(t[r])}function be(e,t){return $e(e,t).length>0}function Ce(e){e.prototype.on=function(t,n){Me(this,t,n)},e.prototype.off=function(t,n){ut(this,t,n)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ce(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ve(e){ne(e),oe(e)}function Ne(e){return e.target||e.srcElement}function Le(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 ze=function(){if(j&&U<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),it;function ct(e){if(it==null){var t=u("span","\u200B");c(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(it=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&U<8))}var n=it?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var dt;function Dt(e){if(dt!=null)return dt;var t=c(e,document.createTextNode("A\u062EA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return C(e),!n||n.left==n.right?!1:dt=r.right-n.right<3}var At=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var o=e.indexOf(`
`,t);o==-1&&(o=e.length);var k=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),W=k.indexOf("\r");W!=-1?(n.push(k.slice(0,W)),t+=W+1):(n.push(k),t=o+1)}return n}:function(e){return e.split(/\r\n?|\n/)},pt=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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},jt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Rt(e){if(Et!=null)return Et;var t=c(e,u("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var Ot={},tt={};function Tr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ot[e]=t}function wr(e,t){tt[e]=t}function St(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=ie(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return St("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return St("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function mt(e,t){t=St(t);var n=Ot[t.name];if(!n)return mt(e,"text/plain");var r=n(e,t);if(lt.hasOwnProperty(t.name)){var o=lt[t.name];for(var k in o){if(!o.hasOwnProperty(k))continue;r.hasOwnProperty(k)&&(r["_"+k]=r[k]),r[k]=o[k]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var lt={};function Ct(e,t){var n=lt.hasOwnProperty(e)?lt[e]:lt[e]={};N(t,n)}function $t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var o=t[r];o instanceof Array&&(o=o.concat([])),n[r]=o}return n}function Jt(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function nr(e,t,n){return e.startState?e.startState(t,n):!0}var Pt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.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)},Pt.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(W){return n?W.toLowerCase():W},o=this.string.substr(this.pos,e.length);if(r(o)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function yt(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 n=e;!n.lines;)for(var r=0;;++r){var o=n.children[r],k=o.chunkSize();if(t<k){n=o;break}t-=k}return n.lines[t]}function Mr(e,t,n){var r=[],o=t.line;return e.iter(t.line,n.line+1,function(k){var W=k.text;o==n.line&&(W=W.slice(0,n.ch)),o==t.line&&(W=W.slice(t.ch)),r.push(W),++o}),r}function tn(e,t,n){var r=[];return e.iter(t,n,function(o){r.push(o.text)}),r}function Ar(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function It(e){if(e.parent==null)return null;for(var t=e.parent,n=le(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var o=0;!(r.children[o]==t);++o)n+=r.children[o].chunkSize();return n+t.first}function kr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var o=e.children[r],k=o.height;if(t<k){e=o;continue e}t-=k,n+=o.chunkSize()}return n}while(!e.lines);for(var W=0;W<e.lines.length;++W){var Q=e.lines[W],Z=Q.height;if(t<Z)break;t-=Z}return n+W}function Kr(e,t){return t>=e.first&&t<e.first+e.size}function rn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function He(e,t,n){if(n===void 0&&(n=null),!(this instanceof He))return new He(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ht(e,t){return e.line-t.line||e.ch-t.ch}function Nt(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function Vt(e){return He(e.line,e.ch)}function Qt(e,t){return ht(e,t)<0?t:e}function er(e,t){return ht(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function h(e,t){if(t.line<e.first)return He(e.first,0);var n=e.first+e.size-1;return t.line>n?He(n,yt(e,n).text.length):b(t,yt(e,t.line).text.length)}function b(e,t){var n=e.ch;return n==null||n>t?He(e.line,t):n<0?He(e.line,0):e}function H(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=h(e,t[r]);return n}var X=function(e,t){this.state=e,this.lookAhead=t},K=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};K.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},K.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}},K.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},K.fromSaved=function(e,t,n){return t instanceof X?new K(e,$t(e.mode,t.state),n,t.lookAhead):new K(e,$t(e.mode,t),n)},K.prototype.save=function(e){var t=e!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function xe(e,t,n,r){var o=[e.state.modeGen],k={};Xr(e,t.text,e.doc.mode,n,function(te,fe){return o.push(te,fe)},k,r);for(var W=n.state,Q=function(te){n.baseTokens=o;var fe=e.state.overlays[te],ye=1,Pe=0;n.state=!0,Xr(e,t.text,fe.mode,n,function(ke,We){for(var Xe=ye;Pe<ke;){var qe=o[ye];qe>ke&&o.splice(ye,1,ke,o[ye+1],qe),ye+=2,Pe=Math.min(ke,qe)}if(!We)return;if(fe.opaque)o.splice(Xe,ye-Xe,ke,"overlay "+We),ye=Xe+2;else for(;Xe<ye;Xe+=2){var at=o[Xe+1];o[Xe+1]=(at?at+" ":"")+"overlay "+We}},k),n.state=W,n.baseTokens=null,n.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)Q(Z);return{styles:o,classes:k.bgClass||k.textClass?k:null}}function Ge(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=nt(e,It(t)),o=t.text.length>e.options.maxHighlightLength&&$t(e.doc.mode,r.state),k=xe(e,t,r);o&&(r.state=o),t.stateAfter=r.save(!o),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function nt(e,t,n){var r=e.doc,o=e.display;if(!r.mode.startState)return new K(r,!0,t);var k=pr(e,t,n),W=k>r.first&&yt(r,k-1).stateAfter,Q=W?K.fromSaved(r,W,k):new K(r,nr(r.mode),k);return r.iter(k,t,function(Z){gt(e,Z.text,Q);var te=Q.line;Z.stateAfter=te==t-1||te%5==0||te>=o.viewFrom&&te<o.viewTo?Q.save():null,Q.nextLine()}),n&&(r.modeFrontier=Q.line),Q}function gt(e,t,n,r){var o=e.doc.mode,k=new Pt(t,e.options.tabSize,n);for(k.start=k.pos=r||0,t==""&&Ke(o,n.state);!k.eol();)kt(o,k,n.state),k.start=k.pos}function Ke(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Jt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function kt(e,t,n,r){for(var o=0;o<10;o++){r&&(r[0]=Jt(e,n).mode);var k=e.token(t,n);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Bt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function tr(e,t,n,r){var o=e.doc,k=o.mode,W;t=h(o,t);var Q=yt(o,t.line),Z=nt(e,t.line,n),te=new Pt(Q.text,e.options.tabSize,Z),fe;for(r&&(fe=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,W=kt(k,te,Z.state),r&&fe.push(new Bt(te,W,$t(o.mode,Z.state)));return r?fe:new Bt(te,W,Z.state)}function Vr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Xr(e,t,n,r,o,k,W){var Q=n.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var Z=0,te=null,fe=new Pt(t,e.options.tabSize,r),ye,Pe=e.options.addModeClass&&[null];for(t==""&&Vr(Ke(n,r.state),k);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(Q=!1,W&&gt(e,t,r,fe.pos),fe.pos=t.length,ye=null):ye=Vr(kt(n,fe,r.state,Pe),k),Pe){var ke=Pe[0].name;ke&&(ye="m-"+(ye?ke+" "+ye:ke))}if(!Q||te!=ye){for(;Z<fe.start;)Z=Math.min(fe.start,Z+5e3),o(Z,te);te=ye}fe.start=fe.pos}for(;Z<fe.pos;){var We=Math.min(fe.pos,Z+5e3);o(We,te),Z=We}}function pr(e,t,n){for(var r,o,k=e.doc,W=n?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>W;--Q){if(Q<=k.first)return k.first;var Z=yt(k,Q-1),te=Z.stateAfter;if(te&&(!n||Q+(te instanceof X?te.lookAhead:0)<=k.modeFrontier))return Q;var fe=Y(Z.text,null,e.options.tabSize);(o==null||r>fe)&&(o=Q-1,r=fe)}return o}function Zr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var o=yt(e,r).stateAfter;if(o&&(!(o instanceof X)||r+o.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Gn=!1,Pr=!1;function Yr(){Gn=!0}function Wr(){Pr=!0}function bn(e,t,n){this.marker=e,this.from=t,this.to=n}function nn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function mn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function dn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function hi(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var k=e[o],W=k.marker,Q=k.from==null||(W.inclusiveLeft?k.from<=t:k.from<t);if(Q||k.from==t&&W.type=="bookmark"&&(!n||!k.marker.insertLeft)){var Z=k.to==null||(W.inclusiveRight?k.to>=t:k.to>t);(r||(r=[])).push(new bn(W,k.from,Z?null:k.to))}}return r}function zn(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var k=e[o],W=k.marker,Q=k.to==null||(W.inclusiveRight?k.to>=t:k.to>t);if(Q||k.from==t&&W.type=="bookmark"&&(!n||k.marker.insertLeft)){var Z=k.from==null||(W.inclusiveLeft?k.from<=t:k.from<t);(r||(r=[])).push(new bn(W,Z?null:k.from-t,k.to==null?null:k.to-t))}}return r}function an(e,t){if(t.full)return null;var n=Kr(e,t.from.line)&&yt(e,t.from.line).markedSpans,r=Kr(e,t.to.line)&&yt(e,t.to.line).markedSpans;if(!n&&!r)return null;var o=t.from.ch,k=t.to.ch,W=ht(t.from,t.to)==0,Q=hi(n,o,W),Z=zn(r,k,W),te=t.text.length==1,fe=re(t.text).length+(te?o:0);if(Q)for(var ye=0;ye<Q.length;++ye){var Pe=Q[ye];if(Pe.to==null){var ke=nn(Z,Pe.marker);ke?te&&(Pe.to=ke.to==null?null:ke.to+fe):Pe.to=o}}if(Z)for(var We=0;We<Z.length;++We){var Xe=Z[We];if(Xe.to!=null&&(Xe.to+=fe),Xe.from==null){var qe=nn(Q,Xe.marker);qe||(Xe.from=fe,te&&(Q||(Q=[])).push(Xe))}else Xe.from+=fe,te&&(Q||(Q=[])).push(Xe)}Q&&(Q=$r(Q)),Z&&Z!=Q&&(Z=$r(Z));var at=[Q];if(!te){var ft=t.text.length-2,ot;if(ft>0&&Q)for(var vt=0;vt<Q.length;++vt)Q[vt].to==null&&(ot||(ot=[])).push(new bn(Q[vt].marker,null,null));for(var Lt=0;Lt<ft;++Lt)at.push(ot);at.push(Z)}return at}function $r(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Rn(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ke){if(ke.markedSpans)for(var We=0;We<ke.markedSpans.length;++We){var Xe=ke.markedSpans[We].marker;Xe.readOnly&&(!r||le(r,Xe)==-1)&&(r||(r=[])).push(Xe)}}),!r)return null;for(var o=[{from:t,to:n}],k=0;k<r.length;++k)for(var W=r[k],Q=W.find(0),Z=0;Z<o.length;++Z){var te=o[Z];if(ht(te.to,Q.from)<0||ht(te.from,Q.to)>0)continue;var fe=[Z,1],ye=ht(te.from,Q.from),Pe=ht(te.to,Q.to);(ye<0||!W.inclusiveLeft&&!ye)&&fe.push({from:te.from,to:Q.from}),(Pe>0||!W.inclusiveRight&&!Pe)&&fe.push({from:Q.to,to:te.to}),o.splice.apply(o,fe),Z+=fe.length-3}return o}function On(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function ci(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function or(e){return e.inclusiveLeft?-1:0}function Gt(e){return e.inclusiveRight?1:0}function Er(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),o=t.find(),k=ht(r.from,o.from)||or(e)-or(t);if(k)return-k;var W=ht(r.to,o.to)||Gt(e)-Gt(t);return W||t.id-e.id}function Ht(e,t){var n=Pr&&e.markedSpans,r;if(n)for(var o=void 0,k=0;k<n.length;++k)o=n[k],o.marker.collapsed&&(t?o.from:o.to)==null&&(!r||Er(r,o.marker)<0)&&(r=o.marker);return r}function dr(e){return Ht(e,!0)}function Xt(e){return Ht(e,!1)}function hn(e,t){var n=Pr&&e.markedSpans,r;if(n)for(var o=0;o<n.length;++o){var k=n[o];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!r||Er(r,k.marker)<0)&&(r=k.marker)}return r}function lr(e,t,n,r,o){var k=yt(e,t),W=Pr&&k.markedSpans;if(W)for(var Q=0;Q<W.length;++Q){var Z=W[Q];if(!Z.marker.collapsed)continue;var te=Z.marker.find(0),fe=ht(te.from,n)||or(Z.marker)-or(o),ye=ht(te.to,r)||Gt(Z.marker)-Gt(o);if(fe>=0&&ye<=0||fe<=0&&ye>=0)continue;if(fe<=0&&(Z.marker.inclusiveRight&&o.inclusiveLeft?ht(te.to,n)>=0:ht(te.to,n)>0)||fe>=0&&(Z.marker.inclusiveRight&&o.inclusiveLeft?ht(te.from,r)<=0:ht(te.from,r)<0))return!0}}function Ir(e){for(var t;t=dr(e);)e=t.find(-1,!0).line;return e}function Kn(e){for(var t;t=Xt(e);)e=t.find(1,!0).line;return e}function Vn(e){for(var t,n;t=Xt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xn(e,t){var n=yt(e,t),r=Ir(n);return n==r?t:It(r)}function Ui(e,t){if(t>e.lastLine())return t;var n=yt(e,t),r;if(!Hr(e,n))return t;for(;r=Xt(n);)n=r.find(1,!0).line;return It(n)+1}function Hr(e,t){var n=Pr&&t.markedSpans;if(n)for(var r=void 0,o=0;o<n.length;++o){if(r=n[o],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fi(e,t,r))return!0}}function fi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return fi(e,r.line,nn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var o=void 0,k=0;k<t.markedSpans.length;++k)if(o=t.markedSpans[k],o.marker.collapsed&&!o.marker.widgetNode&&o.from==n.to&&(o.to==null||o.to!=n.from)&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&fi(e,t,o))return!0}function on(e){e=Ir(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var o=n.lines[r];if(o==e)break;t+=o.height}for(var k=n.parent;k;n=k,k=n.parent)for(var W=0;W<k.children.length;++W){var Q=k.children[W];if(Q==n)break;t+=Q.height}return t}function Xn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=dr(r);){var o=n.find(0,!0);r=o.from.line,t+=o.from.ch-o.to.ch}for(r=e;n=Xt(r);){var k=n.find(0,!0);t-=r.text.length-k.from.ch,r=k.to.line,t+=r.text.length-k.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=yt(n,n.first),t.maxLineLength=Xn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var o=Xn(r);o>t.maxLineLength&&(t.maxLineLength=o,t.maxLine=r)})}var Mn=function(e,t,n){this.text=e,ci(this,t),this.height=n?n(this):1};Mn.prototype.lineNo=function(){return It(this)},Ce(Mn);function $a(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),On(e),ci(e,n);var o=r?r(e):1;o!=e.height&&Ar(e,o)}function da(e){e.parent=null,On(e)}var xt={},Mt={};function wt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Mt:xt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var n=L("span",null,null,P?"padding-right: .1px":null),r={pre:L("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var k=o?t.rest[o-1]:t.line,W=void 0;r.pos=0,r.addToken=Zt,Dt(e.display.measure)&&(W=Je(k,e.doc.direction))&&(r.addToken=hr(r.addToken,W)),r.map=[];var Q=t!=e.display.externalMeasured&&It(k);Ut(k,r,Ge(e,k,Q)),k.styleClasses&&(k.styleClasses.bgClass&&(r.bgClass=G(k.styleClasses.bgClass,r.bgClass||"")),k.styleClasses.textClass&&(r.textClass=G(k.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ct(e.display.measure))),o==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(P){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 je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=G(r.pre.className,r.textClass||"")),r}function zt(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Zt(e,t,n,r,o,k,W){if(!t)return;var Q=e.splitSpaces?Wt(t,e.trailingSpace):t,Z=e.cm.state.specialChars,te=!1,fe;if(!Z.test(t))e.col+=t.length,fe=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,fe),j&&U<9&&(te=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var ye=0;;){Z.lastIndex=ye;var Pe=Z.exec(t),ke=Pe?Pe.index-ye:t.length-ye;if(ke){var We=document.createTextNode(Q.slice(ye,ye+ke));j&&U<9?fe.appendChild(u("span",[We])):fe.appendChild(We),e.map.push(e.pos,e.pos+ke,We),e.col+=ke,e.pos+=ke}if(!Pe)break;ye+=ke+1;var Xe=void 0;if(Pe[0]==" "){var qe=e.cm.options.tabSize,at=qe-e.col%qe;Xe=fe.appendChild(u("span",de(at),"cm-tab")),Xe.setAttribute("role","presentation"),Xe.setAttribute("cm-text"," "),e.col+=at}else Pe[0]=="\r"||Pe[0]==`
`?(Xe=fe.appendChild(u("span",Pe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Xe.setAttribute("cm-text",Pe[0]),e.col+=1):(Xe=e.cm.options.specialCharPlaceholder(Pe[0]),Xe.setAttribute("cm-text",Pe[0]),j&&U<9?fe.appendChild(u("span",[Xe])):fe.appendChild(Xe),e.col+=1);e.map.push(e.pos,e.pos+1,Xe),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,n||r||o||te||k||W){var ft=n||"";r&&(ft+=r),o&&(ft+=o);var ot=u("span",[fe],ft,k);if(W)for(var vt in W)W.hasOwnProperty(vt)&&vt!="style"&&vt!="class"&&ot.setAttribute(vt,W[vt]);return e.content.appendChild(ot)}e.content.appendChild(fe)}function Wt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",o=0;o<e.length;o++){var k=e.charAt(o);k==" "&&n&&(o==e.length-1||e.charCodeAt(o+1)==32)&&(k="\xA0"),r+=k,n=k==" "}return r}function hr(e,t){return function(n,r,o,k,W,Q,Z){o=o?o+" cm-force-border":"cm-force-border";for(var te=n.pos,fe=te+r.length;;){for(var ye=void 0,Pe=0;Pe<t.length&&!(ye=t[Pe],ye.to>te&&ye.from<=te);Pe++);if(ye.to>=fe)return e(n,r,o,k,W,Q,Z);e(n,r.slice(0,ye.to-te),o,k,null,Q,Z),k=null,r=r.slice(ye.to-te),te=ye.to}}}function _r(e,t,n,r){var o=!r&&n.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!r&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",n.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function Ut(e,t,n){var r=e.markedSpans,o=e.text,k=0;if(!r){for(var W=1;W<n.length;W+=2)t.addToken(t,o.slice(k,k=n[W]),wt(n[W+1],t.cm.options));return}for(var Q=o.length,Z=0,te=1,fe="",ye,Pe,ke=0,We,Xe,qe,at,ft;;){if(ke==Z){We=Xe=qe=Pe="",ft=null,at=null,ke=Infinity;for(var ot=[],vt=void 0,Lt=0;Lt<r.length;++Lt){var Tt=r[Lt],_t=Tt.marker;if(_t.type=="bookmark"&&Tt.from==Z&&_t.widgetNode)ot.push(_t);else if(Tt.from<=Z&&(Tt.to==null||Tt.to>Z||_t.collapsed&&Tt.to==Z&&Tt.from==Z)){if(Tt.to!=null&&Tt.to!=Z&&ke>Tt.to&&(ke=Tt.to,Xe=""),_t.className&&(We+=" "+_t.className),_t.css&&(Pe=(Pe?Pe+";":"")+_t.css),_t.startStyle&&Tt.from==Z&&(qe+=" "+_t.startStyle),_t.endStyle&&Tt.to==ke&&(vt||(vt=[])).push(_t.endStyle,Tt.to),_t.title&&((ft||(ft={})).title=_t.title),_t.attributes)for(var rr in _t.attributes)(ft||(ft={}))[rr]=_t.attributes[rr];_t.collapsed&&(!at||Er(at.marker,_t)<0)&&(at=Tt)}else Tt.from>Z&&ke>Tt.from&&(ke=Tt.from)}if(vt)for(var br=0;br<vt.length;br+=2)vt[br+1]==ke&&(Xe+=" "+vt[br]);if(!at||at.from==Z)for(var ar=0;ar<ot.length;++ar)_r(t,0,ot[ar]);if(at&&(at.from||0)==Z){if(_r(t,(at.to==null?Q+1:at.to)-Z,at.marker,at.from==null),at.to==null)return;at.to==Z&&(at=!1)}}if(Z>=Q)break;for(var zr=Math.min(Q,ke);;){if(fe){var Br=Z+fe.length;if(!at){var cr=Br>zr?fe.slice(0,zr-Z):fe;t.addToken(t,cr,ye?ye+We:We,qe,Z+cr.length==ke?Xe:"",Pe,ft)}if(Br>=zr){fe=fe.slice(zr-Z),Z=zr;break}Z=Br,qe=""}fe=o.slice(k,k=n[te++]),ye=wt(n[te++],t.cm.options)}}}function En(e,t,n){this.line=t,this.rest=Vn(t),this.size=this.rest?It(re(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Hr(e,t)}function Kt(e,t,n){for(var r=[],o,k=t;k<n;k=o){var W=new En(e.doc,yt(e.doc,k),k);o=k+W.size,r.push(W)}return r}var gr=null;function qr(e){gr?gr.ops.push(e):e.ownsGroup=gr={ops:[e],delayedCallbacks:[]}}function en(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var o=e.ops[r];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(n<t.length)}function Wi(e,t){var n=e.ownsGroup;if(!n)return;try{en(n)}finally{gr=null,t(n)}}var pi=null;function Cr(e,t){var n=$e(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),o;gr?o=gr.delayedCallbacks:pi?o=pi:(o=pi=[],setTimeout(Ms,0));for(var k=function(Q){o.push(function(){return n[Q].apply(null,r)})},W=0;W<n.length;++W)k(W)}function Ms(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var o=0;o<t.changes.length;o++){var k=t.changes[o];k=="text"?Is(e,t):k=="gutter"?Za(e,t,n,r):k=="class"?ha(e,t):k=="widget"&&_s(e,t,r)}t.changes=null}function mi(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),j&&U<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=mi(t);t.background=r.insertBefore(u("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Qa(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ft(e,t)}function Is(e,t){var n=t.text.className,r=Qa(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){Ps(e,t),t.line.wrapClass?mi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Za(e,t,n,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 o=mi(t);t.gutterBackground=u("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),o.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var W=mi(t),Q=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),W.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(u("div",rn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var te=e.display.gutterSpecs[Z].className,fe=k.hasOwnProperty(te)&&k[te];fe&&Q.appendChild(u("div",[fe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function _s(e,t,n){t.alignable&&(t.alignable=null);for(var r=w("CodeMirror-linewidget"),o=t.node.firstChild,k=void 0;o;o=k)k=o.nextSibling,r.test(o.className)&&t.node.removeChild(o);qa(e,t,n)}function Ns(e,t,n,r){var o=Qa(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),ha(e,t),Za(e,t,n,r),qa(e,t,r),t.node}function qa(e,t,n){if(eo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,n,!1)}function eo(e,t,n,r,o){if(!t.widgets)return;for(var k=mi(n),W=0,Q=t.widgets;W<Q.length;++W){var Z=Q[W],te=u("div",[Z.node],"CodeMirror-linewidget"+(Z.className?" "+Z.className:""));Z.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Fs(Z,te,n,r),e.display.input.setUneditable(te),o&&Z.above?k.insertBefore(te,n.gutter||n.text):k.appendChild(te),Cr(Z,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var o=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(o-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),c(t.display.measure,u("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function gn(e,t){for(var n=Ne(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Hi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=c(e.measure,u("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function cn(e){return me-e.display.nativeBarWidth}function Pn(e){return e.display.scroller.clientWidth-cn(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-cn(e)-e.display.barHeight}function Bs(e,t,n){var r=e.options.lineWrapping,o=r&&Pn(e);if(!t.measure.heights||r&&t.measure.width!=o){var k=t.measure.heights=[];if(r){t.measure.width=o;for(var W=t.text.firstChild.getClientRects(),Q=0;Q<W.length-1;Q++){var Z=W[Q],te=W[Q+1];Math.abs(Z.bottom-te.bottom)>2&&k.push((Z.bottom+te.top)/2-n.top)}}k.push(n.bottom-n.top)}}function ro(e,t,n){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 o=0;o<e.rest.length;o++)if(It(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Us(e,t){t=Ir(t);var n=It(t),r=e.display.externalMeasured=new En(e.doc,t,n);r.lineN=n;var o=r.built=Ft(e,r);return r.text=o.pre,c(e.display.lineMeasure,o.pre),r}function no(e,t,n,r){return fn(e,Yn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Yn(e,t){var n=It(t),r=pa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,xa(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var o=ro(r,t,n);return{line:t,view:r,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function fn(e,t,n,r,o){t.before&&(n=-1);var k=n+(r||""),W;return t.cache.hasOwnProperty(k)?W=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),W=Ws(e,t,n,r),W.bogus||(t.cache[k]=W)),{left:W.left,right:W.right,top:o?W.rtop:W.top,bottom:o?W.rbottom:W.bottom}}var io={left:0,right:0,top:0,bottom:0};function ao(e,t,n){for(var r,o,k,W,Q,Z,te=0;te<e.length;te+=3)if(Q=e[te],Z=e[te+1],t<Q?(o=0,k=1,W="left"):t<Z?(o=t-Q,k=o+1):(te==e.length-3||t==Z&&e[te+3]>t)&&(k=Z-Q,o=k-1,t>=Z&&(W="right")),o!=null){if(r=e[te+2],Q==Z&&n==(r.insertLeft?"left":"right")&&(W=n),n=="left"&&o==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],W="left";if(n=="right"&&o==Z-Q)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],W="right";break}return{node:r,start:o,end:k,collapse:W,coverStart:Q,coverEnd:Z}}function js(e,t){var n=io;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var o=e.length-1;o>=0&&!((n=e[o]).left!=n.right);o--);return n}function Ws(e,t,n,r){var o=ao(t.map,n,r),k=o.node,W=o.start,Q=o.end,Z=o.collapse,te;if(k.nodeType==3){for(var fe=0;fe<4;fe++){for(;W&&Ue(t.line.text.charAt(o.coverStart+W));)--W;for(;o.coverStart+Q<o.coverEnd&&Ue(t.line.text.charAt(o.coverStart+Q));)++Q;if(j&&U<9&&W==0&&Q==o.coverEnd-o.coverStart?te=k.parentNode.getBoundingClientRect():te=js(S(k,W,Q).getClientRects(),r),te.left||te.right||W==0)break;Q=W,W=W-1,Z="right"}j&&U<11&&(te=Hs(e.display.measure,te))}else{W>0&&(Z=r="right");var ye;e.options.lineWrapping&&(ye=k.getClientRects()).length>1?te=ye[r=="right"?ye.length-1:0]:te=k.getBoundingClientRect()}if(j&&U<9&&!W&&(!te||!te.left&&!te.right)){var Pe=k.parentNode.getClientRects()[0];Pe?te={left:Pe.left,right:Pe.left+Jn(e.display),top:Pe.top,bottom:Pe.bottom}:te=io}for(var ke=te.top-t.rect.top,We=te.bottom-t.rect.top,Xe=(ke+We)/2,qe=t.view.measure.heights,at=0;at<qe.length-1&&!(Xe<qe[at]);at++);var ft=at?qe[at-1]:0,ot=qe[at],vt={left:(Z=="right"?te.right:te.left)-t.rect.left,right:(Z=="left"?te.left:te.right)-t.rect.left,top:ft,bottom:ot};return!te.left&&!te.right&&(vt.bogus=!0),e.options.singleCursorHeightPerLine||(vt.rtop=ke,vt.rbottom=We),vt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,C(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vi(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return d&&a?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return d&&a?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=gi(e.widgets[n]));return t}function Gi(e,t,n,r,o){if(!o){var k=ma(t);n.top+=k,n.bottom+=k}if(r=="line")return n;r||(r="local");var W=on(t);if(r=="local"?W+=Hi(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var Q=e.display.lineSpace.getBoundingClientRect();W+=Q.top+(r=="window"?0:uo());var Z=Q.left+(r=="window"?0:lo());n.left+=Z,n.right+=Z}return n.top+=W,n.bottom+=W,n}function ho(e,t,n){if(n=="div")return t;var r=t.left,o=t.top;if(n=="page")r-=lo(),o-=uo();else if(n=="local"||!n){var k=e.display.sizer.getBoundingClientRect();r+=k.left,o+=k.top}var W=e.display.lineSpace.getBoundingClientRect();return{left:r-W.left,top:o-W.top}}function ga(e,t,n,r,o){return r||(r=yt(e.doc,t.line)),Gi(e,r,no(e,r,t.ch,o),n)}function sn(e,t,n,r,o,k){r=r||yt(e.doc,t.line),o||(o=Yn(e,r));function W(We,Xe){var qe=fn(e,o,We,Xe?"right":"left",k);return Xe?qe.left=qe.right:qe.right=qe.left,Gi(e,r,qe,n)}var Q=Je(r,e.doc.direction),Z=t.ch,te=t.sticky;if(Z>=r.text.length?(Z=r.text.length,te="before"):Z<=0&&(Z=0,te="after"),!Q)return W(te=="before"?Z-1:Z,te=="before");function fe(We,Xe,qe){var at=Q[Xe],ft=at.level==1;return W(qe?We-1:We,ft!=qe)}var ye=Ye(Q,Z,te),Pe=rt,ke=fe(Z,ye,te=="before");return Pe!=null&&(ke.other=fe(Z,Pe,te!="before")),ke}function co(e,t){var n=0;t=h(e.doc,t),e.options.lineWrapping||(n=Jn(e.display)*t.ch);var r=yt(e.doc,t.line),o=on(r)+Hi(e.display);return{left:n,right:n,top:o,bottom:o+r.height}}function va(e,t,n,r,o){var k=He(e,t,n);return k.xRel=o,r&&(k.outside=r),k}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var o=kr(r,n),k=r.first+r.size-1;if(o>k)return va(r.first+r.size-1,yt(r,k).text.length,null,1,1);t<0&&(t=0);for(var W=yt(r,o);;){var Q=Gs(e,W,o,t,n),Z=hn(W,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!Z)return Q;var te=Z.find(1);if(te.line==o)return te;W=yt(r,o=te.line)}}function fo(e,t,n,r){r-=ma(t);var o=t.text.length,k=Ze(function(W){return fn(e,n,W-1).bottom<=r},o,0);return o=Ze(function(W){return fn(e,n,W).top>r},k,o),{begin:k,end:o}}function po(e,t,n,r){n||(n=Yn(e,t));var o=Gi(e,t,fn(e,n,r),"line").top;return fo(e,t,n,o)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Gs(e,t,n,r,o){o-=on(t);var k=Yn(e,t),W=ma(t),Q=0,Z=t.text.length,te=!0,fe=Je(t,e.doc.direction);if(fe){var ye=(e.options.lineWrapping?Ks:zs)(e,t,n,k,fe,r,o);te=ye.level!=1,Q=te?ye.from:ye.to-1,Z=te?ye.to:ye.from-1}var Pe=null,ke=null,We=Ze(function(Lt){var Tt=fn(e,k,Lt);return Tt.top+=W,Tt.bottom+=W,ba(Tt,r,o,!1)?(Tt.top<=o&&Tt.left<=r&&(Pe=Lt,ke=Tt),!0):!1},Q,Z),Xe,qe,at=!1;if(ke){var ft=r-ke.left<ke.right-r,ot=ft==te;We=Pe+(ot?0:1),qe=ot?"after":"before",Xe=ft?ke.left:ke.right}else{!te&&(We==Z||We==Q)&&We++,qe=We==0?"after":We==t.text.length?"before":fn(e,k,We-(te?1:0)).bottom+W<=o==te?"after":"before";var vt=sn(e,He(n,We,qe),"line",t,k);Xe=vt.left,at=o<vt.top?-1:o>=vt.bottom?1:0}return We=Be(t.text,We,1),va(n,We,qe,at,r-Xe)}function zs(e,t,n,r,o,k,W){var Q=Ze(function(ye){var Pe=o[ye],ke=Pe.level!=1;return ba(sn(e,He(n,ke?Pe.to:Pe.from,ke?"before":"after"),"line",t,r),k,W,!0)},0,o.length-1),Z=o[Q];if(Q>0){var te=Z.level!=1,fe=sn(e,He(n,te?Z.from:Z.to,te?"after":"before"),"line",t,r);ba(fe,k,W,!0)&&fe.top>W&&(Z=o[Q-1])}return Z}function Ks(e,t,n,r,o,k,W){var Q=fo(e,t,r,W),Z=Q.begin,te=Q.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var fe=null,ye=null,Pe=0;Pe<o.length;Pe++){var ke=o[Pe];if(ke.from>=te||ke.to<=Z)continue;var We=ke.level!=1,Xe=fn(e,r,We?Math.min(te,ke.to)-1:Math.max(Z,ke.from)).right,qe=Xe<k?k-Xe+1e9:Xe-k;(!fe||ye>qe)&&(fe=ke,ye=qe)}return fe||(fe=o[o.length-1]),fe.from<Z&&(fe={from:Z,to:fe.to,level:fe.level}),fe.to>te&&(fe={from:fe.from,to:te,level:fe.level}),fe}var In;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(In==null){In=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)In.appendChild(document.createTextNode("x")),In.appendChild(u("br"));In.appendChild(document.createTextNode("x"))}c(e.measure,In);var n=In.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),C(e.measure),n||1}function Jn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),n=u("pre",[t],"CodeMirror-line-like");c(e.measure,n);var r=t.getBoundingClientRect(),o=(r.right-r.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function xa(e){for(var t=e.display,n={},r={},o=t.gutters.clientLeft,k=t.gutters.firstChild,W=0;k;k=k.nextSibling,++W){var Q=e.display.gutterSpecs[W].className;n[Q]=k.offsetLeft+k.clientLeft+o,r[Q]=k.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=$n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Jn(e.display)-3);return function(o){if(Hr(e.doc,o))return 0;var k=0;if(o.widgets)for(var W=0;W<o.widgets.length;W++)o.widgets[W].height&&(k+=o.widgets[W].height);return n?k+(Math.ceil(o.text.length/r)||1)*t:k+t}}function Ca(e){var t=e.doc,n=mo(e);t.iter(function(r){var o=n(r);o!=r.height&&Ar(r,o)})}function _n(e,t,n,r){var o=e.display;if(!n&&Ne(t).getAttribute("cm-not-content")=="true")return null;var k,W,Q=o.lineSpace.getBoundingClientRect();try{k=t.clientX-Q.left,W=t.clientY-Q.top}catch(ye){return null}var Z=ya(e,k,W),te;if(r&&Z.xRel>0&&(te=yt(e.doc,Z.line).text).length==Z.ch){var fe=Y(te,te.length,e.options.tabSize)-te.length;Z=He(Z.line,Math.max(0,Math.round((k-to(e.display).left)/Jn(e.display))-fe))}return Z}function Nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Nr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var o=e.display;if(r&&n<o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Pr&&xn(e.doc,t)<o.viewTo&&Sn(e);else if(n<=o.viewFrom)Pr&&Ui(e.doc,n+r)>o.viewFrom?Sn(e):(o.viewFrom+=r,o.viewTo+=r);else if(t<=o.viewFrom&&n>=o.viewTo)Sn(e);else if(t<=o.viewFrom){var k=zi(e,n,n+r,1);k?(o.view=o.view.slice(k.index),o.viewFrom=k.lineN,o.viewTo+=r):Sn(e)}else if(n>=o.viewTo){var W=zi(e,t,t,-1);W?(o.view=o.view.slice(0,W.index),o.viewTo=W.lineN):Sn(e)}else{var Q=zi(e,t,t,-1),Z=zi(e,n,n+r,1);Q&&Z?(o.view=o.view.slice(0,Q.index).concat(Kt(e,Q.lineN,Z.lineN)).concat(o.view.slice(Z.index)),o.viewTo+=r):Sn(e)}var te=o.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(o.externalMeasured=null))}function Cn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var k=r.view[Nn(e,t)];if(k.node==null)return;var W=k.changes||(k.changes=[]);le(W,n)==-1&&W.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zi(e,t,n,r){var o=Nn(e,t),k,W=e.display.view;if(!Pr||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var Q=e.display.viewFrom,Z=0;Z<o;Z++)Q+=W[Z].size;if(Q!=t){if(r>0){if(o==W.length-1)return null;k=Q+W[o].size-t,o++}else k=Q-t;t+=k,n+=k}for(;xn(e.doc,n)!=n;){if(o==(r<0?0:W.length-1))return null;n+=r*W[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Vs(e,t,n){var r=e.display,o=r.view;o.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Kt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Kt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Kt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function go(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var o=t[r];!o.hidden&&(!o.node||o.changes)&&++n}return n}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},o=r.cursors=document.createDocumentFragment(),k=r.selection=document.createDocumentFragment(),W=0;W<n.sel.ranges.length;W++){if(!t&&W==n.sel.primIndex)continue;var Q=n.sel.ranges[W];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var Z=Q.empty();(Z||e.options.showCursorWhenSelecting)&&yo(e,Q.head,o),Z||Xs(e,Q,k)}return r}function yo(e,t,n){var r=sn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=n.appendChild(u("div","\xA0","CodeMirror-cursor"));if(o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var k=n.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=r.other.left+"px",k.style.top=r.other.top+"px",k.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,o=e.doc,k=document.createDocumentFragment(),W=to(e.display),Q=W.left,Z=Math.max(r.sizerWidth,Pn(e)-r.sizer.offsetLeft)-W.right,te=o.direction=="ltr";function fe(ot,vt,Lt,Tt){vt<0&&(vt=0),vt=Math.round(vt),Tt=Math.round(Tt),k.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+ot+`px;
top: `+vt+"px; width: "+(Lt==null?Z-ot:Lt)+`px;
height: `+(Tt-vt)+"px"))}function ye(ot,vt,Lt){var Tt=yt(o,ot),_t=Tt.text.length,rr,br;function ar(cr,Ur){return ga(e,He(ot,cr),"div",Tt,Ur)}function zr(cr,Ur,Sr){var mr=po(e,Tt,null,cr),fr=Ur=="ltr"==(Sr=="after")?"left":"right",sr=Sr=="after"?mr.begin:mr.end-(/\s/.test(Tt.text.charAt(mr.end-1))?2:1);return ar(sr,fr)[fr]}var Br=Je(Tt,o.direction);return et(Br,vt||0,Lt==null?_t:Lt,function(cr,Ur,Sr,mr){var fr=Sr=="ltr",sr=ar(cr,fr?"left":"right"),jr=ar(Ur-1,fr?"right":"left"),ui=vt==null&&cr==0,kn=Lt==null&&Ur==_t,Dr=mr==0,pn=!Br||mr==Br.length-1;if(jr.top-sr.top<=3){var xr=(te?ui:kn)&&Dr,Xa=(te?kn:ui)&&pn,yn=xr?Q:(fr?sr:jr).left,Wn=Xa?Z:(fr?jr:sr).right;fe(yn,sr.top,Wn-yn,sr.bottom)}else{var Hn,Or,di,Ya;fr?(Hn=te&&ui&&Dr?Q:sr.left,Or=te?Z:zr(cr,Sr,"before"),di=te?Q:zr(Ur,Sr,"after"),Ya=te&&kn&&pn?Z:jr.right):(Hn=te?zr(cr,Sr,"before"):Q,Or=!te&&ui&&Dr?Z:sr.right,di=!te&&kn&&pn?Q:jr.left,Ya=te?zr(Ur,Sr,"after"):Z),fe(Hn,sr.top,Or-Hn,sr.bottom),sr.bottom<jr.top&&fe(Q,sr.bottom,null,jr.top),fe(di,jr.top,Ya-di,jr.bottom)}(!rr||Ki(sr,rr)<0)&&(rr=sr),Ki(jr,rr)<0&&(rr=jr),(!br||Ki(sr,br)<0)&&(br=sr),Ki(jr,br)<0&&(br=jr)}),{start:rr,end:br}}var Pe=t.from(),ke=t.to();if(Pe.line==ke.line)ye(Pe.line,Pe.ch,ke.ch);else{var We=yt(o,Pe.line),Xe=yt(o,ke.line),qe=Ir(We)==Ir(Xe),at=ye(Pe.line,Pe.ch,qe?We.text.length+1:null).end,ft=ye(ke.line,qe?0:null,ke.ch).start;qe&&(at.top<ft.top-2?(fe(at.right,at.top,null,at.bottom),fe(Q,ft.top,ft.left,ft.bottom)):fe(at.right,at.top,ft.left-at.right,at.bottom)),at.bottom<ft.top&&fe(Q,at.bottom,null,ft.top)}n.appendChild(k)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Qn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Qn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Qn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,E(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var o=t.view[r],k=e.options.lineWrapping,W=void 0,Q=0;if(o.hidden)continue;if(j&&U<8){var Z=o.node.offsetTop+o.node.offsetHeight;W=Z-n,n=Z}else{var te=o.node.getBoundingClientRect();W=te.bottom-te.top,!k&&o.text.firstChild&&(Q=o.text.firstChild.getBoundingClientRect().right-te.left-1)}var fe=o.line.height-W;if((fe>.005||fe<-.005)&&(Ar(o.line,W),Eo(o.line),o.rest))for(var ye=0;ye<o.rest.length;ye++)Eo(o.rest[ye]);if(Q>e.display.sizerWidth){var Pe=Math.ceil(Q/Jn(e.display));Pe>e.display.maxLineLength&&(e.display.maxLineLength=Pe,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Xi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Hi(e));var o=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,k=kr(t,r),W=kr(t,o);if(n&&n.ensure){var Q=n.ensure.from.line,Z=n.ensure.to.line;Q<k?(k=Q,W=kr(t,on(yt(t,Q))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=W&&(k=kr(t,on(yt(t,Z))-e.wrapper.clientHeight),W=Z)}return{from:k,to:Math.max(W,k+1)}}function Ys(e,t){if(Ve(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),o=null;if(t.top+r.top<0?o=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!m){var k=u("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Hi(e.display))+`px;
height: `+(t.bottom-t.top+cn(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(o),e.display.lineSpace.removeChild(k)}}function $s(e,t,n,r){r==null&&(r=0);var o;!e.options.lineWrapping&&t==n&&(t=t.ch?He(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?He(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var W=!1,Q=sn(e,t),Z=!n||n==t?Q:sn(e,n);o={left:Math.min(Q.left,Z.left),top:Math.min(Q.top,Z.top)-r,right:Math.max(Q.left,Z.left),bottom:Math.max(Q.bottom,Z.bottom)+r};var te=wa(e,o),fe=e.doc.scrollTop,ye=e.doc.scrollLeft;if(te.scrollTop!=null&&(xi(e,te.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(W=!0)),te.scrollLeft!=null&&(Fn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-ye)>1&&(W=!0)),!W)break}return o}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&Fn(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,k=fa(e),W={};t.bottom-t.top>k&&(t.bottom=t.top+k);var Q=e.doc.height+ca(n),Z=t.top<r,te=t.bottom>Q-r;if(t.top<o)W.scrollTop=Z?0:t.top;else if(t.bottom>o+k){var fe=Math.min(t.top,(te?Q:t.bottom)-k);fe!=o&&(W.scrollTop=fe)}var ye=e.options.fixedGutter?0:n.gutters.offsetWidth,Pe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ye,ke=Pn(e)-n.gutters.offsetWidth,We=t.right-t.left>ke;return We&&(t.right=t.left+ke),t.left<10?W.scrollLeft=0:t.left<Pe?W.scrollLeft=Math.max(0,t.left+ye-(We?0:10)):t.right>ke+Pe-3&&(W.scrollLeft=t.right+(We?0:10)-ke),W}function Aa(e,t){if(t==null)return;Yi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zn(e){Yi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,n){(t!=null||n!=null)&&Yi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Yi(e),e.curOp.scrollToPos=t}function Yi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=co(e,t.from),r=co(e,t.to);Co(e,n,r,t.margin)}}function Co(e,t,n,r){var o=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});bi(e,o.scrollLeft,o.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||Da(e,{top:t}),So(e,t,!0),O&&Da(e),Si(e,100)}function So(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Fn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+cn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Bn=function(e,t,n){this.cm=n;var r=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),Me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Me(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var o=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Bn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bn.prototype.zeroWidthHack=function(){var e=s&&!p?"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},Bn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var o=e.getBoundingClientRect(),k=n=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ci=function(){};Ci.prototype.update=function(){return{bottom:0,right:0}},Ci.prototype.setScrollLeft=function(){},Ci.prototype.setScrollTop=function(){},Ci.prototype.clear=function(){};function qn(e,t){t||(t=Ei(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var o=0;o<4&&n!=e.display.barWidth||r!=e.display.barHeight;o++)n!=e.display.barWidth&&e.options.lineWrapping&&Vi(e),To(e,Ei(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var wo={native:Bn,null:Ci};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Fn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Un(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:++Zs},qr(e.curOp)}function jn(e){var t=e.curOp;t&&Wi(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var o=0;o<t.length;o++)rl(t[o]);for(var k=0;k<t.length;k++)nl(t[k]);for(var W=0;W<t.length;W++)il(t[W])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $i(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vi(t),e.barMeasure=Ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+cn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Pn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&bo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fn(t,e.scrollLeft,!0,!0),e.scrollToPos){var o=$s(t,h(r,e.scrollToPos.from),h(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,o)}var k=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(k)for(var Q=0;Q<k.length;++Q)k[Q].lines.length||je(k[Q],"hide");if(W)for(var Z=0;Z<W.length;++Z)W[Z].lines.length&&je(W[Z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&je(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Gr(e,t){if(e.curOp)return t();Un(e);try{return t()}finally{jn(e)}}function vr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Un(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function Rr(e){return function(){if(this.curOp)return e.apply(this,arguments);Un(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function yr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Un(t);try{return e.apply(this,arguments)}finally{jn(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nt(e,t.highlightFrontier),o=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(r.line>=e.display.viewFrom){var W=k.styles,Q=k.text.length>e.options.maxHighlightLength?$t(t.mode,r.state):null,Z=xe(e,k,r,!0);Q&&(r.state=Q),k.styles=Z.styles;var te=k.styleClasses,fe=Z.classes;fe?k.styleClasses=fe:te&&(k.styleClasses=null);for(var ye=!W||W.length!=k.styles.length||te!=fe&&(!te||!fe||te.bgClass!=fe.bgClass||te.textClass!=fe.textClass),Pe=0;!ye&&Pe<W.length;++Pe)ye=W[Pe]!=k.styles[Pe];ye&&o.push(r.line),k.stateAfter=r.save(),r.nextLine()}else k.text.length<=e.options.maxHighlightLength&&gt(e,k.text,r),k.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),o.length&&Gr(e,function(){for(var k=0;k<o.length;k++)Cn(e,o[k],"text")})}var $i=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Xi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Pn(e),this.force=n,this.dims=xa(e),this.events=[]};$i.prototype.signal=function(e,t){be(e,t)&&this.events.push(arguments)},$i.prototype.finish=function(){for(var e=0;e<this.events.length;e++)je.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=cn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=cn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=_();if(!t||!D(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==_())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Sn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&go(e)==0)return!1;ko(e)&&(Sn(e),t.dims=xa(e));var o=r.first+r.size,k=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(o,t.visible.to+e.options.viewportMargin);n.viewFrom<k&&k-n.viewFrom<20&&(k=Math.max(r.first,n.viewFrom)),n.viewTo>W&&n.viewTo-W<20&&(W=Math.min(o,n.viewTo)),Pr&&(k=xn(e.doc,k),W=Ui(e.doc,W));var Q=k!=n.viewFrom||W!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,k,W),n.viewOffset=on(yt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Z=go(e);if(!Q&&Z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=sl(e);return Z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(te),C(n.cursorDiv),C(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Q&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Si(e,400)),n.updateLineNumbers=null,!0}function Lo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Pn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Xi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xi(e.display,e.doc,n));if(!La(e,t))break;Vi(e);var o=Ei(e);yi(e),qn(e,o),Ra(e,o),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new $i(e,t);if(La(e,n)){Vi(e),Lo(e,n);var r=Ei(e);yi(e),qn(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,o=e.options.lineNumbers,k=r.lineDiv,W=k.firstChild;function Q(We){var Xe=We.nextSibling;return P&&s&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),Xe}for(var Z=r.view,te=r.viewFrom,fe=0;fe<Z.length;fe++){var ye=Z[fe];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=k){var Pe=Ns(e,ye,te,n);k.insertBefore(Pe,W)}else{for(;W!=ye.node;)W=Q(W);var ke=o&&t!=null&&t<=te&&ye.lineNumber;ye.changes&&(le(ye.changes,"gutter")>-1&&(ke=!1),Ja(e,ye,te,n)),ke&&(C(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(rn(e.options,te)))),W=ye.node.nextSibling}te+=ye.size}for(;W;)W=Q(W)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+cn(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,k=r+"px",W=0;W<n.length;W++)if(!n[W].hidden){e.options.fixedGutter&&(n[W].gutter&&(n[W].gutter.style.left=k),n[W].gutterBackground&&(n[W].gutterBackground.style.left=k));var Q=n[W].alignable;if(Q)for(var Z=0;Z<Q.length;Z++)Q[Z].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=r+o+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=rn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var o=r.measure.appendChild(u("div",[u("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=o.firstChild.offsetWidth,W=o.offsetWidth-k;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(k,r.lineGutter.offsetWidth-W)+1,r.lineNumWidth=r.lineNumInnerWidth+W,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,o=0;o<e.length;o++){var k=e[o],W=null;if(typeof k!="string"&&(W=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:k,style:W})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(e){var t=e.gutters,n=e.gutterSpecs;C(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var o=n[r],k=o.className,W=o.style,Q=t.appendChild(u("div",null,"CodeMirror-gutter "+k));W&&(Q.style.cssText=W),k=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ka(e)}function Ti(e){Ro(e.display),Nr(e),Do(e)}function dl(e,t,n,r){var o=this;this.input=n,o.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=L("div",null,"CodeMirror-code"),o.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=u("div",null,"CodeMirror-cursors"),o.measure=u("div",null,"CodeMirror-measure"),o.lineMeasure=u("div",null,"CodeMirror-measure"),o.lineSpace=L("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var k=L("div",[o.lineSpace],"CodeMirror-lines");o.mover=u("div",[k],null,"position: relative"),o.sizer=u("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=u("div",null,null,"position: absolute; height: "+me+"px; width: 1px;"),o.gutters=u("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=u("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=u("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),j&&U<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),!P&&!(O&&i)&&(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Oa(r.gutters,r.lineNumbers),Ro(o),n.init(o)}var Ji=0,Jr=null;j?Jr=-.53:O?Jr=15:d?Jr=-.7:T&&(Jr=-1/3);function Oo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function hl(e){var t=Oo(e);return t.x*=Jr,t.y*=Jr,t}function Mo(e,t){var n=Oo(t),r=n.x,o=n.y,k=e.display,W=k.scroller,Q=W.scrollWidth>W.clientWidth,Z=W.scrollHeight>W.clientHeight;if(!(r&&Q||o&&Z))return;if(o&&s&&P){e:for(var te=t.target,fe=k.view;te!=W;te=te.parentNode)for(var ye=0;ye<fe.length;ye++)if(fe[ye].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!O&&!f&&Jr!=null){o&&Z&&xi(e,Math.max(0,W.scrollTop+o*Jr)),Fn(e,Math.max(0,W.scrollLeft+r*Jr)),(!o||o&&Z)&&ne(t),k.wheelStartX=null;return}if(o&&Jr!=null){var Pe=o*Jr,ke=e.doc.scrollTop,We=ke+k.wrapper.clientHeight;Pe<0?ke=Math.max(0,ke+Pe-50):We=Math.min(e.doc.height,We+Pe+50),Da(e,{top:ke,bottom:We})}Ji<20&&(k.wheelStartX==null?(k.wheelStartX=W.scrollLeft,k.wheelStartY=W.scrollTop,k.wheelDX=r,k.wheelDY=o,setTimeout(function(){if(k.wheelStartX==null)return;var Xe=W.scrollLeft-k.wheelStartX,qe=W.scrollTop-k.wheelStartY,at=qe&&k.wheelDY&&qe/k.wheelDY||Xe&&k.wheelDX&&Xe/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!at)return;Jr=(Jr*Ji+at)/(Ji+1),++Ji},200)):(k.wheelDX+=r,k.wheelDY+=o))}var Qr=function(e,t){this.ranges=e,this.primIndex=t};Qr.prototype.primary=function(){return this.ranges[this.primIndex]},Qr.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 n=this.ranges[t],r=e.ranges[t];if(!Nt(n.anchor,r.anchor)||!Nt(n.head,r.head))return!1}return!0},Qr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Yt(Vt(this.ranges[t].anchor),Vt(this.ranges[t].head));return new Qr(e,this.primIndex)},Qr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Qr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ht(t,r.from())>=0&&ht(e,r.to())<=0)return n}return-1};var Yt=function(e,t){this.anchor=e,this.head=t};Yt.prototype.from=function(){return er(this.anchor,this.head)},Yt.prototype.to=function(){return Qt(this.anchor,this.head)},Yt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ln(e,t,n){var r=e&&e.options.selectionsMayTouch,o=t[n];t.sort(function(Pe,ke){return ht(Pe.from(),ke.from())}),n=le(t,o);for(var k=1;k<t.length;k++){var W=t[k],Q=t[k-1],Z=ht(Q.to(),W.from());if(r&&!W.empty()?Z>0:Z>=0){var te=er(Q.from(),W.from()),fe=Qt(Q.to(),W.to()),ye=Q.empty()?W.from()==W.head:Q.from()==Q.head;k<=n&&--n,t.splice(--k,2,new Yt(ye?fe:te,ye?te:fe))}}return new Qr(t,n)}function Tn(e,t){return new Qr([new Yt(e,t||e)],0)}function wn(e){return e.text?He(e.from.line+e.text.length-1,re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return wn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=wn(t).ch-t.to.ch),He(n,r)}function Ma(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var o=e.sel.ranges[r];n.push(new Yt(Po(o.anchor,t),Po(o.head,t)))}return ln(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?He(n.line,e.ch-t.ch+n.ch):He(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var r=[],o=He(e.first,0),k=o,W=0;W<t.length;W++){var Q=t[W],Z=Io(Q.from,o,k),te=Io(wn(Q),o,k);if(o=Q.to,k=te,n=="around"){var fe=e.sel.ranges[W],ye=ht(fe.head,fe.anchor)<0;r[W]=new Yt(ye?te:Z,ye?Z:te)}else r[W]=new Yt(Z,Z)}return new Qr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=mt(e.options,e.doc.modeOption),wi(e)}function wi(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,Si(e,100),e.state.modeGen++,e.curOp&&Nr(e)}function _o(e,t){return t.from.ch==0&&t.to.ch==0&&re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ia(e,t,n,r){function o(ft){return n?n[ft]:null}function k(ft,ot,vt){$a(ft,ot,vt,r),Cr(ft,"change",ft,t)}function W(ft,ot){for(var vt=[],Lt=ft;Lt<ot;++Lt)vt.push(new Mn(te[Lt],o(Lt),r));return vt}var Q=t.from,Z=t.to,te=t.text,fe=yt(e,Q.line),ye=yt(e,Z.line),Pe=re(te),ke=o(te.length-1),We=Z.line-Q.line;if(t.full)e.insert(0,W(0,te.length)),e.remove(te.length,e.size-te.length);else if(_o(e,t)){var Xe=W(0,te.length-1);k(ye,ye.text,ke),We&&e.remove(Q.line,We),Xe.length&&e.insert(Q.line,Xe)}else if(fe==ye)if(te.length==1)k(fe,fe.text.slice(0,Q.ch)+Pe+fe.text.slice(Z.ch),ke);else{var qe=W(1,te.length-1);qe.push(new Mn(Pe+fe.text.slice(Z.ch),ke,r)),k(fe,fe.text.slice(0,Q.ch)+te[0],o(0)),e.insert(Q.line+1,qe)}else if(te.length==1)k(fe,fe.text.slice(0,Q.ch)+te[0]+ye.text.slice(Z.ch),o(0)),e.remove(Q.line+1,We);else{k(fe,fe.text.slice(0,Q.ch)+te[0],o(0)),k(ye,Pe+ye.text.slice(Z.ch),ke);var at=W(1,te.length-1);We>1&&e.remove(Q.line+1,We-1),e.insert(Q.line+1,at)}Cr(e,"change",e,t)}function An(e,t,n){function r(o,k,W){if(o.linked)for(var Q=0;Q<o.linked.length;++Q){var Z=o.linked[Q];if(Z.doc==k)continue;var te=W&&Z.sharedHist;if(n&&!te)continue;t(Z.doc,te),r(Z.doc,o,te)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Pa(e),Fo(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,Nr(e)}function Fo(e){(e.doc.direction=="rtl"?B:E)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Gr(e,function(){Fo(e),Nr(e)})}function Qi(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 _a(e,t){var n={from:Vt(t.from),to:wn(t),text:Mr(e,t.from,t.to)};return jo(e,n,t.from.line,t.to.line+1),An(e,function(r){return jo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=re(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Bo(e.done),re(e.done);if(e.done.length&&!re(e.done).ranges)return re(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),re(e.done)}function Uo(e,t,n,r){var o=e.history;o.undone.length=0;var k=+new Date,W,Q;if((o.lastOp==r||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(o,o.lastOp==r)))Q=re(W.changes),ht(t.from,t.to)==0&&ht(t.from,Q.to)==0?Q.to=wn(t):W.changes.push(_a(e,t));else{var Z=re(o.done);for((!Z||!Z.ranges)&&Zi(e.sel,o.done),W={changes:[_a(e,t)],generation:o.generation},o.done.push(W);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(n),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=k,o.lastOp=o.lastSelOp=r,o.lastOrigin=o.lastSelOrigin=t.origin,Q||je(e,"historyAdded")}function ml(e,t,n,r){var o=t.charAt(0);return o=="*"||o=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var o=e.history,k=r&&r.origin;n==o.lastSelOp||k&&o.lastSelOrigin==k&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==k||ml(e,k,re(o.done),t))?o.done[o.done.length-1]=t:Zi(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=k,o.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(o.undone)}function Zi(e,t){var n=re(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var o=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((o||(o=t["spans_"+e.id]={}))[k]=W.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],o=0;o<t.text.length;++o)r.push(vl(n[o]));return r}function Wo(e,t){var n=yl(e,t),r=an(e,t);if(!n)return r;if(!r)return n;for(var o=0;o<n.length;++o){var k=n[o],W=r[o];if(k&&W){e:for(var Q=0;Q<W.length;++Q){for(var Z=W[Q],te=0;te<k.length;++te)if(k[te].marker==Z.marker)continue e;k.push(Z)}}else W&&(n[o]=W)}return n}function ei(e,t,n){for(var r=[],o=0;o<e.length;++o){var k=e[o];if(k.ranges){r.push(n?Qr.prototype.deepCopy.call(k):k);continue}var W=k.changes,Q=[];r.push({changes:Q});for(var Z=0;Z<W.length;++Z){var te=W[Z],fe=void 0;if(Q.push({from:te.from,to:te.to,text:te.text}),t)for(var ye in te)(fe=ye.match(/^spans_(\d+)$/))&&(le(t,Number(fe[1]))>-1&&(re(Q)[ye]=te[ye],delete te[ye]))}}return r}function Na(e,t,n,r){if(r){var o=e.anchor;if(n){var k=ht(t,o)<0;k!=ht(n,o)<0?(o=t,t=n):k!=ht(t,n)<0&&(t=n)}return new Yt(o,t)}else return new Yt(n||t,t)}function qi(e,t,n,r,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),Lr(e,new Qr([Na(e.sel.primary(),t,n,o)],0),r)}function Ho(e,t,n){for(var r=[],o=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)r[k]=Na(e.sel.ranges[k],t[k],null,o);var W=ln(e.cm,r,e.sel.primIndex);Lr(e,W,n)}function Fa(e,t,n,r){var o=e.sel.ranges.slice(0);o[t]=n,Lr(e,ln(e.cm,o,e.sel.primIndex),r)}function Go(e,t,n,r){Lr(e,Tn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(o){this.ranges=[];for(var k=0;k<o.length;k++)this.ranges[k]=new Yt(h(e,o[k].anchor),h(e,o[k].head))},origin:n&&n.origin};return je(e,"beforeSelectionChange",e,r),e.cm&&je(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ln(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,o=re(r);o&&o.ranges?(r[r.length-1]=t,ea(e,t,n)):Lr(e,t,n)}function Lr(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(be(e,"beforeSelectionChange")||e.cm&&be(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Zn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),Cr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,n,r){for(var o,k=0;k<t.ranges.length;k++){var W=t.ranges[k],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],Z=ta(e,W.anchor,Q&&Q.anchor,n,r),te=ta(e,W.head,Q&&Q.head,n,r);(o||Z!=W.anchor||te!=W.head)&&(o||(o=t.ranges.slice(0,k)),o[k]=new Yt(Z,te))}return o?ln(e.cm,o,t.primIndex):t}function ti(e,t,n,r,o){var k=yt(e,t.line);if(k.markedSpans)for(var W=0;W<k.markedSpans.length;++W){var Q=k.markedSpans[W],Z=Q.marker,te="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,fe="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if((Q.from==null||(te?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(fe?Q.to>=t.ch:Q.to>t.ch))){if(o&&(je(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(k.markedSpans){--W;continue}else break;if(!Z.atomic)continue;if(n){var ye=Z.find(r<0?1:-1),Pe=void 0;if((r<0?fe:te)&&(ye=Yo(e,ye,-r,ye&&ye.line==t.line?k:null)),ye&&ye.line==t.line&&(Pe=ht(ye,n))&&(r<0?Pe<0:Pe>0))return ti(e,ye,t,r,o)}var ke=Z.find(r<0?-1:1);return(r<0?te:fe)&&(ke=Yo(e,ke,r,ke.line==t.line?k:null)),ke?ti(e,ke,t,r,o):null}}return t}function ta(e,t,n,r,o){var k=r||1,W=ti(e,t,n,k,o)||!o&&ti(e,t,n,k,!0)||ti(e,t,n,-k,o)||!o&&ti(e,t,n,-k,!0);return W||(e.cantEdit=!0,He(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?h(e,He(t.line-1)):null:n>0&&t.ch==(r||yt(e,t.line)).text.length?t.line<e.first+e.size-1?He(t.line+1,0):null:new He(t.line,t.ch+n)}function $o(e){e.setSelection(He(e.firstLine(),0),He(e.lastLine()),Te)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(o,k,W,Q){o&&(r.from=h(e,o)),k&&(r.to=h(e,k)),W&&(r.text=W),Q!==void 0&&(r.origin=Q)}),je(e,"beforeChange",e,r),e.cm&&je(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 ri(e,t,n){if(e.cm){if(!e.cm.curOp)return vr(e.cm,ri)(e,t,n);if(e.cm.state.suppressEdits)return}if((be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Gn&&!n&&Rn(e,t.from,t.to);if(r)for(var o=r.length-1;o>=0;--o)Qo(e,{from:r[o].from,to:r[o].to,text:o?[""]:t.text,origin:t.origin});else Qo(e,t)}function Qo(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var n=Ma(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),Ai(e,t,n,an(e,t));var r=[];An(e,function(o,k){!k&&le(r,o.history)==-1&&(ts(o.history,t),r.push(o.history)),Ai(o,t,null,an(o,t))})}function ra(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var o=e.history,k,W=e.sel,Q=t=="undo"?o.done:o.undone,Z=t=="undo"?o.undone:o.done,te=0;te<Q.length&&!(k=Q[te],n?k.ranges&&!k.equals(e.sel):!k.ranges);te++);if(te==Q.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(k=Q.pop(),k.ranges){if(Zi(k,Z),n&&!k.equals(e.sel)){Lr(e,k,{clearRedo:!1});return}W=k}else if(r){Q.push(k);return}else break;var fe=[];Zi(W,Z),Z.push({changes:fe,generation:o.generation}),o.generation=k.generation||++o.maxGeneration;for(var ye=be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"),Pe=function(Xe){var qe=k.changes[Xe];if(qe.origin=t,ye&&!Jo(e,qe,!1))return Q.length=0,{};fe.push(_a(e,qe));var at=Xe?Ma(e,qe):re(Q);Ai(e,qe,at,Wo(e,qe)),!Xe&&e.cm&&e.cm.scrollIntoView({from:qe.from,to:wn(qe)});var ft=[];An(e,function(ot,vt){!vt&&le(ft,ot.history)==-1&&(ts(ot.history,qe),ft.push(ot.history)),Ai(ot,qe,null,Wo(ot,qe))})},ke=k.changes.length-1;ke>=0;--ke){var We=Pe(ke);if(We)return We.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Qr(he(e.sel.ranges,function(o){return new Yt(He(o.anchor.line+t,o.anchor.ch),He(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){Nr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Cn(e.cm,r,"gutter")}}function Ai(e,t,n,r){if(e.cm&&!e.cm.curOp)return vr(e.cm,Ai)(e,t,n,r);if(t.to.line<e.first){Zo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);Zo(e,o),t={from:He(e.first,0),to:He(t.to.line+o,t.to.ch),text:[re(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:He(k,yt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),n||(n=Ma(e,t)),e.cm?xl(e.cm,t,r):Ia(e,t,r),ea(e,n,Te),e.cantEdit&&ta(e,He(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,o=e.display,k=t.from,W=t.to,Q=!1,Z=k.line;e.options.lineWrapping||(Z=It(Ir(yt(r,k.line))),r.iter(Z,W.line+1,function(ke){if(ke==o.maxLine)return Q=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Se(e),Ia(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(Z,k.line+t.text.length,function(ke){var We=Xn(ke);We>o.maxLineLength&&(o.maxLine=ke,o.maxLineLength=We,o.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Zr(r,k.line),Si(e,400);var te=t.text.length-(W.line-k.line)-1;t.full?Nr(e):k.line==W.line&&t.text.length==1&&!_o(e.doc,t)?Cn(e,k.line,"text"):Nr(e,k.line,W.line+1,te);var fe=be(e,"changes"),ye=be(e,"change");if(ye||fe){var Pe={from:k,to:W,text:t.text,removed:t.removed,origin:t.origin};ye&&Cr(e,"change",e,Pe),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Pe)}e.display.selForContextMenu=null}function ni(e,t,n,r,o){var k;r||(r=n),ht(r,n)<0&&(k=[r,n],n=k[0],r=k[1]),typeof t=="string"&&(t=e.splitLines(t)),ri(e,{from:n,to:r,text:t,origin:o})}function qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,n,r){for(var o=0;o<e.length;++o){var k=e[o],W=!0;if(k.ranges){k.copied||(k=e[o]=k.deepCopy(),k.copied=!0);for(var Q=0;Q<k.ranges.length;Q++)qo(k.ranges[Q].anchor,t,n,r),qo(k.ranges[Q].head,t,n,r);continue}for(var Z=0;Z<k.changes.length;++Z){var te=k.changes[Z];if(n<te.from.line)te.from=He(te.from.line+r,te.from.ch),te.to=He(te.to.line+r,te.to.ch);else if(t<=te.to.line){W=!1;break}}W||(e.splice(0,o+1),o=0)}}function ts(e,t){var n=t.from.line,r=t.to.line,o=t.text.length-(r-n)-1;es(e.done,n,r,o),es(e.undone,n,r,o)}function Li(e,t,n,r){var o=t,k=t;return typeof t=="number"?k=yt(e,z(e,t)):o=It(t),o==null?null:(r(k,o)&&e.cm&&Cn(e.cm,o,n),k)}function Di(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Di.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var o=this.lines[n];this.height-=o.height,da(o),Cr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,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,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function ki(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var o=e[r];t+=o.chunkSize(),n+=o.height,o.parent=this}this.size=t,this.height=n,this.parent=null}ki.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],o=r.chunkSize();if(e<o){var k=Math.min(t,o-e),W=r.height;if(r.removeInner(e,k),this.height-=W-r.height,o==k&&(this.children.splice(n--,1),r.parent=null),(t-=k)==0)break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Di))){var Q=[];this.collapse(Q),this.children=[new Di(Q)],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,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var o=this.children[r],k=o.chunkSize();if(e<=k){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var W=o.lines.length%25+25,Q=W;Q<o.lines.length;){var Z=new Di(o.lines.slice(Q,Q+=25));o.height-=Z.height,this.children.splice(++r,0,Z),Z.parent=this}o.lines=o.lines.slice(0,W),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ki(t);if(e.parent){e.size-=n.size,e.height-=n.height;var o=le(e.parent.children,e);e.parent.children.splice(o+1,0,n)}else{var r=new ki(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var o=this.children[r],k=o.chunkSize();if(e<k){var W=Math.min(t,k-e);if(o.iterN(e,W,n))return!0;if((t-=W)==0)break;e=0}else e-=k}}};var Ri=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Ri.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=It(n);if(r==null||!t)return;for(var o=0;o<t.length;++o)t[o]==this&&t.splice(o--,1);t.length||(n.widgets=null);var k=gi(this);Ar(n,Math.max(0,n.height-k)),e&&(Gr(e,function(){rs(e,n,-k),Cn(e,r,"widget")}),Cr(e,"lineWidgetCleared",e,this,r))},Ri.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var o=gi(this)-t;if(!o)return;Hr(this.doc,r)||Ar(r,r.height+o),n&&Gr(n,function(){n.curOp.forceUpdate=!0,rs(n,r,o),Cr(n,"lineWidgetChanged",n,e,It(r))})},Ce(Ri);function rs(e,t,n){on(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,n)}function El(e,t,n,r){var o=new Ri(e,n,r),k=e.cm;return k&&o.noHScroll&&(k.display.alignWidgets=!0),Li(e,t,"widget",function(W){var Q=W.widgets||(W.widgets=[]);if(o.insertAt==null?Q.push(o):Q.splice(Math.min(Q.length-1,Math.max(0,o.insertAt)),0,o),o.line=W,k&&!Hr(e,W)){var Z=on(W)<e.scrollTop;Ar(W,W.height+gi(o)),Z&&Aa(k,o.height),k.curOp.forceUpdate=!0}return!0}),k&&Cr(k,"lineWidgetAdded",k,o,typeof t=="number"?t:It(t)),o}var ns=0,Ln=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};Ln.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Un(e),be(this,"clear")){var n=this.find();n&&Cr(this,"clear",n.from,n.to)}for(var r=null,o=null,k=0;k<this.lines.length;++k){var W=this.lines[k],Q=nn(W.markedSpans,this);e&&!this.collapsed?Cn(e,It(W),"text"):e&&(Q.to!=null&&(o=It(W)),Q.from!=null&&(r=It(W))),W.markedSpans=mn(W.markedSpans,Q),Q.from==null&&this.collapsed&&!Hr(this.doc,W)&&e&&Ar(W,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var te=Ir(this.lines[Z]),fe=Xn(te);fe>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Nr(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Cr(e,"markerCleared",e,this,r,o),t&&jn(e),this.parent&&this.parent.clear()},Ln.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,o=0;o<this.lines.length;++o){var k=this.lines[o],W=nn(k.markedSpans,this);if(W.from!=null&&(n=He(t?k:It(k),W.from),e==-1))return n;if(W.to!=null&&(r=He(t?k:It(k),W.to),e==1))return r}return n&&{from:n,to:r}},Ln.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Gr(r,function(){var o=t.line,k=It(t.line),W=pa(r,k);if(W&&(oo(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Hr(n.doc,o)&&n.height!=null){var Q=n.height;n.height=null;var Z=gi(n)-Q;Z&&Ar(o,o.height+Z)}Cr(r,"markerChanged",r,e)})},Ln.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||le(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ln.prototype.detachLine=function(e){if(this.lines.splice(le(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ce(Ln);function ii(e,t,n,r,o){if(r&&r.shared)return Cl(e,t,n,r,o);if(e.cm&&!e.cm.curOp)return vr(e.cm,ii)(e,t,n,r,o);var k=new Ln(e,o),W=ht(t,n);if(r&&N(r,k,!1),W>0||W==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=L("span",[k.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(lr(e,t.line,t,n,k)||t.line!=n.line&&lr(e,n.line,t,n,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");Wr()}k.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Q=t.line,Z=e.cm,te;if(e.iter(Q,n.line+1,function(ye){Z&&k.collapsed&&!Z.options.lineWrapping&&Ir(ye)==Z.display.maxLine&&(te=!0),k.collapsed&&Q!=t.line&&Ar(ye,0),dn(ye,new bn(k,Q==t.line?t.ch:null,Q==n.line?n.ch:null)),++Q}),k.collapsed&&e.iter(t.line,n.line+1,function(ye){Hr(e,ye)&&Ar(ye,0)}),k.clearOnEnter&&Me(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Yr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++ns,k.atomic=!0),Z){if(te&&(Z.curOp.updateMaxLine=!0),k.collapsed)Nr(Z,t.line,n.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var fe=t.line;fe<=n.line;fe++)Cn(Z,fe,"text");k.atomic&&Vo(Z.doc),Cr(Z,"markerAdded",Z,k)}return k}var Oi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Oi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Cr(this,"clear")},Oi.prototype.find=function(e,t){return this.primary.find(e,t)},Ce(Oi);function Cl(e,t,n,r,o){r=N(r),r.shared=!1;var k=[ii(e,t,n,r,o)],W=k[0],Q=r.widgetNode;return An(e,function(Z){Q&&(r.widgetNode=Q.cloneNode(!0)),k.push(ii(Z,h(Z,t),h(Z,n),r,o));for(var te=0;te<Z.linked.length;++te)if(Z.linked[te].isParent)return;W=re(k)}),new Oi(k,W)}function is(e){return e.findMarks(He(e.first,0),e.clipPos(He(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],o=r.find(),k=e.clipPos(o.from),W=e.clipPos(o.to);if(ht(k,W)){var Q=ii(e,k,W,r.primary,r.primary.type);r.markers.push(Q),Q.parent=r}}}function Tl(e){for(var t=function(r){var o=e[r],k=[o.primary.doc];An(o.primary.doc,function(Z){return k.push(Z)});for(var W=0;W<o.markers.length;W++){var Q=o.markers[W];le(k,Q.doc)==-1&&(Q.parent=null,o.markers.splice(W--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Fr=function(e,t,n,r,o){if(!(this instanceof Fr))return new Fr(e,t,n,r,o);n==null&&(n=0),ki.call(this,[new Di([new Mn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var k=He(n,0);this.sel=Tn(k),this.history=new Qi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=o=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ia(this,{from:k,to:k,text:e}),Lr(this,Tn(k),Te)};Fr.prototype=ie(ki.prototype,{constructor:Fr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:yr(function(e){var t=He(this.first,0),n=this.first+this.size-1;ri(this,{from:t,to:He(n,yt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),Lr(this,Tn(t),Te)}),replaceRange:function(e,t,n,r){t=h(this,t),n=n?h(this,n):t,ni(this,e,t,n,r)},getRange:function(e,t,n){var r=Mr(this,h(this,e),h(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Kr(this,e))return yt(this,e)},getLineNumber:function(e){return It(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=yt(this,e)),Ir(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return h(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:yr(function(e,t,n){Go(this,h(this,typeof e=="number"?He(e,t||0):e),null,n)}),setSelection:yr(function(e,t,n){Go(this,h(this,e),h(this,t||e),n)}),extendSelection:yr(function(e,t,n){qi(this,h(this,e),t&&h(this,t),n)}),extendSelections:yr(function(e,t){Ho(this,H(this,e),t)}),extendSelectionsBy:yr(function(e,t){var n=he(this.sel.ranges,e);Ho(this,H(this,n),t)}),setSelections:yr(function(e,t,n){if(!e.length)return;for(var r=[],o=0;o<e.length;o++)r[o]=new Yt(h(this,e[o].anchor),h(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Lr(this,ln(this.cm,r,t),n)}),addSelection:yr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Yt(h(this,e),h(this,t||e))),Lr(this,ln(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var o=Mr(this,t[r].from(),t[r].to());n=n?n.concat(o):o}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var o=Mr(this,n[r].from(),n[r].to());e!==!1&&(o=o.join(e||this.lineSeparator())),t[r]=o}return t},replaceSelection:function(e,t,n){for(var r=[],o=0;o<this.sel.ranges.length;o++)r[o]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:yr(function(e,t,n){for(var r=[],o=this.sel,k=0;k<o.ranges.length;k++){var W=o.ranges[k];r[k]={from:W.from(),to:W.to(),text:this.splitLines(e[k]),origin:n}}for(var Q=t&&t!="end"&&cl(this,r,t),Z=r.length-1;Z>=0;Z--)ri(this,r[Z]);Q?zo(this,Q):this.cm&&Zn(this.cm)}),undo:yr(function(){ra(this,"undo")}),redo:yr(function(){ra(this,"redo")}),undoSelection:yr(function(){ra(this,"undo",!0)}),redoSelection:yr(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Qi(this.history.maxGeneration),An(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:ei(this.history.done),undone:ei(this.history.undone)}},setHistory:function(e){var t=this.history=new Qi(this.history.maxGeneration);t.done=ei(e.done.slice(0),null,!0),t.undone=ei(e.undone.slice(0),null,!0)},setGutterMarker:yr(function(e,t,n){return Li(this,e,"gutter",function(r){var o=r.gutterMarkers||(r.gutterMarkers={});return o[t]=n,!n&&_e(o)&&(r.gutterMarkers=null),!0})}),clearGutter:yr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Li(t,n,"gutter",function(){return n.gutterMarkers[e]=null,_e(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Kr(this,e))return null;if(t=e,e=yt(this,e),!e)return null}else if(t=It(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:yr(function(e,t,n){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[o])r[o]=n;else{if(w(n).test(r[o]))return!1;r[o]+=" "+n}return!0})}),removeLineClass:yr(function(e,t,n){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=r[o];if(k)if(n==null)r[o]=null;else{var W=k.match(w(n));if(!W)return!1;var Q=W.index+W[0].length;r[o]=k.slice(0,W.index)+(!W.index||Q==k.length?"":" ")+k.slice(Q)||null}else return!1;return!0})}),addLineWidget:yr(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ii(this,h(this,e),h(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=h(this,e),ii(this,e,e,n,"bookmark")},findMarksAt:function(e){e=h(this,e);var t=[],n=yt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var o=n[r];(o.from==null||o.from<=e.ch)&&(o.to==null||o.to>=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,n){e=h(this,e),t=h(this,t);var r=[],o=e.line;return this.iter(e.line,t.line+1,function(k){var W=k.markedSpans;if(W)for(var Q=0;Q<W.length;Q++){var Z=W[Q];!(Z.to!=null&&o==e.line&&e.ch>=Z.to||Z.from==null&&o!=e.line||Z.from!=null&&o==t.line&&Z.from>=t.ch)&&(!n||n(Z.marker))&&r.push(Z.marker.parent||Z.marker)}++o}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(o){var k=o.text.length+r;if(k>e)return t=e,!0;e-=k,++n}),h(this,He(n,t))},indexFromPos:function(e){e=h(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Fr(tn(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,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Fr(tn(this,t,n),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}],Sl(r,is(this)),r},unlinkDoc:function(e){if(e instanceof ir&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(is(this));break}if(e.history==this.history){var r=[e.id];An(e,function(o){return r.push(o.id)},!0),e.history=new Qi(null),e.history.done=ei(this.history.done,r),e.history.undone=ei(this.history.undone,r)}},iterLinkedDocs:function(e){An(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:yr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Fr.prototype.eachLine=Fr.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),Ve(t,e)||gn(t.display,e))return;ne(e),j&&(as=+new Date);var n=_n(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var o=r.length,k=Array(o),W=0,Q=function(){++W==o&&vr(t,function(){n=h(t.doc,n);var ke={from:n,to:n,text:t.doc.splitLines(k.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};ri(t.doc,ke),zo(t.doc,Tn(h(t.doc,n),h(t.doc,wn(ke))))})()},Z=function(ke,We){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,ke.type)==-1){Q();return}var Xe=new FileReader;Xe.onerror=function(){return Q()},Xe.onload=function(){var qe=Xe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(qe)){Q();return}k[We]=qe,Q()},Xe.readAsText(ke)},te=0;te<r.length;te++)Z(r[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var fe=e.dataTransfer.getData("Text");if(fe){var ye;if(t.state.draggingText&&!t.state.draggingText.copy&&(ye=t.listSelections()),ea(t.doc,Tn(n,n)),ye)for(var Pe=0;Pe<ye.length;++Pe)ni(t.doc,"",ye[Pe].anchor,ye[Pe].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(ke){}}}function Ll(e,t){if(j&&(!e.state.draggingText||+new Date-as<100)){ve(t);return}if(Ve(e,t)||gn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!T){var n=u("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=_n(e,t);if(!n)return;var r=document.createDocumentFragment();yo(e,n,r),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),c(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var o=t[r].CodeMirror;o&&n.push(o)}n.length&&n[0].operation(function(){for(var k=0;k<n.length;k++)e(n[k])})}var ls=!1;function kl(){if(ls)return;Rl(),ls=!0}function Rl(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ol)},100))}),Me(window,"blur",function(){return ss(Qn)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Dn={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"},Mi=0;Mi<10;Mi++)Dn[Mi+48]=Dn[Mi+96]=String(Mi);for(var na=65;na<=90;na++)Dn[na]=String.fromCharCode(na);for(var Pi=1;Pi<=12;Pi++)Dn[Pi+111]=Dn[Pi+63235]="F"+Pi;var vn={};vn.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"},vn.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"},vn.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"},vn.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"]},vn.default=s?vn.macDefault:vn.pcDefault;function Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,o,k,W=0;W<t.length-1;W++){var Q=t[W];if(/^(cmd|meta|m)$/i.test(Q))k=!0;else if(/^a(lt)?$/i.test(Q))n=!0;else if(/^(c|ctrl|control)$/i.test(Q))r=!0;else if(/^s(hift)?$/i.test(Q))o=!0;else throw new Error("Unrecognized modifier name: "+Q)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var o=he(n.split(" "),Ml),k=0;k<o.length;k++){var W=void 0,Q=void 0;k==o.length-1?(Q=o.join(" "),W=r):(Q=o.slice(0,k+1).join(" "),W="...");var Z=t[Q];if(!Z)t[Q]=W;else if(Z!=W)throw new Error("Inconsistent bindings for "+Q)}delete e[n]}for(var te in t)e[te]=t[te];return e}function ai(e,t,n,r){t=ia(t);var o=t.call?t.call(e,r):t[e];if(o===!1)return"nothing";if(o==="...")return"multi";if(o!=null&&n(o))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ai(e,t.fallthrough,n,r);for(var k=0;k<t.fallthrough.length;k++){var W=ai(e,t.fallthrough[k],n,r);if(W)return W}}}function us(e){var t=typeof e=="string"?e:Dn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(f&&e.keyCode==34&&e.char)return!1;var n=Dn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ds(n,e,t))}function ia(e){return typeof e=="string"?vn[e]:e}function oi(e,t){for(var n=e.doc.sel.ranges,r=[],o=0;o<n.length;o++){for(var k=t(n[o]);r.length&&ht(k.from,re(r).to)<=0;){var W=r.pop();if(ht(W.from,k.from)<0){k.from=W.from;break}}r.push(k)}Gr(e,function(){for(var Q=r.length-1;Q>=0;Q--)ni(e.doc,"",r[Q].from,r[Q].to,"+delete");Zn(e)})}function Ba(e,t,n){var r=Be(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ua(e,t,n){var r=Ba(e,t.ch,n);return r==null?null:new He(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,o){if(e){t.doc.direction=="rtl"&&(o=-o);var k=Je(n,t.doc.direction);if(k){var W=o<0?re(k):k[0],Q=o<0==(W.level==1),Z=Q?"after":"before",te;if(W.level>0||t.doc.direction=="rtl"){var fe=Yn(t,n);te=o<0?n.text.length-1:0;var ye=fn(t,fe,te).top;te=Ze(function(Pe){return fn(t,fe,Pe).top==ye},o<0==(W.level==1)?W.from:W.to-1,te),Z=="before"&&(te=Ba(n,te,1))}else te=o<0?W.to:W.from;return new He(r,te,Z)}}return new He(r,o<0?n.text.length:0,o<0?"before":"after")}function Il(e,t,n,r){var o=Je(t,e.doc.direction);if(!o)return Ua(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var k=Ye(o,n.ch,n.sticky),W=o[k];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>n.ch:W.from<n.ch))return Ua(t,n,r);var Q=function(at,ft){return Ba(t,at instanceof He?at.ch:at,ft)},Z,te=function(at){return e.options.lineWrapping?(Z=Z||Yn(e,t),po(e,t,Z,at)):{begin:0,end:t.text.length}},fe=te(n.sticky=="before"?Q(n,-1):n.ch);if(e.doc.direction=="rtl"||W.level==1){var ye=W.level==1==r<0,Pe=Q(n,ye?1:-1);if(Pe!=null&&(ye?Pe<=W.to&&Pe<=fe.end:Pe>=W.from&&Pe>=fe.begin)){var ke=ye?"before":"after";return new He(n.line,Pe,ke)}}var We=function(at,ft,ot){for(var vt=function(rr,br){return br?new He(n.line,Q(rr,1),"before"):new He(n.line,rr,"after")};at>=0&&at<o.length;at+=ft){var Lt=o[at],Tt=ft>0==(Lt.level!=1),_t=Tt?ot.begin:Q(ot.end,-1);if(Lt.from<=_t&&_t<Lt.to)return vt(_t,Tt);if(_t=Tt?Lt.from:Q(Lt.to,-1),ot.begin<=_t&&_t<ot.end)return vt(_t,Tt)}},Xe=We(k+r,r,fe);if(Xe)return Xe;var qe=r>0?fe.end:Q(fe.begin,-1);return qe!=null&&!(r>0&&qe==t.text.length)&&(Xe=We(r>0?0:o.length-1,r,te(qe)),Xe)?Xe:null}var Ii={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Te)},killLine:function(e){return oi(e,function(t){if(t.empty()){var n=yt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:He(t.head.line+1,0)}:{from:t.head,to:He(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return oi(e,function(t){return{from:He(t.from().line,0),to:h(e.doc,He(t.to().line+1,0))}})},delLineLeft:function(e){return oi(e,function(t){return{from:He(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"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(He(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(He(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return _l(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Re)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Re)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},Re)},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=[],n=e.listSelections(),r=e.options.tabSize,o=0;o<n.length;o++){var k=n[o].from(),W=Y(e.getLine(k.line),k.ch,r);t.push(de(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Gr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var o=t[r].head,k=yt(e.doc,o.line).text;if(k){if(o.ch==k.length&&(o=new He(o.line,o.ch-1)),o.ch>0)o=new He(o.line,o.ch+1),e.replaceRange(k.charAt(o.ch-1)+k.charAt(o.ch-2),He(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var W=yt(e.doc,o.line-1).text;W&&(o=new He(o.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),He(o.line-1,W.length-1),o,"+transpose"))}}n.push(new Yt(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return Gr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Zn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var n=yt(e.doc,t),r=Ir(n);return r!=n&&(t=It(r)),ja(!0,e,r,t,1)}function _l(e,t){var n=yt(e.doc,t),r=Kn(n);return r!=n&&(t=It(r)),ja(!0,e,n,t,-1)}function fs(e,t){var n=cs(e,t.line),r=yt(e.doc,n.line),o=Je(r,e.doc.direction);if(!o||o[0].level==0){var k=Math.max(n.ch,r.text.search(/\S/)),W=t.line==n.line&&t.ch<=k&&t.ch;return He(n.line,W?0:k,n.sticky)}return n}function aa(e,t,n){if(typeof t=="string"&&(t=Ii[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),o=t(e)!=Ie}finally{e.display.shift=r,e.state.suppressEdits=!1}return o}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var o=ai(t,e.state.keyMaps[r],n,e);if(o)return o}return e.options.extraKeys&&ai(t,e.options.extraKeys,n,e)||ai(t,e.options.keyMap,n,e)}var Fl=new ee;function _i(e,t,n,r){var o=e.state.keySeq;if(o){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==o&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,o+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var o=Nl(e,t,r);return o=="multi"&&(e.state.keySeq=t),o=="handled"&&Cr(e,"keyHandled",e,t,n),(o=="handled"||o=="multi")&&(ne(n),Sa(e)),!!o}function ms(e,t){var n=hs(t,!0);return n?t.shiftKey&&!e.state.keySeq?_i(e,"Shift-"+n,t,function(r){return aa(e,r,!0)})||_i(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):_i(e,n,t,function(r){return aa(e,r)}):!1}function Bl(e,t,n){return _i(e,"'"+n+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=_(),Ve(t,e))return;j&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ms(t,e);f&&(Wa=r?n:null,!r&&n==88&&!jt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(E(t,"CodeMirror-crosshair"),ut(document,"keyup",n),ut(document,"mouseover",n))}Me(document,"keyup",n),Me(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ve(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(gn(t.display,e)||Ve(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(f&&n==Wa){Wa=null,ne(e);return}if(f&&(!e.which||e.which<10)&&ms(t,e))return;var o=String.fromCharCode(r==null?n:r);if(o=="\b")return;if(Bl(t,e,o))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ht(t,this.pos)==0&&n==this.button};var Ni,Fi;function Wl(e,t){var n=+new Date;return Fi&&Fi.compare(n,e,t)?(Ni=Fi=null,"triple"):Ni&&Ni.compare(n,e,t)?(Fi=new Ha(n,e,t),Ni=null,"double"):(Ni=new Ha(n,e,t),Fi=null,"single")}function bs(e){var t=this,n=t.display;if(Ve(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,gn(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=_n(t,e),o=Le(e),k=r?Wl(r,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,o,r,k,e))return;o==1?r?zl(t,r,k,e):Ne(e)==n.scroller&&ne(e):o==2?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):o==3&&(R?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,o){var k="Click";return r=="double"?k="Double"+k:r=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,_i(e,ds(k,o),o,function(W){if(typeof W=="string"&&(W=Ii[W]),!W)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=W(e,n)!=Ie}finally{e.state.suppressEdits=!1}return Q})}function Gl(e,t,n){var r=e.getOption("configureMouse"),o=r?r(e,t,n):{};if(o.unit==null){var k=l?n.shiftKey&&n.metaKey:n.altKey;o.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||n.shiftKey),o.addNew==null&&(o.addNew=s?n.metaKey:n.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(s?n.altKey:n.ctrlKey)),o}function zl(e,t,n,r){j?setTimeout(I(bo,e),0):e.curOp.focus=_();var o=Gl(e,n,r),k=e.doc.sel,W;e.options.dragDrop&&ze&&!e.isReadOnly()&&n=="single"&&(W=k.contains(t))>-1&&(ht((W=k.ranges[W]).from(),t)<0||t.xRel>0)&&(ht(W.to(),t)>0||t.xRel<0)?Kl(e,r,t,o):Vl(e,r,t,o)}function Kl(e,t,n,r){var o=e.display,k=!1,W=vr(e,function(te){P&&(o.scroller.draggable=!1),e.state.draggingText=!1,ut(o.wrapper.ownerDocument,"mouseup",W),ut(o.wrapper.ownerDocument,"mousemove",Q),ut(o.scroller,"dragstart",Z),ut(o.scroller,"drop",W),k||(ne(te),r.addNew||qi(e.doc,n,null,null,r.extend),P&&!T||j&&U==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),Q=function(te){k=k||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Z=function(){return k=!0};P&&(o.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Me(o.wrapper.ownerDocument,"mouseup",W),Me(o.wrapper.ownerDocument,"mousemove",Q),Me(o.scroller,"dragstart",Z),Me(o.scroller,"drop",W),xo(e),setTimeout(function(){return o.input.focus()},20)}function xs(e,t,n){if(n=="char")return new Yt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Yt(He(t.line,0),h(e.doc,He(t.line+1,0)));var r=n(e,t);return new Yt(r.from,r.to)}function Vl(e,t,n,r){var o=e.display,k=e.doc;ne(t);var W,Q,Z=k.sel,te=Z.ranges;if(r.addNew&&!r.extend?(Q=k.sel.contains(n),Q>-1?W=te[Q]:W=new Yt(n,n)):(W=k.sel.primary(),Q=k.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new Yt(n,n)),n=_n(e,t,!0,!0),Q=-1;else{var fe=xs(e,n,r.unit);r.extend?W=Na(W,fe.anchor,fe.head,r.extend):W=fe}r.addNew?Q==-1?(Q=te.length,Lr(k,ln(e,te.concat([W]),Q),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Q].empty()&&r.unit=="char"&&!r.extend?(Lr(k,ln(e,te.slice(0,Q).concat(te.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),Z=k.sel):Fa(k,Q,W,Oe):(Q=0,Lr(k,new Qr([W],0),Oe),Z=k.sel);var ye=n;function Pe(ot){if(ht(ye,ot)==0)return;if(ye=ot,r.unit=="rectangle"){for(var vt=[],Lt=e.options.tabSize,Tt=Y(yt(k,n.line).text,n.ch,Lt),_t=Y(yt(k,ot.line).text,ot.ch,Lt),rr=Math.min(Tt,_t),br=Math.max(Tt,_t),ar=Math.min(n.line,ot.line),zr=Math.min(e.lastLine(),Math.max(n.line,ot.line));ar<=zr;ar++){var Br=yt(k,ar).text,cr=Ee(Br,rr,Lt);rr==br?vt.push(new Yt(He(ar,cr),He(ar,cr))):Br.length>cr&&vt.push(new Yt(He(ar,cr),He(ar,Ee(Br,br,Lt))))}vt.length||vt.push(new Yt(n,n)),Lr(k,ln(e,Z.ranges.slice(0,Q).concat(vt),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ot)}else{var Ur=W,Sr=xs(e,ot,r.unit),mr=Ur.anchor,fr;ht(Sr.anchor,mr)>0?(fr=Sr.head,mr=er(Ur.from(),Sr.anchor)):(fr=Sr.anchor,mr=Qt(Ur.to(),Sr.head));var sr=Z.ranges.slice(0);sr[Q]=Xl(e,new Yt(h(k,mr),fr)),Lr(k,ln(e,sr,Q),Oe)}}var ke=o.wrapper.getBoundingClientRect(),We=0;function Xe(ot){var vt=++We,Lt=_n(e,ot,!0,r.unit=="rectangle");if(!Lt)return;if(ht(Lt,ye)!=0){e.curOp.focus=_(),Pe(Lt);var Tt=Xi(o,k);(Lt.line>=Tt.to||Lt.line<Tt.from)&&setTimeout(vr(e,function(){We==vt&&Xe(ot)}),150)}else{var _t=ot.clientY<ke.top?-20:ot.clientY>ke.bottom?20:0;_t&&setTimeout(vr(e,function(){if(We!=vt)return;o.scroller.scrollTop+=_t,Xe(ot)}),50)}}function qe(ot){e.state.selectingText=!1,We=Infinity,ot&&(ne(ot),o.input.focus()),ut(o.wrapper.ownerDocument,"mousemove",at),ut(o.wrapper.ownerDocument,"mouseup",ft),k.history.lastSelOrigin=null}var at=vr(e,function(ot){ot.buttons===0||!Le(ot)?qe(ot):Xe(ot)}),ft=vr(e,qe);e.state.selectingText=ft,Me(o.wrapper.ownerDocument,"mousemove",at),Me(o.wrapper.ownerDocument,"mouseup",ft)}function Xl(e,t){var n=t.anchor,r=t.head,o=yt(e.doc,n.line);if(ht(n,r)==0&&n.sticky==r.sticky)return t;var k=Je(o);if(!k)return t;var W=Ye(k,n.ch,n.sticky),Q=k[W];if(Q.from!=n.ch&&Q.to!=n.ch)return t;var Z=W+(Q.from==n.ch==(Q.level!=1)?0:1);if(Z==0||Z==k.length)return t;var te;if(r.line!=n.line)te=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=Ye(k,r.ch,r.sticky),ye=fe-W||(r.ch-n.ch)*(Q.level==1?-1:1);fe==Z-1||fe==Z?te=ye<0:te=ye>0}var Pe=k[Z+(te?-1:0)],ke=te==(Pe.level==1),We=ke?Pe.from:Pe.to,Xe=ke?"after":"before";return n.ch==We&&n.sticky==Xe?t:new Yt(new He(n.line,We,Xe),r)}function Es(e,t,n,r){var o,k;if(t.touches)o=t.touches[0].clientX,k=t.touches[0].clientY;else try{o=t.clientX,k=t.clientY}catch(Pe){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ne(t);var W=e.display,Q=W.lineDiv.getBoundingClientRect();if(k>Q.bottom||!be(e,n))return ce(t);k-=Q.top-W.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var te=W.gutters.childNodes[Z];if(te&&te.getBoundingClientRect().right>=o){var fe=kr(e.doc,k),ye=e.display.gutterSpecs[Z];return je(e,n,e,fe,ye.className,t),ce(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Cs(e,t){if(gn(e.display,t)||Yl(e,t))return;if(Ve(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return be(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var si={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function n(r,o,k,W){e.defaults[r]=o,k&&(t[r]=W?function(Q,Z,te){te!=si&&k(Q,Z,te)}:k)}e.defineOption=n,e.Init=si,n("value","",function(r,o){return r.setValue(o)},!0),n("mode",null,function(r,o){r.doc.modeOption=o,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),Nr(r)},!0),n("lineSeparator",null,function(r,o){if(r.doc.lineSep=o,!o)return;var k=[],W=r.doc.first;r.doc.iter(function(Z){for(var te=0;;){var fe=Z.text.indexOf(o,te);if(fe==-1)break;te=fe+o.length,k.push(He(W,fe))}W++});for(var Q=k.length-1;Q>=0;Q--)ni(r.doc,o,k[Q],He(k[Q].line,k[Q].ch+o.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,o,k){r.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),k!=si&&r.refresh()}),n("specialCharPlaceholder",zt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,o){return r.getInputField().spellcheck=o},!0),n("autocorrect",!1,function(r,o){return r.getInputField().autocorrect=o},!0),n("autocapitalize",!1,function(r,o){return r.getInputField().autocapitalize=o},!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),Ti(r)},!0),n("keyMap","default",function(r,o,k){var W=ia(o),Q=k!=si&&ia(k);Q&&Q.detach&&Q.detach(r,W),W.attach&&W.attach(r,Q||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,o){r.display.gutterSpecs=Oa(o,r.options.lineNumbers),Ti(r)},!0),n("fixedGutter",!0,function(r,o){r.display.gutters.style.left=o?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return qn(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,o){r.display.gutterSpecs=Oa(r.options.gutters,o),Ti(r)},!0),n("firstLineNumber",1,Ti,!0),n("lineNumberFormatter",function(r){return r},Ti,!0),n("showCursorWhenSelecting",!1,yi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,o){o=="nocursor"&&(Qn(r),r.display.input.blur()),r.display.input.readOnlyChanged(o)}),n("screenReaderLabel",null,function(r,o){o=o===""?null:o,r.display.input.screenReaderLabelChanged(o)}),n("disableInput",!1,function(r,o){o||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,yi,!0),n("singleCursorHeightPerLine",!0,yi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wi,!0),n("addModeClass",!1,wi,!0),n("pollInterval",100),n("undoDepth",200,function(r,o){return r.doc.history.undoDepth=o}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wi,!0),n("moveInputWithCursor",!0,function(r,o){o||r.display.input.resetPosition()}),n("tabindex",null,function(r,o){return r.display.input.getField().tabIndex=o||""}),n("autofocus",null),n("direction","ltr",function(r,o){return r.doc.setDirection(o)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=si;if(!t!=!r){var o=e.display.dragFunctions,k=t?Me:ut;k(e.display.scroller,"dragstart",o.start),k(e.display.scroller,"dragenter",o.enter),k(e.display.scroller,"dragover",o.over),k(e.display.scroller,"dragleave",o.leave),k(e.display.scroller,"drop",o.drop)}}function Ql(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Ca(e),Nr(e),vi(e),setTimeout(function(){return qn(e)},100)}function ir(e,t){var n=this;if(!(this instanceof ir))return new ir(e,t);this.options=t=t?N(t):{},N(Ts,t,!1);var r=t.value;typeof r=="string"?r=new Fr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var o=new ir.inputStyles[t.inputStyle](this),k=this.display=new dl(e,r,o,t);k.wrapper.CodeMirror=this,Ss(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!i&&k.input.focus(),j&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),kl(),Un(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Qn(this);for(var W in oa)oa.hasOwnProperty(W)&&oa[W](this,t[W],si);ko(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<za.length;++Q)za[Q](this);jn(this),P&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}ir.defaults=Ts,ir.optionHandlers=oa;function Zl(e){var t=e.display;Me(t.scroller,"mousedown",vr(e,bs)),j&&U<11?Me(t.scroller,"dblclick",vr(e,function(Z){if(Ve(e,Z))return;var te=_n(e,Z);if(!te||Ga(e,Z)||gn(e.display,Z))return;ne(Z);var fe=e.findWordAt(te);qi(e.doc,fe.anchor,fe.head)})):Me(t.scroller,"dblclick",function(Z){return Ve(e,Z)||ne(Z)}),Me(t.scroller,"contextmenu",function(Z){return Cs(e,Z)}),Me(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||Cs(e,Z)});var n,r={end:0};function o(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function k(Z){if(Z.touches.length!=1)return!1;var te=Z.touches[0];return te.radiusX<=1&&te.radiusY<=1}function W(Z,te){if(te.left==null)return!0;var fe=te.left-Z.left,ye=te.top-Z.top;return fe*fe+ye*ye>20*20}Me(t.scroller,"touchstart",function(Z){if(!Ve(e,Z)&&!k(Z)&&!Ga(e,Z)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},Z.touches.length==1&&(t.activeTouch.left=Z.touches[0].pageX,t.activeTouch.top=Z.touches[0].pageY)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(t.scroller,"touchend",function(Z){var te=t.activeTouch;if(te&&!gn(t,Z)&&te.left!=null&&!te.moved&&new Date-te.start<300){var fe=e.coordsChar(t.activeTouch,"page"),ye;!te.prev||W(te,te.prev)?ye=new Yt(fe,fe):!te.prev.prev||W(te,te.prev.prev)?ye=e.findWordAt(fe):ye=new Yt(He(fe.line,0),h(e.doc,He(fe.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),ne(Z)}o()}),Me(t.scroller,"touchcancel",o),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(Z){return Mo(e,Z)}),Me(t.scroller,"DOMMouseScroll",function(Z){return Mo(e,Z)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){Ve(e,Z)||ve(Z)},over:function(Z){Ve(e,Z)||(Dl(e,Z),ve(Z))},start:function(Z){return Ll(e,Z)},drop:vr(e,Al),leave:function(Z){Ve(e,Z)||os(e)}};var Q=t.input.getField();Me(Q,"keyup",function(Z){return vs.call(e,Z)}),Me(Q,"keydown",vr(e,gs)),Me(Q,"keypress",vr(e,ys)),Me(Q,"focus",function(Z){return Ta(e,Z)}),Me(Q,"blur",function(Z){return Qn(e,Z)})}var za=[];ir.defineInitHook=function(e){return za.push(e)};function Bi(e,t,n,r){var o=e.doc,k;n==null&&(n="add"),n=="smart"&&(o.mode.indent?k=nt(e,t).state:n="prev");var W=e.options.tabSize,Q=yt(o,t),Z=Y(Q.text,null,W);Q.stateAfter&&(Q.stateAfter=null);var te=Q.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(Q.text))fe=0,n="not";else if(n=="smart"&&(fe=o.mode.indent(k,Q.text.slice(te.length),Q.text),fe==Ie||fe>150)){if(!r)return;n="prev"}n=="prev"?t>o.first?fe=Y(yt(o,t-1).text,null,W):fe=0:n=="add"?fe=Z+e.options.indentUnit:n=="subtract"?fe=Z-e.options.indentUnit:typeof n=="number"&&(fe=Z+n),fe=Math.max(0,fe);var ye="",Pe=0;if(e.options.indentWithTabs)for(var ke=Math.floor(fe/W);ke;--ke)Pe+=W,ye+=" ";if(Pe<fe&&(ye+=de(fe-Pe)),ye!=te)return ni(o,ye,He(t,0),He(t,te.length),"+input"),Q.stateAfter=null,!0;for(var We=0;We<o.sel.ranges.length;We++){var Xe=o.sel.ranges[We];if(Xe.head.line==t&&Xe.head.ch<te.length){var qe=He(t,te.length);Fa(o,We,new Yt(qe,qe));break}}}var un=null;function sa(e){un=e}function Ka(e,t,n,r,o){var k=e.doc;e.display.shift=!1,r||(r=k.sel);var W=+new Date-200,Q=o=="paste"||e.state.pasteIncoming>W,Z=At(t),te=null;if(Q&&r.ranges.length>1)if(un&&un.text.join(`
`)==t){if(r.ranges.length%un.text.length==0){te=[];for(var fe=0;fe<un.text.length;fe++)te.push(k.splitLines(un.text[fe]))}}else Z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=he(Z,function(at){return[at]}));for(var ye=e.curOp.updateInput,Pe=r.ranges.length-1;Pe>=0;Pe--){var ke=r.ranges[Pe],We=ke.from(),Xe=ke.to();ke.empty()&&(n&&n>0?We=He(We.line,We.ch-n):e.state.overwrite&&!Q?Xe=He(Xe.line,Math.min(yt(k,Xe.line).text.length,Xe.ch+re(Z).length)):Q&&un&&un.lineWise&&un.text.join(`
`)==Z.join(`
`)&&(We=Xe=He(We.line,0)));var qe={from:We,to:Xe,text:te?te[Pe%te.length]:Z,origin:o||(Q?"paste":e.state.cutIncoming>W?"cut":"+input")};ri(e.doc,qe),Cr(e,"inputRead",e,qe)}t&&!Q&&As(e,t),Zn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ye),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Gr(t,function(){return Ka(t,n,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var o=n.ranges[r];if(o.head.ch>100||r&&n.ranges[r-1].head.line==o.head.line)continue;var k=e.getModeAt(o.head),W=!1;if(k.electricChars){for(var Q=0;Q<k.electricChars.length;Q++)if(t.indexOf(k.electricChars.charAt(Q))>-1){W=Bi(e,o.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(yt(e.doc,o.head.line).text.slice(0,o.head.ch))&&(W=Bi(e,o.head.line,"smart")));W&&Cr(e,"electricInput",e,o.head.line)}}function Ls(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var o=e.doc.sel.ranges[r].head.line,k={anchor:He(o,0),head:He(o+1,0)};n.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,o){var k=this.options,W=k[r];if(k[r]==o&&r!="mode")return;k[r]=o,t.hasOwnProperty(r)&&vr(this,t[r])(this,o,W),je(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,o){this.state.keyMaps[o?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var o=this.state.keyMaps,k=0;k<o.length;++k)if(o[k]==r||o[k].name==r)return o.splice(k,1),!0},addOverlay:Rr(function(r,o){var k=r.token?r:e.getMode(this.options,r);if(k.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:k,modeSpec:r,opaque:o&&o.opaque,priority:o&&o.priority||0},function(W){return W.priority}),this.state.modeGen++,Nr(this)}),removeOverlay:Rr(function(r){for(var o=this.state.overlays,k=0;k<o.length;++k){var W=o[k].modeSpec;if(W==r||typeof r=="string"&&W.name==r){o.splice(k,1),this.state.modeGen++,Nr(this);return}}}),indentLine:Rr(function(r,o,k){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),Kr(this.doc,r)&&Bi(this,r,o,k)}),indentSelection:Rr(function(r){for(var o=this.doc.sel.ranges,k=-1,W=0;W<o.length;W++){var Q=o[W];if(Q.empty())Q.head.line>k&&(Bi(this,Q.head.line,r,!0),k=Q.head.line,W==this.doc.sel.primIndex&&Zn(this));else{var Z=Q.from(),te=Q.to(),fe=Math.max(k,Z.line);k=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var ye=fe;ye<k;++ye)Bi(this,ye,r);var Pe=this.doc.sel.ranges;Z.ch==0&&o.length==Pe.length&&Pe[W].from().ch>0&&Fa(this.doc,W,new Yt(Z,Pe[W].to()),Te)}}}),getTokenAt:function(r,o){return tr(this,r,o)},getLineTokens:function(r,o){return tr(this,He(r),o,!0)},getTokenTypeAt:function(r){r=h(this.doc,r);var o=Ge(this,yt(this.doc,r.line)),k=0,W=(o.length-1)/2,Q=r.ch,Z;if(Q==0)Z=o[2];else for(;;){var te=k+W>>1;if((te?o[te*2-1]:0)>=Q)W=te;else if(o[te*2+1]<Q)k=te+1;else{Z=o[te*2+2];break}}var fe=Z?Z.indexOf("overlay "):-1;return fe<0?Z:fe==0?null:Z.slice(0,fe-1)},getModeAt:function(r){var o=this.doc.mode;return o.innerMode?e.innerMode(o,this.getTokenAt(r).state).mode:o},getHelper:function(r,o){return this.getHelpers(r,o)[0]},getHelpers:function(r,o){var k=[];if(!n.hasOwnProperty(o))return k;var W=n[o],Q=this.getModeAt(r);if(typeof Q[o]=="string")W[Q[o]]&&k.push(W[Q[o]]);else if(Q[o])for(var Z=0;Z<Q[o].length;Z++){var te=W[Q[o][Z]];te&&k.push(te)}else Q.helperType&&W[Q.helperType]?k.push(W[Q.helperType]):W[Q.name]&&k.push(W[Q.name]);for(var fe=0;fe<W._global.length;fe++){var ye=W._global[fe];ye.pred(Q,this)&&le(k,ye.val)==-1&&k.push(ye.val)}return k},getStateAfter:function(r,o){var k=this.doc;return r=z(k,r==null?k.first+k.size-1:r),nt(this,r+1,o).state},cursorCoords:function(r,o){var k,W=this.doc.sel.primary();return r==null?k=W.head:typeof r=="object"?k=h(this.doc,r):k=r?W.from():W.to(),sn(this,k,o||"page")},charCoords:function(r,o){return ga(this,h(this.doc,r),o||"page")},coordsChar:function(r,o){return r=ho(this,r,o||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,o){return r=ho(this,{top:r,left:0},o||"page").top,kr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,o,k){var W=!1,Q;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,W=!0),Q=yt(this.doc,r)}else Q=r;return Gi(this,Q,{top:0,left:0},o||"page",k||W).top+(W?this.doc.height-on(Q):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Jn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,o,k,W,Q){var Z=this.display;r=sn(this,h(this.doc,r));var te=r.bottom,fe=r.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),Z.sizer.appendChild(o),W=="over")te=r.top;else if(W=="above"||W=="near"){var ye=Math.max(Z.wrapper.clientHeight,this.doc.height),Pe=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(W=="above"||r.bottom+o.offsetHeight>ye)&&r.top>o.offsetHeight?te=r.top-o.offsetHeight:r.bottom+o.offsetHeight<=ye&&(te=r.bottom),fe+o.offsetWidth>Pe&&(fe=Pe-o.offsetWidth)}o.style.top=te+"px",o.style.left=o.style.right="",Q=="right"?(fe=Z.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(Q=="left"?fe=0:Q=="middle"&&(fe=(Z.sizer.clientWidth-o.offsetWidth)/2),o.style.left=fe+"px"),k&&Js(this,{left:fe,top:te,right:fe+o.offsetWidth,bottom:te+o.offsetHeight})},triggerOnKeyDown:Rr(gs),triggerOnKeyPress:Rr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Rr(bs),execCommand:function(r){if(Ii.hasOwnProperty(r))return Ii[r].call(null,this)},triggerElectric:Rr(function(r){As(this,r)}),findPosH:function(r,o,k,W){var Q=1;o<0&&(Q=-1,o=-o);for(var Z=h(this.doc,r),te=0;te<o&&!(Z=Va(this.doc,Z,Q,k,W),Z.hitSide);++te);return Z},moveH:Rr(function(r,o){var k=this;this.extendSelectionsBy(function(W){return k.display.shift||k.doc.extend||W.empty()?Va(k.doc,W.head,r,o,k.options.rtlMoveVisually):r<0?W.from():W.to()},Re)}),deleteH:Rr(function(r,o){var k=this.doc.sel,W=this.doc;k.somethingSelected()?W.replaceSelection("",null,"+delete"):oi(this,function(Q){var Z=Va(W,Q.head,r,o,!1);return r<0?{from:Z,to:Q.head}:{from:Q.head,to:Z}})}),findPosV:function(r,o,k,W){var Q=1,Z=W;o<0&&(Q=-1,o=-o);for(var te=h(this.doc,r),fe=0;fe<o;++fe){var ye=sn(this,te,"div");if(Z==null?Z=ye.left:ye.left=Z,te=Rs(this,ye,Q,k),te.hitSide)break}return te},moveV:Rr(function(r,o){var k=this,W=this.doc,Q=[],Z=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(fe){if(Z)return r<0?fe.from():fe.to();var ye=sn(k,fe.head,"div");fe.goalColumn!=null&&(ye.left=fe.goalColumn),Q.push(ye.left);var Pe=Rs(k,ye,r,o);return o=="page"&&fe==W.sel.primary()&&Aa(k,ga(k,Pe,"div").top-ye.top),Pe},Re),Q.length)for(var te=0;te<W.sel.ranges.length;te++)W.sel.ranges[te].goalColumn=Q[te]}),findWordAt:function(r){var o=this.doc,k=yt(o,r.line).text,W=r.ch,Q=r.ch;if(k){var Z=this.getHelper(r,"wordChars");(r.sticky=="before"||Q==k.length)&&W?--W:++Q;for(var te=k.charAt(W),fe=we(te,Z)?function(ye){return we(ye,Z)}:/\s/.test(te)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!we(ye)};W>0&&fe(k.charAt(W-1));)--W;for(;Q<k.length&&fe(k.charAt(Q));)++Q}return new Yt(He(r.line,W),He(r.line,Q))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),je(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==_()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Rr(function(r,o){bi(this,r,o)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-cn(this)-this.display.barHeight,width:r.scrollWidth-cn(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Pn(this)}},scrollIntoView:Rr(function(r,o){r==null?(r={from:this.doc.sel.primary().head,to:null},o==null&&(o=this.options.cursorScrollMargin)):typeof r=="number"?r={from:He(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=o||0,r.from.line!=null?Qs(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Rr(function(r,o){var k=this,W=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};r!=null&&(this.display.wrapper.style.width=W(r)),o!=null&&(this.display.wrapper.style.height=W(o)),this.options.lineWrapping&&so(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(Z){if(Z.widgets){for(var te=0;te<Z.widgets.length;te++)if(Z.widgets[te].noHScroll){Cn(k,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,je(this,"refresh",this)}),operation:function(r){return Gr(this,r)},startOperation:function(){return Un(this)},endOperation:function(){return jn(this)},refresh:Rr(function(){var r=this.display.cachedTextHeight;Nr(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-$n(this.display))>.5||this.options.lineWrapping)&&Ca(this),je(this,"refresh",this)}),swapDoc:Rr(function(r){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Cr(this,"swapDoc",this,o),o}),phrase:function(r){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,r)?o[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}},Ce(e),e.registerHelper=function(r,o,k){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][o]=k},e.registerGlobalHelper=function(r,o,k,W){e.registerHelper(r,o,W),n[r]._global.push({pred:k,val:W})}}function Va(e,t,n,r,o){var k=t,W=n,Q=yt(e,t.line),Z=o&&e.direction=="rtl"?-n:n;function te(){var ft=t.line+Z;return ft<e.first||ft>=e.first+e.size?!1:(t=new He(ft,t.ch,t.sticky),Q=yt(e,ft))}function fe(ft){var ot;if(r=="codepoint"){var vt=Q.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(vt)?ot=null:ot=new He(t.line,Math.max(0,Math.min(Q.text.length,t.ch+n*(vt>=55296&&vt<56320?2:1))),-n)}else o?ot=Il(e.cm,Q,t,n):ot=Ua(Q,t,n);if(ot==null)if(!ft&&te())t=ja(o,e.cm,Q,t.line,Z);else return!1;else t=ot;return!0}if(r=="char"||r=="codepoint")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var ye=null,Pe=r=="group",ke=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(n<0&&!fe(!We));We=!1){var Xe=Q.text.charAt(t.ch)||`
`,qe=we(Xe,ke)?"w":Pe&&Xe==`
`?"n":!Pe||/\s/.test(Xe)?null:"p";if(Pe&&!We&&!qe&&(qe="s"),ye&&ye!=qe){n<0&&(n=1,fe(),t.sticky="after");break}if(qe&&(ye=qe),n>0&&!fe(!We))break}var at=ta(e,t,k,W,!0);return Nt(k,at)&&(at.hitSide=!0),at}function Rs(e,t,n,r){var o=e.doc,k=t.left,W;if(r=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max(Q-.5*$n(e.display),3);W=(n>0?t.bottom:t.top)+n*Z}else r=="line"&&(W=n>0?t.bottom+3:t.top-3);for(var te;!(te=ya(e,k,W),!te.outside);){if(n<0?W<=0:W>=o.height){te.hitSide=!0;break}W+=n*5}return te}var qt=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};qt.prototype.init=function(e){var t=this,n=this,r=n.cm,o=n.div=e.lineDiv;Ds(o,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function k(Q){for(var Z=Q.target;Z;Z=Z.parentNode){if(Z==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Z.className))break}return!1}Me(o,"paste",function(Q){if(!k(Q)||Ve(r,Q)||ws(Q,r))return;U<=11&&setTimeout(vr(r,function(){return t.updateFromDOM()}),20)}),Me(o,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Me(o,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Me(o,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(o,"touchstart",function(){return n.forceCompositionEnd()}),Me(o,"input",function(){t.composing||t.readFromDOMSoon()});function W(Q){if(!k(Q)||Ve(r,Q))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Q.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Z=Ls(r);sa({lineWise:!0,text:Z.text}),Q.type=="cut"&&r.operation(function(){r.setSelections(Z.ranges,0,Te),r.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var te=un.text.join(`
`);if(Q.clipboardData.setData("Text",te),Q.clipboardData.getData("Text")==te){Q.preventDefault();return}}var fe=ks(),ye=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),ye.value=un.text.join(`
`);var Pe=document.activeElement;V(ye),setTimeout(function(){r.display.lineSpace.removeChild(fe),Pe.focus(),Pe==o&&n.showPrimarySelection()},50)}Me(o,"copy",W),Me(o,"cut",W)},qt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},qt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},qt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},qt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},qt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line<t.display.viewFrom){e.removeAllRanges();return}var k=la(t,e.anchorNode,e.anchorOffset),W=la(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&W&&!W.bad&&ht(er(k,W),r)==0&&ht(Qt(k,W),o)==0)return;var Q=t.display.view,Z=r.line>=t.display.viewFrom&&Os(t,r)||{node:Q[0].measure.map[2],offset:0},te=o.line<t.display.viewTo&&Os(t,o);if(!te){var fe=Q[Q.length-1].measure,ye=fe.maps?fe.maps[fe.maps.length-1]:fe.map;te={node:ye[ye.length-1],offset:ye[ye.length-2]-ye[ye.length-3]}}if(!Z||!te){e.removeAllRanges();return}var Pe=e.rangeCount&&e.getRangeAt(0),ke;try{ke=S(Z.node,Z.offset,te.offset,te.node)}catch(We){}ke&&(!O&&t.state.focused?(e.collapse(Z.node,Z.offset),ke.collapsed||(e.removeAllRanges(),e.addRange(ke))):(e.removeAllRanges(),e.addRange(ke)),Pe&&e.anchorNode==null?e.addRange(Pe):O&&this.startGracePeriod()),this.rememberSelection()},qt.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)},qt.prototype.showMultipleSelections=function(e){c(this.cm.display.cursorDiv,e.cursors),c(this.cm.display.selectionDiv,e.selection)},qt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},qt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},qt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},qt.prototype.blur=function(){this.div.blur()},qt.prototype.getField=function(){return this.div},qt.prototype.supportsTouch=function(){return!0},qt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Gr(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)},qt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},qt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(a&&d&&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 n=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);n&&r&&Gr(t,function(){Lr(t.doc,Tn(n,r),Te),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},qt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),o=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=He(r.line-1,yt(e.doc,r.line-1).length)),o.ch==yt(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=He(o.line+1,0)),r.line<t.viewFrom||o.line>t.viewTo-1)return!1;var k,W,Q;r.line==t.viewFrom||(k=Nn(e,r.line))==0?(W=It(t.view[0].line),Q=t.view[0].node):(W=It(t.view[k].line),Q=t.view[k-1].node.nextSibling);var Z=Nn(e,o.line),te,fe;if(Z==t.view.length-1?(te=t.viewTo-1,fe=t.lineDiv.lastChild):(te=It(t.view[Z+1].line)-1,fe=t.view[Z+1].node.previousSibling),!Q)return!1;for(var ye=e.doc.splitLines(tu(e,Q,fe,W,te)),Pe=Mr(e.doc,He(W,0),He(te,yt(e.doc,te).text.length));ye.length>1&&Pe.length>1;)if(re(ye)==re(Pe))ye.pop(),Pe.pop(),te--;else if(ye[0]==Pe[0])ye.shift(),Pe.shift(),W++;else break;for(var ke=0,We=0,Xe=ye[0],qe=Pe[0],at=Math.min(Xe.length,qe.length);ke<at&&Xe.charCodeAt(ke)==qe.charCodeAt(ke);)++ke;for(var ft=re(ye),ot=re(Pe),vt=Math.min(ft.length-(ye.length==1?ke:0),ot.length-(Pe.length==1?ke:0));We<vt&&ft.charCodeAt(ft.length-We-1)==ot.charCodeAt(ot.length-We-1);)++We;if(ye.length==1&&Pe.length==1&&W==r.line)for(;ke&&ke>r.ch&&ft.charCodeAt(ft.length-We-1)==ot.charCodeAt(ot.length-We-1);)ke--,We++;ye[ye.length-1]=ft.slice(0,ft.length-We).replace(/^\u200b+/,""),ye[0]=ye[0].slice(ke).replace(/\u200b+$/,"");var Lt=He(W,ke),Tt=He(te,Pe.length?re(Pe).length-We:0);if(ye.length>1||ye[0]||ht(Lt,Tt))return ni(e.doc,ye,Lt,Tt,"+input"),!0},qt.prototype.ensurePolled=function(){this.forceCompositionEnd()},qt.prototype.reset=function(){this.forceCompositionEnd()},qt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},qt.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)},qt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Gr(this.cm,function(){return Nr(e.cm)})},qt.prototype.setUneditable=function(e){e.contentEditable="false"},qt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||vr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},qt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},qt.prototype.onContextMenu=function(){},qt.prototype.resetPosition=function(){},qt.prototype.needsContentAttribute=!0;function Os(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=yt(e.doc,t.line),o=ro(n,r,t.line),k=Je(r,e.doc.direction),W="left";if(k){var Q=Ye(k,t.ch);W=Q%2?"right":"left"}var Z=ao(o.map,t.ch,W);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 li(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,o){var k="",W=!1,Q=e.doc.lineSeparator(),Z=!1;function te(ke){return function(We){return We.id==ke}}function fe(){W&&(k+=Q,Z&&(k+=Q),W=Z=!1)}function ye(ke){ke&&(fe(),k+=ke)}function Pe(ke){if(ke.nodeType==1){var We=ke.getAttribute("cm-text");if(We){ye(We);return}var Xe=ke.getAttribute("cm-marker"),qe;if(Xe){var at=e.findMarks(He(r,0),He(o+1,0),te(+Xe));at.length&&(qe=at[0].find(0))&&ye(Mr(e.doc,qe.from,qe.to).join(Q));return}if(ke.getAttribute("contenteditable")=="false")return;var ft=/^(pre|div|p|li|table|br)$/i.test(ke.nodeName);if(!/^br$/i.test(ke.nodeName)&&ke.textContent.length==0)return;ft&&fe();for(var ot=0;ot<ke.childNodes.length;ot++)Pe(ke.childNodes[ot]);/^(pre|p)$/i.test(ke.nodeName)&&(Z=!0),ft&&(W=!0)}else ke.nodeType==3&&ye(ke.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Pe(t),t==n);)t=t.nextSibling,Z=!1;return k}function la(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return li(e.clipPos(He(e.display.viewTo-1)),!0);t=null,n=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 o=0;o<e.display.view.length;o++){var k=e.display.view[o];if(k.node==r)return ru(k,t,n)}}function ru(e,t,n){var r=e.text.firstChild,o=!1;if(!t||!D(r,t))return li(He(It(e.line),0),!0);if(t==r&&(o=!0,t=r.childNodes[n],n=0,!t)){var k=e.rest?re(e.rest):e.line;return li(He(It(k),k.text.length),o)}var W=t.nodeType==3?t:null,Q=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,n&&(n=W.nodeValue.length));Q.parentNode!=r;)Q=Q.parentNode;var Z=e.measure,te=Z.maps;function fe(qe,at,ft){for(var ot=-1;ot<(te?te.length:0);ot++)for(var vt=ot<0?Z.map:te[ot],Lt=0;Lt<vt.length;Lt+=3){var Tt=vt[Lt+2];if(Tt==qe||Tt==at){var _t=It(ot<0?e.line:e.rest[ot]),rr=vt[Lt]+ft;return(ft<0||Tt!=qe)&&(rr=vt[Lt+(ft?1:0)]),He(_t,rr)}}}var ye=fe(W,Q,n);if(ye)return li(ye,o);for(var Pe=Q.nextSibling,ke=W?W.nodeValue.length-n:0;Pe;Pe=Pe.nextSibling){if(ye=fe(Pe,Pe.firstChild,0),ye)return li(He(ye.line,ye.ch-ke),o);ke+=Pe.textContent.length}for(var We=Q.previousSibling,Xe=n;We;We=We.previousSibling){if(ye=fe(We,We.firstChild,-1),ye)return li(He(ye.line,ye.ch+Xe),o);Xe+=We.textContent.length}}var ur=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};ur.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(o.style.width="0px"),Me(o,"input",function(){j&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Me(o,"paste",function(W){if(Ve(r,W)||ws(W,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function k(W){if(Ve(r,W))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Q=Ls(r);sa({lineWise:!0,text:Q.text}),W.type=="cut"?r.setSelections(Q.ranges,null,Te):(n.prevInput="",o.value=Q.text.join(`
`),V(o))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}Me(o,"cut",k),Me(o,"copy",k),Me(e.scroller,"paste",function(W){if(gn(e,W)||Ve(r,W))return;if(!o.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Q=new Event("paste");Q.clipboardData=W.clipboardData,o.dispatchEvent(Q)}),Me(e.lineSpace,"selectstart",function(W){gn(e,W)||ne(W)}),Me(o,"compositionstart",function(){var W=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:W,range:r.markText(W,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Me(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ur.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},ur.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ur.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var o=sn(e,n.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+W.top-k.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+W.left-k.left))}return r},ur.prototype.showSelection=function(e){var t=this.cm,n=t.display;c(n.cursorDiv,e.cursors),c(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ur.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&V(this.textarea),j&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",j&&U>=9&&(this.hasSelection=null))},ur.prototype.getField=function(){return this.textarea},ur.prototype.supportsTouch=function(){return!1},ur.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||_()!=this.textarea))try{this.textarea.focus()}catch(e){}},ur.prototype.blur=function(){this.textarea.blur()},ur.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ur.prototype.receivedFocus=function(){this.slowPoll()},ur.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()})},ur.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ur.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||pt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=n.value;if(o==r&&!t.somethingSelected())return!1;if(j&&U>=9&&this.hasSelection===o||s&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=o.charCodeAt(0);if(k==8203&&!r&&(r="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,Q=Math.min(r.length,o.length);W<Q&&r.charCodeAt(W)==o.charCodeAt(W);)++W;return Gr(t,function(){Ka(t,o.slice(W),r.length-W,null,e.composing?"*compose":null),o.length>1e3||o.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ur.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ur.prototype.onKeyPress=function(){j&&U>=9&&(this.hasSelection=null),this.fastPoll()},ur.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=_n(n,e),W=r.scroller.scrollTop;if(!k||f)return;var Q=n.options.resetSelectionOnContextMenu;Q&&n.doc.sel.contains(k)==-1&&vr(n,Lr)(n.doc,Tn(k),Te);var Z=o.style.cssText,te=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-fe.top-5)+"px; left: "+(e.clientX-fe.left-5)+`px;
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ye;P&&(ye=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ye),r.input.reset(),n.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=ke,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Pe(){if(o.selectionStart!=null){var Xe=n.somethingSelected(),qe="\u200B"+(Xe?o.value:"");o.value="\u21DA",o.value=qe,t.prevInput=Xe?"":"\u200B",o.selectionStart=1,o.selectionEnd=qe.length,r.selForContextMenu=n.doc.sel}}function ke(){if(t.contextMenuPending!=ke)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,o.style.cssText=Z,j&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),o.selectionStart!=null){(!j||j&&U<9)&&Pe();var Xe=0,qe=function(){r.selForContextMenu==n.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?vr(n,$o)(n):Xe++<10?r.detectingSelectAll=setTimeout(qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(qe,200)}}if(j&&U>=9&&Pe(),R){ve(e);var We=function(){ut(window,"mouseup",We),setTimeout(ke,20)};Me(window,"mouseup",We)}else setTimeout(ke,50)},ur.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ur.prototype.setUneditable=function(){},ur.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?N(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=_();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Q.getValue()}var o;if(e.form&&(Me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var k=e.form;o=k.submit;try{var W=k.submit=function(){r(),k.submit=o,k.submit(),k.submit=W}}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&&(ut(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var Q=ir(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return Q}function iu(e){e.off=ut,e.on=Me,e.wheelEventPixels=hl,e.Doc=Fr,e.splitLines=At,e.countColumn=Y,e.findColumn=Ee,e.isWordChar=ge,e.Pass=Ie,e.signal=je,e.Line=Mn,e.changeEnd=wn,e.scrollbarModel=wo,e.Pos=He,e.cmpPos=ht,e.modes=Ot,e.mimeModes=tt,e.resolveMode=St,e.getMode=mt,e.modeExtensions=lt,e.extendMode=Ct,e.copyState=$t,e.startState=nr,e.innerMode=Jt,e.commands=Ii,e.keyMap=vn,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ai,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=Oi,e.TextMarker=Ln,e.LineWidget=Ri,e.e_preventDefault=ne,e.e_stopPropagation=oe,e.e_stop=ve,e.addClass=B,e.contains=D,e.rmClass=E,e.keyNames=Dn}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Fr.prototype)Fr.prototype.hasOwnProperty(ua)&&le(au,ua)<0&&(ir.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Fr.prototype[ua]));return Ce(Fr),ir.inputStyles={textarea:ur,contenteditable:qt},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),Tr.apply(this,arguments)},ir.defineMIME=wr,ir.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ir.defineMIME("text/plain","null"),ir.defineExtension=function(e,t){ir.prototype[e]=t},ir.defineDocExtension=function(e,t){Fr.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},Y1PL:function(bt,De,q){"use strict";q.r(De),q.d(De,"ResizableTextArea",function(){return le});var ue=q("wx14"),J=q("1OyB"),O=q("vuIU"),$=q("Ji7U"),F=q("LK+K"),M=q("q1tI"),j=q("VTBJ"),U=q("rePB"),P=q("Zm9Q"),A=q("Kwbf"),d=q("c+Xe"),f=q("m+aA"),T=q("bdgK"),p=new Map;function m(Te){Te.forEach(function(Oe){var Re,Ee=Oe.target;(Re=p.get(Ee))===null||Re===void 0||Re.forEach(function(pe){return pe(Ee)})})}var g=new T.default(m),a=null,i=null;function s(Te,Oe){p.has(Te)||(p.set(Te,new Set),g.observe(Te)),p.get(Te).add(Oe)}function l(Te,Oe){p.has(Te)&&(p.get(Te).delete(Oe),p.get(Te).size||(g.unobserve(Te),p.delete(Te)))}var x=function(Te){Object($.a)(Re,Te);var Oe=Object(F.a)(Re);function Re(){return Object(J.a)(this,Re),Oe.apply(this,arguments)}return Object(O.a)(Re,[{key:"render",value:function(){return this.props.children}}]),Re}(M.Component),v=M.createContext(null);function y(Te){var Oe=Te.children,Re=Te.onBatchResize,Ee=M.useRef(0),pe=M.useRef([]),de=M.useContext(v),re=M.useCallback(function(he,se,Ae){Ee.current+=1;var ie=Ee.current;pe.current.push({size:he,element:se,data:Ae}),Promise.resolve().then(function(){ie===Ee.current&&(Re==null||Re(pe.current),pe.current=[])}),de==null||de(he,se,Ae)},[Re,de]);return M.createElement(v.Provider,{value:re},Oe)}function R(Te){var Oe=Te.children,Re=Te.disabled,Ee=M.useRef(null),pe=M.useRef(null),de=M.useContext(v),re=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=M.isValidElement(Oe)&&Object(d.c)(Oe),se=he?Oe.ref:null,Ae=M.useMemo(function(){return Object(d.a)(se,Ee)},[se,Ee]),ie=M.useRef(Te);ie.current=Te;var ae=M.useCallback(function(ge){var we=ie.current,_e=we.onResize,Fe=we.data,Ue=ge.getBoundingClientRect(),Be=Ue.width,Ze=Ue.height,et=ge.offsetWidth,rt=ge.offsetHeight,Ye=Math.floor(Be),st=Math.floor(Ze);if(re.current.width!==Ye||re.current.height!==st||re.current.offsetWidth!==et||re.current.offsetHeight!==rt){var Je={width:Ye,height:st,offsetWidth:et,offsetHeight:rt};re.current=Je;var Qe=et===Math.round(Be)?Be:et,Me=rt===Math.round(Ze)?Ze:rt,$e=Object(j.a)(Object(j.a)({},Je),{},{offsetWidth:Qe,offsetHeight:Me});de==null||de($e,ge,Fe),_e&&Promise.resolve().then(function(){_e($e,ge)})}},[]);return M.useEffect(function(){var ge=Object(f.a)(Ee.current)||Object(f.a)(pe.current);return ge&&!Re&&s(ge,ae),function(){return l(ge,ae)}},[Ee.current,Re]),M.createElement(x,{ref:pe},he?M.cloneElement(Oe,{ref:Ae}):Oe)}var w="rc-observer-key";function E(Te){var Oe=Te.children,Re=Object(P.a)(Oe);return Re.map(function(Ee,pe){var de=(Ee==null?void 0:Ee.key)||"".concat(w,"-").concat(pe);return M.createElement(R,Object(ue.a)({},Te,{key:de}),Ee)})}E.Collection=y;var C=E,c=q("bT9E"),u=q("TSYQ"),L=q.n(u),S=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,D=["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;function G(Te){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=Te.getAttribute("id")||Te.getAttribute("data-reactid")||Te.getAttribute("name");if(Oe&&_[Re])return _[Re];var Ee=window.getComputedStyle(Te),pe=Ee.getPropertyValue("box-sizing")||Ee.getPropertyValue("-moz-box-sizing")||Ee.getPropertyValue("-webkit-box-sizing"),de=parseFloat(Ee.getPropertyValue("padding-bottom"))+parseFloat(Ee.getPropertyValue("padding-top")),re=parseFloat(Ee.getPropertyValue("border-bottom-width"))+parseFloat(Ee.getPropertyValue("border-top-width")),he=D.map(function(Ae){return"".concat(Ae,":").concat(Ee.getPropertyValue(Ae))}).join(";"),se={sizingStyle:he,paddingSize:de,borderSize:re,boxSizing:pe};return Oe&&Re&&(_[Re]=se),se}function V(Te){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ee=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),Te.getAttribute("wrap")?B.setAttribute("wrap",Te.getAttribute("wrap")):B.removeAttribute("wrap");var pe=G(Te,Oe),de=pe.paddingSize,re=pe.borderSize,he=pe.boxSizing,se=pe.sizingStyle;B.setAttribute("style","".concat(se,";").concat(S)),B.value=Te.value||Te.placeholder||"";var Ae=Number.MIN_SAFE_INTEGER,ie=Number.MAX_SAFE_INTEGER,ae=B.scrollHeight,ge;if(he==="border-box"?ae+=re:he==="content-box"&&(ae-=de),Re!==null||Ee!==null){B.value=" ";var we=B.scrollHeight-de;Re!==null&&(Ae=we*Re,he==="border-box"&&(Ae=Ae+de+re),ae=Math.max(Ae,ae)),Ee!==null&&(ie=we*Ee,he==="border-box"&&(ie=ie+de+re),ge=ae>ie?"":"hidden",ae=Math.min(ie,ae))}return{height:ae,minHeight:Ae,maxHeight:ie,overflowY:ge,resize:"none"}}var I=q("Gytx"),N=q.n(I),Y;(function(Te){Te[Te.NONE=0]="NONE",Te[Te.RESIZING=1]="RESIZING",Te[Te.RESIZED=2]="RESIZED"})(Y||(Y={}));var ee=function(Te){Object($.a)(Re,Te);var Oe=Object(F.a)(Re);function Re(Ee){var pe;return Object(J.a)(this,Re),pe=Oe.call(this,Ee),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(de){pe.textArea=de},pe.handleResize=function(de){var re=pe.state.resizeStatus,he=pe.props,se=he.autoSize,Ae=he.onResize;if(re!==Y.NONE)return;typeof Ae=="function"&&Ae(de),se&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var de=pe.props.autoSize;if(!de||!pe.textArea)return;var re=de.minRows,he=de.maxRows,se=V(pe.textArea,!1,re,he);pe.setState({textareaStyles:se,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:Y.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:Y.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var de=pe.props,re=de.prefixCls,he=re===void 0?"rc-textarea":re,se=de.autoSize,Ae=de.onResize,ie=de.className,ae=de.disabled,ge=pe.state,we=ge.textareaStyles,_e=ge.resizeStatus,Fe=Object(c.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=L()(he,ie,Object(U.a)({},"".concat(he,"-disabled"),ae));"value"in Fe&&(Fe.value=Fe.value||"");var Be=Object(j.a)(Object(j.a)(Object(j.a)({},pe.props.style),we),_e===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(C,{onResize:pe.handleResize,disabled:!(se||Ae)},M.createElement("textarea",Object(ue.a)({},Fe,{className:Ue,style:Be,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:Y.NONE},pe}return Object(O.a)(Re,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!N()(pe.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var pe=this.textArea.selectionStart,de=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,de)}}catch(re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Re}(M.Component),le=ee,me=function(Te){Object($.a)(Re,Te);var Oe=Object(F.a)(Re);function Re(Ee){var pe;Object(J.a)(this,Re),pe=Oe.call(this,Ee),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(re){pe.resizableTextArea=re},pe.handleChange=function(re){var he=pe.props.onChange;pe.setValue(re.target.value,function(){pe.resizableTextArea.resizeTextarea()}),he&&he(re)},pe.handleKeyDown=function(re){var he=pe.props,se=he.onPressEnter,Ae=he.onKeyDown;re.keyCode===13&&se&&se(re),Ae&&Ae(re)};var de=typeof Ee.value=="undefined"||Ee.value===null?Ee.defaultValue:Ee.value;return pe.state={value:de},pe}return Object(O.a)(Re,[{key:"setValue",value:function(pe,de){"value"in this.props||this.setState({value:pe},de)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(le,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Re}(M.Component),Ie=De.default=me},ZW9T:function(bt,De,q){"use strict";q.d(De,"a",function(){return C});var ue=q("k1fw"),J=q("oBTY"),O=q("9og8"),$=q("miYZ"),F=q("tsqr"),M=q("rAM+"),j=q("tJVT"),U=q("PpiC"),P=q("WmNS"),A=q.n(P),d=q("q1tI"),f=q.n(d),T=q("bdgK");function p(c,u,L,S,D){var _=u.getWordUntilPosition(L),B={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:_.startColumn,endColumn:_.endColumn},G=S.map(function(V){return{label:V,kind:c.languages.CompletionItemKind.Keyword,insertText:V,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:B}});return D.map(function(V){G.push(Object(ue.a)(Object(ue.a)({},V),{},{range:B}))}),G}var m=function(c){var u={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];c.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(B,G){var V=p(c,B,G,L,[u]);return{suggestions:V}}});var S=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];c.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(B,G){var V=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],I=p(c,B,G,S,V);return{suggestions:I}}});var D=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];c.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(B,G){var V=[u,{label:"main",kind:c.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:c.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],I=p(c,B,G,D,V);return{suggestions:I}}})},g="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",a=q("fjLI"),i=q("LvDl"),s=q("+ua5");function l(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function x(){}var v=!1,y={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function R(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=c;if(Array.isArray(c)){for(var L=0;L<c.length;L++){var S=y[c[L]];if(S)return S}return u[0]}return y[u]||u}var w=null,E=De.b=function(c){var u=c.width,L=u===void 0?"100%":u,S=c.height,D=S===void 0?"100%":S,_=c.value,B=c.language,G=B===void 0?"javascript":B,V=c.style,I=V===void 0?{}:V,N=c.options,Y=N===void 0?{}:N,ee=c.overrideServices,le=ee===void 0?{}:ee,me=c.theme,Ie=me===void 0?"vs-dark":me,Te=c.onEditBlur,Oe=c.onSave,Re=c.autoHeight,Ee=Re===void 0?!1:Re,pe=c.forbidCopy,de=pe===void 0?!1:pe,re=c.onChange,he=re===void 0?x:re,se=c.editorDidMount,Ae=se===void 0?x:se,ie=c.onFocus,ae=ie===void 0?x:ie,ge=c.onBreakPoint,we=ge===void 0?x:ge,_e=c.breakPointValue,Fe=_e===void 0?[]:_e,Ue=c.filename,Be=Ue===void 0?"educoder.txt":Ue,Ze=c.errorLine,et=c.errorContent,rt=et===void 0?"":et,Ye=c.highlightLine,st=c.openBreakPoint,Je=st===void 0?!1:st,Qe=Object(U.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),Me=Object(d.useRef)(),$e=Object(d.useRef)({}),ut=Object(d.useRef)(),je=Object(d.useRef)(),Ve=Object(d.useRef)([]),Se=Object(d.useRef)(!1),be=Object(d.useRef)(),Ce=Object(d.useState)(!1),ne=Object(j.a)(Ce,2),oe=ne[0],ce=ne[1];function ve(){var mt;return Me.current&&(mt=new T.default(function(lt){var Ct=Object(M.a)(lt),$t;try{for(Ct.s();!($t=Ct.n()).done;){var Jt=$t.value;(Jt.target.offsetHeight>0||Jt.target.offsetWidth>0)&&$e.current.instance.layout()}}catch(nr){Ct.e(nr)}finally{Ct.f()}}),mt.observe(Me.current)),mt}function Ne(){F.b.warn({content:decodeURIComponent(g),key:"monaco-editor-tip"})}var Le=function(){var lt=$e.current.instance;if(_!=null&&lt&&oe){var Ct=lt.getModel();Ct&&_!==Ct.getValue()&&(v=!0,Ct.setValue(_),lt.layout(),v=!1)}};Object(d.useEffect)(function(){try{var mt,lt=$e.current.instance;je.current&&clearTimeout(je.current),je.current=setTimeout(function(){Le()},500),lt==null||((mt=lt.updateOptions)===null||mt===void 0)||mt.call(lt,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(_.split(/\r\n|\r|\n/g).length))+3,5)})}catch(Ct){debugger}},[_,oe,$e.current]),Object(d.useEffect)(function(){try{if(Ze&&$e.current&&$e.current.instance){var mt=$e.current.instance;mt.changeViewZones(function(Ct){var $t=document.createElement("div");$t.style.padding="10px 20px",$t.style.width="calc(100% - 20px)",$t.className="my-error-line-wrp",$t.innerHTML=rt,Ct.addZone({afterLineNumber:Ze||11,heightInLines:3,domNode:$t})});var lt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};mt.addOverlayWidget(lt),mt.revealPositionInCenter({lineNumber:20,column:1})}}catch(Ct){debugger}},[Ze,$e.current,oe]),Object(d.useEffect)(function(){var mt;if((mt=$e.current)!==null&&mt!==void 0&&mt.instance&&oe&&Je){var lt=$e.current.instance,Ct=lt.getModel();if(!Ct)return;var $t=function(){var ht=[],Nt=[],Vt=Ct.getAllDecorations(),Qt=Object(M.a)(Vt),er;try{for(Qt.s();!(er=Qt.n()).done;){var z=er.value;if(z.options.className==="highlighted-line"){var h;ht.push(z==null||((h=z.range)===null||h===void 0)?void 0:h.startLineNumber),Nt.push(z==null?void 0:z.id)}}}catch(H){Qt.e(H)}finally{Qt.f()}Ct.deltaDecorations(Nt,[]);var b=Ct.getLineCount();!!Ye&&Ye<=b&&(lt.deltaDecorations([],[{range:new w.Range(Ye,1,Ye,Ct.getLineMaxColumn(Ye)),options:{isWholeLine:!0,className:"highlighted-line"}}]),lt.revealLineInCenter(Ye))};$t();var Jt=function(){var ht=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Nt=[],Vt=[],Qt=Ct.getAllDecorations(),er=Object(M.a)(Qt),z;try{for(er.s();!(z=er.n()).done;){var h=z.value;if(h.options.linesDecorationsClassName==="breakpoints"){var b;Nt.push(h==null||((b=h.range)===null||b===void 0)?void 0:b.startLineNumber),Vt.push(h==null?void 0:h.id)}}}catch(H){er.e(H)}finally{er.f()}if(ht)return{lines:Nt,ids:Vt};we(Nt)},nr=function(){var He=Object(O.a)(A.a.mark(function ht(Nt){var Vt;return A.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return Vt={range:new w.Range(Nt,1,Nt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},er.next=3,Ct.deltaDecorations([],[Vt]);case 3:Jt();case 4:case"end":return er.stop()}},ht)}));return function(Nt){return He.apply(this,arguments)}}(),Pt=function(){var He=Object(O.a)(A.a.mark(function ht(Nt){var Vt,Qt,er,z,h;return A.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:Vt=[],Qt=lt.getLineDecorations(Nt),er=Object(M.a)(Qt);try{for(er.s();!(z=er.n()).done;)h=z.value,h.options.linesDecorationsClassName==="breakpoints"&&Vt.push(h.id)}catch(X){er.e(X)}finally{er.f()}return H.next=6,Ct.deltaDecorations(Vt,[]);case 6:Jt();case 7:case"end":return H.stop()}},ht)}));return function(Nt){return He.apply(this,arguments)}}(),yt=function(ht){var Nt=lt.getLineDecorations(ht),Vt=Object(M.a)(Nt),Qt;try{for(Vt.s();!(Qt=Vt.n()).done;){var er=Qt.value;if(er.options.linesDecorationsClassName==="breakpoints")return!0}}catch(z){Vt.e(z)}finally{Vt.f()}return!1};if(!Object(i.isEqual)(Fe,Jt(!0).lines)){Ct.deltaDecorations(Jt(!0).ids,[]);var Mr=Fe.map(function(He){return{range:new w.Range(He,1,He,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});Ct.deltaDecorations([],Mr)}var tn=lt.onDidChangeModelContent(function(He){var ht=lt.getPosition();if(ht){var Nt=ht.lineNumber;Ct.getLineContent(Nt).trim()===""?Pt(Nt):yt(Nt)&&(Pt(Nt),nr(Nt))}}),Ar=lt.onMouseDown(function(He){var ht,Nt,Vt;if(He.target.detail&&(ht=He.target)!==null&&ht!==void 0&&(Nt=ht.element)!==null&&Nt!==void 0&&(Vt=Nt.className)!==null&&Vt!==void 0&&Vt.includes("line-numbers")){var Qt=He.target.position.lineNumber;if(Ct.getLineContent(Qt).trim()==="")return;yt(Qt)?Pt(Qt):nr(Qt)}}),It=function(ht){var Nt={range:new w.Range(ht,1,ht,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Ve.current=lt.deltaDecorations(Ve.current,[Nt])},kr=function(){Ve.current=lt.deltaDecorations(Ve.current,[])},Kr=lt.onMouseMove(function(He){var ht,Nt,Vt;if(kr(),He.target.detail&&(ht=He.target)!==null&&ht!==void 0&&(Nt=ht.element)!==null&&Nt!==void 0&&(Vt=Nt.className)!==null&&Vt!==void 0&&Vt.includes("line-numbers")){var Qt=He.target.position.lineNumber;if(Ct.getLineContent(Qt).trim()==="")return;It(Qt)}}),rn=lt.onMouseLeave(function(){kr()});return function(){tn.dispose(),Ar.dispose(),Kr.dispose(),rn.dispose()}}},[$e.current,oe,Fe,Ye,Je]);function ze(){var mt=$e.current.instance;if(mt){var lt=mt.getSelection(),Ct=$e.current.pastePos||{},$t=new w.Range(Ct.startLineNumber||lt.endLineNumber,Ct.startColumn||lt.endColumn,Ct.endLineNumber||lt.endLineNumber,Ct.endColumn||lt.endColumn);setTimeout(function(){mt.executeEdits("",[{range:$t,text:""}])},300)}}function it(mt){(window.navigator.platform.match("Mac")?mt.metaKey:mt.ctrlKey)&&mt.keyCode==83&&(mt.preventDefault(),Oe())}var ct=function(){if(Ee&&$e.current.instance){var lt=$e.current.instance.getContentHeight();wr(lt<D?D:lt)}else wr(D)};function dt(mt){var lt=document.createEvent("MouseEvents");lt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),mt.dispatchEvent(lt)}var Dt=function(lt){var Ct=lt.keyCode,$t=lt.ctrlKey,Jt=lt.metaKey,nr=lt.target,Pt=lt.type;return(Pt==="paste"||(Ct===67||Ct===86)&&(Jt||$t))&&nr.nodeName==="TEXTAREA"&&(Ne(),lt.preventDefault()),!1};function At(mt,lt){var Ct=window.URL||window.webkitURL||window,$t=new Blob([lt]),Jt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Jt.href=Ct.createObjectURL($t),Jt.download=mt,dt(Jt)}Object(d.useEffect)(function(){ct()},[ct]),Object(d.useEffect)(function(){Me.current&&!oe&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(mt){try{w=mt,$e.current.instance=w.editor.create(Me.current,{value:_,language:R(G),theme:Ie,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},le);var lt=$e.current.instance,Ct=a.c._menuItems,$t=Object(J.a)(Ct).find(function(nr){return nr[0]._debugName=="EditorContext"});if(Ae(lt,w),setTimeout(function(){ct(),$e.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){At(Be||"educoder.txt",lt.getValue())}}),lt.getDomNode().addEventListener("input",function(){ut.current.autoFormat&&lt.getAction("editor.action.formatDocument").run()})},500),$e.current.subscription=lt.onDidChangeModelContent(function(nr){debugger;Se.current?clearTimeout(be.current):(ct(),he(lt.getValue(),nr)),be.current=setTimeout(function(){Se.current=!1},500)}),window.Monaco||m(w,R(G)),de&&(Me.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Dt),window.removeEventListener("paste",Dt),window.addEventListener("keydown",Dt),window.addEventListener("paste",Dt)),window.Monaco=w,Te&&lt.onDidBlurEditorWidget(function(){Te(lt.getValue())}),ae&&lt.onDidFocusEditorText(function(){ae(lt.getValue())}),de)try{window.addEventListener("paste",ze)}catch(nr){}var Jt=ve();return ce(!0),function(){var nr=$e.current.instance;nr.dispose();var Pt=nr.getModel();Pt&&Pt.dispose(),$e.current.subscription&&$e.current.subscription.dispose(),de&&window.removeEventListener("paste",ze),Jt.unobserve(Me.current)}}catch(nr){debugger}})},[]),Object(d.useEffect)(function(){var mt=$e.current.instance;if(mt&&oe)return document.addEventListener("keydown",it,!1),function(){document.removeEventListener("keydown",it)}},[Oe,oe]),Object(d.useEffect)(function(){var mt=$e.current.instance;if(mt&&oe){var lt=R(G);w.editor.setModelLanguage(mt.getModel(),lt)}},[G,oe]),Object(d.useEffect)(function(){var mt=$e.current.instance;mt&&oe&&w.editor.setTheme(Ie)},[Ie,oe]),Object(d.useEffect)(function(){var mt=$e.current.instance;ut.current=Y,mt&&oe&&(mt.updateOptions(Object(ue.a)({},Y)),setTimeout(function(){mt.getModel().updateOptions(Object(ue.a)({},Y))},200))},[JSON.stringify(Y),oe]),Object(d.useEffect)(function(){var mt=$e.current.instance;mt&&oe&&mt.layout()},[L,D,oe]);var pt=Object(d.useState)(l(L)),jt=Object(j.a)(pt,2),Et=jt[0],Rt=jt[1],Ot=Object(d.useState)(l(D)),tt=Object(j.a)(Ot,2),Tr=tt[0],wr=tt[1],St=Object(ue.a)(Object(ue.a)({},I),{},{width:Et,height:Tr});return f.a.createElement("div",{className:"my-monaco-editor",ref:Me,style:St})};function C(c){var u=c.width,L=u===void 0?"100%":u,S=c.height,D=S===void 0?"100%":S,_=c.original,B=c.modified,G=c.language,V=c.options,I=V===void 0?{}:V,N=Object(d.useRef)(),Y=Object(d.useState)(null),ee=Object(j.a)(Y,2),le=ee[0],me=ee[1];function Ie(Ee){var pe;return N.current&&(pe=new T.default(function(de){var re=Object(M.a)(de),he;try{for(re.s();!(he=re.n()).done;){var se=he.value;(se.target.offsetHeight>0||se.target.offsetWidth>0)&&Ee.layout()}}catch(Ae){re.e(Ae)}finally{re.f()}}),pe.observe(N.current)),pe}Object(d.useEffect)(function(){return N.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(Ee){w=Ee;var pe=w.editor.createDiffEditor(N.current,Object(ue.a)(Object(ue.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},I),{},{wordWrap:!0}));me(pe);var de=Ie(pe);return function(){pe.dispose();var re=pe.getModel();re&&re.dispose(),de.unobserve(N.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){le&&le.setModel({original:w.editor.createModel(_,G),modified:w.editor.createModel(B,G)})},[_,B,G,le]);var Te=l(L),Oe=l(D),Re={width:Te,height:Oe};return f.a.createElement("div",{className:"my-diff-editor",ref:N,style:Re})}},ZpRC:function(bt,De,q){"use strict";function ue(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function J(d,f){return(!f||d!=="hidden")&&d!=="visible"&&d!=="clip"}function O(d,f){if(d.clientHeight<d.scrollHeight||d.clientWidth<d.scrollWidth){var T=getComputedStyle(d,null);return J(T.overflowY,f)||J(T.overflowX,f)||function(p){var m=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(a){return null}}(p);return!!m&&(m.clientHeight<p.scrollHeight||m.clientWidth<p.scrollWidth)}(d)}return!1}function $(d,f,T,p,m,g,a,i){return g<d&&a>f||g>d&&a<f?0:g<=d&&i<=T||a>=f&&i>=T?g-d-p:a>f&&i<T||g<d&&i>T?a-f+m:0}var F=function(d,f){var T=window,p=f.scrollMode,m=f.block,g=f.inline,a=f.boundary,i=f.skipOverflowHiddenElements,s=typeof a=="function"?a:function(we){return we!==a};if(!ue(d))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,x=[],v=d;ue(v)&&s(v);){if((v=v.parentElement)===l){x.push(v);break}v!=null&&v===document.body&&O(v)&&!O(document.documentElement)||v!=null&&O(v,i)&&x.push(v)}for(var y=T.visualViewport?T.visualViewport.width:innerWidth,R=T.visualViewport?T.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,C=d.getBoundingClientRect(),c=C.height,u=C.width,L=C.top,S=C.right,D=C.bottom,_=C.left,B=m==="start"||m==="nearest"?L:m==="end"?D:L+c/2,G=g==="center"?_+u/2:g==="end"?S:_,V=[],I=0;I<x.length;I++){var N=x[I],Y=N.getBoundingClientRect(),ee=Y.height,le=Y.width,me=Y.top,Ie=Y.right,Te=Y.bottom,Oe=Y.left;if(p==="if-needed"&&L>=0&&_>=0&&D<=R&&S<=y&&L>=me&&D<=Te&&_>=Oe&&S<=Ie)return V;var Re=getComputedStyle(N),Ee=parseInt(Re.borderLeftWidth,10),pe=parseInt(Re.borderTopWidth,10),de=parseInt(Re.borderRightWidth,10),re=parseInt(Re.borderBottomWidth,10),he=0,se=0,Ae="offsetWidth"in N?N.offsetWidth-N.clientWidth-Ee-de:0,ie="offsetHeight"in N?N.offsetHeight-N.clientHeight-pe-re:0;if(l===N)he=m==="start"?B:m==="end"?B-R:m==="nearest"?$(E,E+R,R,pe,re,E+B,E+B+c,c):B-R/2,se=g==="start"?G:g==="center"?G-y/2:g==="end"?G-y:$(w,w+y,y,Ee,de,w+G,w+G+u,u),he=Math.max(0,he+E),se=Math.max(0,se+w);else{he=m==="start"?B-me-pe:m==="end"?B-Te+re+ie:m==="nearest"?$(me,Te,ee,pe,re+ie,B,B+c,c):B-(me+ee/2)+ie/2,se=g==="start"?G-Oe-Ee:g==="center"?G-(Oe+le/2)+Ae/2:g==="end"?G-Ie+de+Ae:$(Oe,Ie,le,Ee,de+Ae,G,G+u,u);var ae=N.scrollLeft,ge=N.scrollTop;B+=ge-(he=Math.max(0,Math.min(ge+he,N.scrollHeight-ee+ie))),G+=ae-(se=Math.max(0,Math.min(ae+se,N.scrollWidth-le+Ae)))}V.push({el:N,top:he,left:se})}return V};function M(d){return d===Object(d)&&Object.keys(d).length!==0}function j(d,f){f===void 0&&(f="auto");var T="scrollBehavior"in document.body.style;d.forEach(function(p){var m=p.el,g=p.top,a=p.left;m.scroll&&T?m.scroll({top:g,left:a,behavior:f}):(m.scrollTop=g,m.scrollLeft=a)})}function U(d){return d===!1?{block:"end",inline:"nearest"}:M(d)?d:{block:"start",inline:"nearest"}}function P(d,f){var T=!d.ownerDocument.documentElement.contains(d);if(M(f)&&typeof f.behavior=="function")return f.behavior(T?[]:F(d,f));if(T)return;var p=U(f);return j(F(d,p),p.behavior)}var A=De.a=P},Zss7:function(bt,De,q){var ue;(function(J){var O=/^\s+/,$=/\s+$/,F=0,M=J.round,j=J.min,U=J.max,P=J.random;function A(re,he){if(re=re||"",he=he||{},re instanceof A)return re;if(!(this instanceof A))return new A(re,he);var se=d(re);this._originalInput=re,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=M(100*this._a)/100,this._format=he.format||se.format,this._gradientType=he.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=se.ok,this._tc_id=F++}A.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var re=this.toRgb();return(re.r*299+re.g*587+re.b*114)/1e3},getLuminance:function(){var re=this.toRgb(),he,se,Ae,ie,ae,ge;return he=re.r/255,se=re.g/255,Ae=re.b/255,he<=.03928?ie=he/12.92:ie=J.pow((he+.055)/1.055,2.4),se<=.03928?ae=se/12.92:ae=J.pow((se+.055)/1.055,2.4),Ae<=.03928?ge=Ae/12.92:ge=J.pow((Ae+.055)/1.055,2.4),.2126*ie+.7152*ae+.0722*ge},setAlpha:function(re){return this._a=V(re),this._roundA=M(100*this._a)/100,this},toHsv:function(){var re=m(this._r,this._g,this._b);return{h:re.h*360,s:re.s,v:re.v,a:this._a}},toHsvString:function(){var re=m(this._r,this._g,this._b),he=M(re.h*360),se=M(re.s*100),Ae=M(re.v*100);return this._a==1?"hsv("+he+", "+se+"%, "+Ae+"%)":"hsva("+he+", "+se+"%, "+Ae+"%, "+this._roundA+")"},toHsl:function(){var re=T(this._r,this._g,this._b);return{h:re.h*360,s:re.s,l:re.l,a:this._a}},toHslString:function(){var re=T(this._r,this._g,this._b),he=M(re.h*360),se=M(re.s*100),Ae=M(re.l*100);return this._a==1?"hsl("+he+", "+se+"%, "+Ae+"%)":"hsla("+he+", "+se+"%, "+Ae+"%, "+this._roundA+")"},toHex:function(re){return a(this._r,this._g,this._b,re)},toHexString:function(re){return"#"+this.toHex(re)},toHex8:function(re){return i(this._r,this._g,this._b,this._a,re)},toHex8String:function(re){return"#"+this.toHex8(re)},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(I(this._r,255)*100)+"%",g:M(I(this._g,255)*100)+"%",b:M(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(I(this._r,255)*100)+"%, "+M(I(this._g,255)*100)+"%, "+M(I(this._b,255)*100)+"%)":"rgba("+M(I(this._r,255)*100)+"%, "+M(I(this._g,255)*100)+"%, "+M(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:B[a(this._r,this._g,this._b,!0)]||!1},toFilter:function(re){var he="#"+s(this._r,this._g,this._b,this._a),se=he,Ae=this._gradientType?"GradientType = 1, ":"";if(re){var ie=A(re);se="#"+s(ie._r,ie._g,ie._b,ie._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ae+"startColorstr="+he+",endColorstr="+se+")"},toString:function(re){var he=!!re;re=re||this._format;var se=!1,Ae=this._a<1&&this._a>=0,ie=!he&&Ae&&(re==="hex"||re==="hex6"||re==="hex3"||re==="hex4"||re==="hex8"||re==="name");return ie?re==="name"&&this._a===0?this.toName():this.toRgbString():(re==="rgb"&&(se=this.toRgbString()),re==="prgb"&&(se=this.toPercentageRgbString()),(re==="hex"||re==="hex6")&&(se=this.toHexString()),re==="hex3"&&(se=this.toHexString(!0)),re==="hex4"&&(se=this.toHex8String(!0)),re==="hex8"&&(se=this.toHex8String()),re==="name"&&(se=this.toName()),re==="hsl"&&(se=this.toHslString()),re==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(re,he){var se=re.apply(null,[this].concat([].slice.call(he)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(x,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(E,arguments)},_applyCombination:function(re,he){return re.apply(null,[this].concat([].slice.call(he)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(C,arguments)},monochromatic:function(){return this._applyCombination(D,arguments)},splitcomplement:function(){return this._applyCombination(L,arguments)},triad:function(){return this._applyCombination(c,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},A.fromRatio=function(re,he){if(typeof re=="object"){var se={};for(var Ae in re)re.hasOwnProperty(Ae)&&(Ae==="a"?se[Ae]=re[Ae]:se[Ae]=Ie(re[Ae]));re=se}return A(re,he)};function d(re){var he={r:0,g:0,b:0},se=1,Ae=null,ie=null,ae=null,ge=!1,we=!1;return typeof re=="string"&&(re=pe(re)),typeof re=="object"&&(Ee(re.r)&&Ee(re.g)&&Ee(re.b)?(he=f(re.r,re.g,re.b),ge=!0,we=String(re.r).substr(-1)==="%"?"prgb":"rgb"):Ee(re.h)&&Ee(re.s)&&Ee(re.v)?(Ae=Ie(re.s),ie=Ie(re.v),he=g(re.h,Ae,ie),ge=!0,we="hsv"):Ee(re.h)&&Ee(re.s)&&Ee(re.l)&&(Ae=Ie(re.s),ae=Ie(re.l),he=p(re.h,Ae,ae),ge=!0,we="hsl"),re.hasOwnProperty("a")&&(se=re.a)),se=V(se),{ok:ge,format:re.format||we,r:j(255,U(he.r,0)),g:j(255,U(he.g,0)),b:j(255,U(he.b,0)),a:se}}function f(re,he,se){return{r:I(re,255)*255,g:I(he,255)*255,b:I(se,255)*255}}function T(re,he,se){re=I(re,255),he=I(he,255),se=I(se,255);var Ae=U(re,he,se),ie=j(re,he,se),ae,ge,we=(Ae+ie)/2;if(Ae==ie)ae=ge=0;else{var _e=Ae-ie;ge=we>.5?_e/(2-Ae-ie):_e/(Ae+ie);switch(Ae){case re:ae=(he-se)/_e+(he<se?6:0);break;case he:ae=(se-re)/_e+2;break;case se:ae=(re-he)/_e+4;break}ae/=6}return{h:ae,s:ge,l:we}}function p(re,he,se){var Ae,ie,ae;re=I(re,360),he=I(he,100),se=I(se,100);function ge(Fe,Ue,Be){return Be<0&&(Be+=1),Be>1&&(Be-=1),Be<1/6?Fe+(Ue-Fe)*6*Be:Be<1/2?Ue:Be<2/3?Fe+(Ue-Fe)*(2/3-Be)*6:Fe}if(he===0)Ae=ie=ae=se;else{var we=se<.5?se*(1+he):se+he-se*he,_e=2*se-we;Ae=ge(_e,we,re+1/3),ie=ge(_e,we,re),ae=ge(_e,we,re-1/3)}return{r:Ae*255,g:ie*255,b:ae*255}}function m(re,he,se){re=I(re,255),he=I(he,255),se=I(se,255);var Ae=U(re,he,se),ie=j(re,he,se),ae,ge,we=Ae,_e=Ae-ie;if(ge=Ae===0?0:_e/Ae,Ae==ie)ae=0;else{switch(Ae){case re:ae=(he-se)/_e+(he<se?6:0);break;case he:ae=(se-re)/_e+2;break;case se:ae=(re-he)/_e+4;break}ae/=6}return{h:ae,s:ge,v:we}}function g(re,he,se){re=I(re,360)*6,he=I(he,100),se=I(se,100);var Ae=J.floor(re),ie=re-Ae,ae=se*(1-he),ge=se*(1-ie*he),we=se*(1-(1-ie)*he),_e=Ae%6,Fe=[se,ge,ae,ae,we,se][_e],Ue=[we,se,se,ge,ae,ae][_e],Be=[ae,ae,we,se,se,ge][_e];return{r:Fe*255,g:Ue*255,b:Be*255}}function a(re,he,se,Ae){var ie=[me(M(re).toString(16)),me(M(he).toString(16)),me(M(se).toString(16))];return Ae&&ie[0].charAt(0)==ie[0].charAt(1)&&ie[1].charAt(0)==ie[1].charAt(1)&&ie[2].charAt(0)==ie[2].charAt(1)?ie[0].charAt(0)+ie[1].charAt(0)+ie[2].charAt(0):ie.join("")}function i(re,he,se,Ae,ie){var ae=[me(M(re).toString(16)),me(M(he).toString(16)),me(M(se).toString(16)),me(Te(Ae))];return ie&&ae[0].charAt(0)==ae[0].charAt(1)&&ae[1].charAt(0)==ae[1].charAt(1)&&ae[2].charAt(0)==ae[2].charAt(1)&&ae[3].charAt(0)==ae[3].charAt(1)?ae[0].charAt(0)+ae[1].charAt(0)+ae[2].charAt(0)+ae[3].charAt(0):ae.join("")}function s(re,he,se,Ae){var ie=[me(Te(Ae)),me(M(re).toString(16)),me(M(he).toString(16)),me(M(se).toString(16))];return ie.join("")}A.equals=function(re,he){return!re||!he?!1:A(re).toRgbString()==A(he).toRgbString()},A.random=function(){return A.fromRatio({r:P(),g:P(),b:P()})};function l(re,he){he=he===0?0:he||10;var se=A(re).toHsl();return se.s-=he/100,se.s=N(se.s),A(se)}function x(re,he){he=he===0?0:he||10;var se=A(re).toHsl();return se.s+=he/100,se.s=N(se.s),A(se)}function v(re){return A(re).desaturate(100)}function y(re,he){he=he===0?0:he||10;var se=A(re).toHsl();return se.l+=he/100,se.l=N(se.l),A(se)}function R(re,he){he=he===0?0:he||10;var se=A(re).toRgb();return se.r=U(0,j(255,se.r-M(255*-(he/100)))),se.g=U(0,j(255,se.g-M(255*-(he/100)))),se.b=U(0,j(255,se.b-M(255*-(he/100)))),A(se)}function w(re,he){he=he===0?0:he||10;var se=A(re).toHsl();return se.l-=he/100,se.l=N(se.l),A(se)}function E(re,he){var se=A(re).toHsl(),Ae=(se.h+he)%360;return se.h=Ae<0?360+Ae:Ae,A(se)}function C(re){var he=A(re).toHsl();return he.h=(he.h+180)%360,A(he)}function c(re){var he=A(re).toHsl(),se=he.h;return[A(re),A({h:(se+120)%360,s:he.s,l:he.l}),A({h:(se+240)%360,s:he.s,l:he.l})]}function u(re){var he=A(re).toHsl(),se=he.h;return[A(re),A({h:(se+90)%360,s:he.s,l:he.l}),A({h:(se+180)%360,s:he.s,l:he.l}),A({h:(se+270)%360,s:he.s,l:he.l})]}function L(re){var he=A(re).toHsl(),se=he.h;return[A(re),A({h:(se+72)%360,s:he.s,l:he.l}),A({h:(se+216)%360,s:he.s,l:he.l})]}function S(re,he,se){he=he||6,se=se||30;var Ae=A(re).toHsl(),ie=360/se,ae=[A(re)];for(Ae.h=(Ae.h-(ie*he>>1)+720)%360;--he;)Ae.h=(Ae.h+ie)%360,ae.push(A(Ae));return ae}function D(re,he){he=he||6;for(var se=A(re).toHsv(),Ae=se.h,ie=se.s,ae=se.v,ge=[],we=1/he;he--;)ge.push(A({h:Ae,s:ie,v:ae})),ae=(ae+we)%1;return ge}A.mix=function(re,he,se){se=se===0?0:se||50;var Ae=A(re).toRgb(),ie=A(he).toRgb(),ae=se/100,ge={r:(ie.r-Ae.r)*ae+Ae.r,g:(ie.g-Ae.g)*ae+Ae.g,b:(ie.b-Ae.b)*ae+Ae.b,a:(ie.a-Ae.a)*ae+Ae.a};return A(ge)},A.readability=function(re,he){var se=A(re),Ae=A(he);return(J.max(se.getLuminance(),Ae.getLuminance())+.05)/(J.min(se.getLuminance(),Ae.getLuminance())+.05)},A.isReadable=function(re,he,se){var Ae=A.readability(re,he),ie,ae;ae=!1,ie=de(se);switch(ie.level+ie.size){case"AAsmall":case"AAAlarge":ae=Ae>=4.5;break;case"AAlarge":ae=Ae>=3;break;case"AAAsmall":ae=Ae>=7;break}return ae},A.mostReadable=function(re,he,se){var Ae=null,ie=0,ae,ge,we,_e;se=se||{},ge=se.includeFallbackColors,we=se.level,_e=se.size;for(var Fe=0;Fe<he.length;Fe++)ae=A.readability(re,he[Fe]),ae>ie&&(ie=ae,Ae=A(he[Fe]));return A.isReadable(re,Ae,{level:we,size:_e})||!ge?Ae:(se.includeFallbackColors=!1,A.mostReadable(re,["#fff","#000"],se))};var _=A.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},B=A.hexNames=G(_);function G(re){var he={};for(var se in re)re.hasOwnProperty(se)&&(he[re[se]]=se);return he}function V(re){return re=parseFloat(re),(isNaN(re)||re<0||re>1)&&(re=1),re}function I(re,he){ee(re)&&(re="100%");var se=le(re);return re=j(he,U(0,parseFloat(re))),se&&(re=parseInt(re*he,10)/100),J.abs(re-he)<1e-6?1:re%he/parseFloat(he)}function N(re){return j(1,U(0,re))}function Y(re){return parseInt(re,16)}function ee(re){return typeof re=="string"&&re.indexOf(".")!=-1&&parseFloat(re)===1}function le(re){return typeof re=="string"&&re.indexOf("%")!=-1}function me(re){return re.length==1?"0"+re:""+re}function Ie(re){return re<=1&&(re=re*100+"%"),re}function Te(re){return J.round(parseFloat(re)*255).toString(16)}function Oe(re){return Y(re)/255}var Re=function(){var re="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",se="(?:"+he+")|(?:"+re+")",Ae="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",ie="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+Ae),rgba:new RegExp("rgba"+ie),hsl:new RegExp("hsl"+Ae),hsla:new RegExp("hsla"+ie),hsv:new RegExp("hsv"+Ae),hsva:new RegExp("hsva"+ie),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 Ee(re){return!!Re.CSS_UNIT.exec(re)}function pe(re){re=re.replace(O,"").replace($,"").toLowerCase();var he=!1;if(_[re])re=_[re],he=!0;else if(re=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Re.rgb.exec(re))?{r:se[1],g:se[2],b:se[3]}:(se=Re.rgba.exec(re))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Re.hsl.exec(re))?{h:se[1],s:se[2],l:se[3]}:(se=Re.hsla.exec(re))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Re.hsv.exec(re))?{h:se[1],s:se[2],v:se[3]}:(se=Re.hsva.exec(re))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Re.hex8.exec(re))?{r:Y(se[1]),g:Y(se[2]),b:Y(se[3]),a:Oe(se[4]),format:he?"name":"hex8"}:(se=Re.hex6.exec(re))?{r:Y(se[1]),g:Y(se[2]),b:Y(se[3]),format:he?"name":"hex"}:(se=Re.hex4.exec(re))?{r:Y(se[1]+""+se[1]),g:Y(se[2]+""+se[2]),b:Y(se[3]+""+se[3]),a:Oe(se[4]+""+se[4]),format:he?"name":"hex8"}:(se=Re.hex3.exec(re))?{r:Y(se[1]+""+se[1]),g:Y(se[2]+""+se[2]),b:Y(se[3]+""+se[3]),format:he?"name":"hex"}:!1}function de(re){var he,se;return re=re||{level:"AA",size:"small"},he=(re.level||"AA").toUpperCase(),se=(re.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:he,size:se}}bt.exports?bt.exports=A:!(ue=function(){return A}.call(De,q,De,bt),ue!==void 0&&(bt.exports=ue))})(Math)},bT9E:function(bt,De,q){"use strict";q.d(De,"a",function(){return J});var ue=q("VTBJ");function J(O,$){var F=Object(ue.a)({},O);return Array.isArray($)&&$.forEach(function(M){delete F[M]}),F}},c5Ni:function(bt,De,q){},dejd:function(bt,De,q){},dmUQ:function(bt,De,q){"use strict";var ue=q("Ff2n"),J=q("rePB"),O=q("1OyB"),$=q("vuIU"),F=q("Ji7U"),M=q("md7G"),j=q("foSv"),U=q("q1tI"),P=q.n(U),A=q("TSYQ"),d=q.n(A),f=q("4IlW");function T(c,u){var L=Object.keys(c);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);u&&(S=S.filter(function(D){return Object.getOwnPropertyDescriptor(c,D).enumerable})),L.push.apply(L,S)}return L}function p(c){for(var u=1;u<arguments.length;u++){var L=arguments[u]!=null?arguments[u]:{};u%2?T(Object(L),!0).forEach(function(S){Object(J.a)(c,S,L[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(L)):T(Object(L)).forEach(function(S){Object.defineProperty(c,S,Object.getOwnPropertyDescriptor(L,S))})}return c}function m(c){var u=g();return function(){var S=Object(j.a)(c),D;if(u){var _=Object(j.a)(this).constructor;D=Reflect.construct(S,arguments,_)}else D=S.apply(this,arguments);return Object(M.a)(this,D)}}function g(){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(c){return!1}}function a(){}function i(c){c.preventDefault()}var s=function(u){return u.replace(/[^\w.-]+/g,"")},l=200,x=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,y=function(u){return u!=null},R=function(u,L){return L===u||typeof L=="number"&&typeof u=="number"&&isNaN(L)&&isNaN(u)},w=function(c){Object(F.a)(L,c);var u=m(L);function L(S){var D;Object(O.a)(this,L),D=u.call(this,S),D.onKeyDown=function(G){var V=D.props,I=V.onKeyDown,N=V.onPressEnter;if(G.keyCode===f.a.UP){var Y=D.getRatio(G);D.up(G,Y,null),D.stop()}else if(G.keyCode===f.a.DOWN){var ee=D.getRatio(G);D.down(G,ee,null),D.stop()}else G.keyCode===f.a.ENTER&&N&&N(G);if(D.recordCursorPosition(),D.lastKeyCode=G.keyCode,I){for(var le=arguments.length,me=new Array(le>1?le-1:0),Ie=1;Ie<le;Ie++)me[Ie-1]=arguments[Ie];I.apply(void 0,[G].concat(me))}},D.onKeyUp=function(G){var V=D.props.onKeyUp;if(D.stop(),D.recordCursorPosition(),V){for(var I=arguments.length,N=new Array(I>1?I-1:0),Y=1;Y<I;Y++)N[Y-1]=arguments[Y];V.apply(void 0,[G].concat(N))}},D.onChange=function(G){var V=D.props.onChange;D.state.focused&&(D.inputting=!0),D.rawInput=D.props.parser(D.getValueFromEvent(G)),D.setState({inputValue:D.rawInput}),V(D.toNumber(D.rawInput))},D.onMouseUp=function(){var G=D.props.onMouseUp;D.recordCursorPosition(),G&&G.apply(void 0,arguments)},D.onFocus=function(){var G;D.setState({focused:!0}),(G=D.props).onFocus.apply(G,arguments)},D.onBlur=function(){var G=D.props.onBlur;D.inputting=!1,D.setState({focused:!1});var V=D.getCurrentValidValue(D.state.inputValue),I=D.setValue(V,a);if(G){var N=D.input.value,Y=D.getInputDisplayValue({focus:!1,value:I});D.input.value=Y&&Number(Y),G.apply(void 0,arguments),D.input.value=N}},D.getRatio=function(G){var V=1;return G.metaKey||G.ctrlKey?V=.1:G.shiftKey&&(V=10),V},D.getFullNum=function(G){return isNaN(G)?G:/e/i.test(String(G))?Number(G).toFixed(18).replace(/\.?0+$/,""):G},D.getPrecision=function(G){if(y(D.props.precision))return D.props.precision;var V=String(G);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var I=0;return V.indexOf(".")>=0&&(I=V.length-V.indexOf(".")-1),I},D.getInputDisplayValue=function(G){var V=G||D.state,I=V.focused,N=V.inputValue,Y=V.value,ee;I?ee=N:ee=D.toPrecisionAsStep(Y),ee==null&&(ee="");var le=D.formatWrapper(ee);return y(D.props.decimalSeparator)&&(le=le.toString().replace(".",D.props.decimalSeparator)),le},D.recordCursorPosition=function(){try{D.cursorStart=D.input.selectionStart,D.cursorEnd=D.input.selectionEnd,D.currentValue=D.input.value,D.cursorBefore=D.input.value.substring(0,D.cursorStart),D.cursorAfter=D.input.value.substring(D.cursorEnd)}catch(G){}},D.restoreByAfter=function(G){if(G===void 0)return!1;var V=D.input.value,I=V.lastIndexOf(G);if(I===-1)return!1;var N=D.cursorBefore.length;return D.lastKeyCode===f.a.DELETE&&D.cursorBefore.charAt(N-1)===G[0]?(D.fixCaret(N,N),!0):I+G.length===V.length?(D.fixCaret(I,I),!0):!1},D.partRestoreByAfter=function(G){return G===void 0?!1:Array.prototype.some.call(G,function(V,I){var N=G.substring(I);return D.restoreByAfter(N)})},D.isNotCompleteNumber=function(G){return isNaN(G)||G===""||G===null||G&&G.toString().indexOf(".")===G.toString().length-1},D.stop=function(){D.autoStepTimer&&clearTimeout(D.autoStepTimer)},D.down=function(G,V,I){D.pressingUpOrDown=!0,D.step("down",G,V,I)},D.up=function(G,V,I){D.pressingUpOrDown=!0,D.step("up",G,V,I)},D.saveInput=function(G){D.input=G};var _=S.value;_===void 0&&(_=S.defaultValue),D.state={focused:S.autoFocus};var B=D.getValidValue(D.toNumber(_));return D.state=p(p({},D.state),{},{inputValue:D.toPrecisionAsStep(B),value:B}),D}return Object($.a)(L,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(D){var _=this.props,B=_.value,G=_.onChange,V=_.max,I=_.min,N=this.state.focused;if(D){if(!R(D.value,B)||!R(D.max,V)||!R(D.min,I)){var Y=N?B:this.getValidValue(B),ee;this.pressingUpOrDown?ee=Y:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:ee})}var le="value"in this.props?B:this.state.value;"max"in this.props&&D.max!==V&&typeof le=="number"&&le>V&&G&&G(V),"min"in this.props&&D.min!==I&&typeof le=="number"&&le<I&&G&&G(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var me=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===f.a.BACKSPACE?me=this.cursorStart-1:this.lastKeyCode===f.a.DELETE&&(me=this.cursorStart):me=this.input.value.length,this.fixCaret(me,me)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case f.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case f.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ie){}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(D){var _=D;return _===""?_="":this.isNotCompleteNumber(parseFloat(_))?_=this.state.value:_=this.getValidValue(_),this.toNumber(_)}},{key:"getValueFromEvent",value:function(D){var _=D.target.value.trim().replace(/。/g,".");return y(this.props.decimalSeparator)&&(_=_.replace(this.props.decimalSeparator,".")),_}},{key:"getValidValue",value:function(D){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,G=parseFloat(D);return isNaN(G)?D:(G<_&&(G=_),G>B&&(G=B),G)}},{key:"setValue",value:function(D,_){var B=this.props.precision,G=this.isNotCompleteNumber(parseFloat(D))?null:parseFloat(D),V=this.state.value,I=V===void 0?null:V,N=this.state.inputValue,Y=N===void 0?null:N,ee=typeof G=="number"?G.toFixed(B):"".concat(G),le=G!==I||ee!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},_)):this.setState({value:G,inputValue:this.toPrecisionAsStep(D)},_),le&&this.props.onChange(G),G}},{key:"getMaxPrecision",value:function(D){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,G=B.precision,V=B.step;if(y(G))return G;var I=this.getPrecision(_),N=this.getPrecision(V),Y=this.getPrecision(D);return D?Math.max(Y,I+N):I+N}},{key:"getPrecisionFactor",value:function(D){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(D,_);return Math.pow(10,B)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(D){return this.props.formatter?this.props.formatter(D):D}},{key:"toPrecisionAsStep",value:function(D){if(this.isNotCompleteNumber(D)||D==="")return D;var _=Math.abs(this.getMaxPrecision(D));return isNaN(_)?D.toString():Number(D).toFixed(_)}},{key:"toNumber",value:function(D){var _=this.props.precision,B=this.state.focused,G=D&&D.length>16&&B;return this.isNotCompleteNumber(D)||G?D:y(_)?Math.round(D*Math.pow(10,_))/Math.pow(10,_):Number(D)}},{key:"upStep",value:function(D,_){var B=this.props.step,G=this.getPrecisionFactor(D,_),V=Math.abs(this.getMaxPrecision(D,_)),I=((G*D+G*B*_)/G).toFixed(V);return this.toNumber(I)}},{key:"downStep",value:function(D,_){var B=this.props.step,G=this.getPrecisionFactor(D,_),V=Math.abs(this.getMaxPrecision(D,_)),I=((G*D-G*B*_)/G).toFixed(V);return this.toNumber(I)}},{key:"step",value:function(D,_){var B=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),_&&(_.persist(),_.preventDefault());var I=this.props;if(I.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var Y=this["".concat(D,"Step")](N,G),ee=Y>I.max||Y<I.min;if(Y>I.max?Y=I.max:Y<I.min&&(Y=I.min),this.setValue(Y,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){B[D](_,G,!0)},V?l:x)}},{key:"fixCaret",value:function(D,_){if(D===void 0||_===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,G=this.input.selectionEnd;(D!==B||_!==G)&&this.input.setSelectionRange(D,_)}catch(V){}}},{key:"render",value:function(){var D,_=this.props,B=_.prefixCls,G=_.disabled,V=_.readOnly,I=_.useTouch,N=_.autoComplete,Y=_.upHandler,ee=_.downHandler,le=_.className,me=_.max,Ie=_.min,Te=_.style,Oe=_.title,Re=_.onMouseEnter,Ee=_.onMouseLeave,pe=_.onMouseOver,de=_.onMouseOut,re=_.required,he=_.onClick,se=_.tabIndex,Ae=_.type,ie=_.placeholder,ae=_.id,ge=_.inputMode,we=_.pattern,_e=_.step,Fe=_.maxLength,Ue=_.autoFocus,Be=_.name,Ze=_.onPaste,et=_.onInput,rt=Object(ue.a)(_,["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"]),Ye=this.state,st=Ye.value,Je=Ye.focused,Qe=d()(B,(D={},Object(J.a)(D,le,!!le),Object(J.a)(D,"".concat(B,"-disabled"),G),Object(J.a)(D,"".concat(B,"-focused"),Je),D)),Me={};Object.keys(rt).forEach(function(ve){(ve.substr(0,5)==="data-"||ve.substr(0,5)==="aria-"||ve==="role")&&(Me[ve]=rt[ve])});var $e=!V&&!G,ut=this.getInputDisplayValue(null),je=(st||st===0)&&(isNaN(st)||Number(st)>=me),Ve=(st||st===0)&&(isNaN(st)||Number(st)<=Ie),Se=je||G||V,be=Ve||G||V,Ce=d()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(J.a)({},"".concat(B,"-handler-up-disabled"),Se)),ne=d()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(J.a)({},"".concat(B,"-handler-down-disabled"),be)),oe=I?{onTouchStart:Se?a:this.up,onTouchEnd:this.stop}:{onMouseDown:Se?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ce=I?{onTouchStart:be?a:this.down,onTouchEnd:this.stop}:{onMouseDown:be?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Qe,style:Te,title:Oe,onMouseEnter:Re,onMouseLeave:Ee,onMouseOver:pe,onMouseOut:de,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(B,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Increase Value","aria-disabled":Se,className:Ce}),Y||P.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:i})),P.a.createElement("span",Object.assign({unselectable:"on"},ce,{role:"button","aria-label":"Decrease Value","aria-disabled":be,className:ne}),ee||P.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:i}))),P.a.createElement("div",{className:"".concat(B,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ie,"aria-valuemax":me,"aria-valuenow":st,required:re,type:Ae,placeholder:ie,onPaste:Ze,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:se,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:$e?this.onKeyDown:a,onKeyUp:$e?this.onKeyUp:a,autoFocus:Ue,maxLength:Fe,readOnly:V,disabled:G,max:me,min:Ie,step:_e,name:Be,title:Oe,id:ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ut),pattern:we,inputMode:ge,onInput:et},Me))))}}]),L}(P.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:s,required:!1,autoComplete:"off"};var E=w,C=De.a=E},fjLI:function(bt,De,q){"use strict";q.d(De,"e",function(){return A}),q.d(De,"a",function(){return d}),q.d(De,"c",function(){return f}),q.d(De,"d",function(){return p}),q.d(De,"b",function(){return m});var ue=q("8HAY"),J=q("Cg/j"),O=q("T8No"),$=q("nnTU"),F=q("MI8n"),M=function(){var g=function(a,i){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var x in l)l.hasOwnProperty(x)&&(s[x]=l[x])},g(a,i)};return function(a,i){g(a,i);function s(){this.constructor=a}a.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),j=function(g,a,i,s){var l=arguments.length,x=l<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,i):s,v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,a,i,s);else for(var y=g.length-1;y>=0;y--)(v=g[y])&&(x=(l<3?v(x):l>3?v(a,i,x):v(a,i))||x);return l>3&&x&&Object.defineProperty(a,i,x),x},U=function(g,a){return function(i,s){a(i,s,g)}},P=function(){for(var g=0,a=0,i=arguments.length;a<i;a++)g+=arguments[a].length;for(var s=Array(g),l=0,a=0;a<i;a++)for(var x=arguments[a],v=0,y=x.length;v<y;v++,l++)s[l]=x[v];return s};function A(g){return g.command!==void 0}var d=Object(J.c)("menuService"),f=new(function(){function g(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new F.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return g.prototype.addCommand=function(a){var i=this;return this._commands.set(a.id,a),this._onDidChangeMenu.fire(0),{dispose:function(){i._commands.delete(a.id)&&i._onDidChangeMenu.fire(0)}}},g.prototype.getCommand=function(a){return this._commands.get(a)},g.prototype.getCommands=function(){var a=new Map;return this._commands.forEach(function(i,s){return a.set(s,i)}),a},g.prototype.appendMenuItem=function(a,i){var s=this,l=this._menuItems.get(a);return l?l.push(i):(l=[i],this._menuItems.set(a,l)),this._onDidChangeMenu.fire(a),{dispose:function(){var x=l.indexOf(i);x>=0&&(l.splice(x,1),s._onDidChangeMenu.fire(a))}}},g.prototype.getMenuItems=function(a){var i=(this._menuItems.get(a)||[]).slice(0);return a===0&&this._appendImplicitItems(i),i},g.prototype._appendImplicitItems=function(a){for(var i=new Set,s=a.filter(function(w){return A(w)}),l=0,x=s;l<x.length;l++){var v=x[l],y=v.command,R=v.alt;i.add(y.id),R&&i.add(R.id)}this._commands.forEach(function(w,E){i.has(E)||a.push({command:w})})},g}()),T=function(g){M(a,g);function a(i,s,l){var x=g.call(this,i,s)||this;return x._commandService=l,x}return a.prototype.run=function(){for(var i,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return(i=this._commandService).executeCommand.apply(i,P([this.id],s))},a=j([U(2,$.b)],a),a}(ue.a),p=function(g){M(a,g);function a(i){var s=this;return typeof i.title=="string"?s=g.call(this,"",i.title,"submenu")||this:s=g.call(this,"",i.title.value,"submenu")||this,s.item=i,s}return a}(ue.a),m=function(g){M(a,g);function a(i,s,l,x,v){var y=this;return typeof i.title=="string"?y=g.call(this,i.id,i.title,v)||this:y=g.call(this,i.id,i.title.value,v)||this,y._cssClass=void 0,y._enabled=!i.precondition||x.contextMatchesRules(i.precondition),y._checked=Boolean(i.toggled&&x.contextMatchesRules(i.toggled)),y._options=l||{},y.item=i,y.alt=s?new a(s,void 0,y._options,x,v):void 0,y}return a.prototype.dispose=function(){this.alt&&this.alt.dispose(),g.prototype.dispose.call(this)},a.prototype.run=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var l=[];return this._options.arg&&(l=P(l,[this._options.arg])),this._options.shouldForwardArgs&&(l=P(l,i)),g.prototype.run.apply(this,l)},a=j([U(3,O.c),U(4,$.b)],a),a}(T)},h78n:function(bt,De,q){"use strict";q.d(De,"a",function(){return D});var ue=q("q1tI"),J=q.n(ue),O=q("TSYQ"),$=q.n(O),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(G){var V=G.map(function(){return Object(ue.useRef)()}),I=Object(ue.useRef)();return Object(ue.useEffect)(function(){var N=Date.now(),Y=!1;Object.keys(V).forEach(function(ee){var le=V[ee].current;if(!le)return;Y=!0;var me=le.style;me.transitionDuration=".3s, .3s, .3s, .06s",I.current&&N-I.current<100&&(me.transitionDuration="0s, 0s")}),Y&&(I.current=Date.now())}),[V]};function j(){return j=Object.assign||function(B){for(var G=1;G<arguments.length;G++){var V=arguments[G];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(B[I]=V[I])}return B},j.apply(this,arguments)}function U(B,G){return T(B)||f(B,G)||A(B,G)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(B,G){if(!B)return;if(typeof B=="string")return d(B,G);var V=Object.prototype.toString.call(B).slice(8,-1);if(V==="Object"&&B.constructor&&(V=B.constructor.name),V==="Map"||V==="Set")return Array.from(B);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return d(B,G)}function d(B,G){(G==null||G>B.length)&&(G=B.length);for(var V=0,I=new Array(G);V<G;V++)I[V]=B[V];return I}function f(B,G){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var V=[],I=!0,N=!1,Y=void 0;try{for(var ee=B[Symbol.iterator](),le;!(I=(le=ee.next()).done)&&!(V.push(le.value),G&&V.length===G);I=!0);}catch(me){N=!0,Y=me}finally{try{!I&&ee.return!=null&&ee.return()}finally{if(N)throw Y}}return V}function T(B){if(Array.isArray(B))return B}function p(B,G){if(B==null)return{};var V=m(B,G),I,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);for(N=0;N<Y.length;N++){if(I=Y[N],G.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;V[I]=B[I]}}return V}function m(B,G){if(B==null)return{};var V={},I=Object.keys(B),N,Y;for(Y=0;Y<I.length;Y++){if(N=I[Y],G.indexOf(N)>=0)continue;V[N]=B[N]}return V}var g=function(G){var V=G.className,I=G.percent,N=G.prefixCls,Y=G.strokeColor,ee=G.strokeLinecap,le=G.strokeWidth,me=G.style,Ie=G.trailColor,Te=G.trailWidth,Oe=G.transition,Re=p(G,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Re.gapPosition;var Ee=Array.isArray(I)?I:[I],pe=Array.isArray(Y)?Y:[Y],de=M(Ee),re=U(de,1),he=re[0],se=le/2,Ae=100-le/2,ie="M ".concat(ee==="round"?se:0,",").concat(se,`
L `).concat(ee==="round"?Ae:100,",").concat(se),ae="0 0 100 ".concat(le),ge=0;return J.a.createElement("svg",j({className:$()("".concat(N,"-line"),V),viewBox:ae,preserveAspectRatio:"none",style:me},Re),J.a.createElement("path",{className:"".concat(N,"-line-trail"),d:ie,strokeLinecap:ee,stroke:Ie,strokeWidth:Te||le,fillOpacity:"0"}),Ee.map(function(we,_e){var Fe={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(ge,"px"),transition:Oe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=pe[_e]||pe[pe.length-1];return ge+=we,J.a.createElement("path",{key:_e,className:"".concat(N,"-line-path"),d:ie,strokeLinecap:ee,stroke:Ue,strokeWidth:le,fillOpacity:"0",ref:he[_e],style:Fe})}))};g.defaultProps=F;var a=g;function i(){return i=Object.assign||function(B){for(var G=1;G<arguments.length;G++){var V=arguments[G];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(B[I]=V[I])}return B},i.apply(this,arguments)}function s(B,G){return R(B)||y(B,G)||x(B,G)||l()}function l(){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 x(B,G){if(!B)return;if(typeof B=="string")return v(B,G);var V=Object.prototype.toString.call(B).slice(8,-1);if(V==="Object"&&B.constructor&&(V=B.constructor.name),V==="Map"||V==="Set")return Array.from(B);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(B,G)}function v(B,G){(G==null||G>B.length)&&(G=B.length);for(var V=0,I=new Array(G);V<G;V++)I[V]=B[V];return I}function y(B,G){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var V=[],I=!0,N=!1,Y=void 0;try{for(var ee=B[Symbol.iterator](),le;!(I=(le=ee.next()).done)&&!(V.push(le.value),G&&V.length===G);I=!0);}catch(me){N=!0,Y=me}finally{try{!I&&ee.return!=null&&ee.return()}finally{if(N)throw Y}}return V}function R(B){if(Array.isArray(B))return B}function w(B,G){if(B==null)return{};var V=E(B,G),I,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);for(N=0;N<Y.length;N++){if(I=Y[N],G.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;V[I]=B[I]}}return V}function E(B,G){if(B==null)return{};var V={},I=Object.keys(B),N,Y;for(Y=0;Y<I.length;Y++){if(N=I[Y],G.indexOf(N)>=0)continue;V[N]=B[N]}return V}var C=0;function c(B){return+B.replace("%","")}function u(B){return Array.isArray(B)?B:[B]}function L(B,G,V,I){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,ee=50-I/2,le=0,me=-ee,Ie=0,Te=-2*ee;switch(Y){case"left":le=-ee,me=0,Ie=2*ee,Te=0;break;case"right":le=ee,me=0,Ie=-2*ee,Te=0;break;case"bottom":me=ee,Te=2*ee;break;default:}var Oe="M 50,50 m ".concat(le,",").concat(me,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Ie,",").concat(-Te,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Ie,",").concat(Te),Re=Math.PI*2*ee,Ee={stroke:V,strokeDasharray:"".concat(G/100*(Re-N),"px ").concat(Re,"px"),strokeDashoffset:"-".concat(N/2+B/100*(Re-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Oe,pathStyle:Ee}}var S=function(G){var V=G.prefixCls,I=G.strokeWidth,N=G.trailWidth,Y=G.gapDegree,ee=G.gapPosition,le=G.trailColor,me=G.strokeLinecap,Ie=G.style,Te=G.className,Oe=G.strokeColor,Re=G.percent,Ee=w(G,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(ue.useMemo)(function(){return C+=1,C},[]),de=L(0,100,le,I,Y,ee),re=de.pathString,he=de.pathStyle,se=u(Re),Ae=u(Oe),ie=Ae.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),ae=M(se),ge=s(ae,1),we=ge[0],_e=function(){var Ue=0;return se.map(function(Be,Ze){var et=Ae[Ze]||Ae[Ae.length-1],rt=Object.prototype.toString.call(et)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(pe,")"):"",Ye=L(Ue,Be,et,I,Y,ee);return Ue+=Be,J.a.createElement("path",{key:Ze,className:"".concat(V,"-circle-path"),d:Ye.pathString,stroke:rt,strokeLinecap:me,strokeWidth:I,opacity:Be===0?0:1,fillOpacity:"0",style:Ye.pathStyle,ref:we[Ze]})})};return J.a.createElement("svg",i({className:$()("".concat(V,"-circle"),Te),viewBox:"0 0 100 100",style:Ie},Ee),ie&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ie).sort(function(Fe,Ue){return c(Fe)-c(Ue)}).map(function(Fe,Ue){return J.a.createElement("stop",{key:Ue,offset:Fe,stopColor:ie[Fe]})}))),J.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:re,stroke:le,strokeLinecap:me,strokeWidth:N||I,fillOpacity:"0",style:he}),_e().reverse())};S.defaultProps=F;var D=S,_={Line:a,Circle:D}},kSUc:function(bt,De,q){},lZu9:function(bt,De,q){(function(ue){ue(q("VrN/"),q("1eCo"),q("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(J,O){var $=ue.getMode(J,"text/html"),F=$.name=="null";function M(I){if(ue.findModeByName){var N=ue.findModeByName(I);N&&(I=N.mime||N.mimes[0])}var Y=ue.getMode(J,I);return Y.name=="null"?null:Y}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var j={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in j)j.hasOwnProperty(U)&&O.tokenTypeOverrides[U]&&(j[U]=O.tokenTypeOverrides[U]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,d=/^\[(x| )\](?=\s)/i,f=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,T=/^ {0,3}(?:\={1,}|-{2,})\s*$/,p=/^[^#!\[\]*_\\<>` "'(~:]+/,m=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,a=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,i=" ";function s(I,N,Y){return N.f=N.inline=Y,Y(I,N)}function l(I,N,Y){return N.f=N.block=Y,Y(I,N)}function x(I){return!I||!/\S/.test(I.string)}function v(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==R){var N=F;if(!N){var Y=ue.innerMode($,I.htmlState);N=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}N&&(I.f=c,I.block=y,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function y(I,N){var Y=I.column()===N.indentation,ee=x(N.prevLine.stream),le=N.indentedCode,me=N.prevLine.hr,Ie=N.list!==!1,Te=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Oe=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Ie)){for(N.list=null;Oe<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Oe-N.listStack[N.listStack.length-1])}var Re=!ee&&!me&&!N.prevLine.header&&(!Ie||!le)&&!N.prevLine.fencedCodeEnd,Ee=(N.list===!1||me||ee)&&N.indentation<=Te&&I.match(P),pe=null;if(N.indentationDiff>=4&&(le||N.prevLine.fencedCodeEnd||N.prevLine.header||ee))return I.skipToEnd(),N.indentedCode=!0,j.code;if(I.eatSpace())return null;if(Y&&N.indentation<=Te&&(pe=I.match(f))&&pe[1].length<=6)return N.quote=0,N.header=pe[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,E(N);if(N.indentation<=Te&&I.eat(">"))return N.quote=Y?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),I.eatSpace(),E(N);if(!Ee&&!N.setext&&Y&&N.indentation<=Te&&(pe=I.match(A))){var de=pe[1]?"ol":"ul";return N.indentation=Oe+I.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,O.taskLists&&I.match(d,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+de]),E(N)}else{if(Y&&N.indentation<=Te&&(pe=I.match(m,!0)))return N.quote=0,N.fencedEndRE=new RegExp(pe[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&M(pe[2]||O.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ue.startState(N.localMode)),N.f=N.block=w,O.highlightFormatting&&(N.formatting="code-block"),N.code=-1,E(N);if(N.setext||(!Re||!Ie)&&!N.quote&&N.list===!1&&!N.code&&!Ee&&!g.test(I.string)&&(pe=I.lookAhead(1))&&(pe=pe.match(T)))return N.setext?(N.header=N.setext,N.setext=0,I.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=pe[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,E(N);if(Ee)return I.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,j.hr;if(I.peek()==="[")return s(I,N,_)}return s(I,N,N.inline)}function R(I,N){var Y=$.token(I,N.htmlState);if(!F){var ee=ue.innerMode($,N.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||N.md_inside&&I.current().indexOf(">")>-1)&&(N.f=c,N.block=y,N.htmlState=null)}return Y}function w(I,N){var Y=N.listStack[N.listStack.length-1]||0,ee=N.indentation<Y,le=Y+3;if(N.fencedEndRE&&N.indentation<=le&&(ee||I.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var me;return ee||(me=E(N)),N.localMode=N.localState=null,N.block=y,N.f=c,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ee?l(I,N,N.block):me}else return N.localMode?N.localMode.token(I,N.localState):(I.skipToEnd(),j.code)}function E(I){var N=[];if(I.formatting){N.push(j.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var Y=0;Y<I.formatting.length;Y++)N.push(j.formatting+"-"+I.formatting[Y]),I.formatting[Y]==="header"&&N.push(j.formatting+"-"+I.formatting[Y]+"-"+I.header),I.formatting[Y]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=I.quote?N.push(j.formatting+"-"+I.formatting[Y]+"-"+I.quote):N.push("error"))}if(I.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(I.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(I.linkHref?N.push(j.linkHref,"url"):(I.strong&&N.push(j.strong),I.em&&N.push(j.em),I.strikethrough&&N.push(j.strikethrough),I.emoji&&N.push(j.emoji),I.linkText&&N.push(j.linkText),I.code&&N.push(j.code),I.image&&N.push(j.image),I.imageAltText&&N.push(j.imageAltText,"link"),I.imageMarker&&N.push(j.imageMarker)),I.header&&N.push(j.header,j.header+"-"+I.header),I.quote&&(N.push(j.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=I.quote?N.push(j.quote+"-"+I.quote):N.push(j.quote+"-"+O.maxBlockquoteDepth)),I.list!==!1){var ee=(I.listStack.length-1)%3;ee?ee===1?N.push(j.list2):N.push(j.list3):N.push(j.list1)}return I.trailingSpaceNewLine?N.push("trailing-space-new-line"):I.trailingSpace&&N.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function C(I,N){return I.match(p,!0)?E(N):void 0}function c(I,N){var Y=N.text(I,N);if(typeof Y!="undefined")return Y;if(N.list)return N.list=null,E(N);if(N.taskList){var ee=I.match(d,!0)[1]===" ";return ee?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,E(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&I.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),E(N);var le=I.next();if(N.linkTitle){N.linkTitle=!1;var me=le;le==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ie="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(I.match(new RegExp(Ie),!0))return j.linkHref}if(le==="`"){var Te=N.formatting;O.highlightFormatting&&(N.formatting="code"),I.eatWhile("`");var Oe=I.current().length;if(N.code==0&&(!N.quote||Oe==1))return N.code=Oe,E(N);if(Oe==N.code){var Re=E(N);return N.code=0,Re}else return N.formatting=Te,E(N)}else if(N.code)return E(N);if(le==="\\"&&(I.next(),O.highlightFormatting)){var Ee=E(N),pe=j.formatting+"-escape";return Ee?Ee+" "+pe:pe}if(le==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),E(N);if(le==="["&&N.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),E(N);if(le==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var Ee=E(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=L,Ee}if(le==="["&&!N.image)return N.linkText&&I.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),E(N);if(le==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var Ee=E(N);return N.linkText=!1,N.inline=N.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?L:c,Ee}if(le==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=u,O.highlightFormatting&&(N.formatting="link");var Ee=E(N);return Ee?Ee+=" ":Ee="",Ee+j.linkInline}if(le==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=u,O.highlightFormatting&&(N.formatting="link");var Ee=E(N);return Ee?Ee+=" ":Ee="",Ee+j.linkEmail}if(O.xml&&le==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var de=I.string.indexOf(">",I.pos);if(de!=-1){var re=I.string.substring(I.start,de);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(N.md_inside=!0)}return I.backUp(1),N.htmlState=ue.startState($),l(I,N,R)}if(O.xml&&le==="<"&&I.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(le==="*"||le==="_"){for(var he=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);he<3&&I.eat(le);)he++;var Ae=I.peek()||" ",ie=!/\s/.test(Ae)&&(!a.test(Ae)||/\s/.test(se)||a.test(se)),ae=!/\s/.test(se)&&(!a.test(se)||/\s/.test(Ae)||a.test(Ae)),ge=null,we=null;if(he%2&&(!N.em&&ie&&(le==="*"||!ae||a.test(se))?ge=!0:N.em==le&&ae&&(le==="*"||!ie||a.test(Ae))&&(ge=!1)),he>1&&(!N.strong&&ie&&(le==="*"||!ae||a.test(se))?we=!0:N.strong==le&&ae&&(le==="*"||!ie||a.test(Ae))&&(we=!1)),we!=null||ge!=null){O.highlightFormatting&&(N.formatting=ge==null?"strong":we==null?"em":"strong em"),ge===!0&&(N.em=le),we===!0&&(N.strong=le);var Re=E(N);return ge===!1&&(N.em=!1),we===!1&&(N.strong=!1),Re}}else if(le===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return E(N);I.backUp(1)}if(O.strikethrough){if(le==="~"&&I.eatWhile(le)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var Re=E(N);return N.strikethrough=!1,Re}else if(I.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),E(N)}else if(le===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return E(N);I.backUp(2)}}if(O.emoji&&le===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var _e=E(N);return N.emoji=!1,_e}return le===" "&&(I.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),E(N)}function u(I,N){var Y=I.next();if(Y===">"){N.f=N.inline=c,O.highlightFormatting&&(N.formatting="link");var ee=E(N);return ee?ee+=" ":ee="",ee+j.linkInline}return I.match(/^[^>]+/,!0),j.linkInline}function L(I,N){if(I.eatSpace())return null;var Y=I.next();return Y==="("||Y==="["?(N.f=N.inline=D(Y==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,E(N)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function D(I){return function(N,Y){var ee=N.next();if(ee===I){Y.f=Y.inline=c,O.highlightFormatting&&(Y.formatting="link-string");var le=E(Y);return Y.linkHref=!1,le}return N.match(S[I]),Y.linkHref=!0,E(Y)}}function _(I,N){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=B,I.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,E(N)):s(I,N,c)}function B(I,N){if(I.match(/^\]:/,!0)){N.f=N.inline=G,O.highlightFormatting&&(N.formatting="link");var Y=E(N);return N.linkText=!1,Y}return I.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function G(I,N){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?N.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=c,j.linkHref+" url")}var V={startState:function(){return{f:y,prevLine:{stream:null},thisLine:{stream:null},block:y,htmlState:null,indentation:0,inline:c,text:C,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ue.copyState($,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ue.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,N){if(N.formatting=!1,I!=N.thisLine.stream){if(N.header=0,N.hr=!1,I.match(/^\s*$/,!0))return v(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:I},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=R)){var Y=I.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(N.indentation=Y,N.indentationDiff=null,Y>0)return null}}return N.f(I,N)},innerMode:function(I){return I.block==R?{state:I.htmlState,mode:$}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:V}},indent:function(I,N,Y){return I.block==R&&$.indent?$.indent(I.htmlState,N,Y):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,N,Y):ue.Pass},blankLine:v,getType:E,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},nnTU:function(bt,De,q){"use strict";q.d(De,"b",function(){return U}),q.d(De,"a",function(){return P});var ue=q("pmY6"),J=q("746U"),O=q("Cg/j"),$=q("MI8n"),F=q("24hK"),M=q("QDVR"),j=function(){for(var A=0,d=0,f=arguments.length;d<f;d++)A+=arguments[d].length;for(var T=Array(A),p=0,d=0;d<f;d++)for(var m=arguments[d],g=0,a=m.length;g<a;g++,p++)T[p]=m[g];return T},U=Object(O.c)("commandService"),P=new(function(){function A(){this._commands=new Map,this._onDidRegisterCommand=new $.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return A.prototype.registerCommand=function(d,f){var T=this;if(!d)throw new Error("invalid command");if(typeof d=="string"){if(!f)throw new Error("invalid command");return this.registerCommand({id:d,handler:f})}if(d.description){for(var p=[],m=0,g=d.description.args;m<g.length;m++){var a=g[m];p.push(a.constraint)}var i=d.handler;d.handler=function(y){for(var R=[],w=1;w<arguments.length;w++)R[w-1]=arguments[w];return Object(J.m)(R,p),i.apply(void 0,j([y],R))}}var s=d.id,l=this._commands.get(s);l||(l=new F.a,this._commands.set(s,l));var x=l.unshift(d),v=Object(ue.h)(function(){x();var y=T._commands.get(s);(y==null?void 0:y.isEmpty())&&T._commands.delete(s)});return this._onDidRegisterCommand.fire(s),v},A.prototype.registerCommandAlias=function(d,f){return P.registerCommand(d,function(T){for(var p,m=[],g=1;g<arguments.length;g++)m[g-1]=arguments[g];return(p=T.get(U)).executeCommand.apply(p,j([f],m))})},A.prototype.getCommand=function(d){var f=this._commands.get(d);return!f||f.isEmpty()?void 0:f.iterator().next().value},A.prototype.getCommands=function(){for(var d=new Map,f=0,T=Object(M.d)(this._commands);f<T.length;f++){var p=T[f],m=this.getCommand(p);m&&d.set(p,m)}return d},A}())},osHv:function(bt,De,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";var J=ue.Pos;function O(a,i){return a.line-i.line||a.ch-i.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",F=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+$+"]["+F+"]*)","g");function j(a,i,s,l){this.line=i,this.ch=s,this.cm=a,this.text=a.getLine(i),this.min=l?Math.max(l.from,a.firstLine()):a.firstLine(),this.max=l?Math.min(l.to-1,a.lastLine()):a.lastLine()}function U(a,i){var s=a.cm.getTokenTypeAt(J(a.line,i));return s&&/\btag\b/.test(s)}function P(a){return a.line>=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function A(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function d(a){for(;;){var i=a.text.indexOf(">",a.ch);if(i==-1){if(P(a))continue;return}if(!U(a,i+1)){a.ch=i+1;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function f(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(A(a))continue;return}if(!U(a,i+1)){a.ch=i;continue}M.lastIndex=i,a.ch=i;var s=M.exec(a.text);if(s&&s.index==i)return s}}function T(a){for(;;){M.lastIndex=a.ch;var i=M.exec(a.text);if(!i){if(P(a))continue;return}if(!U(a,i.index+1)){a.ch=i.index+1;continue}return a.ch=i.index+i[0].length,i}}function p(a){for(;;){var i=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(i==-1){if(A(a))continue;return}if(!U(a,i+1)){a.ch=i;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function m(a,i){for(var s=[];;){var l=T(a),x,v=a.line,y=a.ch-(l?l[0].length:0);if(!l||!(x=d(a)))return;if(x=="selfClose")continue;if(l[1]){for(var R=s.length-1;R>=0;--R)if(s[R]==l[2]){s.length=R;break}if(R<0&&(!i||i==l[2]))return{tag:l[2],from:J(v,y),to:J(a.line,a.ch)}}else s.push(l[2])}}function g(a,i){for(var s=[];;){var l=p(a);if(!l)return;if(l=="selfClose"){f(a);continue}var x=a.line,v=a.ch,y=f(a);if(!y)return;if(y[1])s.push(y[2]);else{for(var R=s.length-1;R>=0;--R)if(s[R]==y[2]){s.length=R;break}if(R<0&&(!i||i==y[2]))return{tag:y[2],from:J(a.line,a.ch),to:J(x,v)}}}}ue.registerHelper("fold","xml",function(a,i){for(var s=new j(a,i.line,0);;){var l=T(s);if(!l||s.line!=i.line)return;var x=d(s);if(!x)return;if(!l[1]&&x!="selfClose"){var v=J(s.line,s.ch),y=m(s,l[2]);return y&&O(y.from,v)>0?{from:v,to:y.from}:null}}}),ue.findMatchingTag=function(a,i,s){var l=new j(a,i.line,i.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var x=d(l),v=x&&J(l.line,l.ch),y=x&&f(l);if(!x||!y||O(l,i)>0)return;var R={from:J(l.line,l.ch),to:v,tag:y[2]};return x=="selfClose"?{open:R,close:null,at:"open"}:y[1]?{open:g(l,y[2]),close:R,at:"close"}:(l=new j(a,v.line,v.ch,s),{open:R,close:m(l,y[2]),at:"open"})},ue.findEnclosingTag=function(a,i,s,l){for(var x=new j(a,i.line,i.ch,s);;){var v=g(x,l);if(!v)break;var y=new j(a,i.line,i.ch,s),R=m(y,v.tag);if(R)return{open:v,close:R}}},ue.scanForClosingTag=function(a,i,s,l){var x=new j(a,i.line,i.ch,l?{from:0,to:l}:null);return m(x,s)}})},p0QG:function(bt,De,q){bt.exports={flex_box_center:"flex_box_center___2axlI",flex_space_between:"flex_space_between___F6m1U",flex_box_vertical_center:"flex_box_vertical_center___2GovZ",flex_box_center_end:"flex_box_center_end___2h9j0",flex_box_column:"flex_box_column___1kuIs",SubMentItem:"SubMentItem___34z-Y",MenuItem:"MenuItem___1bbPM",wrp:"wrp___3LRhb",classroomInfo:"classroomInfo___Ohxoq",title:"title___22ZLP",titleLeft:"titleLeft___1MP-h",titleRight:"titleRight___3zsz9",classroomUser:"classroomUser___1ePAN",headPic:"headPic___2lEg_",teacherInfo:"teacherInfo___3C0Dn",classroomDesc:"classroomDesc____QVZX",classroomDescBg:"classroomDescBg___1e7L7",joinCouses:"joinCouses___2G4vP",bg:"bg___2QojS",leftMenus:"leftMenus___34tjX",titleSelected:"titleSelected___K6QwW",menuText:"menuText___3qMqH",totalCount:"totalCount___R2q38",actions:"actions___26Ww0",task_count:"task_count___3UQ1V",container:"container___2EGM4",leftMenuActions:"leftMenuActions___3_J-1"}},p5ED:function(bt,De,q){"use strict";var ue=q("+L6B"),J=q("2/Rp"),O=q("5Dmo"),$=q("3S7+"),F=q("k1fw"),M=q("9og8"),j=q("tJVT"),U=q("WmNS"),P=q.n(U),A=q("q1tI"),d=q.n(A),f=q("vHTk"),T=q.n(f),p=q("yEEn"),m=q("ZW9T"),g=q("1vsH"),a=q("V0Rq"),i=q("m3rI");De.a=function(s){var l,x,v,y,R,w,E=s.editOffice,C=E===void 0?"view":E,c=s.name,u=s.data,L=s.theme,S=s.type,D=s.filename,_=s.monacoEditor,B=s.className,G=s.style,V=s.close,I=s.onClose,N=s.hasMask,Y=s.disabledDownload,ee=s.onImgDimensions,le=s.otherData,me=Object(A.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Ie=Object(j.a)(me,2),Te=Ie[0],Oe=Ie[1],Re=Object(A.useState)(""),Ee=Object(j.a)(Re,2),pe=Ee[0],de=Ee[1],re=Object(A.useState)(),he=Object(j.a)(re,2),se=he[0],Ae=he[1],ie=window.ENV==="build"?"/react/build":"",ae=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,ge,we=1024*1024,_e=10*we,Fe=Object(A.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&S!=="txt"&&(u=i.a.API_SERVER+u),S==="office"&&(ge=Object(g.P)(u).filesize,ge>_e&&(S="other")),D&&(_.filename=D),Object(A.useEffect)(function(){var et,rt,Ye=(et=document.cookie)===null||et===void 0||((rt=et.replace(/\s/g,""))===null||rt===void 0)?void 0:rt.split(";");Ye==null||Ye.map(function(st){var Je=st.split("=");Je[0]==="_educoder_session"&&de(Je[1])})},[]),Object(A.useEffect)(function(){S==="office"&&Ue()},[S,u]);var Ue=function(){var et=Object(M.a)(P.a.mark(function rt(){var Ye,st,Je;return P.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return console.log("data:",u),Ye=u,u.startsWith("http")||(Ye=location.origin+Ye),st=new URL(Ye).pathname.split("/").pop(),Me.next=6,Object(a.U)({attachment_id:st});case 6:Je=Me.sent,Ae(Je);case 8:case"end":return Me.stop()}},rt)}));return function(){return et.apply(this,arguments)}}(),Be=function(){if(u.startsWith("http")||u.startsWith("blob:")){Ze();return}Object(g.x)(D||"educoder",u,D)},Ze=function(){Object(g.v)(D||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(F.a)({},G||{}),className:"".concat(N&&T.a.bgBlack," ").concat(S?T.a.wrp:"hide")},V&&d.a.createElement("div",{className:T.a.close,ref:Fe},!!ee&&d.a.createElement($.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return Fe.current}},d.a.createElement("span",{onClick:function(){I(),ee()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!Y&&d.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Fe.current}},d.a.createElement("span",{onClick:Ze},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Fe.current}},d.a.createElement("span",{className:"",onClick:I},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(T.a[B]," ").concat(B," ").concat(T.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&d.a.createElement(m.b,_)),S==="audio"&&d.a.createElement("audio",{src:"".concat(((x=u)===null||x===void 0?void 0:x.indexOf("http://"))>-1||((v=u)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),S==="video"&&d.a.createElement(d.a.Fragment,null,((y=u)===null||y===void 0?void 0:y.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),S==="office"&&se&&d.a.createElement("iframe",{src:"".concat(ie,"/office.html?key=").concat(se.key,"&url=").concat(ae+se.url,"&callbackUrl=").concat(ae+se.callbackUrl,"&fileType=").concat(se.fileType,"&title=").concat(se.title,"&model=").concat(C,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!Y)}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(le.key,"&url=").concat(i.a.API_SERVER+le.url,"&callbackUrl=").concat(i.a.API_SERVER+le.callbackUrl,"&fileType=").concat(le.fileType,"&title=").concat(le.title,"&model=").concat(le.model)}),S==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),S==="pdf"&&d.a.createElement("embed",{className:T.a.embed,src:u}),S==="image"&&d.a.createElement("img",{src:"".concat(((R=u)===null||R===void 0?void 0:R.indexOf("http://"))>-1||((w=u)===null||w===void 0?void 0:w.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)}),S==="other"&&d.a.createElement("div",null,d.a.createElement(J.a,{type:"primary",size:"large",onClick:Be},d.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&d.a.createElement(J.a,{type:"primary",size:"large",onClick:Be},d.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(bt,De,q){},pmY6:function(bt,De,q){"use strict";q.d(De,"g",function(){return F}),q.d(De,"f",function(){return M}),q.d(De,"e",function(){return j}),q.d(De,"h",function(){return U}),q.d(De,"b",function(){return P}),q.d(De,"a",function(){return A}),q.d(De,"d",function(){return d}),q.d(De,"c",function(){return f});var ue=!1,J="__is_disposable_tracked__";function O(T){if(!ue)return;if(T&&T!==A.None)try{T[J]=!0}catch(p){}}function $(T){if(!ue)return T;var p=new Error("Potentially leaked disposable").stack;return setTimeout(function(){T[J]||console.log(p)},3e3),T}function F(T){return typeof T.dispose=="function"&&T.dispose.length===0}function M(T){return Array.isArray(T)?(T.forEach(function(p){p&&(O(p),p.dispose())}),[]):T?(O(T),T.dispose(),T):void 0}function j(){for(var T=[],p=0;p<arguments.length;p++)T[p]=arguments[p];return T.forEach(O),$({dispose:function(){return M(T)}})}function U(T){var p=$({dispose:function(){O(p),T()}});return p}var P=function(){function T(){this._toDispose=new Set,this._isDisposed=!1}return T.prototype.dispose=function(){if(this._isDisposed)return;O(this),this._isDisposed=!0,this.clear()},T.prototype.clear=function(){this._toDispose.forEach(function(p){return p.dispose()}),this._toDispose.clear()},T.prototype.add=function(p){if(!p)return p;if(p===this)throw new Error("Cannot register a disposable on itself!");return O(p),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(p),p},T}(),A=function(){function T(){this._store=new P,$(this)}return T.prototype.dispose=function(){O(this),this._store.dispose()},T.prototype._register=function(p){if(p===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(p)},T.None=Object.freeze({dispose:function(){}}),T}(),d=function(){function T(){this._isDisposed=!1,$(this)}return Object.defineProperty(T.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(p){if(this._isDisposed||p===this._value)return;this._value&&this._value.dispose(),p&&O(p),this._value=p},enumerable:!0,configurable:!0}),T.prototype.clear=function(){this.value=void 0},T.prototype.dispose=function(){this._isDisposed=!0,O(this),this._value&&this._value.dispose(),this._value=void 0},T}(),f=function(){function T(p){this.object=p}return T.prototype.dispose=function(){},T}()},"rAM+":function(bt,De,q){"use strict";q.d(De,"a",function(){return J});var ue=q("Qw5x");function J(O,$){var F;if(typeof Symbol=="undefined"||O[Symbol.iterator]==null){if(Array.isArray(O)||(F=Object(ue.a)(O))||$&&O&&typeof O.length=="number"){F&&(O=F);var M=0,j=function(){};return{s:j,n:function(){return M>=O.length?{done:!0}:{done:!1,value:O[M++]}},e:function(f){throw f},f:j}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,P=!1,A;return{s:function(){F=O[Symbol.iterator]()},n:function(){var f=F.next();return U=f.done,f},e:function(f){P=!0,A=f},f:function(){try{!U&&F.return!=null&&F.return()}finally{if(P)throw A}}}}},rUJ1:function(bt,De){const q=/[&<>"']/,ue=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=w=>$[w];function M(w,E){if(E){if(q.test(w))return w.replace(ue,F)}else if(J.test(w))return w.replace(O,F);return w}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(w){return w.replace(j,(E,C)=>(C=C.toLowerCase(),C==="colon"?":":C.charAt(0)==="#"?C.charAt(1)==="x"?String.fromCharCode(parseInt(C.substring(2),16)):String.fromCharCode(+C.substring(1)):""))}const P=/(^|[^\[])\^/g;function A(w,E){w=w.source||w,E=E||"";const C={replace:(c,u)=>(u=u.source||u,u=u.replace(P,"$1"),w=w.replace(c,u),C),getRegex:()=>new RegExp(w,E)};return C}const d=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(w,E,C){if(w){let c;try{c=decodeURIComponent(U(C)).replace(d,"").toLowerCase()}catch(u){return null}if(c.indexOf("javascript:")===0||c.indexOf("vbscript:")===0||c.indexOf("data:")===0)return null}E&&!f.test(C)&&(C=i(E,C));try{C=encodeURI(C).replace(/%25/g,"%")}catch(c){return null}return C}const p={},m=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(w,E){p[" "+w]||(m.test(w)?p[" "+w]=w+"/":p[" "+w]=v(w,"/",!0)),w=p[" "+w];const C=w.indexOf(":")===-1;return E.substring(0,2)==="//"?C?E:w.replace(g,"$1")+E:E.charAt(0)==="/"?C?E:w.replace(a,"$1")+E:w+E}const s={exec:function(){}};function l(w){let E=1,C,c;for(;E<arguments.length;E++){C=arguments[E];for(c in C)Object.prototype.hasOwnProperty.call(C,c)&&(w[c]=C[c])}return w}function x(w,E){const C=w.replace(/\|/g,(L,S,D)=>{let _=!1,B=S;for(;--B>=0&&D[B]==="\\";)_=!_;return _?"|":" |"}),c=C.split(/ \|/);let u=0;if(c.length>E)c.splice(E);else for(;c.length<E;)c.push("");for(;u<c.length;u++)c[u]=c[u].trim().replace(/\\\|/g,"|");return c}function v(w,E,C){const c=w.length;if(c===0)return"";let u=0;for(;u<c;){const L=w.charAt(c-u-1);if(L===E&&!C)u++;else if(L!==E&&C)u++;else break}return w.substr(0,c-u)}function y(w,E){if(w.indexOf(E[1])===-1)return-1;const C=w.length;let c=0,u=0;for(;u<C;u++)if(w[u]==="\\")u++;else if(w[u]===E[0])c++;else if(w[u]===E[1]&&(c--,c<0))return u;return-1}function R(w){w&&w.sanitize&&!w.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")}bt.exports={escape:M,unescape:U,edit:A,cleanUrl:T,resolveUrl:i,noopTest:s,merge:l,splitCells:x,rtrim:v,findClosingBracket:y,checkSanitizeDeprecation:R}},ulZh:function(bt,De,q){typeof window!="undefined"&&function(J,O){bt.exports=O()}(this,function(){return function(ue){var J={};function O($){if(J[$])return J[$].exports;var F=J[$]={i:$,l:!1,exports:{}};return ue[$].call(F.exports,F,F.exports,O),F.l=!0,F.exports}return O.m=ue,O.c=J,O.d=function($,F,M){O.o($,F)||Object.defineProperty($,F,{enumerable:!0,get:M})},O.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},O.t=function($,F){if(F&1&&($=O($)),F&8)return $;if(F&4&&typeof $=="object"&&$&&$.__esModule)return $;var M=Object.create(null);if(O.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:$}),F&2&&typeof $!="string")for(var j in $)O.d(M,j,function(U){return $[U]}.bind(null,j));return M},O.n=function($){var F=$&&$.__esModule?function(){return $.default}:function(){return $};return O.d(F,"a",F),F},O.o=function($,F){return Object.prototype.hasOwnProperty.call($,F)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,J,O){"use strict";var $=Object.prototype.hasOwnProperty,F="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(F=!1));function j(d,f,T){this.fn=d,this.context=f,this.once=T||!1}function U(d,f,T,p,m){if(typeof T!="function")throw new TypeError("The listener must be a function");var g=new j(T,p||d,m),a=F?F+f:f;return d._events[a]?d._events[a].fn?d._events[a]=[d._events[a],g]:d._events[a].push(g):(d._events[a]=g,d._eventsCount++),d}function P(d,f){--d._eventsCount===0?d._events=new M:delete d._events[f]}function A(){this._events=new M,this._eventsCount=0}A.prototype.eventNames=function(){var f=[],T,p;if(this._eventsCount===0)return f;for(p in T=this._events)$.call(T,p)&&f.push(F?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(T)):f},A.prototype.listeners=function(f){var T=F?F+f:f,p=this._events[T];if(!p)return[];if(p.fn)return[p.fn];for(var m=0,g=p.length,a=new Array(g);m<g;m++)a[m]=p[m].fn;return a},A.prototype.listenerCount=function(f){var T=F?F+f:f,p=this._events[T];return p?p.fn?1:p.length:0},A.prototype.emit=function(f,T,p,m,g,a){var i=F?F+f:f;if(!this._events[i])return!1;var s=this._events[i],l=arguments.length,x,v;if(s.fn){s.once&&this.removeListener(f,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,T),!0;case 3:return s.fn.call(s.context,T,p),!0;case 4:return s.fn.call(s.context,T,p,m),!0;case 5:return s.fn.call(s.context,T,p,m,g),!0;case 6:return s.fn.call(s.context,T,p,m,g,a),!0}for(v=1,x=new Array(l-1);v<l;v++)x[v-1]=arguments[v];s.fn.apply(s.context,x)}else{var y=s.length,R;for(v=0;v<y;v++){s[v].once&&this.removeListener(f,s[v].fn,void 0,!0);switch(l){case 1:s[v].fn.call(s[v].context);break;case 2:s[v].fn.call(s[v].context,T);break;case 3:s[v].fn.call(s[v].context,T,p);break;case 4:s[v].fn.call(s[v].context,T,p,m);break;default:if(!x)for(R=1,x=new Array(l-1);R<l;R++)x[R-1]=arguments[R];s[v].fn.apply(s[v].context,x)}}}return!0},A.prototype.on=function(f,T,p){return U(this,f,T,p,!1)},A.prototype.once=function(f,T,p){return U(this,f,T,p,!0)},A.prototype.removeListener=function(f,T,p,m){var g=F?F+f:f;if(!this._events[g])return this;if(!T)return P(this,g),this;var a=this._events[g];if(a.fn)a.fn===T&&(!m||a.once)&&(!p||a.context===p)&&P(this,g);else{for(var i=0,s=[],l=a.length;i<l;i++)(a[i].fn!==T||m&&!a[i].once||p&&a[i].context!==p)&&s.push(a[i]);s.length?this._events[g]=s.length===1?s[0]:s:P(this,g)}return this},A.prototype.removeAllListeners=function(f){var T;return f?(T=F?F+f:f,this._events[T]&&P(this,T)):(this._events=new M,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=F,A.EventEmitter=A,ue.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,J,O){(function($){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(A,d,f){if(f=f||{},A=A.trim(),d=d.trim(),!d){if(!f.alwaysNormalize)return A;var T=P.parseURL(A);if(!T)throw new Error("Error trying to parse base URL.");return T.path=P.normalizePath(T.path),P.buildURLFromParts(T)}var p=P.parseURL(d);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=P.normalizePath(p.path),P.buildURLFromParts(p)):d;var m=P.parseURL(A);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var g=M.exec(m.path);m.netLoc=g[1],m.path=g[2]}m.netLoc&&!m.path&&(m.path="/");var a={scheme:m.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(a.netLoc=m.netLoc,p.path[0]!=="/"))if(!p.path)a.path=m.path,p.params||(a.params=m.params,p.query||(a.query=m.query));else{var i=m.path,s=i.substring(0,i.lastIndexOf("/")+1)+p.path;a.path=P.normalizePath(s)}return a.path===null&&(a.path=f.alwaysNormalize?P.normalizePath(p.path):p.path),P.buildURLFromParts(a)},parseURL:function(A){var d=F.exec(A);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(j,"");A.length!==(A=A.replace(U,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};ue.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,J,O){function $(f){var T={};function p(g){if(T[g])return T[g].exports;var a=T[g]={i:g,l:!1,exports:{}};return f[g].call(a.exports,a,a.exports,p),a.l=!0,a.exports}p.m=f,p.c=T,p.i=function(g){return g},p.d=function(g,a,i){p.o(g,a)||Object.defineProperty(g,a,{configurable:!1,enumerable:!0,get:i})},p.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},p.n=function(g){var a=g&&g.__esModule?function(){return g.default}:function(){return g};return p.d(a,"a",a),a},p.o=function(g,a){return Object.prototype.hasOwnProperty.call(g,a)},p.p="/",p.oe=function(g){throw console.error(g),g};var m=p(p.s=ENTRY_MODULE);return m.default||m}var F="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function j(f){return(f+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(f){return!isNaN(1*f)}function P(f,T,p){var m={};m[p]=[];var g=T.toString(),a=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return m;for(var i=a[1],s=new RegExp("(\\\\n|\\W)"+j(i)+M,"g"),l;l=s.exec(g);){if(l[3]==="dll-reference")continue;m[p].push(l[3])}for(s=new RegExp("\\("+j(i)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+M,"g");l=s.exec(g);)f[l[2]]||(m[p].push(l[1]),f[l[2]]=O(l[1]).m),m[l[2]]=m[l[2]]||[],m[l[2]].push(l[4]);for(var x=Object.keys(m),v=0;v<x.length;v++)for(var y=0;y<m[x[v]].length;y++)U(m[x[v]][y])&&(m[x[v]][y]=1*m[x[v]][y]);return m}function A(f){var T=Object.keys(f);return T.reduce(function(p,m){return p||f[m].length>0},!1)}function d(f,T){for(var p={main:[T]},m={main:[]},g={main:{}};A(p);)for(var a=Object.keys(p),i=0;i<a.length;i++){var s=a[i],l=p[s],x=l.pop();if(g[s]=g[s]||{},g[s][x]||!f[s][x])continue;g[s][x]=!0,m[s]=m[s]||[],m[s].push(x);for(var v=P(f,f[s][x],s),y=Object.keys(v),R=0;R<y.length;R++)p[y[R]]=p[y[R]]||[],p[y[R]]=p[y[R]].concat(v[y[R]])}return m}ue.exports=function(f,T){T=T||{};var p={main:O.m},m=T.all?{main:Object.keys(p.main)}:d(p,f),g="";Object.keys(m).filter(function(x){return x!=="main"}).forEach(function(x){for(var v=0;m[x][v];)v++;m[x].push(v),p[x][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+x+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+m[x].map(function(y){return""+JSON.stringify(y)+": "+p[x][y].toString()}).join(",")+`});
`}),g=g+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+m.main.map(function(x){return""+JSON.stringify(x)+": "+p.main[x].toString()}).join(",")+"}))(self);";var a=new window.Blob([g],{type:"text/javascript"});if(T.bare)return a;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,s=i.createObjectURL(a),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"hlsDefaultConfig",function(){return R}),O.d(J,"mergeConfig",function(){return E}),O.d(J,"enableStreamingMode",function(){return C});var $=O("./src/controller/abr-controller.ts"),F=O("./src/controller/audio-stream-controller.ts"),M=O("./src/controller/audio-track-controller.ts"),j=O("./src/controller/subtitle-stream-controller.ts"),U=O("./src/controller/subtitle-track-controller.ts"),P=O("./src/controller/buffer-controller.ts"),A=O("./src/controller/timeline-controller.ts"),d=O("./src/controller/cap-level-controller.ts"),f=O("./src/controller/fps-controller.ts"),T=O("./src/controller/eme-controller.ts"),p=O("./src/controller/cmcd-controller.ts"),m=O("./src/utils/xhr-loader.ts"),g=O("./src/utils/fetch-loader.ts"),a=O("./src/utils/cues.ts"),i=O("./src/utils/mediakeys-helper.ts"),s=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(c){for(var u=1;u<arguments.length;u++){var L=arguments[u];for(var S in L)Object.prototype.hasOwnProperty.call(L,S)&&(c[S]=L[S])}return c},l.apply(this,arguments)}function x(c,u){var L=Object.keys(c);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);u&&(S=S.filter(function(D){return Object.getOwnPropertyDescriptor(c,D).enumerable})),L.push.apply(L,S)}return L}function v(c){for(var u=1;u<arguments.length;u++){var L=arguments[u]!=null?arguments[u]:{};u%2?x(Object(L),!0).forEach(function(S){y(c,S,L[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(L)):x(Object(L)).forEach(function(S){Object.defineProperty(c,S,Object.getOwnPropertyDescriptor(L,S))})}return c}function y(c,u,L){return u in c?Object.defineProperty(c,u,{value:L,enumerable:!0,configurable:!0,writable:!0}):c[u]=L,c}var R=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:m.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:P.default,capLevelController:d.default,fpsController:f.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:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},w()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:U.default,timelineController:A.TimelineController,audioStreamController:F.default,audioTrackController:M.default,emeController:T.default,cmcdController:p.default});function w(){return{cueHandler:a.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 E(c,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},c,u)}function C(c){var u=c.loader;if(u!==g.default&&u!==m.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),c.progressive=!1;else{var L=Object(g.fetchSupported)();L&&(c.loader=g.default,c.progressive=!0,c.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/polyfills/number.ts"),F=O("./src/utils/ewma-bandwidth-estimator.ts"),M=O("./src/events.ts"),j=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),P=O("./src/types/loader.ts"),A=O("./src/utils/logger.ts");function d(p,m){for(var g=0;g<m.length;g++){var a=m[g];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function f(p,m,g){return m&&d(p.prototype,m),g&&d(p,g),p}var T=function(){function p(g){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=g;var a=g.config;this.bwEstimator=new F.default(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate),this.registerListeners()}var m=p.prototype;return m.registerListeners=function(){var a=this.hls;a.on(M.Events.FRAG_LOADING,this.onFragLoading,this),a.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(M.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var a=this.hls;a.off(M.Events.FRAG_LOADING,this.onFragLoading,this),a.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(M.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},m.onFragLoading=function(a,i){var s=i.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=i.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},m.onLevelLoaded=function(a,i){var s=this.hls.config;i.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},m._abandonRulesCheck=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,x=s.config,v=s.media;if(!a||!v)return;var y=i?i.stats:a.stats,R=i?i.duration:a.duration;if(y.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||v.paused||!v.playbackRate||!v.readyState)return;var w=performance.now()-y.loading.start,E=Math.abs(v.playbackRate);if(w<=500*R/E)return;var C=s.levels,c=s.minAutoLevel,u=C[a.level],L=y.total||Math.max(y.loaded,Math.round(R*u.maxBitrate/8)),S=Math.max(1,y.bwEstimate?y.bwEstimate/8:y.loaded*1e3/w),D=(L-y.loaded)/S,_=v.currentTime,B=(j.BufferHelper.bufferInfo(v,_,x.maxBufferHole).end-_)/E;if(B>=2*R/E||D<=B)return;var G=Number.POSITIVE_INFINITY,V;for(V=a.level-1;V>c;V--){var I=C[V].maxBitrate;if(G=R*I/(8*.8*S),G<B)break}if(G>=D)return;var N=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+a.sn+(i?" part "+i.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object($.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+D.toFixed(3)+` s
Estimated load time for the next fragment: `+G.toFixed(3)+` s
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(w,y.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:i,stats:y})},m.onFragLoaded=function(a,i){var s=i.frag,l=i.part;if(s.type===P.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(s.sn)){var x=l?l.stats:s.stats,v=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var y=this.hls.levels[s.level],R=(y.loaded?y.loaded.bytes:0)+x.loaded,w=(y.loaded?y.loaded.duration:0)+v;y.loaded={bytes:R,duration:w},y.realBitrate=Math.round(8*R/w)}if(s.bitrateTest){var E={stats:x,frag:s,part:l,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,E),s.bitrateTest=!1}}},m.onFragBuffered=function(a,i){var s=i.frag,l=i.part,x=l?l.stats:s.stats;if(x.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var v=x.parsing.end-x.loading.start;this.bwEstimator.sample(v,x.loaded),x.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},m.onError=function(a,i){switch(i.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},m.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},m.getNextABRAutoLevel=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.maxAutoLevel,x=s.config,v=s.minAutoLevel,y=s.media,R=i?i.duration:a?a.duration:0,w=y?y.currentTime:0,E=y&&y.playbackRate!==0?Math.abs(y.playbackRate):1,C=this.bwEstimator?this.bwEstimator.getEstimate():x.abrEwmaDefaultEstimate,c=(j.BufferHelper.bufferInfo(y,w,x.maxBufferHole).end-w)/E,u=this.findBestLevel(C,v,l,c,x.abrBandWidthFactor,x.abrBandWidthUpFactor);if(u>=0)return u;A.logger.trace((c?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var L=R?Math.min(R,x.maxStarvationDelay):x.maxStarvationDelay,S=x.abrBandWidthFactor,D=x.abrBandWidthUpFactor;if(!c){var _=this.bitrateTestDelay;if(_){var B=R?Math.min(R,x.maxLoadingDelay):x.maxLoadingDelay;L=B-_,A.logger.trace("bitrate test took "+Math.round(1e3*_)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*L)+" ms"),S=D=1}}return u=this.findBestLevel(C,v,l,c+L,S,D),Math.max(u,0)},m.findBestLevel=function(a,i,s,l,x,v){for(var y,R=this.fragCurrent,w=this.partCurrent,E=this.lastLoadedFragLevel,C=this.hls.levels,c=C[E],u=!!(c!=null&&(y=c.details)!==null&&y!==void 0&&y.live),L=c==null?void 0:c.codecSet,S=w?w.duration:R?R.duration:0,D=s;D>=i;D--){var _=C[D];if(!_||L&&_.codecSet!==L)continue;var B=_.details,G=(w?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||S,V=void 0;D<=E?V=x*a:V=v*a;var I=C[D].maxBitrate,N=I*G/V;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+D+"/"+Math.round(V)+"/"+I+"/"+G+"/"+l+"/"+N),V>I&&(!N||u&&!this.bitrateTestDelay||N<l))return D}return-1},f(p,[{key:"nextAutoLevel",get:function(){var a=this._nextAutoLevel,i=this.bwEstimator;if(a!==-1&&(!i||!i.canEstimate()))return a;var s=this.getNextABRAutoLevel();return a!==-1&&(s=Math.min(a,s)),s},set:function(a){this._nextAutoLevel=a}}]),p}();J.default=T},"./src/controller/audio-stream-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),M=O("./src/events.ts"),j=O("./src/utils/buffer-helper.ts"),U=O("./src/controller/fragment-tracker.ts"),P=O("./src/types/level.ts"),A=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),f=O("./src/demux/chunk-cache.ts"),T=O("./src/demux/transmuxer-interface.ts"),p=O("./src/types/transmuxer.ts"),m=O("./src/controller/fragment-finders.ts"),g=O("./src/utils/discontinuities.ts"),a=O("./src/errors.ts"),i=O("./src/utils/logger.ts");function s(){return s=Object.assign||function(R){for(var w=1;w<arguments.length;w++){var E=arguments[w];for(var C in E)Object.prototype.hasOwnProperty.call(E,C)&&(R[C]=E[C])}return R},s.apply(this,arguments)}function l(R,w){R.prototype=Object.create(w.prototype),R.prototype.constructor=R,x(R,w)}function x(R,w){return x=Object.setPrototypeOf||function(C,c){return C.__proto__=c,C},x(R,w)}var v=100,y=function(R){l(w,R);function w(C,c){var u;return u=R.call(this,C,c,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var E=w.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var c=this.hls;c.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(M.Events.ERROR,this.onError,this),c.on(M.Events.BUFFER_RESET,this.onBufferReset,this),c.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var c=this.hls;c.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(M.Events.ERROR,this.onError,this),c.off(M.Events.BUFFER_RESET,this.onBufferReset,this),c.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(c,u){var L=u.frag,S=u.id,D=u.initPTS;if(S==="main"){var _=L.cc;this.initPTS[L.cc]=D,this.log("InitPTS for cc: "+_+" found from main: "+D),this.videoTrackCC=_,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},E.startLoad=function(c){if(!this.levels){this.startPosition=c,this.state=F.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,u>0&&c===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()},E.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var c,u=this.levels,L=this.trackId,S=u==null||((c=u[L])===null||c===void 0)?void 0:c.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var D,_=performance.now(),B=this.retryDate;(!B||_>=B||(D=this.media)!==null&&D!==void 0&&D.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var G=this.waitingData;if(G){var V=G.frag,I=G.part,N=G.cache,Y=G.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var ee=N.flush(),le={frag:V,part:I,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(le),Y&&R.prototype._handleFragmentLoadComplete.call(this,le)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var me=this.getLoadPosition(),Ie=j.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),Te=Object(m.fragmentWithinToleranceTest)(Ie.end,this.config.maxFragLookUpTolerance,V);Te<0&&(i.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Ie.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},E.clearWaitingFragment=function(){var c=this.waitingData;c&&(this.fragmentTracker.removeFragment(c.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},E.onTickEnd=function(){var c=this.media;if(!c||!c.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:c,L=u.buffered;!this.loadedmetadata&&L.length&&(this.loadedmetadata=!0),this.lastCurrentTime=c.currentTime},E.doTickIdle=function(){var c,u,L=this.hls,S=this.levels,D=this.media,_=this.trackId,B=L.config;if(!S||!S[_])return;if(!D&&(this.startFragRequested||!B.startFragPrefetch))return;var G=S[_],V=G.details;if(!V||V.live&&this.levelLastLoaded!==_||this.waitForCdnTuneIn(V)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(I===null)return;var N=I.len,Y=this.getMaxBufferLength(),ee=this.audioSwitch;if(N>=Y&&!ee)return;if(!ee&&this._streamEnded(I,V)){L.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var le=V.fragments,me=le[0].start,Ie=I.end;if(ee){var Te=this.getLoadPosition();Ie=Te,V.PTSKnown&&Te<me&&((I.end>me||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),D.currentTime=me+.05))}var Oe=this.getNextFragment(Ie,V);if(!Oe){this.bufferFlushed=!0;return}((c=Oe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=Oe.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Oe,V):this.loadFragment(Oe,V,Ie)},E.getMaxBufferLength=function(){var c=R.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return u===null?c:Math.max(c,u.len)},E.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(c,u){var L=u.audioTracks;this.resetTransmuxer(),this.levels=L.map(function(S){return new P.Level(S)})},E.onAudioTrackSwitching=function(c,u){var L=!!u.url;this.trackId=u.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),L?this.setInterval(v):this.resetTransmuxer(),L?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(c,u){this.mainDetails=u.details},E.onAudioTrackLoaded=function(c,u){var L,S=this.levels,D=u.details,_=u.id;if(!S){this.warn("Audio tracks were reset while loading level "+_);return}this.log("Track "+_+" loaded ["+D.startSN+","+D.endSN+"],duration:"+D.totalduration);var B=S[_],G=0;if(D.live||(L=B.details)!==null&&L!==void 0&&L.live){var V=this.mainDetails;if(D.fragments[0]||(D.deltaUpdateFailed=!0),D.deltaUpdateFailed||!V)return;!B.details&&D.hasProgramDateTime&&V.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(D,V),G=D.fragments[0].start):G=this.alignPlaylists(D,B.details)}B.details=D,this.levelLastLoaded=_,!this.startFragRequested&&(this.mainDetails||!D.live)&&this.setStartPosition(B.details,G),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(D)&&(this.state=F.State.IDLE),this.tick()},E._handleFragmentLoadProgress=function(c){var u,L=c.frag,S=c.part,D=c.payload,_=this.config,B=this.trackId,G=this.levels;if(!G){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+L.sn+" of level "+L.level+" will not be buffered");return}var V=G[B];console.assert(V,"Audio track is defined on fragment load progress");var I=V.details;console.assert(I,"Audio track details are defined on fragment load progress");var N=_.defaultAudioCodec||V.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new T.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[L.cc],le=(u=L.initSegment)===null||u===void 0?void 0:u.data;if(ee!==void 0){var me=!1,Ie=S?S.index:-1,Te=Ie!==-1,Oe=new p.ChunkMetadata(L.level,L.sn,L.stats.chunkCount,D.byteLength,Ie,Te);Y.push(D,le,N,"",L,S,I.totalduration,me,Oe,ee)}else{i.logger.log("Unknown video PTS for cc "+L.cc+", waiting for video PTS before demuxing audio frag "+L.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+B);var Re=this.waitingData=this.waitingData||{frag:L,part:S,cache:new f.default,complete:!1},Ee=Re.cache;Ee.push(new Uint8Array(D)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},E._handleFragmentLoadComplete=function(c){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,c)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(c,u){var L=u.tracks.audio;L&&(this.mediaBuffer=L.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},E.onFragBuffered=function(c,u){var L=u.frag,S=u.part;if(L.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(L)){this.warn("Fragment "+L.sn+(S?" p: "+S.index:"")+" of level "+L.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}L.sn!=="initSegment"&&(this.fragPrevious=L,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(L,S)},E.onError=function(c,u){switch(u.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,u);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=u.fatal?F.State.ERROR:F.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var L=!0,S=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);S&&S.len>.5&&(L=!this.reduceMaxBufferLength(S.len)),L&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},E.onBufferFlushed=function(c,u){var L=u.type;L===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(c){var u,L="audio",S=this.hls,D=c.remuxResult,_=c.chunkMeta,B=this.getCurrentContext(_);if(!B){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var G=B.frag,V=B.part,I=D.audio,N=D.text,Y=D.id3,ee=D.initSegment;if(this.fragContextChanged(G))return;if(this.state=F.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,G,_),S.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:L,tracks:ee.tracks})),I){var le=I.startPTS,me=I.endPTS,Ie=I.startDTS,Te=I.endDTS;V&&(V.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:me,startDTS:Ie,endDTS:Te}),G.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,le,me,Ie,Te),this.bufferFragmentData(I,G,V,_)}if(Y!=null&&(u=Y.samples)!==null&&u!==void 0&&u.length){var Oe=s({frag:G,id:L},Y);S.trigger(M.Events.FRAG_PARSING_METADATA,Oe)}if(N){var Re=s({frag:G,id:L},N);S.trigger(M.Events.FRAG_PARSING_USERDATA,Re)}},E._bufferInitSegment=function(c,u,L){if(this.state!==F.State.PARSING)return;c.video&&delete c.video;var S=c.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,c);var D=S.initSegment;if(D!=null&&D.byteLength){var _={type:"audio",frag:u,part:null,chunkMeta:L,parent:u.type,data:D};this.hls.trigger(M.Events.BUFFER_APPENDING,_)}this.tick()},E.loadFragment=function(c,u,L){var S=this.fragmentTracker.getState(c);this.fragCurrent=c,(this.audioSwitch||S===U.FragmentState.NOT_LOADED||S===U.FragmentState.PARTIAL)&&(c.sn==="initSegment"?this._loadInitSegment(c):u.live&&!Object($.isFiniteNumber)(this.initPTS[c.cc])?(this.log("Waiting for video PTS in continuity counter "+c.cc+" of live stream before loading audio fragment "+c.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,c,u,L)))},E.completeAudioSwitch=function(){var c=this.hls,u=this.media,L=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,c.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:L})},w}(F.default);J.default=y},"./src/controller/audio-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/controller/base-playlist-controller.ts"),j=O("./src/types/loader.ts");function U(T,p){for(var m=0;m<p.length;m++){var g=p[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(T,g.key,g)}}function P(T,p,m){return p&&U(T.prototype,p),m&&U(T,m),T}function A(T,p){T.prototype=Object.create(p.prototype),T.prototype.constructor=T,d(T,p)}function d(T,p){return d=Object.setPrototypeOf||function(g,a){return g.__proto__=a,g},d(T,p)}var f=function(T){A(p,T);function p(g){var a;return a=T.call(this,g,"[audio-track-controller]")||this,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.trackName="",a.selectDefaultTrack=!0,a.registerListeners(),a}var m=p.prototype;return m.registerListeners=function(){var a=this.hls;a.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on($.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var a=this.hls;a.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off($.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},m.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},m.onManifestParsed=function(a,i){this.tracks=i.audioTracks||[]},m.onAudioTrackLoaded=function(a,i){var s=i.id,l=i.details,x=this.tracksInGroup[s];if(!x){this.warn("Invalid audio track id "+s);return}var v=x.details;x.details=i.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,i,v))},m.onLevelLoading=function(a,i){this.switchLevel(i.level)},m.onLevelSwitching=function(a,i){this.switchLevel(i.level)},m.switchLevel=function(a){var i=this.hls.levels[a];if(!(i!=null&&i.audioGroupIds))return;var s=i.audioGroupIds[i.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(v){return!s||v.groupId===s});this.selectDefaultTrack&&!l.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var x={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,x),this.selectInitialTrack()}},m.onError=function(a,i){if(T.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===j.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},m.setAudioTrack=function(a){var i=this.tracksInGroup;if(a<0||a>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=i[this.trackId];this.log("Now switching to audio-track index "+a);var l=i[a],x=l.id,v=l.groupId,y=v===void 0?"":v,R=l.name,w=l.type,E=l.url;if(this.trackId=a,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:x,groupId:y,name:R,type:w,url:E}),l.details&&!l.details.live)return;var C=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(C)},m.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,s=this.findTrackId(i)||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:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},m.findTrackId=function(a){for(var i=this.tracksInGroup,s=0;s<i.length;s++){var l=i[s];if((!this.selectDefaultTrack||l.default)&&(!a||a===l.name))return l.id}return-1},m.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var s=i.id,l=i.groupId,x=i.url;if(a)try{x=a.addDirectives(x)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:x,id:s,groupId:l,deliveryDirectives:a||null})}},P(p,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}}]),p}(M.default);J.default=f},"./src/controller/base-playlist-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return P});var $=O("./src/polyfills/number.ts"),F=O("./src/types/level.ts"),M=O("./src/controller/level-helper.ts"),j=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),P=function(){function A(f,T){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,T+":"),this.warn=j.logger.warn.bind(j.logger,T+":"),this.hls=f}var d=A.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(T,p){p.fatal&&p.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},d.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},d.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},d.stopLoad=function(){this.canLoad=!1,this.clearTimer()},d.switchParams=function(T,p){var m=p==null?void 0:p.renditionReports;if(m)for(var g=0;g<m.length;g++){var a=m[g],i=""+a.URI;if(i===T.substr(-i.length)){var s=parseInt(a["LAST-MSN"]),l=parseInt(a["LAST-PART"]);if(p&&this.hls.config.lowLatencyMode){var x=Math.min(p.age-p.partTarget,p.targetduration);l!==void 0&&x>p.partTarget&&(l+=1)}if(Object($.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object($.isFiniteNumber)(l)?l:void 0,F.HlsSkip.No)}}},d.loadPlaylist=function(T){},d.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},d.playlistLoaded=function(T,p,m){var g=this,a=p.details,i=p.stats,s=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(a.advancedDateTime=Date.now()-s,a.live||m!=null&&m.live){if(a.reloaded(m),m&&this.log("live playlist "+T+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),m&&a.fragments.length>0&&Object(M.mergeDetails)(m,a),!this.canLoad||!a.live)return;var l,x=void 0,v=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var y=this.hls.config.lowLatencyMode,R=a.lastPartSn,w=a.endSN,E=a.lastPartIndex,C=E!==-1,c=R===w,u=y?0:E;C?(x=c?w+1:R,v=c?u:E+1):x=w+1;var L=a.age,S=L+a.ageHeader,D=Math.min(S-a.partTarget,a.targetduration*1.5);if(D>0){if(m&&D>m.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+m.tuneInGoal+" to: "+D+" with playlist age: "+a.age),D=0;else{var _=Math.floor(D/a.targetduration);if(x+=_,v!==void 0){var B=Math.round(D%a.targetduration/a.partTarget);v+=B}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+D+" skip sn "+_+" to part "+v)}a.tuneInGoal=D}if(l=this.getDeliveryDirectives(a,p.deliveryDirectives,x,v),y||!c){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(a,p.deliveryDirectives,x,v);var G=Object(M.computeReloadInterval)(a,i);x!==void 0&&a.canBlockReload&&(G-=a.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(G)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(l)},G)}else this.clearTimer()},d.getDeliveryDirectives=function(T,p,m,g){var a=Object(F.getSkipValue)(T,m);return p!=null&&p.skip&&T.deltaUpdateFailed&&(m=p.msn,g=p.part,a=F.HlsSkip.No),new F.HlsUrlParameters(m,g,a)},d.retryLoadingOrFail=function(T){var p=this,m=this.hls.config,g=this.retryCount<m.levelLoadingMaxRetry;if(g){var a;if(this.retryCount++,T.details.indexOf("LoadTimeOut")>-1&&(a=T.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+T.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*m.levelLoadingRetryDelay,m.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return p.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return g},A}()},"./src/controller/base-stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"State",function(){return w}),O.d(J,"default",function(){return E});var $=O("./src/polyfills/number.ts"),F=O("./src/task-loop.ts"),M=O("./src/controller/fragment-tracker.ts"),j=O("./src/utils/buffer-helper.ts"),U=O("./src/utils/logger.ts"),P=O("./src/events.ts"),A=O("./src/errors.ts"),d=O("./src/types/transmuxer.ts"),f=O("./src/utils/mp4-tools.ts"),T=O("./src/utils/discontinuities.ts"),p=O("./src/controller/fragment-finders.ts"),m=O("./src/controller/level-helper.ts"),g=O("./src/loader/fragment-loader.ts"),a=O("./src/crypt/decrypter.ts"),i=O("./src/utils/time-ranges.ts"),s=O("./src/types/loader.ts");function l(C,c){for(var u=0;u<c.length;u++){var L=c[u];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(C,L.key,L)}}function x(C,c,u){return c&&l(C.prototype,c),u&&l(C,u),C}function v(C){if(C===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C}function y(C,c){C.prototype=Object.create(c.prototype),C.prototype.constructor=C,R(C,c)}function R(C,c){return R=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},R(C,c)}var w={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"},E=function(C){y(c,C);function c(L,S,D){var _;return _=C.call(this)||this,_.hls=void 0,_.fragPrevious=null,_.fragCurrent=null,_.fragmentTracker=void 0,_.transmuxer=null,_._state=w.STOPPED,_.media=void 0,_.mediaBuffer=void 0,_.config=void 0,_.bitrateTest=!1,_.lastCurrentTime=0,_.nextLoadPosition=0,_.startPosition=0,_.loadedmetadata=!1,_.fragLoadError=0,_.retryDate=0,_.levels=null,_.fragmentLoader=void 0,_.levelLastLoaded=null,_.startFragRequested=!1,_.decrypter=void 0,_.initPTS=[],_.onvseeking=null,_.onvended=null,_.logPrefix="",_.log=void 0,_.warn=void 0,_.logPrefix=D,_.log=U.logger.log.bind(U.logger,D+":"),_.warn=U.logger.warn.bind(U.logger,D+":"),_.hls=L,_.fragmentLoader=new g.default(L.config),_.fragmentTracker=S,_.config=L.config,_.decrypter=new a.default(L,L.config),L.on(P.Events.KEY_LOADED,_.onKeyLoaded,v(_)),_}var u=c.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(S){},u.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=w.STOPPED},u._streamEnded=function(S,D){var _=this.fragCurrent,B=this.fragmentTracker;if(!D.live&&_&&_.sn===D.endSN&&!S.nextStart){var G=B.getState(_);return G===M.FragmentState.PARTIAL||G===M.FragmentState.OK}return!1},u.onMediaAttached=function(S,D){var _=this.media=this.mediaBuffer=D.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),_.addEventListener("seeking",this.onvseeking),_.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(B.startPosition)},u.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var S=this.config,D=this.fragCurrent,_=this.media,B=this.mediaBuffer,G=this.state,V=_?_.currentTime:0,I=j.BufferHelper.bufferInfo(B||_,V,S.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+G),G===w.ENDED)this.resetLoadingState();else if(D&&!I.len){var N=S.maxFragLookUpTolerance,Y=D.start-N,ee=D.start+D.duration+N,le=V>ee;(V<Y||le)&&(le&&D.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),D.loader.abort()),this.resetLoadingState())}_&&(this.lastCurrentTime=V),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(S,D){if(this.state!==w.KEY_LOADING||D.frag!==this.fragCurrent||!this.levels)return;this.state=w.IDLE;var _=this.levels[D.frag.level].details;_&&this.loadFragment(D.frag,_,D.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),C.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=w.STOPPED,this.hls.off(P.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,C.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(S,D){this.log("Loading key for "+S.sn+" of ["+D.startSN+"-"+D.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=w.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(P.Events.KEY_LOADING,{frag:S})},u.loadFragment=function(S,D,_){this._loadFragForPlayback(S,D,_)},u._loadFragForPlayback=function(S,D,_){var B=this,G=function(I){if(B.fragContextChanged(S)){B.warn("Fragment "+S.sn+(I.part?" p: "+I.part.index:"")+" of level "+S.level+" was dropped during download."),B.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,B._handleFragmentLoadProgress(I)};this._doFragLoad(S,D,_,G).then(function(V){if(!V)return;B.fragLoadError=0;var I=B.state;if(B.fragContextChanged(S)){(I===w.FRAG_LOADING||I===w.BACKTRACKING||!B.fragCurrent&&I===w.PARSING)&&(B.fragmentTracker.removeFragment(S),B.state=w.IDLE);return}if("payload"in V&&(B.log("Loaded fragment "+S.sn+" of level "+S.level),B.hls.trigger(P.Events.FRAG_LOADED,V),B.state===w.BACKTRACKING)){B.fragmentTracker.backtrack(S,V),B.resetFragmentLoading(S);return}B._handleFragmentLoadComplete(V)}).catch(function(V){B.warn(V),B.resetFragmentLoading(S)})},u.flushMainBuffer=function(S,D,_){if(_===void 0&&(_=null),!(S-D))return;var B={startOffset:S,endOffset:D,type:_};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,B)},u._loadInitSegment=function(S){var D=this;this._doFragLoad(S).then(function(_){if(!_||D.fragContextChanged(S)||!D.levels)throw new Error("init load aborted");return _}).then(function(_){var B=D.hls,G=_.payload,V=S.decryptdata;if(G&&G.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var I=self.performance.now();return D.decrypter.webCryptoDecrypt(new Uint8Array(G),V.key.buffer,V.iv.buffer).then(function(N){var Y=self.performance.now();return B.trigger(P.Events.FRAG_DECRYPTED,{frag:S,payload:N,stats:{tstart:I,tdecrypt:Y}}),_.payload=N,_})}return _}).then(function(_){var B=D.fragCurrent,G=D.hls,V=D.levels;if(!V)throw new Error("init load aborted, missing levels");var I=V[S.level].details;console.assert(I,"Level details are defined when init segment is loaded");var N=S.stats;D.state=w.IDLE,D.fragLoadError=0,S.data=new Uint8Array(_.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),_.frag===B&&G.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:B,part:null,id:S.type}),D.tick()}).catch(function(_){D.warn(_),D.resetFragmentLoading(S)})},u.fragContextChanged=function(S){var D=this.fragCurrent;return!S||!D||S.level!==D.level||S.sn!==D.sn||S.urlId!==D.urlId},u.fragBufferedComplete=function(S,D){var _=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(D?" part: "+D.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+i.default.toString(j.BufferHelper.getBuffered(_))),this.state=w.IDLE,this.tick()},u._handleFragmentLoadComplete=function(S){var D=this.transmuxer;if(!D)return;var _=S.frag,B=S.part,G=S.partsLoaded,V=!G||G.length===0||G.some(function(N){return!N}),I=new d.ChunkMetadata(_.level,_.sn,_.stats.chunkCount+1,0,B?B.index:-1,!V);D.flush(I)},u._handleFragmentLoadProgress=function(S){},u._doFragLoad=function(S,D,_,B){var G=this;if(_===void 0&&(_=null),!this.levels)throw new Error("frag load aborted, missing levels");if(_=Math.max(S.start,_||0),this.config.lowLatencyMode&&D){var V=D.partList;if(V&&B){_>S.end&&D.fragmentHint&&(S=D.fragmentHint);var I=this.getNextPart(V,S,_);if(I>-1){var N=V[I];return this.log("Loading part sn: "+S.sn+" p: "+N.index+" cc: "+S.cc+" of playlist ["+D.startSN+"-"+D.endSN+"] parts [0-"+I+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(_.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=w.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,part:V[I],targetBufferTime:_}),this.doFragPartsLoad(S,V,I,B).catch(function(Y){return G.handleFragLoadError(Y)})}else if(!S.url||this.loadedEndOfParts(V,_))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(D?"of ["+D.startSN+"-"+D.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(_.toFixed(3))),Object($.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=w.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,targetBufferTime:_}),this.fragmentLoader.load(S,B).catch(function(Y){return G.handleFragLoadError(Y)})},u.doFragPartsLoad=function(S,D,_,B){var G=this;return new Promise(function(V,I){var N=[],Y=function ee(le){var me=D[le];G.fragmentLoader.loadPart(S,me,B).then(function(Ie){N[me.index]=Ie;var Te=Ie.part;G.hls.trigger(P.Events.FRAG_LOADED,Ie);var Oe=D[le+1];if(Oe&&Oe.fragment===S)ee(le+1);else return V({frag:S,part:Te,partsLoaded:N})}).catch(I)};Y(_)})},u.handleFragLoadError=function(S){var D=S.data;return D&&D.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(D.frag,D.part):this.hls.trigger(P.Events.ERROR,D),null},u._handleTransmuxerFlush=function(S){var D=this.getCurrentContext(S);if(!D||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var _=D.frag,B=D.part,G=D.level,V=self.performance.now();_.stats.parsing.end=V,B&&(B.stats.parsing.end=V),this.updateLevelTiming(_,B,G,S.partial)},u.getCurrentContext=function(S){var D=this.levels,_=S.level,B=S.sn,G=S.part;if(!D||!D[_])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+_+". The current chunk will not be buffered."),null;var V=D[_],I=G>-1?Object(m.getPartWith)(V,B,G):null,N=I?I.fragment:Object(m.getFragmentWithSN)(V,B,this.fragCurrent);return N?{frag:N,part:I,level:V}:null},u.bufferFragmentData=function(S,D,_,B){if(!S||this.state!==w.PARSING)return;var G=S.data1,V=S.data2,I=G;if(G&&V&&(I=Object(f.appendUint8Array)(G,V)),!I||!I.length)return;var N={type:S.type,frag:D,part:_,chunkMeta:B,parent:D.type,data:I};this.hls.trigger(P.Events.BUFFER_APPENDING,N),S.dropped&&S.independent&&!_&&this.flushBufferGap(D)},u.flushBufferGap=function(S){var D=this.media;if(!D)return;if(!j.BufferHelper.isBuffered(D,D.currentTime)){this.flushMainBuffer(0,S.start);return}var _=D.currentTime,B=j.BufferHelper.bufferInfo(D,_,0),G=S.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,G*.25),I=Math.max(Math.min(S.start-V,B.end-V),_+V);S.start-I>V&&this.flushMainBuffer(I,S.start)},u.getFwdBufferInfo=function(S,D){var _=this.config,B=this.getLoadPosition();if(!Object($.isFiniteNumber)(B))return null;var G=j.BufferHelper.bufferInfo(S,B,_.maxBufferHole);if(G.len===0&&G.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(B,D);if(V&&G.nextStart<V.end)return j.BufferHelper.bufferInfo(S,B,Math.max(G.nextStart,_.maxBufferHole))}return G},u.getMaxBufferLength=function(S){var D=this.config,_;return S?_=Math.max(8*D.maxBufferSize/S,D.maxBufferLength):_=D.maxBufferLength,Math.min(_,D.maxMaxBufferLength)},u.reduceMaxBufferLength=function(S){var D=this.config,_=S||D.maxBufferLength;return D.maxMaxBufferLength>=_?(D.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+D.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(S,D){var _,B,G=D.fragments,V=G.length;if(!V)return null;var I=this.config,N=G[0].start,Y;if(D.live){var ee=I.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!D.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(D,G),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:S)}else S<=N&&(Y=G[0]);if(!Y){var le=I.lowLatencyMode?D.partEnd:D.fragmentEnd;Y=this.getFragmentAtPosition(S,le,D)}return(_=Y)!==null&&_!==void 0&&_.initSegment&&!((B=Y)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},u.getNextPart=function(S,D,_){for(var B=-1,G=!1,V=!0,I=0,N=S.length;I<N;I++){var Y=S[I];if(V=V&&!Y.independent,B>-1&&_<Y.start)break;var ee=Y.loaded;!ee&&(G||Y.independent||V)&&Y.fragment===D&&(B=I),G=ee}return B},u.loadedEndOfParts=function(S,D){var _=S[S.length-1];return _&&D>_.start&&_.loaded},u.getInitialLiveFragment=function(S,D){var _=this.fragPrevious,B=null;if(_){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+_.programDateTime),B=Object(p.findFragmentByPDT)(D,_.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var G=_.sn+1;if(G>=S.startSN&&G<=S.endSN){var V=D[G-S.startSN];_.cc===V.cc&&(B=V,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(p.findFragWithCC)(D,_.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(B=this.getFragmentAtPosition(I,this.bitrateTest?S.fragmentEnd:S.edge,S))}return B},u.getFragmentAtPosition=function(S,D,_){var B=this.config,G=this.fragPrevious,V=_.fragments,I=_.endSN,N=_.fragmentHint,Y=B.maxFragLookUpTolerance,ee=!!(B.lowLatencyMode&&_.partList&&N);ee&&N&&!this.bitrateTest&&(V=V.concat(N),I=N.sn);var le;if(S<D){var me=S>D-Y?0:Y;le=Object(p.findFragmentByPTS)(G,V,S,me)}else le=V[V.length-1];if(le){var Ie=le.sn-_.startSN,Te=G&&le.level===G.level,Oe=V[Ie+1],Re=this.fragmentTracker.getState(le);if(Re===M.FragmentState.BACKTRACKED){le=null;for(var Ee=Ie;V[Ee]&&this.fragmentTracker.getState(V[Ee])===M.FragmentState.BACKTRACKED;)G?le=V[Ee--]:le=V[--Ee];le||(le=Oe)}else G&&le.sn===G.sn&&!ee&&(Te&&(le.sn<I&&this.fragmentTracker.getState(Oe)!==M.FragmentState.OK?(this.log("SN "+le.sn+" just loaded, load next one: "+Oe.sn),le=Oe):le=null))}return le},u.synchronizeToLiveEdge=function(S){var D=this.config,_=this.media;if(!_)return;var B=this.hls.liveSyncPosition,G=_.currentTime,V=S.fragments[0].start,I=S.edge,N=G>=V-D.maxFragLookUpTolerance&&G<=I;if(B!==null&&_.duration>B&&(G<B||!N)){var Y=D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:D.liveMaxLatencyDurationCount*S.targetduration;(!N&&_.readyState<4||G<I-Y)&&(this.loadedmetadata||(this.nextLoadPosition=B),_.readyState&&(this.warn("Playback: "+G.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+B.toFixed(3)),_.currentTime=B))}},u.alignPlaylists=function(S,D){var _=this.levels,B=this.levelLastLoaded,G=this.fragPrevious,V=B!==null?_[B]:null,I=S.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var N=S.fragments[0].start,Y=!D,ee=S.alignedSliding&&Object($.isFiniteNumber)(N);if(Y||!ee&&!N){Object(T.alignStream)(G,V,S);var le=S.fragments[0].start;return this.log("Live playlist sliding: "+le.toFixed(2)+" start-sn: "+(D?D.startSN:"na")+"->"+S.startSN+" prev-sn: "+(G?G.sn:"na")+" fragments: "+I),le}return N},u.waitForCdnTuneIn=function(S){var D=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*D)},u.setStartPosition=function(S,D){var _=this.startPosition;if(_<D&&(_=-1),_===-1||this.lastCurrentTime===-1){var B=S.startTimeOffset;Object($.isFiniteNumber)(B)?(_=D+B,B<0&&(_+=S.totalduration),_=Math.min(Math.max(D,_),D+S.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+_),this.startPosition=_):S.live?_=this.hls.liveSyncPosition||D:this.startPosition=_=0,this.lastCurrentTime=_}this.nextLoadPosition=_},u.getLoadPosition=function(){var S=this.media,D=0;return this.loadedmetadata&&S?D=S.currentTime:this.nextLoadPosition&&(D=this.nextLoadPosition),D},u.handleFragLoadAborted=function(S,D){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(D?" part"+D.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},u.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=w.IDLE)},u.onFragmentOrKeyLoadError=function(S,D){if(D.fatal)return;var _=D.frag;if(!_||_.type!==S)return;var B=this.fragCurrent;console.assert(B&&_.sn===B.sn&&_.level===B.level&&_.urlId===B.urlId,"Frag load error must match current frag to retry");var G=this.config;if(this.fragLoadError+1<=G.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(_.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*G.fragLoadingRetryDelay,G.fragLoadingMaxRetryTimeout);this.warn("Fragment "+_.sn+" of "+S+" "+_.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=w.FRAG_LOADING_WAITING_RETRY}else D.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=w.IDLE):(U.logger.error(D.details+" reaches max retry, redispatch as fatal ..."),D.fatal=!0,this.hls.stopLoad(),this.state=w.ERROR)},u.afterBufferFlushed=function(S,D,_){if(!S)return;var B=j.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(D,B,_),this.state===w.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=w.IDLE},u.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var D=this.levels?this.levels[S].details:null;if(D!=null&&D.live)return this.startPosition=-1,this.setStartPosition(D,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(S,D,_,B){var G=this,V=_.details;console.assert(!!V,"level.details must be defined");var I=Object.keys(S.elementaryStreams).reduce(function(N,Y){var ee=S.elementaryStreams[Y];if(ee){var le=ee.endPTS-ee.startPTS;if(le<=0)return G.warn("Could not parse fragment "+S.sn+" "+Y+" duration reliably ("+le+") resetting transmuxer to fallback to playlist timing"),G.resetTransmuxer(),N||!1;var me=B?0:Object(m.updateFragPTSDTS)(V,S,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return G.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:V,level:_,drift:me,type:Y,frag:S,start:ee.startPTS,end:ee.endPTS}),!0}return N},!1);I?(this.state=w.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:S,part:D})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},x(c,[{key:"state",get:function(){return this._state},set:function(S){var D=this._state;D!==S&&(this._state=S,this.log(D+"->"+S))}}]),c}(F.default)},"./src/controller/buffer-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return p});var $=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),M=O("./src/utils/logger.ts"),j=O("./src/errors.ts"),U=O("./src/utils/buffer-helper.ts"),P=O("./src/utils/mediasource-helper.ts"),A=O("./src/loader/fragment.ts"),d=O("./src/controller/buffer-operation-queue.ts"),f=Object(P.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,p=function(){function m(a){var i=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=i.hls,l=i.media,x=i.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:l})),x&&x.removeEventListener("sourceopen",i._onMediaSourceOpen),i.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=a,this._initSourceBuffer(),this.registerListeners()}var g=m.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var i=this.hls;i.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(F.Events.BUFFER_RESET,this.onBufferReset,this),i.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(F.Events.BUFFER_EOS,this.onBufferEos,this),i.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(F.Events.FRAG_PARSED,this.onFragParsed,this),i.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var i=this.hls;i.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(F.Events.BUFFER_RESET,this.onBufferReset,this),i.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(F.Events.BUFFER_EOS,this.onBufferEos,this),i.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(F.Events.FRAG_PARSED,this.onFragParsed,this),i.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(i,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(i,s){var l=this.media=s.media;if(l&&f){var x=this.mediaSource=new f;x.addEventListener("sourceopen",this._onMediaSourceOpen),x.addEventListener("sourceended",this._onMediaSourceEnded),x.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(x),this._objectUrl=l.src}},g.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(x){M.logger.warn("[buffer-controller]: onMediaDetaching: "+x.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(l&&self.URL.revokeObjectURL(l),i.src===l?(i.removeAttribute("src"),i.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(F.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(s){var l=i.sourceBuffer[s];try{l&&(i.removeBufferListeners(s),i.mediaSource&&i.mediaSource.removeSourceBuffer(l),i.sourceBuffer[s]=void 0)}catch(x){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",x)}}),this._initSourceBuffer()},g.onBufferCodecs=function(i,s){var l=this,x=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(v){if(x){var y=l.tracks[v];if(y&&typeof y.buffer.changeType=="function"){var R=s[v],w=R.codec,E=R.levelCodec,C=R.container,c=(y.levelCodec||y.codec).replace(T,"$1"),u=(E||w).replace(T,"$1");if(c!==u){var L=C+";codecs="+(E||w);l.appendChangeType(v,L)}}}else l.pendingTracks[v]=s[v]}),x)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(i,s){var l=this,x=this.operationQueue,v={execute:function(){var R=l.sourceBuffer[i];R&&(M.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),R.changeType(s)),x.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(R){M.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",R)}};x.append(v,i)},g.onBufferAppending=function(i,s){var l=this,x=this.hls,v=this.operationQueue,y=this.tracks,R=s.data,w=s.type,E=s.frag,C=s.part,c=s.chunkMeta,u=c.buffering[w],L=self.performance.now();u.start=L;var S=E.stats.buffering,D=C?C.stats.buffering:null;S.start===0&&(S.start=L),D&&D.start===0&&(D.start=L);var _=y.audio,B=w==="audio"&&c.id===1&&(_==null?void 0:_.container)==="audio/mpeg",G={execute:function(){if(u.executeStart=self.performance.now(),B){var I=l.sourceBuffer[w];if(I){var N=E.start-I.timestampOffset;Math.abs(N)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+E.start+" (delta: "+N+") sn: "+E.sn+")"),I.timestampOffset=E.start)}}l.appendExecutor(R,w)},onStart:function(){},onComplete:function(){var I=self.performance.now();u.executeEnd=u.end=I,S.first===0&&(S.first=I),D&&D.first===0&&(D.first=I);var N=l.sourceBuffer,Y={};for(var ee in N)Y[ee]=U.BufferHelper.getBuffered(N[ee]);l.appendError=0,l.hls.trigger(F.Events.BUFFER_APPENDED,{type:w,frag:E,part:C,chunkMeta:c,parent:E.type,timeRanges:Y})},onError:function(I){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",I);var N={type:j.ErrorTypes.MEDIA_ERROR,parent:E.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=j.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,N.details=j.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>x.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+x.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),x.trigger(F.Events.ERROR,N)}};v.append(G,w)},g.onBufferFlushing=function(i,s){var l=this,x=this.operationQueue,v=function(R){return{execute:l.removeExecutor.bind(l,R,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(F.Events.BUFFER_FLUSHED,{type:R})},onError:function(E){M.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",E)}}};s.type?x.append(v(s.type),s.type):this.getSourceBufferTypes().forEach(function(y){x.append(v(y),y)})},g.onFragParsed=function(i,s){var l=this,x=s.frag,v=s.part,y=[],R=v?v.elementaryStreams:x.elementaryStreams;R[A.ElementaryStreamTypes.AUDIOVIDEO]?y.push("audiovideo"):(R[A.ElementaryStreamTypes.AUDIO]&&y.push("audio"),R[A.ElementaryStreamTypes.VIDEO]&&y.push("video"));var w=function(){var C=self.performance.now();x.stats.buffering.end=C,v&&(v.stats.buffering.end=C);var c=v?v.stats:x.stats;l.hls.trigger(F.Events.FRAG_BUFFERED,{frag:x,part:v,stats:c,id:x.type})};y.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+x.type+" level: "+x.level+" sn: "+x.sn),this.blockBuffers(w,y)},g.onFragChanged=function(i,s){this.flushBackBuffer()},g.onBufferEos=function(i,s){var l=this,x=this.getSourceBufferTypes().reduce(function(v,y){var R=l.sourceBuffer[y];return(!s.type||s.type===y)&&(R&&!R.ended&&(R.ended=!0,M.logger.log("[buffer-controller]: "+y+" sourceBuffer now EOS"))),v&&!!(!R||R.ended)},!0);x&&this.blockBuffers(function(){var v=l.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},g.onLevelUpdated=function(i,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var i=this.hls,s=this.details,l=this.media,x=this.sourceBuffer;if(!l||s===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var y=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object($.isFiniteNumber)(y)||y<0)return;var R=l.currentTime,w=s.levelTargetDuration,E=Math.max(y,w),C=Math.floor(R/w)*w-E;v.forEach(function(c){var u=x[c];if(u){var L=U.BufferHelper.getBuffered(u);L.length>0&&C>L.start(0)&&(i.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:C}),s.live&&i.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:C}),i.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:C,type:c}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,s=this.hls,l=this.media,x=this.mediaSource,v=i.fragments[0].start+i.totalduration,y=l.duration,R=Object($.isFiniteNumber)(x.duration)?x.duration:0;i.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),x.duration=Infinity,this.updateSeekableRange(i)):(v>R&&v>y||!Object($.isFiniteNumber)(y))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),x.duration=v)},g.updateSeekableRange=function(i){var s=this.mediaSource,l=i.fragments,x=l.length;if(x&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var v=Math.max(0,l[0].start),y=Math.max(v,v+i.totalduration);s.setLiveSeekableRange(v,y)}},g.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,x=Object.keys(l).length;if(x&&!i||x===2){this.createSourceBuffers(l),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(y){s.executeNext(y)})}},g.createSourceBuffers=function(i){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var x=0;for(var v in i)if(!s[v]){var y=i[v];if(!y)throw Error("source buffer exists for track "+v+", however track does not");var R=y.levelCodec||y.codec,w=y.container+";codecs="+R;M.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var E=s[v]=l.addSourceBuffer(w),C=v;this.addBufferListener(C,"updatestart",this._onSBUpdateStart),this.addBufferListener(C,"updateend",this._onSBUpdateEnd),this.addBufferListener(C,"error",this._onSBUpdateError),this.tracks[v]={buffer:E,codec:R,container:y.container,levelCodec:y.levelCodec,id:y.id},x++}catch(c){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+c.message),this.hls.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,mimeType:w})}}x&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(i){var s=this.operationQueue,l=s.current(i);l.onStart()},g._onSBUpdateEnd=function(i){var s=this.operationQueue,l=s.current(i);l.onComplete(),s.shiftAndExecuteNext(i)},g._onSBUpdateError=function(i,s){M.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(s)},g.removeExecutor=function(i,s,l){var x=this.media,v=this.mediaSource,y=this.operationQueue,R=this.sourceBuffer,w=R[i];if(!x||!v||!w){M.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),y.shiftAndExecuteNext(i);return}var E=Object($.isFiniteNumber)(x.duration)?x.duration:Infinity,C=Object($.isFiniteNumber)(v.duration)?v.duration:Infinity,c=Math.max(0,s),u=Math.min(l,E,C);u>c?(M.logger.log("[buffer-controller]: Removing ["+c+","+u+"] from the "+i+" SourceBuffer"),console.assert(!w.updating,i+" sourceBuffer must not be updating"),w.remove(c,u)):y.shiftAndExecuteNext(i)},g.appendExecutor=function(i,s){var l=this.operationQueue,x=this.sourceBuffer,v=x[s];if(!v){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}v.ended=!1,console.assert(!v.updating,s+" sourceBuffer must not be updating"),v.appendBuffer(i)},g.blockBuffers=function(i,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var x=this.operationQueue,v=s.map(function(y){return x.appendBlocker(y)});Promise.all(v).then(function(){i(),s.forEach(function(y){var R=l.sourceBuffer[y];(!R||!R.updating)&&x.shiftAndExecuteNext(y)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(i,s,l){var x=this.sourceBuffer[i];if(!x)return;var v=l.bind(this,i);this.listeners[i].push({event:s,listener:v}),x.addEventListener(s,v)},g.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(l){s.removeEventListener(l.event,l.listener)})},m}()},"./src/controller/buffer-operation-queue.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return F});var $=O("./src/utils/logger.ts"),F=function(){function M(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var j=M.prototype;return j.append=function(P,A){var d=this.queues[A];d.push(P),d.length===1&&this.buffers[A]&&this.executeNext(A)},j.insertAbort=function(P,A){var d=this.queues[A];d.unshift(P),this.executeNext(A)},j.appendBlocker=function(P){var A,d=new Promise(function(T){A=T}),f={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(f,P),d},j.executeNext=function(P){var A=this.buffers,d=this.queues,f=A[P],T=d[P];if(T.length){var p=T[0];try{p.execute()}catch(m){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),p.onError(m),(!f||!f.updating)&&(T.shift(),this.executeNext(P))}}},j.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},j.current=function(P){return this.queues[P][0]},M}()},"./src/controller/cap-level-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/events.ts");function F(U,P){for(var A=0;A<P.length;A++){var d=P[A];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(U,d.key,d)}}function M(U,P,A){return P&&F(U.prototype,P),A&&F(U,A),U}var j=function(){function U(A){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=U.prototype;return P.setStreamController=function(d){this.streamController=d},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var d=this.hls;d.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var d=this.hls;d.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(d,f){U.isLevelAllowed(f.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(f.droppedLevel)},P.onMediaAttaching=function(d,f){this.media=f.media instanceof HTMLVideoElement?f.media:null},P.onManifestParsed=function(d,f){var T=this.hls;this.restrictedLevels=[],this.firstLevel=f.firstLevel,T.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onBufferCodecs=function(d,f){var T=this.hls;T.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var f=this.hls;f.autoLevelCapping=this.getMaxLevel(d.length-1),f.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=f.autoLevelCapping}}},P.getMaxLevel=function(d){var f=this,T=this.hls.levels;if(!T.length)return-1;var p=T.filter(function(m,g){return U.isLevelAllowed(g,f.restrictedLevels)&&g<=d});return this.clientRect=null,U.getMaxLevelByMediaSize(p,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,f={width:0,height:0};if(d){var T=d.getBoundingClientRect();f.width=T.width,f.height=T.height,!f.width&&!f.height&&(f.width=T.right-T.left||d.width||0,f.height=T.bottom-T.top||d.height||0)}return this.clientRect=f,f},U.isLevelAllowed=function(d,f){return f===void 0&&(f=[]),f.indexOf(d)===-1},U.getMaxLevelByMediaSize=function(d,f,T){if(!d||!d.length)return-1;for(var p=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},m=d.length-1,g=0;g<d.length;g+=1){var a=d[g];if((a.width>=f||a.height>=T)&&p(a,d[g+1])){m=g;break}}return m},M(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(f){}return d}}]),U}();J.default=j},"./src/controller/cmcd-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return p});var $=O("./src/events.ts"),F=O("./src/types/cmcd.ts"),M=O("./src/utils/buffer-helper.ts"),j=O("./src/utils/logger.ts");function U(m,g){for(var a=0;a<g.length;a++){var i=g[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,i.key,i)}}function P(m,g,a){return g&&U(m.prototype,g),a&&U(m,a),m}function A(m,g){var a=typeof Symbol!="undefined"&&m[Symbol.iterator]||m["@@iterator"];if(a)return(a=a.call(m)).next.bind(a);if(Array.isArray(m)||(a=d(m))||g&&m&&typeof m.length=="number"){a&&(m=a);var i=0;return function(){return i>=m.length?{done:!0}:{done:!1,value:m[i++]}}}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 d(m,g){if(!m)return;if(typeof m=="string")return f(m,g);var a=Object.prototype.toString.call(m).slice(8,-1);if(a==="Object"&&m.constructor&&(a=m.constructor.name),a==="Map"||a==="Set")return Array.from(m);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return f(m,g)}function f(m,g){(g==null||g>m.length)&&(g=m.length);for(var a=0,i=new Array(g);a<g;a++)i[a]=m[a];return i}function T(){return T=Object.assign||function(m){for(var g=1;g<arguments.length;g++){var a=arguments[g];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(m[i]=a[i])}return m},T.apply(this,arguments)}var p=function(){function m(a){var i=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(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(x){try{i.apply(x,{ot:F.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(v){j.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(x){try{var v=x.frag,y=i.hls.levels[v.level],R=i.getObjectType(v),w={d:v.duration*1e3,ot:R};(R===F.CMCDObjectType.VIDEO||R===F.CMCDObjectType.AUDIO||R==F.CMCDObjectType.MUXED)&&(w.br=y.bitrate/1e3,w.tb=i.getTopBandwidth(R),w.bl=i.getBufferLength(R)),i.apply(x,w)}catch(E){j.logger.warn("Could not generate segment CMCD data.",E)}},this.hls=a;var s=this.config=a.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||m.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var g=m.prototype;return g.registerListeners=function(){var i=this.hls;i.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var i=this.hls;i.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(i,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(i,s){var l,x;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(x=s.tracks.video)===null||x===void 0?void 0:x.buffer},g.createData=function(){var i;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(i,s){s===void 0&&(s={}),T(s,this.createData());var l=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var x=m.toHeaders(s);if(!Object.keys(x).length)return;i.headers||(i.headers={}),T(i.headers,x)}else{var v=m.toQuery(s);if(!v)return;i.url=m.appendQueryToUri(i.url,v)}},g.getObjectType=function(i){var s=i.type;return s==="subtitle"?F.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?F.CMCDObjectType.INIT:s==="audio"?F.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(i){for(var s=0,l=i===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,x=A(l),v;!(v=x()).done;){var y=v.value;y.bitrate>s&&(s=y.bitrate)}return s>0?s:NaN},g.getBufferLength=function(i){var s=this.hls.media,l=i===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var x=M.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return x.len*1e3},g.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,l=i||this.config.loader;return function(){function x(y){this.loader=void 0,this.loader=new l(y)}var v=x.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(R,w,E){s(R),this.loader.load(R,w,E)},P(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},g.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,l=i||this.config.loader;return function(){function x(y){this.loader=void 0,this.loader=new l(y)}var v=x.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(R,w,E){s(R),this.loader.load(R,w,E)},P(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},m.uuid=function(){var i=URL.createObjectURL(new Blob),s=i.toString();return URL.revokeObjectURL(i),s.substr(s.lastIndexOf("/")+1)},m.serialize=function(i){for(var s=[],l=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},x=function(B){return Math.round(B)},v=function(B){return x(B/100)*100},y=function(B){return encodeURIComponent(B)},R={br:x,d:x,bl:v,dl:v,mtp:v,nor:y,rtp:v,tb:x},w=Object.keys(i||{}).sort(),E=A(w),C;!(C=E()).done;){var c=C.value,u=i[c];if(!l(u))continue;if(c==="v"&&u===1)continue;if(c=="pr"&&u===1)continue;var L=R[c];L&&(u=L(u));var S=typeof u,D=void 0;c==="ot"||c==="sf"||c==="st"?D=c+"="+u:S==="boolean"?D=c:S==="number"?D=c+"="+u:D=c+"="+JSON.stringify(u),s.push(D)}return s.join(",")},m.toHeaders=function(i){for(var s=Object.keys(i),l={},x=["Object","Request","Session","Status"],v=[{},{},{},{}],y={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},R=0,w=s;R<w.length;R++){var E=w[R],C=y[E]!=null?y[E]:1;v[C][E]=i[E]}for(var c=0;c<v.length;c++){var u=m.serialize(v[c]);u&&(l["CMCD-"+x[c]]=u)}return l},m.toQuery=function(i){return"CMCD="+encodeURIComponent(m.serialize(i))},m.appendQueryToUri=function(i,s){if(!s)return i;var l=i.includes("?")?"&":"?";return""+i+l+s},m}()},"./src/controller/eme-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),j=O("./src/utils/mediakeys-helper.ts");function U(p,m){for(var g=0;g<m.length;g++){var a=m[g];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function P(p,m,g){return m&&U(p.prototype,m),g&&U(p,g),p}var A=3,d=function(m,g,a){var i={audioCapabilities:[],videoCapabilities:[]};return m.forEach(function(s){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:a.audioRobustness||""})}),g.forEach(function(s){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:a.videoRobustness||""})}),[i]},f=function(m,g,a,i){switch(m){case j.KeySystems.WIDEVINE:return d(g,a,i);default:throw new Error("Unknown key-system: "+m)}},T=function(){function p(g){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=g,this._config=g.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 m=p.prototype;return m.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},m._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)},m._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)},m.getLicenseServerUrl=function(a){switch(a){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+a+'"')},m._attemptKeySystemAccess=function(a,i,s){var l=this,x=f(a,i,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(a,x);this.mediaKeysPromise=v.then(function(y){return l._onMediaKeySystemAccessObtained(a,y)}),v.catch(function(y){M.logger.error('Failed to obtain key-system "'+a+'" access:',y)})},m._onMediaKeySystemAccessObtained=function(a,i){var s=this;M.logger.log('Access for key-system "'+a+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:a};this._mediaKeysList.push(l);var x=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(v){return l.mediaKeys=v,M.logger.log('Media-keys created for key-system "'+a+'"'),s._onMediaKeysCreated(),v});return x.catch(function(v){M.logger.error("Failed to create media-keys:",v)}),x},m._onMediaKeysCreated=function(){var a=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),a._onNewMediaKeySession(i.mediaKeysSession))})},m._onNewMediaKeySession=function(a){var i=this;M.logger.log("New key-system session "+a.sessionId),a.addEventListener("message",function(s){i._onKeySessionMessage(a,s.message)},!1)},m._onKeySessionMessage=function(a,i){M.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),a.update(s)})},m.onMediaEncrypted=function(a){var i=this;if(M.logger.log('Media is encrypted using "'+a.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:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(x){if(!i._media)return;i._attemptSetMediaKeys(x),i._generateRequestWithPreferredKeySession(a.initDataType,a.initData)};this.mediaKeysPromise.then(s).catch(s)},m._attemptSetMediaKeys=function(a){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.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:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},m._generateRequestWithPreferredKeySession=function(a,i){var s=this,l=this._mediaKeysList[0];if(!l){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var x=l.mediaKeysSession;if(!x){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+a+'" init data type'),l.mediaKeysSessionInitialized=!0,x.generateRequest(a,i).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(v){M.logger.error("Error generating key-session request:",v),s.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},m._createLicenseXhr=function(a,i,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,a,i,s);var x=this._licenseXhrSetup;if(x)try{x.call(this.hls,l,a),x=void 0}catch(v){M.logger.error(v)}try{l.readyState||l.open("POST",a,!0),x&&x.call(this.hls,l,a)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return l},m._onLicenseRequestReadyStageChange=function(a,i,s,l){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var x=a.response,v=this._licenseResponseCallback;if(v)try{x=v.call(this.hls,a,i)}catch(R){M.logger.error(R)}l(x)}else{if(M.logger.error("License Request XHR failed ("+i+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var y=A-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+y+" attempts left"),this._requestLicense(s,l)}break}},m._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},m._requestLicense=function(a,i){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:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),x=this._createLicenseXhr(l,a,i);M.logger.log("Sending license request to URL: "+l);var v=this._generateLicenseRequestChallenge(s,a);x.send(v)}catch(y){M.logger.error("Failure requesting DRM license: "+y),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},m.onMediaAttached=function(a,i){if(!this._emeEnabled)return;var s=i.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},m.onMediaDetached=function(){var a=this._media,i=this._mediaKeysList;if(!a)return;a.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return a.setMediaKeys(null)}).catch(function(){})},m.onManifestParsed=function(a,i){if(!this._emeEnabled)return;var s=i.levels.map(function(x){return x.audioCodec}).filter(function(x){return!!x}),l=i.levels.map(function(x){return x.videoCodec}).filter(function(x){return!!x});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,s,l)},P(p,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),p}();J.default=T},"./src/controller/fps-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/events.ts"),F=O("./src/utils/logger.ts"),M=function(){function j(P){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=P,this.registerListeners()}var U=j.prototype;return U.setStreamController=function(A){this.streamController=A},U.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(A,d){var f=this.hls.config;if(f.capLevelOnFPSDrop){var T=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=T,T&&typeof T.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),f.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(A,d,f){var T=performance.now();if(d){if(this.lastTime){var p=T-this.lastTime,m=f-this.lastDroppedFrames,g=d-this.lastDecodedFrames,a=1e3*m/p,i=this.hls;if(i.trigger($.Events.FPS_DROP,{currentDropped:m,currentDecoded:g,totalDroppedFrames:f}),a>0&&m>i.config.fpsDroppedMonitoringThreshold*g){var s=i.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=s)&&(s=s-1,i.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=f,this.lastDecodedFrames=d}},U.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var d=A.getVideoPlaybackQuality();this.checkFPS(A,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},j}();J.default=M},"./src/controller/fragment-finders.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"findFragmentByPDT",function(){return M}),O.d(J,"findFragmentByPTS",function(){return j}),O.d(J,"fragmentWithinToleranceTest",function(){return U}),O.d(J,"pdtWithinToleranceTest",function(){return P}),O.d(J,"findFragWithCC",function(){return A});var $=O("./src/polyfills/number.ts"),F=O("./src/utils/binary-search.ts");function M(d,f,T){if(f===null||!Array.isArray(d)||!d.length||!Object($.isFiniteNumber)(f))return null;var p=d[0].programDateTime;if(f<(p||0))return null;var m=d[d.length-1].endProgramDateTime;if(f>=(m||0))return null;T=T||0;for(var g=0;g<d.length;++g){var a=d[g];if(P(f,T,a))return a}return null}function j(d,f,T,p){T===void 0&&(T=0),p===void 0&&(p=0);var m=null;if(d?m=f[d.sn-f[0].sn+1]||null:T===0&&f[0].start===0&&(m=f[0]),m&&U(T,p,m)===0)return m;var g=F.default.search(f,U.bind(null,T,p));return g||m}function U(d,f,T){d===void 0&&(d=0),f===void 0&&(f=0);var p=Math.min(f,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-p<=d?1:T.start-p>d&&T.start?-1:0}function P(d,f,T){var p=Math.min(f,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,m=T.endProgramDateTime||0;return m-p>d}function A(d,f){return F.default.search(d,function(T){return T.cc<f?1:T.cc>f?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"FragmentState",function(){return M}),O.d(J,"FragmentTracker",function(){return j});var $=O("./src/events.ts"),F=O("./src/types/loader.ts"),M;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(M||(M={}));var j=function(){function A(f){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=f,this._registerListeners()}var d=A.prototype;return d._registerListeners=function(){var T=this.hls;T.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var T=this.hls;T.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(T,p){if(p===F.PlaylistLevelType.MAIN){var m=this.activeFragment,g=this.activeParts;if(!m)return null;if(g)for(var a=g.length;a--;){var i=g[a],s=i?i.end:m.appendedPTS;if(i.start<=T&&s!==void 0&&T<=s)return a>9&&(this.activeParts=g.slice(a-9)),i}else if(m.start<=T&&m.appendedPTS!==void 0&&T<=m.appendedPTS)return m}return this.getBufferedFrag(T,p)},d.getBufferedFrag=function(T,p){for(var m=this.fragments,g=Object.keys(m),a=g.length;a--;){var i=m[g[a]];if((i==null?void 0:i.body.type)===p&&i.buffered){var s=i.body;if(s.start<=T&&T<=s.end)return s}}return null},d.detectEvictedFragments=function(T,p,m){var g=this;Object.keys(this.fragments).forEach(function(a){var i=g.fragments[a];if(!i)return;if(!i.buffered){i.body.type===m&&g.removeFragment(i.body);return}var s=i.range[T];if(!s)return;s.time.some(function(l){var x=!g.isTimeBuffered(l.startPTS,l.endPTS,p);return x&&g.removeFragment(i.body),x})})},d.detectPartialFragments=function(T){var p=this,m=this.timeRanges,g=T.frag,a=T.part;if(!m||g.sn==="initSegment")return;var i=P(g),s=this.fragments[i];if(!s)return;Object.keys(m).forEach(function(l){var x=g.elementaryStreams[l];if(!x)return;var v=m[l],y=a!==null||x.partial===!0;s.range[l]=p.getBufferedTimes(g,a,y,v)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},d.fragBuffered=function(T){var p=P(T),m=this.fragments[p];m&&(m.backtrack=m.loaded=null,m.buffered=!0)},d.getBufferedTimes=function(T,p,m,g){for(var a={time:[],partial:m},i=p?p.start:T.start,s=p?p.end:T.end,l=T.minEndPTS||s,x=T.maxStartPTS||i,v=0;v<g.length;v++){var y=g.start(v)-this.bufferPadding,R=g.end(v)+this.bufferPadding;if(x>=y&&l<=R){a.time.push({startPTS:Math.max(i,g.start(v)),endPTS:Math.min(s,g.end(v))});break}else if(i<R&&s>y)a.partial=!0,a.time.push({startPTS:Math.max(i,g.start(v)),endPTS:Math.min(s,g.end(v))});else if(s<=y)break}return a},d.getPartialFragment=function(T){var p=null,m,g,a,i=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(x){var v=l[x];if(!v)return;U(v)&&(g=v.body.start-s,a=v.body.end+s,T>=g&&T<=a&&(m=Math.min(T-g,a-T),i<=m&&(p=v.body,i=m)))}),p},d.getState=function(T){var p=P(T),m=this.fragments[p];return m?m.buffered?U(m)?M.PARTIAL:M.OK:m.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},d.backtrack=function(T,p){var m=P(T),g=this.fragments[m];if(!g||g.backtrack)return null;var a=g.backtrack=p||g.loaded;return g.loaded=null,a},d.getBacktrackData=function(T){var p=P(T),m=this.fragments[p];if(m){var g,a=m.backtrack;if(a!=null&&(g=a.payload)!==null&&g!==void 0&&g.byteLength)return a;this.removeFragment(T)}return null},d.isTimeBuffered=function(T,p,m){for(var g,a,i=0;i<m.length;i++){if(g=m.start(i)-this.bufferPadding,a=m.end(i)+this.bufferPadding,T>=g&&p<=a)return!0;if(p<=g)return!1}return!1},d.onFragLoaded=function(T,p){var m=p.frag,g=p.part;if(m.sn==="initSegment"||m.bitrateTest||g)return;var a=P(m);this.fragments[a]={body:m,loaded:p,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(T,p){var m=this,g=p.frag,a=p.part,i=p.timeRanges;if(g.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=g,a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(l){var x=i[l];if(m.detectEvictedFragments(l,x),!a)for(var v=0;v<x.length;v++)g.appendedPTS=Math.max(x.end(v),g.appendedPTS||0)})},d.onFragBuffered=function(T,p){this.detectPartialFragments(p)},d.hasFragment=function(T){var p=P(T);return!!this.fragments[p]},d.removeFragmentsInRange=function(T,p,m){var g=this;Object.keys(this.fragments).forEach(function(a){var i=g.fragments[a];if(!i)return;if(i.buffered){var s=i.body;s.type===m&&s.start<p&&s.end>T&&g.removeFragment(s)}})},d.removeFragment=function(T){var p=P(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[p]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function U(A){var d,f;return A.buffered&&(((d=A.range.video)===null||d===void 0?void 0:d.partial)||((f=A.range.audio)===null||f===void 0?void 0:f.partial))}function P(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"STALL_MINIMUM_DURATION_MS",function(){return U}),O.d(J,"MAX_START_GAP_JUMP",function(){return P}),O.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),O.d(J,"SKIP_BUFFER_RANGE_START",function(){return d}),O.d(J,"default",function(){return f});var $=O("./src/utils/buffer-helper.ts"),F=O("./src/errors.ts"),M=O("./src/events.ts"),j=O("./src/utils/logger.ts"),U=250,P=2,A=.1,d=.05,f=function(){function T(m,g,a,i){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=m,this.media=g,this.fragmentTracker=a,this.hls=i}var p=T.prototype;return p.destroy=function(){this.hls=this.fragmentTracker=this.media=null},p.poll=function(g){var a=this.config,i=this.media,s=this.stalled,l=i.currentTime,x=i.seeking,v=this.seeking&&!x,y=!this.seeking&&x;if(this.seeking=x,l!==g){if(this.moved=!0,s!==null){if(this.stallReported){var R=self.performance.now()-s;j.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((y||v)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!$.BufferHelper.getBuffered(i).length)return;var w=$.BufferHelper.bufferInfo(i,l,0),E=w.len>0,C=w.nextStart||0;if(!E&&!C)return;if(x){var c=w.len>P,u=!C||C-l>P&&!this.fragmentTracker.getPartialFragment(l);if(c||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var L,S=Math.max(C,w.start||0)-l,D=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=D==null||((L=D.details)===null||L===void 0)?void 0:L.live,B=_?D.details.targetduration*2:P;if(S>0&&S<=B){this._trySkipBufferHole(null);return}}var G=self.performance.now();if(s===null){this.stalled=G;return}var V=G-s;!x&&V>=U&&this._reportStall(w.len);var I=$.BufferHelper.bufferInfo(i,l,a.maxBufferHole);this._tryFixBufferStall(I,V)},p._tryFixBufferStall=function(g,a){var i=this.config,s=this.fragmentTracker,l=this.media,x=l.currentTime,v=s.getPartialFragment(x);if(v){var y=this._trySkipBufferHole(v);if(y)return}g.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},p._reportStall=function(g){var a=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+g+")"),a.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},p._trySkipBufferHole=function(g){for(var a=this.config,i=this.hls,s=this.media,l=s.currentTime,x=0,v=$.BufferHelper.getBuffered(s),y=0;y<v.length;y++){var R=v.start(y);if(l+a.maxBufferHole>=x&&l<R){var w=Math.max(R+d,s.currentTime+A);return j.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+w),this.moved=!0,this.stalled=null,s.currentTime=w,g&&i.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+w,frag:g}),w}x=v.end(y)}return 0},p._tryNudgeBuffer=function(){var g=this.config,a=this.hls,i=this.media,s=i.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<g.nudgeMaxRetry){var x=s+l*g.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+s+" to "+x),i.currentTime=x,a.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+g.nudgeMaxRetry+" nudges"),a.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},T}()},"./src/controller/id3-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),M=O("./src/demux/id3.ts"),j=.25,U=function(){function P(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var A=P.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var f=this.hls;f.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var f=this.hls;f.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(f,T){this.media=T.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(f){if(!this.media)return;for(var T=0;T<f.length;T++){var p=f[T];if(p.kind==="metadata"&&p.label==="id3")return Object(F.sendAddTrackEvent)(p,this.media),p}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(f,T){if(!this.media)return;var p=T.frag,m=T.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<m.length;a++){var i=M.getID3Frames(m[a].data);if(i){var s=m[a].pts,l=a<m.length-1?m[a+1].pts:p.end,x=l-s;x<=0&&(l=s+j);for(var v=0;v<i.length;v++){var y=i[v];if(!M.isTimeStampFrame(y)){var R=new g(s,l,"");R.value=y,this.id3Track.addCue(R)}}}}},A.onBufferFlushing=function(f,T){var p=T.startOffset,m=T.endOffset,g=T.type;if(!g||g==="audio"){var a=this.id3Track;a&&Object(F.removeCuesInRange)(a,p,m)}},P}();J.default=U},"./src/controller/latency-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return P});var $=O("./src/errors.ts"),F=O("./src/events.ts"),M=O("./src/utils/logger.ts");function j(A,d){for(var f=0;f<d.length;f++){var T=d[f];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(A,T.key,T)}}function U(A,d,f){return d&&j(A.prototype,d),f&&j(A,f),A}var P=function(){function A(f){var T=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 T.timeupdate()},this.hls=f,this.config=f.config,this.registerListeners()}var d=A.prototype;return d.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},d.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},d.onMediaAttached=function(T,p){this.media=p.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},d.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},d.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},d.onLevelUpdated=function(T,p){var m=p.details;this.levelDetails=m,m.advanced&&this.timeupdate(),!m.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(T,p){if(p.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var T=this.media,p=this.levelDetails;if(!T||!p)return;this.currentTime=T.currentTime;var m=this.computeLatency();if(m===null)return;this._latency=m;var g=this.config,a=g.lowLatencyMode,i=g.maxLiveSyncPlaybackRate;if(!a||i===1)return;var s=this.targetLatency;if(s===null)return;var l=m-s,x=Math.min(this.maxLatency,s+p.targetduration),v=l<x;if(p.live&&v&&l>.05&&this.forwardBufferLength>1){var y=Math.min(2,Math.max(1,i)),R=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;T.playbackRate=Math.min(y,Math.max(1,R))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)},d.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},d.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},U(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var T=this.config,p=this.levelDetails;return T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:p?T.liveMaxLatencyDurationCount*p.targetduration:0}},{key:"targetLatency",get:function(){var T=this.levelDetails;if(T===null)return null;var p=T.holdBack,m=T.partHoldBack,g=T.targetduration,a=this.config,i=a.liveSyncDuration,s=a.liveSyncDurationCount,l=a.lowLatencyMode,x=this.hls.userConfig,v=l&&m||p;(x.liveSyncDuration||x.liveSyncDurationCount||v===0)&&(v=i!==void 0?i:s*g);var y=g,R=1;return v+Math.min(this.stallCount*R,y)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),p=this.targetLatency,m=this.levelDetails;if(T===null||p===null||m===null)return null;var g=m.edge,a=T-p-this.edgeStalled,i=g-m.totalduration,s=g-(this.config.lowLatencyMode&&m.partTarget||m.targetduration);return Math.min(Math.max(i,a),s)}},{key:"drift",get:function(){var T=this.levelDetails;return T===null?1:T.drift}},{key:"edgeStalled",get:function(){var T=this.levelDetails;if(T===null)return 0;var p=(this.config.lowLatencyMode&&T.partTarget||T.targetduration)*3;return Math.max(T.age-p,0)}},{key:"forwardBufferLength",get:function(){var T=this.media,p=this.levelDetails;if(!T||!p)return 0;var m=T.buffered.length;return m?T.buffered.end(m-1):p.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return a});var $=O("./src/types/level.ts"),F=O("./src/events.ts"),M=O("./src/errors.ts"),j=O("./src/utils/codecs.ts"),U=O("./src/controller/level-helper.ts"),P=O("./src/controller/base-playlist-controller.ts"),A=O("./src/types/loader.ts");function d(){return d=Object.assign||function(i){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var x in l)Object.prototype.hasOwnProperty.call(l,x)&&(i[x]=l[x])}return i},d.apply(this,arguments)}function f(i,s){for(var l=0;l<s.length;l++){var x=s[l];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(i,x.key,x)}}function T(i,s,l){return s&&f(i.prototype,s),l&&f(i,l),i}function p(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,m(i,s)}function m(i,s){return m=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},m(i,s)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(i){p(s,i);function s(x){var v;return v=i.call(this,x,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var l=s.prototype;return l._registerListeners=function(){var v=this.hls;v.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(F.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var v=this.hls;v.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(F.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},l.startLoad=function(){var v=this._levels;v.forEach(function(y){y.loadError=0}),i.prototype.startLoad.call(this)},l.onManifestLoaded=function(v,y){var R=[],w=[],E=[],C,c={},u,L=!1,S=!1,D=!1;if(y.levels.forEach(function(V){var I=V.attrs;L=L||!!(V.width&&V.height),S=S||!!V.videoCodec,D=D||!!V.audioCodec,g&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;u=c[N],u?u.url.push(V.url):(u=new $.Level(V),c[N]=u,R.push(u)),I&&(I.AUDIO&&Object(U.addGroupId)(u,"audio",I.AUDIO),I.SUBTITLES&&Object(U.addGroupId)(u,"text",I.SUBTITLES))}),(L||S)&&D&&(R=R.filter(function(V){var I=V.videoCodec,N=V.width,Y=V.height;return!!I||!!(N&&Y)})),R=R.filter(function(V){var I=V.audioCodec,N=V.videoCodec;return(!I||Object(j.isCodecSupportedInMp4)(I,"audio"))&&(!N||Object(j.isCodecSupportedInMp4)(N,"video"))}),y.audioTracks&&(w=y.audioTracks.filter(function(V){return!V.audioCodec||Object(j.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(w)),y.subtitles&&(E=y.subtitles,Object(U.assignTrackIdsByGroup)(E)),R.length>0){C=R[0].bitrate,R.sort(function(V,I){return V.bitrate-I.bitrate}),this._levels=R;for(var _=0;_<R.length;_++)if(R[_].bitrate===C){this._firstLevel=_,this.log("manifest loaded, "+R.length+" level(s) found, first bitrate: "+C);break}var B=D&&!S,G={levels:R,audioTracks:w,subtitleTracks:E,firstLevel:this._firstLevel,stats:y.stats,audio:D,video:S,altAudio:!B&&w.some(function(V){return!!V.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,G),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:y.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(v,y){if(i.prototype.onError.call(this,v,y),y.fatal)return;var R=y.context,w=this._levels[this.currentLevelIndex];if(R&&(R.type===A.PlaylistContextType.AUDIO_TRACK&&w.audioGroupIds&&R.groupId===w.audioGroupIds[w.urlId]||R.type===A.PlaylistContextType.SUBTITLE_TRACK&&w.textGroupIds&&R.groupId===w.textGroupIds[w.urlId])){this.redundantFailover(this.currentLevelIndex);return}var E=!1,C=!0,c;switch(y.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(y.frag){var u=this._levels[y.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(c=y.frag.level)):c=y.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(C=!1),c=R.level),E=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:c=y.level,E=!0;break}c!==void 0&&this.recoverLevel(y,c,E,C)},l.recoverLevel=function(v,y,R,w){var E=v.details,C=this._levels[y];if(C.loadError++,R){var c=this.retryLoadingOrFail(v);if(c)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var u=C.url.length;if(u>1&&C.loadError<u)v.levelRetry=!0,this.redundantFailover(y);else if(this.manualLevelIndex===-1){var L=y===0?this._levels.length-1:y-1;this.currentLevelIndex!==L&&this._levels[L].loadError===0&&(this.warn(E+": switch to "+L),v.levelRetry=!0,this.hls.nextAutoLevel=L)}}},l.redundantFailover=function(v){var y=this._levels[v],R=y.url.length;if(R>1){var w=(y.urlId+1)%R;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(E){E.urlId=w}),this.level=v}},l.onFragLoaded=function(v,y){var R=y.frag;if(R!==void 0&&R.type===A.PlaylistLevelType.MAIN){var w=this._levels[R.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},l.onLevelLoaded=function(v,y){var R,w=y.level,E=y.details,C=this._levels[w];if(!C){var c;this.warn("Invalid level index "+w),(c=y.deliveryDirectives)!==null&&c!==void 0&&c.skip&&(E.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(C.fragmentError===0&&(C.loadError=0,this.retryCount=0),this.playlistLoaded(w,y,C.details)):(R=y.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(E.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(v,y){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var w=-1,E=this.hls.audioTracks[y.id].groupId,C=0;C<R.audioGroupIds.length;C++)if(R.audioGroupIds[C]===E){w=C;break}w!==R.urlId&&(R.urlId=w,this.startLoad())}},l.loadPlaylist=function(v){var y=this.currentLevelIndex,R=this._levels[y];if(this.canLoad&&R&&R.url.length>0){var w=R.urlId,E=R.url[w];if(v)try{E=v.addDirectives(E)}catch(C){this.warn("Could not construct new URL with HLS Delivery Directives: "+C)}this.log("Attempt loading level index "+y+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+w+" "+E),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:E,level:y,id:w,deliveryDirectives:v||null})}},l.removeLevel=function(v,y){var R=function(C,c){return c!==y},w=this._levels.filter(function(E,C){return C!==v?!0:E.url.length>1&&y!==void 0?(E.url=E.url.filter(R),E.audioGroupIds&&(E.audioGroupIds=E.audioGroupIds.filter(R)),E.textGroupIds&&(E.textGroupIds=E.textGroupIds.filter(R)),E.urlId=0,!0):!1}).map(function(E,C){var c=E.details;return c!=null&&c.fragments&&c.fragments.forEach(function(u){u.level=C}),E});this._levels=w,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:w})},T(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var y,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===v&&(y=R[v])!==null&&y!==void 0&&y.details)return;if(v<0||v>=R.length){var w=v<0;if(this.hls.trigger(F.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:w,reason:"invalid level idx"}),w)return;v=Math.min(v,R.length-1)}this.clearTimer();var E=this.currentLevelIndex,C=R[E],c=R[v];this.log("switching to level "+v+" from "+E),this.currentLevelIndex=v;var u=d({},c,{level:v,maxBitrate:c.maxBitrate,uri:c.uri,urlId:c.urlId});delete u._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,u);var L=c.details;if(!L||L.live){var S=this.switchParams(c.uri,C==null?void 0:C.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"addGroupId",function(){return M}),O.d(J,"assignTrackIdsByGroup",function(){return j}),O.d(J,"updatePTS",function(){return U}),O.d(J,"updateFragPTSDTS",function(){return A}),O.d(J,"mergeDetails",function(){return d}),O.d(J,"mapPartIntersection",function(){return f}),O.d(J,"mapFragmentIntersection",function(){return T}),O.d(J,"adjustSliding",function(){return p}),O.d(J,"addSliding",function(){return m}),O.d(J,"computeReloadInterval",function(){return g}),O.d(J,"getFragmentWithSN",function(){return a}),O.d(J,"getPartWith",function(){return i});var $=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts");function M(s,l,x){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(x);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(x);break}}function j(s){var l={};s.forEach(function(x){var v=x.groupId||"";x.id=l[v]=l[v]||0,l[v]++})}function U(s,l,x){var v=s[l],y=s[x];P(v,y)}function P(s,l){var x=l.startPTS;if(Object($.isFiniteNumber)(x)){var v=0,y;l.sn>s.sn?(v=x-s.start,y=s):(v=s.start-x,y=l),y.duration!==v&&(y.duration=v)}else if(l.sn>s.sn){var R=s.cc===l.cc;R&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function A(s,l,x,v,y,R){var w=v-x;w<=0&&(F.logger.warn("Fragment should have a positive duration",l),v=x+l.duration,R=y+l.duration);var E=x,C=v,c=l.startPTS,u=l.endPTS;if(Object($.isFiniteNumber)(c)){var L=Math.abs(c-x);Object($.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(L,l.deltaPTS):l.deltaPTS=L,E=Math.max(x,c),x=Math.min(x,c),y=Math.min(y,l.startDTS),C=Math.min(v,u),v=Math.max(v,u),R=Math.max(R,l.endDTS)}l.duration=v-x;var S=x-l.start;l.appendedPTS=v,l.start=l.startPTS=x,l.maxStartPTS=E,l.startDTS=y,l.endPTS=v,l.minEndPTS=C,l.endDTS=R;var D=l.sn;if(!s||D<s.startSN||D>s.endSN)return 0;var _,B=D-s.startSN,G=s.fragments;for(G[B]=l,_=B;_>0;_--)P(G[_],G[_-1]);for(_=B;_<G.length-1;_++)P(G[_],G[_+1]);return s.fragmentHint&&P(G[G.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function d(s,l){for(var x=null,v=s.fragments,y=v.length-1;y>=0;y--){var R=v[y].initSegment;if(R){x=R;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var w=0,E;if(T(s,l,function(_,B){_.relurl&&(w=_.cc-B.cc),Object($.isFiniteNumber)(_.startPTS)&&Object($.isFiniteNumber)(_.endPTS)&&(B.start=B.startPTS=_.startPTS,B.startDTS=_.startDTS,B.appendedPTS=_.appendedPTS,B.maxStartPTS=_.maxStartPTS,B.endPTS=_.endPTS,B.endDTS=_.endDTS,B.minEndPTS=_.minEndPTS,B.duration=_.endPTS-_.startPTS,B.duration&&(E=B),l.PTSKnown=l.alignedSliding=!0),B.elementaryStreams=_.elementaryStreams,B.loader=_.loader,B.stats=_.stats,B.urlId=_.urlId,_.initSegment&&(B.initSegment=_.initSegment,x=_.initSegment)}),x){var C=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;C.forEach(function(_){var B;(!_.initSegment||_.initSegment.relurl===((B=x)===null||B===void 0?void 0:B.relurl))&&(_.initSegment=x)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(_){return!_}),l.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=l.skippedSegments;c--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var u=l.fragments;if(w){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var L=0;L<u.length;L++)u[L].cc+=w}l.skippedSegments&&(l.startCC=l.fragments[0].cc),f(s.partList,l.partList,function(_,B){B.elementaryStreams=_.elementaryStreams,B.stats=_.stats}),E?A(l,E,E.startPTS,E.endPTS,E.startDTS,E.endDTS):p(s,l),u.length&&(l.totalduration=l.edge-u[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var S=l.advancedDateTime;if(l.advanced&&S){var D=l.edge;l.driftStart||(l.driftStartTime=S,l.driftStart=D),l.driftEndTime=S,l.driftEnd=D}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function f(s,l,x){if(s&&l)for(var v=0,y=0,R=s.length;y<=R;y++){var w=s[y],E=l[y+v];w&&E&&w.index===E.index&&w.fragment.sn===E.fragment.sn?x(w,E):v--}}function T(s,l,x){for(var v=l.skippedSegments,y=Math.max(s.startSN,l.startSN)-l.startSN,R=(s.fragmentHint?1:0)+(v?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,w=l.startSN-s.startSN,E=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,C=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=y;c<=R;c++){var u=C[w+c],L=E[c];v&&!L&&c<v&&(L=l.fragments[c]=u),u&&L&&x(u,L)}}function p(s,l){var x=l.startSN+l.skippedSegments-s.startSN,v=s.fragments;if(x<0||x>=v.length)return;m(l,v[x].start)}function m(s,l){if(l){for(var x=s.fragments,v=s.skippedSegments;v<x.length;v++)x[v].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function g(s,l){var x=1e3*s.levelTargetDuration,v=x/2,y=s.age,R=y>0&&y<x*3,w=l.loading.end-l.loading.start,E,C=s.availabilityDelay;if(s.updated===!1)if(R){var c=333*s.misses;E=Math.max(Math.min(v,w*2),c),s.availabilityDelay=(s.availabilityDelay||0)+E}else E=v;else R?(C=Math.min(C||x/2,y),s.availabilityDelay=C,E=C+x-y):E=x-w;return Math.round(E)}function a(s,l,x){if(!s||!s.details)return null;var v=s.details,y=v.fragments[l-v.startSN];return y||(y=v.fragmentHint,y&&y.sn===l?y:l<v.startSN&&x&&x.sn===l?x:null)}function i(s,l,x){if(!s||!s.details)return null;var v=s.details.partList;if(v)for(var y=v.length;y--;){var R=v[y];if(R.index===x&&R.fragment.sn===l)return R}return null}},"./src/controller/stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return v});var $=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),M=O("./src/is-supported.ts"),j=O("./src/events.ts"),U=O("./src/utils/buffer-helper.ts"),P=O("./src/controller/fragment-tracker.ts"),A=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),f=O("./src/demux/transmuxer-interface.ts"),T=O("./src/types/transmuxer.ts"),p=O("./src/controller/gap-controller.ts"),m=O("./src/errors.ts"),g=O("./src/utils/logger.ts");function a(y,R){for(var w=0;w<R.length;w++){var E=R[w];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(y,E.key,E)}}function i(y,R,w){return R&&a(y.prototype,R),w&&a(y,w),y}function s(y,R){y.prototype=Object.create(R.prototype),y.prototype.constructor=y,l(y,R)}function l(y,R){return l=Object.setPrototypeOf||function(E,C){return E.__proto__=C,E},l(y,R)}var x=100,v=function(y){s(R,y);function R(E,C){var c;return c=y.call(this,E,C,"[stream-controller]")||this,c.audioCodecSwap=!1,c.gapController=null,c.level=-1,c._forceStartLoad=!1,c.altAudio=!1,c.audioOnly=!1,c.fragPlaying=null,c.onvplaying=null,c.onvseeked=null,c.fragLastKbps=0,c.stalled=!1,c.couldBacktrack=!1,c.audioCodecSwitch=!1,c.videoBuffer=null,c._registerListeners(),c}var w=R.prototype;return w._registerListeners=function(){var C=this.hls;C.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),C.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),C.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),C.on(j.Events.ERROR,this.onError,this),C.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),C.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),C.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),C.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),C.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),C.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var C=this.hls;C.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),C.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),C.off(j.Events.ERROR,this.onError,this),C.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),C.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),C.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),C.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),C.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),C.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},w.startLoad=function(C){if(this.levels){var c=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(x),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var L=u.startLevel;L===-1&&(u.config.testBandwidth?(L=0,this.bitrateTest=!0):L=u.nextAutoLevel),this.level=u.nextLoadLevel=L,this.loadedmetadata=!1}c>0&&C===-1&&(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),C=c),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=C,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},w.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},w.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var C,c=this.levels,u=this.level,L=c==null||((C=c[u])===null||C===void 0)?void 0:C.details;if(L&&(!L.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(L))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var S,D=self.performance.now(),_=this.retryDate;(!_||D>=_||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},w.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var C,c,u=this.hls,L=this.levelLastLoaded,S=this.levels,D=this.media,_=u.config,B=u.nextLoadLevel;if(L===null||!D&&(this.startFragRequested||!_.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[B])return;var G=S[B];this.level=u.nextLoadLevel=B;var V=G.details;if(!V||this.state===F.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==B){this.state=F.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:D,A.PlaylistLevelType.MAIN);if(I===null)return;var N=I.len,Y=this.getMaxBufferLength(G.maxBitrate);if(N>=Y)return;if(this._streamEnded(I,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,ee),this.state=F.State.ENDED;return}var le=I.end,me=this.getNextFragment(le,V);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"){var Ie=me.sn-V.startSN;Ie>1&&(me=V.fragments[Ie-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===P.FragmentState.OK&&this.nextLoadPosition>le){var Te=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(D,Te,A.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,V)}if(!me)return;me.initSegment&&!me.initSegment.data&&!this.bitrateTest&&(me=me.initSegment),((C=me.decryptdata)===null||C===void 0?void 0:C.keyFormat)==="identity"&&!((c=me.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(me,V):this.loadFragment(me,V,le)},w.loadFragment=function(C,c,u){var L,S=this.fragmentTracker.getState(C);if(this.fragCurrent=C,S===P.FragmentState.BACKTRACKED){var D=this.fragmentTracker.getBacktrackData(C);if(D){this._handleFragmentLoadProgress(D),this._handleFragmentLoadComplete(D);return}else S=P.FragmentState.NOT_LOADED}S===P.FragmentState.NOT_LOADED||S===P.FragmentState.PARTIAL?C.sn==="initSegment"?this._loadInitSegment(C):this.bitrateTest?(C.bitrateTest=!0,this.log("Fragment "+C.sn+" of level "+C.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(C)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,C,c,u)):S===P.FragmentState.APPENDING?this.reduceMaxBufferLength(C.duration)&&this.fragmentTracker.removeFragment(C):((L=this.media)===null||L===void 0?void 0:L.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(C){var c=this.fragmentTracker.getAppendedFrag(C,A.PlaylistLevelType.MAIN);return c&&"fragment"in c?c.fragment:c},w.getBufferedFrag=function(C){return this.fragmentTracker.getBufferedFrag(C,A.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(C){return C?this.getBufferedFrag(C.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var C=this.levels,c=this.media;if(c!=null&&c.readyState){var u,L=this.getAppendedFrag(c.currentTime);if(L&&L.start>1&&this.flushMainBuffer(0,L.start-1),!c.paused&&C){var S=this.hls.nextLoadLevel,D=C[S],_=this.fragLastKbps;_&&this.fragCurrent?u=this.fragCurrent.duration*D.maxBitrate/(1e3*_)+1:u=0}else u=0;var B=this.getBufferedFrag(c.currentTime+u);if(B){var G=this.followingBufferedFrag(B);if(G){this.abortCurrentFrag();var V=G.maxStartPTS?G.maxStartPTS:G.start,I=G.duration,N=Math.max(B.end,V+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},w.abortCurrentFrag=function(){var C=this.fragCurrent;this.fragCurrent=null,C!=null&&C.loader&&C.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},w.flushMainBuffer=function(C,c){y.prototype.flushMainBuffer.call(this,C,c,this.altAudio?"video":null)},w.onMediaAttached=function(C,c){y.prototype.onMediaAttached.call(this,C,c);var u=c.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new p.default(this.config,u,this.fragmentTracker,this.hls)},w.onMediaDetaching=function(){var C=this.media;C&&(C.removeEventListener("playing",this.onvplaying),C.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),y.prototype.onMediaDetaching.call(this)},w.onMediaPlaying=function(){this.tick()},w.onMediaSeeked=function(){var C=this.media,c=C?C.currentTime:null;Object($.isFiniteNumber)(c)&&this.log("Media seeked to "+c.toFixed(3)),this.tick()},w.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},w.onManifestParsed=function(C,c){var u=!1,L=!1,S;c.levels.forEach(function(D){S=D.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(u=!0),S.indexOf("mp4a.40.5")!==-1&&(L=!0))}),this.audioCodecSwitch=u&&L&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=c.levels,this.startFragRequested=!1},w.onLevelLoading=function(C,c){var u=this.levels;if(!u||this.state!==F.State.IDLE)return;var L=u[c.level];(!L.details||L.details.live&&this.levelLastLoaded!==c.level||this.waitForCdnTuneIn(L.details))&&(this.state=F.State.WAITING_LEVEL)},w.onLevelLoaded=function(C,c){var u,L=this.levels,S=c.level,D=c.details,_=D.totalduration;if(!L){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+D.startSN+","+D.endSN+"], cc ["+D.startCC+", "+D.endCC+"] duration:"+_);var B=this.fragCurrent;B&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==c.level&&B.loader&&(this.state=F.State.IDLE,B.loader.abort()));var G=L[S],V=0;if(D.live||(u=G.details)!==null&&u!==void 0&&u.live){if(D.fragments[0]||(D.deltaUpdateFailed=!0),D.deltaUpdateFailed)return;V=this.alignPlaylists(D,G.details)}if(G.details=D,this.levelLastLoaded=S,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:D,level:S}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(D))return;this.state=F.State.IDLE}this.startFragRequested?D.live&&this.synchronizeToLiveEdge(D):this.setStartPosition(D,V),this.tick()},w._handleFragmentLoadProgress=function(C){var c,u=C.frag,L=C.part,S=C.payload,D=this.levels;if(!D){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var _=D[u.level],B=_.details;if(!B){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var G=_.videoCodec,V=B.PTSKnown||!B.live,I=(c=u.initSegment)===null||c===void 0?void 0:c.data,N=this._getAudioCodec(_),Y=this.transmuxer=this.transmuxer||new f.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=L?L.index:-1,le=ee!==-1,me=new T.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,S.byteLength,ee,le),Ie=this.initPTS[u.cc];Y.push(S,I,N,G,u,L,B.totalduration,V,me,Ie)},w.onAudioTrackSwitching=function(C,c){var u=this.altAudio,L=!!c.url,S=c.id;if(!L){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var D=this.fragCurrent;D!=null&&D.loader&&(this.log("Switching to main audio track, cancel main fragment load"),D.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var _=this.hls;u&&_.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),_.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:S})}},w.onAudioTrackSwitched=function(C,c){var u=c.id,L=!!this.hls.audioTracks[u].url;if(L){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=L,this.tick()},w.onBufferCreated=function(C,c){var u=c.tracks,L,S,D=!1;for(var _ in u){var B=u[_];if(B.id==="main"){if(S=_,L=B,_==="video"){var G=u[_];G&&(this.videoBuffer=G.buffer)}}else D=!0}D&&L?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=L.buffer):this.mediaBuffer=this.media},w.onFragBuffered=function(C,c){var u=c.frag,L=c.part;if(u&&u.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(L?" p: "+L.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var S=L?L.stats:u.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,L)},w.onError=function(C,c){switch(c.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:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,c);break;case m.ErrorDetails.LEVEL_LOAD_ERROR:case m.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(c.fatal?(this.warn(""+c.details),this.state=F.State.ERROR):!c.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var u=!0,L=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);L&&L.len>.5&&(u=!this.reduceMaxBufferLength(L.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.checkBuffer=function(){var C=this.media,c=this.gapController;if(!C||!c||!C.readyState)return;var u=U.BufferHelper.getBuffered(C);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):c.poll(this.lastCurrentTime),this.lastCurrentTime=C.currentTime},w.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(C,c){var u=c.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var L=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(L,u,A.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(C,c){this.levels=c.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.seekToStartPos=function(){var C=this.media,c=C.currentTime,u=this.startPosition;if(u>=0&&c<u){if(C.seeking){g.logger.log("could not seek to "+u+", already seeking at "+c);return}var L=U.BufferHelper.getBuffered(C),S=L.length?L.start(0):0,D=S-u;D>0&&(D<this.config.maxBufferHole||D<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+D+" to match buffer start"),u+=D,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+c),C.currentTime=u}},w._getAudioCodec=function(C){var c=this.config.defaultAudioCodec||C.audioCodec;return this.audioCodecSwap&&c&&(this.log("Swapping audio codec"),c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5"),c},w._loadBitrateTestFrag=function(C){var c=this;this._doFragLoad(C).then(function(u){var L=c.hls;if(!u||L.nextLoadLevel||c.fragContextChanged(C))return;c.fragLoadError=0,c.state=F.State.IDLE,c.startFragRequested=!1,c.bitrateTest=!1;var S=C.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),L.trigger(j.Events.FRAG_LOADED,u)})},w._handleTransmuxComplete=function(C){var c,u="main",L=this.hls,S=C.remuxResult,D=C.chunkMeta,_=this.getCurrentContext(D);if(!_){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var B=_.frag,G=_.part,V=_.level,I=S.video,N=S.text,Y=S.id3,ee=S.initSegment,le=this.altAudio?void 0:S.audio;if(this.fragContextChanged(B))return;if(this.state=F.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,B,D),L.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:u,tracks:ee.tracks}));var me=ee.initPTS,Ie=ee.timescale;Object($.isFiniteNumber)(me)&&(this.initPTS[B.cc]=me,L.trigger(j.Events.INIT_PTS_FOUND,{frag:B,id:u,initPTS:me,timescale:Ie}))}if(I&&S.independent!==!1){if(V.details){var Te=I.startPTS,Oe=I.endPTS,Re=I.startDTS,Ee=I.endDTS;if(G)G.elementaryStreams[I.type]={startPTS:Te,endPTS:Oe,startDTS:Re,endDTS:Ee};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<Te){this.backtrack(B);return}B.setElementaryStreamInfo(I.type,B.start,Oe,B.start,Ee,!0)}B.setElementaryStreamInfo(I.type,Te,Oe,Re,Ee),this.bufferFragmentData(I,B,G,D)}}else if(S.independent===!1){this.backtrack(B);return}if(le){var de=le.startPTS,re=le.endPTS,he=le.startDTS,se=le.endDTS;G&&(G.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:re,startDTS:he,endDTS:se}),B.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,de,re,he,se),this.bufferFragmentData(le,B,G,D)}if(Y!=null&&(c=Y.samples)!==null&&c!==void 0&&c.length){var Ae={frag:B,id:u,samples:Y.samples};L.trigger(j.Events.FRAG_PARSING_METADATA,Ae)}if(N){var ie={frag:B,id:u,samples:N.samples};L.trigger(j.Events.FRAG_PARSING_USERDATA,ie)}},w._bufferInitSegment=function(C,c,u,L){var S=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!c.audio&&!c.video,this.altAudio&&!this.audioOnly&&delete c.audio;var D=c.audio,_=c.video,B=c.audiovideo;if(D){var G=C.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(G&&(G.indexOf("mp4a.40.5")!==-1?G="mp4a.40.2":G="mp4a.40.5"),D.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(G="mp4a.40.5")),V.indexOf("android")!==-1&&D.container!=="audio/mpeg"&&(G="mp4a.40.2",this.log("Android: force audio codec to "+G)),C.audioCodec&&C.audioCodec!==G&&this.log('Swapping manifest audio codec "'+C.audioCodec+'" for "'+G+'"'),D.levelCodec=G,D.id="main",this.log("Init audio buffer, container:"+D.container+", codecs[selected/level/parsed]=["+(G||"")+"/"+(C.audioCodec||"")+"/"+D.codec+"]")}_&&(_.levelCodec=C.videoCodec,_.id="main",this.log("Init video buffer, container:"+_.container+", codecs[level/parsed]=["+(C.videoCodec||"")+"/"+_.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(C.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,c),Object.keys(c).forEach(function(I){var N=c[I],Y=N.initSegment;Y!=null&&Y.byteLength&&S.hls.trigger(j.Events.BUFFER_APPENDING,{type:I,data:Y,frag:u,part:null,chunkMeta:L,parent:u.type})}),this.tick()},w.backtrack=function(C){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(C);var c=this.fragmentTracker.backtrack(C);this.fragPrevious=null,this.nextLoadPosition=C.start,c?this.resetFragmentLoading(C):this.state=F.State.BACKTRACKING},w.checkFragmentChanged=function(){var C=this.media,c=null;if(C&&C.readyState>1&&C.seeking===!1){var u=C.currentTime;if(U.BufferHelper.isBuffered(C,u)?c=this.getAppendedFrag(u):U.BufferHelper.isBuffered(C,u+.1)&&(c=this.getAppendedFrag(u+.1)),c){var L=this.fragPlaying,S=c.level;(!L||c.sn!==L.sn||L.level!==S||c.urlId!==L.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:c}),(!L||L.level!==S)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=c)}}},i(R,[{key:"nextLevel",get:function(){var C=this.nextBufferedFrag;return C?C.level:-1}},{key:"currentLevel",get:function(){var C=this.media;if(C){var c=this.getAppendedFrag(C.currentTime);if(c)return c.level}return-1}},{key:"nextBufferedFrag",get:function(){var C=this.media;if(C){var c=this.getAppendedFrag(C.currentTime);return this.followingBufferedFrag(c)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"SubtitleStreamController",function(){return s});var $=O("./src/events.ts"),F=O("./src/utils/logger.ts"),M=O("./src/utils/buffer-helper.ts"),j=O("./src/controller/fragment-finders.ts"),U=O("./src/utils/discontinuities.ts"),P=O("./src/controller/level-helper.ts"),A=O("./src/controller/fragment-tracker.ts"),d=O("./src/controller/base-stream-controller.ts"),f=O("./src/types/loader.ts"),T=O("./src/types/level.ts");function p(l,x){for(var v=0;v<x.length;v++){var y=x[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}function m(l,x,v){return x&&p(l.prototype,x),v&&p(l,v),l}function g(l,x){l.prototype=Object.create(x.prototype),l.prototype.constructor=l,a(l,x)}function a(l,x){return a=Object.setPrototypeOf||function(y,R){return y.__proto__=R,y},a(l,x)}var i=500,s=function(l){g(x,l);function x(y,R){var w;return w=l.call(this,y,R,"[subtitle-stream-controller]")||this,w.levels=[],w.currentTrackId=-1,w.tracksBuffered=[],w.mainDetails=null,w._registerListeners(),w}var v=x.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var R=this.hls;R.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on($.Events.ERROR,this.onError,this),R.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var R=this.hls;R.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off($.Events.ERROR,this.onError,this),R.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(i),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(R,w){this.mainDetails=w.details},v.onSubtitleFragProcessed=function(R,w){var E=w.frag,C=w.success;if(this.fragPrevious=E,this.state=d.State.IDLE,!C)return;var c=this.tracksBuffered[this.currentTrackId];if(!c)return;for(var u,L=E.start,S=0;S<c.length;S++)if(L>=c[S].start&&L<=c[S].end){u=c[S];break}var D=E.start+E.duration;u?u.end=D:(u={start:L,end:D},c.push(u)),this.fragmentTracker.fragBuffered(E)},v.onBufferFlushing=function(R,w){var E=w.startOffset,C=w.endOffset;if(E===0&&C!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,u=this.levels;if(!u.length||!u[c]||!u[c].details)return;var L=u[c].details,S=L.targetduration,D=C-S;if(D<=0)return;w.endOffsetSubtitles=Math.max(0,D),this.tracksBuffered.forEach(function(_){for(var B=0;B<_.length;){if(_[B].end<=D){_.shift();continue}else if(_[B].start<D)_[B].start=D;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(E,D,f.PlaylistLevelType.SUBTITLE)}},v.onError=function(R,w){var E,C=w.frag;if(!C||C.type!==f.PlaylistLevelType.SUBTITLE)return;(E=this.fragCurrent)!==null&&E!==void 0&&E.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},v.onSubtitleTracksUpdated=function(R,w){var E=this,C=w.subtitleTracks;this.tracksBuffered=[],this.levels=C.map(function(c){return new T.Level(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){E.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(R,w){if(this.currentTrackId=w.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var E=this.levels[this.currentTrackId];E!=null&&E.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,E&&this.setInterval(i)},v.onSubtitleTrackLoaded=function(R,w){var E,C=w.details,c=w.id,u=this.currentTrackId,L=this.levels;if(!L.length)return;var S=L[u];if(c>=L.length||c!==u||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,C.live||(E=S.details)!==null&&E!==void 0&&E.live){var D=this.mainDetails;if(C.deltaUpdateFailed||!D)return;var _=D.fragments[0];if(!S.details)C.hasProgramDateTime&&D.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(C,D):_&&Object(P.addSliding)(C,_.start);else{var B=this.alignPlaylists(C,S.details);B===0&&_&&Object(P.addSliding)(C,_.start)}}if(S.details=C,this.levelLastLoaded=c,this.tick(),C.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var G=Object(j.findFragmentByPTS)(null,C.fragments,this.media.currentTime,0);G||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},v._handleFragmentLoadComplete=function(R){var w=R.frag,E=R.payload,C=w.decryptdata,c=this.hls;if(this.fragContextChanged(w))return;if(E&&E.byteLength>0&&C&&C.key&&C.iv&&C.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(E),C.key.buffer,C.iv.buffer).then(function(L){var S=performance.now();c.trigger($.Events.FRAG_DECRYPTED,{frag:w,payload:L,stats:{tstart:u,tdecrypt:S}})})}},v.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var R,w=this.currentTrackId,E=this.levels;if(!E.length||!E[w]||!E[w].details)return;var C=E[w].details,c=C.targetduration,u=this.config,L=this.media,S=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,L.currentTime-c,u.maxBufferHole),D=S.end,_=S.len,B=this.getMaxBufferLength()+c;if(_>B)return;console.assert(C,"Subtitle track details are defined on idle subtitle stream controller tick");var G=C.fragments,V=G.length,I=C.edge,N,Y=this.fragPrevious;if(D<I){var ee=u.maxFragLookUpTolerance;Y&&C.hasProgramDateTime&&(N=Object(j.findFragmentByPDT)(G,Y.endProgramDateTime,ee)),N||(N=Object(j.findFragmentByPTS)(Y,G,D,ee),!N&&Y&&Y.start<G[0].start&&(N=G[0]))}else N=G[V-1];(R=N)!==null&&R!==void 0&&R.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=d.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===A.FragmentState.NOT_LOADED&&this.loadFragment(N,C,D)}},v.loadFragment=function(R,w,E){this.fragCurrent=R,l.prototype.loadFragment.call(this,R,w,E)},m(x,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),x}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),M=O("./src/controller/base-playlist-controller.ts"),j=O("./src/types/loader.ts");function U(p,m){for(var g=0;g<m.length;g++){var a=m[g];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function P(p,m,g){return m&&U(p.prototype,m),g&&U(p,g),p}function A(p,m){p.prototype=Object.create(m.prototype),p.prototype.constructor=p,d(p,m)}function d(p,m){return d=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},d(p,m)}var f=function(p){A(m,p);function m(a){var i;return i=p.call(this,a,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}var g=m.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,p.prototype.destroy.call(this)},g.registerListeners=function(){var i=this.hls;i.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on($.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var i=this.hls;i.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off($.Events.ERROR,this.onError,this)},g.onMediaAttached=function(i,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)},g.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},g.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 i=T(this.media.textTracks);i.forEach(function(s){Object(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(i,s){this.tracks=s.subtitleTracks},g.onSubtitleTrackLoaded=function(i,s){var l=s.id,x=s.details,v=this.trackId,y=this.tracksInGroup[v];if(!y){this.warn("Invalid subtitle track id "+l);return}var R=y.details;y.details=s.details,this.log("subtitle track "+l+" loaded ["+x.startSN+"-"+x.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,R))},g.onLevelLoading=function(i,s){this.switchLevel(s.level)},g.onLevelSwitching=function(i,s){this.switchLevel(s.level)},g.switchLevel=function(i){var s=this.hls.levels[i];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var x=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(w){return!l||w.groupId===l});this.tracksInGroup=v;var y=this.findTrackId(x==null?void 0:x.name)||this.findTrackId();this.groupId=l;var R={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger($.Events.SUBTITLE_TRACKS_UPDATED,R),y!==-1&&this.setSubtitleTrack(y,x)}},g.findTrackId=function(i){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var x=s[l];if((!this.selectDefaultTrack||x.default)&&(!i||i===x.name))return x.id}return-1},g.onError=function(i,s){if(p.prototype.onError.call(this,i,s),s.fatal||!s.context)return;s.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},g.loadPlaylist=function(i){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,x=s.groupId,v=s.url;if(i)try{v=i.addDirectives(v)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:v,id:l,groupId:x,deliveryDirectives:i||null})}},g.toggleTrackModes=function(i){var s=this,l=this.media,x=this.subtitleDisplay,v=this.trackId;if(!l)return;var y=T(l.textTracks),R=y.filter(function(C){return C.groupId===s.groupId});if(i===-1)[].slice.call(y).forEach(function(C){C.mode="disabled"});else{var w=R[v];w&&(w.mode="disabled")}var E=R[i];E&&(E.mode=x?"showing":"hidden")},g.setSubtitleTrack=function(i,s){var l,x=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(l=x[i])!==null&&l!==void 0&&l.details)||i<-1||i>=x.length)return;this.clearTimer();var v=x[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,v){var y=v.id,R=v.groupId,w=R===void 0?"":R,E=v.name,C=v.type,c=v.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:y,groupId:w,name:E,type:C,url:c});var u=this.switchParams(v.url,s==null?void 0:s.details);this.loadPlaylist(u)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:i})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,s=T(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")i=l;else if(s[l].mode==="showing"){i=l;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},P(m,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,s)}}]),m}(M.default);function T(p){for(var m=[],g=0;g<p.length;g++){var a=p[g];a.kind==="subtitles"&&a.label&&m.push(p[g])}return m}J.default=f},"./src/controller/timeline-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"TimelineController",function(){return T});var $=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),M=O("./src/utils/cea-608-parser.ts"),j=O("./src/utils/output-filter.ts"),U=O("./src/utils/webvtt-parser.ts"),P=O("./src/utils/texttrack-utils.ts"),A=O("./src/utils/imsc1-ttml-parser.ts"),d=O("./src/types/loader.ts"),f=O("./src/utils/logger.ts"),T=function(){function a(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=g(),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 l=new j.default(this,"textTrack1"),x=new j.default(this,"textTrack2"),v=new j.default(this,"textTrack3"),y=new j.default(this,"textTrack4");this.cea608Parser1=new M.default(1,l,x),this.cea608Parser2=new M.default(3,v,y)}s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(F.Events.FRAG_LOADING,this.onFragLoading,this),s.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var i=a.prototype;return i.destroy=function(){var l=this.hls;l.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(F.Events.FRAG_LOADING,this.onFragLoading,this),l.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(l,x,v,y,R){for(var w=!1,E=R.length;E--;){var C=R[E],c=m(C[0],C[1],x,v);if(c>=0&&(C[0]=Math.min(C[0],x),C[1]=Math.max(C[1],v),w=!0,c/(v-x)>.5))return}if(w||R.push([x,v]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,x,v,y)}else{var L=this.Cues.newCue(null,x,v,y);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:L,track:l})}},i.onInitPtsFound=function(l,x){var v=this,y=x.frag,R=x.id,w=x.initPTS,E=x.timescale,C=this.unparsedVttFrags;R==="main"&&(this.initPTS[y.cc]=w,this.timescale[y.cc]=E),C.length&&(this.unparsedVttFrags=[],C.forEach(function(c){v.onFragLoaded(F.Events.FRAG_LOADED,c)}))},i.getExistingTrack=function(l){var x=this.media;if(x)for(var v=0;v<x.textTracks.length;v++){var y=x.textTracks[v];if(y[l])return y}return null},i.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},i.createNativeTrack=function(l){if(this.captionsTracks[l])return;var x=this.captionsProperties,v=this.captionsTracks,y=this.media,R=x[l],w=R.label,E=R.languageCode,C=this.getExistingTrack(l);if(C)v[l]=C,Object(P.clearCurrentCues)(v[l]),Object(P.sendAddTrackEvent)(v[l],y);else{var c=this.createTextTrack("captions",w,E);c&&(c[l]=!0,v[l]=c)}},i.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var x=this.captionsProperties[l];if(!x)return;var v=x.label,y={_id:l,label:v,kind:"captions",default:x.media?!!x.media.default:!1,closedCaptions:x.media};this.nonNativeCaptionsTracks[l]=y,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[y]})},i.createTextTrack=function(l,x,v){var y=this.media;return y?y.addTextTrack(l,x,v):void 0},i.onMediaAttaching=function(l,x){this.media=x.media,this._cleanTracks()},i.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(x){Object(P.clearCurrentCues)(l[x]),delete l[x]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),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())},i._cleanTracks=function(){var l=this.media;if(!l)return;var x=l.textTracks;if(x)for(var v=0;v<x.length;v++)Object(P.clearCurrentCues)(x[v])},i.onSubtitleTracksUpdated=function(l,x){var v=this;this.textTracks=[];var y=x.subtitleTracks||[],R=y.some(function(c){return c.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||R&&this.config.enableIMSC1){var w=this.tracks&&y&&this.tracks.length===y.length;if(this.tracks=y||[],this.config.renderTextTracksNatively){var E=this.media?this.media.textTracks:[];this.tracks.forEach(function(c,u){var L;if(u<E.length){for(var S=null,D=0;D<E.length;D++)if(p(E[D],c)){S=E[D];break}S&&(L=S)}L?Object(P.clearCurrentCues)(L):(L=v.createTextTrack("subtitles",c.name,c.lang),L&&(L.mode="disabled")),L&&(L.groupId=c.groupId,v.textTracks.push(L))})}else if(!w&&this.tracks&&this.tracks.length){var C=this.tracks.map(function(c){return{label:c.name,kind:c.type.toLowerCase(),default:c.default,subtitleTrack:c}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:C})}}},i.onManifestLoaded=function(l,x){var v=this;this.config.enableCEA708Captions&&x.captions&&x.captions.forEach(function(y){var R=/(?:CC|SERVICE)([1-4])/.exec(y.instreamId);if(!R)return;var w="textTrack"+R[1],E=v.captionsProperties[w];if(!E)return;E.label=y.name,y.lang&&(E.languageCode=y.lang),E.media=y})},i.onFragLoading=function(l,x){var v=this.cea608Parser1,y=this.cea608Parser2,R=this.lastSn,w=this.lastPartIndex;if(!this.enabled||!(v&&y))return;if(x.frag.type===d.PlaylistLevelType.MAIN){var E,C,c=x.frag.sn,u=(E=x==null||((C=x.part)===null||C===void 0)?void 0:C.index)!=null?E:-1;c===R+1||c===R&&u===w+1||(v.reset(),y.reset()),this.lastSn=c,this.lastPartIndex=u}},i.onFragLoaded=function(l,x){var v=x.frag,y=x.payload,R=this.initPTS,w=this.unparsedVttFrags;if(v.type===d.PlaylistLevelType.SUBTITLE)if(y.byteLength){if(!Object($.isFiniteNumber)(R[v.cc])){w.push(x),R.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var E=v.decryptdata;if(E==null||E.key==null||E.method!=="AES-128"){var C=this.tracks[v.level],c=this.vttCCs;c[v.cc]||(c[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),C&&C.textCodec===A.IMSC1_CODEC?this._parseIMSC1(v,y):this._parseVTTs(v,y,c)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(l,x){var v=this,y=this.hls;Object(A.parseIMSC1)(x,this.initPTS[l.cc],this.timescale[l.cc],function(R){v._appendCues(R,l.level),y.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(R){f.logger.log("Failed to parse IMSC1: "+R),y.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:R})})},i._parseVTTs=function(l,x,v){var y=this,R=this.hls;Object(U.parseWebVTT)(x,this.initPTS[l.cc],this.timescale[l.cc],v,l.cc,l.start,function(w){y._appendCues(w,l.level),R.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(w){y._fallbackToIMSC1(l,x),f.logger.log("Failed to parse VTT cue: "+w),R.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:w})})},i._fallbackToIMSC1=function(l,x){var v=this,y=this.tracks[l.level];y.textCodec||Object(A.parseIMSC1)(x,this.initPTS[l.cc],this.timescale[l.cc],function(){y.textCodec=A.IMSC1_CODEC,v._parseIMSC1(l,x)},function(){y.textCodec="wvtt"})},i._appendCues=function(l,x){var v=this.hls;if(this.config.renderTextTracksNatively){var y=this.textTracks[x];if(y.mode==="disabled")return;l.forEach(function(E){return Object(P.addCueToTrack)(y,E)})}else{var R=this.tracks[x],w=R.default?"default":"subtitles"+x;v.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:l,track:w})}},i.onFragDecrypted=function(l,x){var v=x.frag;if(v.type===d.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(x);return}this.onFragLoaded(F.Events.FRAG_LOADED,x)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(l,x){var v=this.cea608Parser1,y=this.cea608Parser2;if(!this.enabled||!(v&&y))return;for(var R=0;R<x.samples.length;R++){var w=x.samples[R].bytes;if(w){var E=this.extractCea608Data(w);v.addData(x.samples[R].pts,E[0]),y.addData(x.samples[R].pts,E[1])}}},i.onBufferFlushing=function(l,x){var v=x.startOffset,y=x.endOffset,R=x.endOffsetSubtitles,w=x.type,E=this.media;if(!E||E.currentTime<y)return;if(!w||w==="video"){var C=this.captionsTracks;Object.keys(C).forEach(function(u){return Object(P.removeCuesInRange)(C[u],v,y)})}if(this.config.renderTextTracksNatively&&(v===0&&R!==void 0)){var c=this.textTracks;Object.keys(c).forEach(function(u){return Object(P.removeCuesInRange)(c[u],v,R)})}},i.extractCea608Data=function(l){for(var x=l[0]&31,v=2,y=[[],[]],R=0;R<x;R++){var w=l[v++],E=127&l[v++],C=127&l[v++],c=(4&w)!==0,u=3&w;if(E===0&&C===0)continue;c&&((u===0||u===1)&&(y[u].push(E),y[u].push(C)))}return y},a}();function p(a,i){return a&&a.label===i.name&&!(a.textTrack1||a.textTrack2)}function m(a,i,s,l){return Math.min(i,l)-Math.max(a,s)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return $});var $=function(){function F(j,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=U}var M=F.prototype;return M.decrypt=function(U,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,U)},F}()},"./src/crypt/aes-decryptor.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"removePadding",function(){return F}),O.d(J,"default",function(){return M});var $=O("./src/utils/typed-array.ts");function F(j){var U=j.byteLength,P=U&&new DataView(j.buffer).getUint8(U-1);return P?Object($.sliceUint8)(j,0,U-P):j}var M=function(){function j(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=j.prototype;return U.uint8ArrayToUint32Array_=function(A){for(var d=new DataView(A),f=new Uint32Array(4),T=0;T<4;T++)f[T]=d.getUint32(T*4);return f},U.initTable=function(){var A=this.sBox,d=this.invSBox,f=this.subMix,T=f[0],p=f[1],m=f[2],g=f[3],a=this.invSubMix,i=a[0],s=a[1],l=a[2],x=a[3],v=new Uint32Array(256),y=0,R=0,w=0;for(w=0;w<256;w++)w<128?v[w]=w<<1:v[w]=w<<1^283;for(w=0;w<256;w++){var E=R^R<<1^R<<2^R<<3^R<<4;E=E>>>8^E&255^99,A[y]=E,d[E]=y;var C=v[y],c=v[C],u=v[c],L=v[E]*257^E*16843008;T[y]=L<<24|L>>>8,p[y]=L<<16|L>>>16,m[y]=L<<8|L>>>24,g[y]=L,L=u*16843009^c*65537^C*257^y*16843008,i[E]=L<<24|L>>>8,s[E]=L<<16|L>>>16,l[E]=L<<8|L>>>24,x[E]=L,y?(y=C^v[v[v[u^C]]],R^=v[v[R]]):y=R=1}},U.expandKey=function(A){for(var d=this.uint8ArrayToUint32Array_(A),f=!0,T=0;T<d.length&&f;)f=d[T]===this.key[T],T++;if(f)return;this.key=d;var p=this.keySize=d.length;if(p!==4&&p!==6&&p!==8)throw new Error("Invalid aes key size="+p);var m=this.ksRows=(p+6+1)*4,g,a,i=this.keySchedule=new Uint32Array(m),s=this.invKeySchedule=new Uint32Array(m),l=this.sBox,x=this.rcon,v=this.invSubMix,y=v[0],R=v[1],w=v[2],E=v[3],C,c;for(g=0;g<m;g++){if(g<p){C=i[g]=d[g];continue}c=C,g%p===0?(c=c<<8|c>>>24,c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255],c^=x[g/p|0]<<24):p>6&&g%p===4&&(c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255]),i[g]=C=(i[g-p]^c)>>>0}for(a=0;a<m;a++)g=m-a,a&3?c=i[g]:c=i[g-4],a<4||g<=4?s[a]=c:s[a]=y[l[c>>>24]]^R[l[c>>>16&255]]^w[l[c>>>8&255]]^E[l[c&255]],s[a]=s[a]>>>0},U.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},U.decrypt=function(A,d,f){for(var T=this.keySize+6,p=this.invKeySchedule,m=this.invSBox,g=this.invSubMix,a=g[0],i=g[1],s=g[2],l=g[3],x=this.uint8ArrayToUint32Array_(f),v=x[0],y=x[1],R=x[2],w=x[3],E=new Int32Array(A),C=new Int32Array(E.length),c,u,L,S,D,_,B,G,V,I,N,Y,ee,le,me=this.networkToHostOrderSwap;d<E.length;){for(V=me(E[d]),I=me(E[d+1]),N=me(E[d+2]),Y=me(E[d+3]),D=V^p[0],_=Y^p[1],B=N^p[2],G=I^p[3],ee=4,le=1;le<T;le++)c=a[D>>>24]^i[_>>16&255]^s[B>>8&255]^l[G&255]^p[ee],u=a[_>>>24]^i[B>>16&255]^s[G>>8&255]^l[D&255]^p[ee+1],L=a[B>>>24]^i[G>>16&255]^s[D>>8&255]^l[_&255]^p[ee+2],S=a[G>>>24]^i[D>>16&255]^s[_>>8&255]^l[B&255]^p[ee+3],D=c,_=u,B=L,G=S,ee=ee+4;c=m[D>>>24]<<24^m[_>>16&255]<<16^m[B>>8&255]<<8^m[G&255]^p[ee],u=m[_>>>24]<<24^m[B>>16&255]<<16^m[G>>8&255]<<8^m[D&255]^p[ee+1],L=m[B>>>24]<<24^m[G>>16&255]<<16^m[D>>8&255]<<8^m[_&255]^p[ee+2],S=m[G>>>24]<<24^m[D>>16&255]<<16^m[_>>8&255]<<8^m[B&255]^p[ee+3],C[d]=me(c^v),C[d+1]=me(S^y),C[d+2]=me(L^R),C[d+3]=me(u^w),v=V,y=I,R=N,w=Y,d=d+4}return C.buffer},j}()},"./src/crypt/decrypter.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return d});var $=O("./src/crypt/aes-crypto.ts"),F=O("./src/crypt/fast-aes-key.ts"),M=O("./src/crypt/aes-decryptor.ts"),j=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),P=O("./src/utils/typed-array.ts"),A=16,d=function(){function f(p,m,g){var a=g===void 0?{}:g,i=a.removePKCS7Padding,s=i===void 0?!0:i;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=p,this.config=m,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(x){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var T=f.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var m=this.currentResult;if(!m){this.reset();return}var g=new Uint8Array(m);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(g):g},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(m,g,a,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(m),g,a);var s=this.flush();s&&i(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(m),g,a).then(i)},T.softwareDecrypt=function(m,g,a){var i=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(m=Object(U.appendUint8Array)(l,m),this.remainderData=null);var x=this.getValidChunk(m);if(!x.length)return null;i&&(a=i);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new M.default),v.expandKey(g);var y=s;return this.currentResult=v.decrypt(x.buffer,0,a),this.currentIV=Object(P.sliceUint8)(x,-16).buffer,y||null},T.webCryptoDecrypt=function(m,g,a){var i=this,s=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new F.default(s,g)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var x=new $.default(s,a);return x.decrypt(m.buffer,l)}).catch(function(l){return i.onWebCryptoError(l,m,g,a)})},T.onWebCryptoError=function(m,g,a,i){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",m),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,a,i)},T.getValidChunk=function(m){var g=m,a=m.length-m.length%A;return a!==m.length&&(g=Object(P.sliceUint8)(m,0,a),this.remainderData=Object(P.sliceUint8)(m,a)),g},T.logOnce=function(m){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+m),this.logEnabled=!1},f}()},"./src/crypt/fast-aes-key.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return $});var $=function(){function F(j,U){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=U}var M=F.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/adts.ts"),M=O("./src/utils/logger.ts"),j=O("./src/demux/id3.ts");function U(d,f){d.prototype=Object.create(f.prototype),d.prototype.constructor=d,P(d,f)}function P(d,f){return P=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},P(d,f)}var A=function(d){U(f,d);function f(p,m){var g;return g=d.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=p,g.config=m,g}var T=f.prototype;return T.resetInitSegment=function(m,g,a){d.prototype.resetInitSegment.call(this,m,g,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:m,duration:a,inputTimeScale:9e4,dropped:0}},f.probe=function(m){if(!m)return!1;for(var g=j.getID3Data(m,0)||[],a=g.length,i=m.length;a<i;a++)if(F.probe(m,a))return M.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(m,g){return F.canParse(m,g)},T.appendFrame=function(m,g,a){F.initTrackConfig(m,this.observer,g,a,m.manifestCodec);var i=F.appendFrame(m,g,a,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},f}($.default);A.minProbeByteLength=9,J.default=A},"./src/demux/adts.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"getAudioConfig",function(){return j}),O.d(J,"isHeaderPattern",function(){return U}),O.d(J,"getHeaderLength",function(){return P}),O.d(J,"getFullFrameLength",function(){return A}),O.d(J,"canGetFrameLength",function(){return d}),O.d(J,"isHeader",function(){return f}),O.d(J,"canParse",function(){return T}),O.d(J,"probe",function(){return p}),O.d(J,"initTrackConfig",function(){return m}),O.d(J,"getFrameDuration",function(){return g}),O.d(J,"parseFrameHeader",function(){return a}),O.d(J,"appendFrame",function(){return i});var $=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),M=O("./src/events.ts");function j(s,l,x,v){var y,R,w,E,C=navigator.userAgent.toLowerCase(),c=v,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];y=((l[x+2]&192)>>>6)+1;var L=(l[x+2]&60)>>>2;if(L>u.length-1){s.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+L});return}return w=(l[x+2]&1)<<2,w|=(l[x+3]&192)>>>6,$.logger.log("manifest codec:"+v+", ADTS type:"+y+", samplingIndex:"+L),/firefox/i.test(C)?L>=6?(y=5,E=new Array(4),R=L-3):(y=2,E=new Array(2),R=L):C.indexOf("android")!==-1?(y=2,E=new Array(2),R=L):(y=5,E=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&L>=6?R=L-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(L>=6&&w===1||/vivaldi/i.test(C))||!v&&w===1)&&(y=2,E=new Array(2)),R=L)),E[0]=y<<3,E[0]|=(L&14)>>1,E[1]|=(L&1)<<7,E[1]|=w<<3,y===5&&(E[1]|=(R&14)>>1,E[2]=(R&1)<<7,E[2]|=2<<2,E[3]=0),{config:E,samplerate:u[L],channelCount:w,codec:"mp4a.40."+y,manifestCodec:c}}function U(s,l){return s[l]===255&&(s[l+1]&246)===240}function P(s,l){return s[l+1]&1?7:9}function A(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function d(s,l){return l+5<s.length}function f(s,l){return l+1<s.length&&U(s,l)}function T(s,l){return d(s,l)&&U(s,l)&&A(s,l)<=s.length-l}function p(s,l){if(f(s,l)){var x=P(s,l);if(l+x>=s.length)return!1;var v=A(s,l);if(v<=x)return!1;var y=l+v;return y===s.length||f(s,y)}return!1}function m(s,l,x,v,y){if(!s.samplerate){var R=j(l,x,v,y);if(!R)return;s.config=R.config,s.samplerate=R.samplerate,s.channelCount=R.channelCount,s.codec=R.codec,s.manifestCodec=R.manifestCodec,$.logger.log("parsed codec:"+s.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function g(s){return 1024*9e4/s}function a(s,l,x,v,y){var R=P(s,l),w=A(s,l);if(w-=R,w>0){var E=x+v*y;return{headerLength:R,frameLength:w,stamp:E}}}function i(s,l,x,v,y){var R=g(s.samplerate),w=a(l,x,v,y,R);if(w){var E=w.frameLength,C=w.headerLength,c=w.stamp,u=C+E,L=Math.max(0,x+u-l.length),S;L?(S=new Uint8Array(u-C),S.set(l.subarray(x+C,l.length),0)):S=l.subarray(x+C,x+u);var D={unit:S,pts:c};return L||s.samples.push(D),{sample:D,length:u,missing:L}}}},"./src/demux/base-audio-demuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"initPTSFn",function(){return A});var $=O("./src/polyfills/number.ts"),F=O("./src/demux/id3.ts"),M=O("./src/demux/dummy-demuxed-track.ts"),j=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/typed-array.ts"),P=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var f=d.prototype;return f.resetInitSegment=function(p,m,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},f.resetTimeStamp=function(){},f.resetContiguity=function(){},f.canParse=function(p,m){return!1},f.appendFrame=function(p,m,g){},f.demux=function(p,m){this.cachedData&&(p=Object(j.appendUint8Array)(this.cachedData,p),this.cachedData=null);var g=F.getID3Data(p,0),a=g?g.length:0,i,s,l=this._audioTrack,x=this._id3Track,v=g?F.getTimeStamp(g):void 0,y=p.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(v,m)),g&&g.length>0&&x.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),s=this.initPTS;a<y;){if(this.canParse(p,a)){var R=this.appendFrame(l,p,a);R?(this.frameIndex++,s=R.sample.pts,a+=R.length,i=a):a=y}else F.canParse(p,a)?(g=F.getID3Data(p,a),x.samples.push({pts:s,dts:s,data:g}),a+=g.length,i=a):a++;if(a===y&&i!==y){var w=Object(U.sliceUint8)(p,i);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,w):this.cachedData=w}}return{audioTrack:l,avcTrack:Object(M.dummyTrack)(),id3Track:x,textTrack:Object(M.dummyTrack)()}},f.demuxSampleAes=function(p,m,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},f.flush=function(p){var m=this.cachedData;return m&&(this.cachedData=null,this.demux(m,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},f.destroy=function(){},d}(),A=function(f,T){return Object($.isFiniteNumber)(f)?f*90:T*9e4};J.default=P},"./src/demux/chunk-cache.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return $});var $=function(){function M(){this.chunks=[],this.dataLength=0}var j=M.prototype;return j.push=function(P){this.chunks.push(P),this.dataLength+=P.length},j.flush=function(){var P=this.chunks,A=this.dataLength,d;if(P.length)P.length===1?d=P[0]:d=F(P,A);else return new Uint8Array(0);return this.reset(),d},j.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function F(M,j){for(var U=new Uint8Array(j),P=0,A=0;A<M.length;A++){var d=M[A];U.set(d,P),P+=d.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(ue,J,O){"use strict";O.r(J),O.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(ue,J,O){"use strict";O.r(J);var $=O("./src/utils/logger.ts"),F=function(){function M(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var j=M.prototype;return j.loadWord=function(){var P=this.data,A=this.bytesAvailable,d=P.byteLength-A,f=new Uint8Array(4),T=Math.min(4,A);if(T===0)throw new Error("no bytes available");f.set(P.subarray(d,d+T)),this.word=new DataView(f.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},j.skipBits=function(P){var A;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,A=P>>3,P-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},j.readBits=function(P){var A=Math.min(this.bitsAvailable,P),d=this.word>>>32-A;return P>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=P-A,A>0&&this.bitsAvailable?d<<A|this.readBits(A):d},j.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},j.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(P){for(var A=8,d=8,f,T=0;T<P;T++)d!==0&&(f=this.readEG(),d=(A+f+256)%256),A=d===0?A:d},j.readSPS=function(){var P=0,A=0,d=0,f=0,T,p,m,g=this.readUByte.bind(this),a=this.readBits.bind(this),i=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),x=this.skipEG.bind(this),v=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);g();var R=g();if(a(5),l(3),g(),v(),R===100||R===110||R===122||R===244||R===44||R===83||R===86||R===118||R===128){var w=i();if(w===3&&l(1),v(),v(),l(1),s())for(p=w!==3?8:12,m=0;m<p;m++)s()&&(m<6?y(16):y(64))}v();var E=i();if(E===0)i();else if(E===1)for(l(1),x(),x(),T=i(),m=0;m<T;m++)x();v(),l(1);var C=i(),c=i(),u=a(1);u===0&&l(1),l(1),s()&&(P=i(),A=i(),d=i(),f=i());var L=[1,1];if(s()&&s()){var S=g();switch(S){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:{L=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((C+1)*16-P*2-A*2),height:(2-u)*(c+1)*16-(u?2:4)*(d+f),pixelRatio:L}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();J.default=F},"./src/demux/id3.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isHeader",function(){return $}),O.d(J,"isFooter",function(){return F}),O.d(J,"getID3Data",function(){return M}),O.d(J,"canParse",function(){return U}),O.d(J,"getTimeStamp",function(){return P}),O.d(J,"isTimeStampFrame",function(){return A}),O.d(J,"getID3Frames",function(){return f}),O.d(J,"decodeFrame",function(){return T}),O.d(J,"utf8ArrayToStr",function(){return i}),O.d(J,"testables",function(){return s});var $=function(y,R){return R+10<=y.length&&(y[R]===73&&y[R+1]===68&&y[R+2]===51&&(y[R+3]<255&&y[R+4]<255&&(y[R+6]<128&&y[R+7]<128&&y[R+8]<128&&y[R+9]<128)))},F=function(y,R){return R+10<=y.length&&(y[R]===51&&y[R+1]===68&&y[R+2]===73&&(y[R+3]<255&&y[R+4]<255&&(y[R+6]<128&&y[R+7]<128&&y[R+8]<128&&y[R+9]<128)))},M=function(y,R){for(var w=R,E=0;$(y,R);){E+=10;var C=j(y,R+6);E+=C,F(y,R+10)&&(E+=10),R+=E}return E>0?y.subarray(w,w+E):void 0},j=function(y,R){var w=0;return w=(y[R]&127)<<21,w|=(y[R+1]&127)<<14,w|=(y[R+2]&127)<<7,w|=y[R+3]&127,w},U=function(y,R){return $(y,R)&&j(y,R+6)+10<=y.length-R},P=function(y){for(var R=f(y),w=0;w<R.length;w++){var E=R[w];if(A(E))return a(E)}return},A=function(y){return y&&y.key==="PRIV"&&y.info==="com.apple.streaming.transportStreamTimestamp"},d=function(y){var R=String.fromCharCode(y[0],y[1],y[2],y[3]),w=j(y,4),E=10;return{type:R,size:w,data:y.subarray(E,E+w)}},f=function(y){for(var R=0,w=[];$(y,R);){var E=j(y,R+6);R+=10;for(var C=R+E;R+8<C;){var c=d(y.subarray(R)),u=T(c);u&&w.push(u),R+=c.size+10}F(y,R)&&(R+=10)}return w},T=function(y){return y.type==="PRIV"?p(y):y.type[0]==="W"?g(y):m(y)},p=function(y){if(y.size<2)return;var R=i(y.data,!0),w=new Uint8Array(y.data.subarray(R.length+1));return{key:y.type,info:R,data:w.buffer}},m=function(y){if(y.size<2)return;if(y.type==="TXXX"){var R=1,w=i(y.data.subarray(R),!0);R+=w.length+1;var E=i(y.data.subarray(R));return{key:y.type,info:w,data:E}}var C=i(y.data.subarray(1));return{key:y.type,data:C}},g=function(y){if(y.type==="WXXX"){if(y.size<2)return;var R=1,w=i(y.data.subarray(R),!0);R+=w.length+1;var E=i(y.data.subarray(R));return{key:y.type,info:w,data:E}}var C=i(y.data);return{key:y.type,data:C}},a=function(y){if(y.data.byteLength===8){var R=new Uint8Array(y.data),w=R[3]&1,E=(R[4]<<23)+(R[5]<<15)+(R[6]<<7)+R[7];return E/=45,w&&(E+=4772185884e-2),Math.round(E)}return},i=function(y,R){R===void 0&&(R=!1);var w=x();if(w){var E=w.decode(y);if(R){var C=E.indexOf("\0");return C!==-1?E.substring(0,C):E}return E.replace(/\0/g,"")}for(var c=y.length,u,L,S,D="",_=0;_<c;){if(u=y[_++],u===0&&R)return D;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:D+=String.fromCharCode(u);break;case 12:case 13:L=y[_++],D+=String.fromCharCode((u&31)<<6|L&63);break;case 14:L=y[_++],S=y[_++],D+=String.fromCharCode((u&15)<<12|(L&63)<<6|(S&63)<<0);break;default:}}return D},s={decodeTextFrame:m},l;function x(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/id3.ts"),M=O("./src/utils/logger.ts"),j=O("./src/demux/mpegaudio.ts");function U(d,f){d.prototype=Object.create(f.prototype),d.prototype.constructor=d,P(d,f)}function P(d,f){return P=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},P(d,f)}var A=function(d){U(f,d);function f(){return d.apply(this,arguments)||this}var T=f.prototype;return T.resetInitSegment=function(m,g,a){d.prototype.resetInitSegment.call(this,m,g,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:m,duration:a,inputTimeScale:9e4,dropped:0}},f.probe=function(m){if(!m)return!1;for(var g=F.getID3Data(m,0)||[],a=g.length,i=m.length;a<i;a++)if(j.probe(m,a))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(m,g){return j.canParse(m,g)},T.appendFrame=function(m,g,a){return this.initPTS===null?void 0:j.appendFrame(m,g,a,this.initPTS,this.frameIndex)},f}($.default);A.minProbeByteLength=4,J.default=A},"./src/demux/mp4demuxer.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/utils/mp4-tools.ts"),F=O("./src/demux/dummy-demuxed-track.ts"),M=function(){function j(P,A){this.remainderData=null,this.config=void 0,this.config=A}var U=j.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},j.probe=function(A){return Object($.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},U.demux=function(A){var d=A,f=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object($.appendUint8Array)(this.remainderData,A));var T=Object($.segmentValidRange)(d);this.remainderData=T.remainder,f.samples=T.valid||new Uint8Array}else f.samples=d;return{audioTrack:Object(F.dummyTrack)(),avcTrack:f,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},U.flush=function(){var A=Object(F.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:A,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},U.demuxSampleAes=function(A,d,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},j}();M.minProbeByteLength=1024,J.default=M},"./src/demux/mpegaudio.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"appendFrame",function(){return P}),O.d(J,"parseHeader",function(){return A}),O.d(J,"isHeaderPattern",function(){return d}),O.d(J,"isHeader",function(){return f}),O.d(J,"canParse",function(){return T}),O.d(J,"probe",function(){return p});var $=null,F=[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],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function P(m,g,a,i,s){if(a+24>g.length)return;var l=A(g,a);if(l&&a+l.frameLength<=g.length){var x=l.samplesPerFrame*9e4/l.sampleRate,v=i+s*x,y={unit:g.subarray(a,a+l.frameLength),pts:v,dts:v};return m.config=[],m.channelCount=l.channelCount,m.samplerate=l.sampleRate,m.samples.push(y),{sample:y,length:l.frameLength,missing:0}}}function A(m,g){var a=m[g+1]>>3&3,i=m[g+1]>>1&3,s=m[g+2]>>4&15,l=m[g+2]>>2&3;if(a!==1&&s!==0&&s!==15&&l!==3){var x=m[g+2]>>1&1,v=m[g+3]>>6,y=a===3?3-i:i===3?3:4,R=F[y*14+s-1]*1e3,w=a===3?0:a===2?1:2,E=M[w*3+l],C=v===3?1:2,c=j[a][i],u=U[i],L=c*8*u,S=Math.floor(c*R/E+x)*u;if($===null){var D=navigator.userAgent||"",_=D.match(/Chrome\/(\d+)/i);$=_?parseInt(_[1]):0}var B=!!$&&$<=87;return B&&i===2&&R>=224e3&&v===0&&(m[g+3]=m[g+3]|128),{sampleRate:E,channelCount:C,frameLength:S,samplesPerFrame:L}}}function d(m,g){return m[g]===255&&(m[g+1]&224)===224&&(m[g+1]&6)!==0}function f(m,g){return g+1<m.length&&d(m,g)}function T(m,g){var a=4;return d(m,g)&&a<=m.length-g}function p(m,g){if(g+1<m.length&&d(m,g)){var a=4,i=A(m,g),s=a;i!=null&&i.frameLength&&(s=i.frameLength);var l=g+s;return l===m.length||f(m,l)}return!1}},"./src/demux/sample-aes.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/crypt/decrypter.ts"),F=O("./src/demux/tsdemuxer.ts"),M=function(){function j(P,A,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new $.default(P,A,{removePKCS7Padding:!1})}var U=j.prototype;return U.decryptBuffer=function(A,d){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,d)},U.decryptAacSample=function(A,d,f,T){var p=A[d].unit,m=p.subarray(16,p.length-p.length%16),g=m.buffer.slice(m.byteOffset,m.byteOffset+m.length),a=this;this.decryptBuffer(g,function(i){var s=new Uint8Array(i);p.set(s,16),T||a.decryptAacSamples(A,d+1,f)})},U.decryptAacSamples=function(A,d,f){for(;;d++){if(d>=A.length){f();return}if(A[d].unit.length<32)continue;var T=this.decrypter.isSync();if(this.decryptAacSample(A,d,f,T),!T)return}},U.getAvcEncryptedData=function(A){for(var d=Math.floor((A.length-48)/160)*16+16,f=new Int8Array(d),T=0,p=32;p<=A.length-16;p+=160,T+=16)f.set(A.subarray(p,p+16),T);return f},U.getAvcDecryptedUnit=function(A,d){for(var f=new Uint8Array(d),T=0,p=32;p<=A.length-16;p+=160,T+=16)A.set(f.subarray(T,T+16),p);return A},U.decryptAvcSample=function(A,d,f,T,p,m){var g=Object(F.discardEPB)(p.data),a=this.getAvcEncryptedData(g),i=this;this.decryptBuffer(a.buffer,function(s){p.data=i.getAvcDecryptedUnit(g,s),m||i.decryptAvcSamples(A,d,f+1,T)})},U.decryptAvcSamples=function(A,d,f,T){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,f=0){if(d>=A.length){T();return}for(var p=A[d].units;!(f>=p.length);f++){var m=p[f];if(m.data.length<=48||m.type!==1&&m.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(A,d,f,T,m,g),!g)return}}},j}();J.default=M},"./src/demux/transmuxer-interface.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return p});var $=O("./node_modules/webworkify-webpack/index.js"),F=O.n($),M=O("./src/events.ts"),j=O("./src/demux/transmuxer.ts"),U=O("./src/utils/logger.ts"),P=O("./src/errors.ts"),A=O("./src/utils/mediasource-helper.ts"),d=O("./node_modules/eventemitter3/index.js"),f=O.n(d),T=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},p=function(){function m(a,i,s,l){var x=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=a,this.id=i,this.onTransmuxComplete=s,this.onFlush=l;var v=a.config,y=function(c,u){u=u||{},u.frag=x.frag,u.id=x.id,a.trigger(c,u)};this.observer=new d.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,y),this.observer.on(M.Events.ERROR,y);var R={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var E;try{E=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),E.addEventListener("message",this.onwmsg),E.onerror=function(C){a.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(C.message+" ("+C.filename+":"+C.lineno+")")})},E.postMessage({cmd:"init",typeSupported:R,vendor:w,id:i,config:JSON.stringify(v)})}catch(C){U.logger.warn("Error in worker:",C),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),E&&self.URL.revokeObjectURL(E.objectURL),this.transmuxer=new j.default(this.observer,R,v,w,i),this.worker=null}}else this.transmuxer=new j.default(this.observer,R,v,w,i)}var g=m.prototype;return g.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},g.push=function(i,s,l,x,v,y,R,w,E,C){var c=this;E.transmuxing.start=self.performance.now();var u=this.transmuxer,L=this.worker,S=y?y.start:v.start,D=v.decryptdata,_=this.frag,B=!(_&&v.cc===_.cc),G=!(_&&E.level===_.level),V=_?E.sn-_.sn:-1,I=this.part?E.part-this.part.index:1,N=!G&&(V===1||V===0&&I===1),Y=self.performance.now();(G||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=Y),y&&(I||!N)&&(y.stats.parsing.start=Y);var ee=new j.TransmuxState(B,N,w,G,S);if(!N||B){U.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+E.sn+" p: "+E.part+" level: "+E.level+" id: "+E.id+`
discontinuity: `+B+`
trackSwitch: `+G+`
contiguous: `+N+`
accurateTimeOffset: `+w+`
timeOffset: `+S);var le=new j.TransmuxConfig(l,x,s,R,C);this.configureTransmuxer(le)}if(this.frag=v,this.part=y,L)L.postMessage({cmd:"demux",data:i,decryptdata:D,chunkMeta:E,state:ee},i instanceof ArrayBuffer?[i]:[]);else if(u){var me=u.push(i,D,E,ee);Object(j.isPromise)(me)?me.then(function(Ie){c.handleTransmuxComplete(Ie)}):this.handleTransmuxComplete(me)}},g.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:i});else if(l){var v=l.flush(i);Object(j.isPromise)(v)?v.then(function(y){s.handleFlushResult(y,i)}):this.handleFlushResult(v,i)}},g.handleFlushResult=function(i,s){var l=this;i.forEach(function(x){l.handleTransmuxComplete(x)}),this.onFlush(s)},g.onWorkerMessage=function(i){var s=i.data,l=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,l.trigger(s.event,s.data);break}}},g.configureTransmuxer=function(i){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:i}):l&&l.configure(i)},g.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},m}()},"./src/demux/transmuxer-worker.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return P});var $=O("./src/demux/transmuxer.ts"),F=O("./src/events.ts"),M=O("./src/utils/logger.ts"),j=O("./node_modules/eventemitter3/index.js"),U=O.n(j);function P(p){var m=new j.EventEmitter,g=function(i,s){p.postMessage({event:i,data:s})};m.on(F.Events.FRAG_DECRYPTED,g),m.on(F.Events.ERROR,g),p.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);p.transmuxer=new $.default(m,i.typeSupported,s,i.vendor,i.id),Object(M.enableLogs)(s.debug),g("init",null);break}case"configure":{p.transmuxer.configure(i.config);break}case"demux":{var l=p.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object($.isPromise)(l)?l.then(function(y){A(p,y)}):A(p,l);break}case"flush":{var x=i.chunkMeta,v=p.transmuxer.flush(x);Object($.isPromise)(v)?v.then(function(y){f(p,y,x)}):f(p,v,x);break}default:break}})}function A(p,m){if(T(m.remuxResult))return;var g=[],a=m.remuxResult,i=a.audio,s=a.video;i&&d(g,i),s&&d(g,s),p.postMessage({event:"transmuxComplete",data:m},g)}function d(p,m){m.data1&&p.push(m.data1.buffer),m.data2&&p.push(m.data2.buffer)}function f(p,m,g){m.forEach(function(a){A(p,a)}),p.postMessage({event:"flush",data:g})}function T(p){return!p.audio&&!p.video&&!p.text&&!p.id3&&!p.initSegment}},"./src/demux/transmuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s}),O.d(J,"isPromise",function(){return v}),O.d(J,"TransmuxConfig",function(){return y}),O.d(J,"TransmuxState",function(){return R});var $=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/crypt/decrypter.ts"),j=O("./src/demux/aacdemuxer.ts"),U=O("./src/demux/mp4demuxer.ts"),P=O("./src/demux/tsdemuxer.ts"),A=O("./src/demux/mp3demuxer.ts"),d=O("./src/remux/mp4-remuxer.ts"),f=O("./src/remux/passthrough-remuxer.ts"),T=O("./src/demux/chunk-cache.ts"),p=O("./src/utils/mp4-tools.ts"),m=O("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(w){m.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var a=[{demux:P.default,remux:d.default},{demux:U.default,remux:f.default},{demux:j.default,remux:d.default},{demux:A.default,remux:d.default}],i=1024;a.forEach(function(w){var E=w.demux;i=Math.max(i,E.minProbeByteLength)});var s=function(){function w(C,c,u,L,S){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new T.default,this.observer=C,this.typeSupported=c,this.config=u,this.vendor=L,this.id=S}var E=w.prototype;return E.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},E.push=function(c,u,L,S){var D=this,_=L.transmuxing;_.executeStart=g();var B=new Uint8Array(c),G=this.cache,V=this.config,I=this.currentTransmuxState,N=this.transmuxConfig;S&&(this.currentTransmuxState=S);var Y=l(B,u);if(Y&&Y.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var le=ee.softwareDecrypt(B,Y.key.buffer,Y.iv.buffer);if(!le)return _.executeEnd=g(),x(L);B=new Uint8Array(le)}else return this.decryptionPromise=ee.webCryptoDecrypt(B,Y.key.buffer,Y.iv.buffer).then(function(ge){var we=D.push(ge,null,L);return D.decryptionPromise=null,we}),this.decryptionPromise}var me=S||I,Ie=me.contiguous,Te=me.discontinuity,Oe=me.trackSwitch,Re=me.accurateTimeOffset,Ee=me.timeOffset,pe=N.audioCodec,de=N.videoCodec,re=N.defaultInitPts,he=N.duration,se=N.initSegmentData;if((Te||Oe)&&this.resetInitSegment(se,pe,de,he),Te&&this.resetInitialTimestamp(re),Ie||this.resetContiguity(),this.needsProbing(B,Te,Oe)){if(G.dataLength){var Ae=G.flush();B=Object(p.appendUint8Array)(Ae,B)}this.configureTransmuxer(B,N)}var ie=this.transmux(B,Y,Ee,Re,L),ae=this.currentTransmuxState;return ae.contiguous=!0,ae.discontinuity=!1,ae.trackSwitch=!1,_.executeEnd=g(),ie},E.flush=function(c){var u=this,L=c.transmuxing;L.executeStart=g();var S=this.decrypter,D=this.cache,_=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return u.flush(c)});var G=[],V=_.timeOffset;if(S){var I=S.flush();I&&G.push(this.push(I,null,c))}var N=D.dataLength;D.reset();var Y=this.demuxer,ee=this.remuxer;if(!Y||!ee)return N>=i&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),L.executeEnd=g(),[x(c)];var le=Y.flush(V);return v(le)?le.then(function(me){return u.flushRemux(G,me,c),G}):(this.flushRemux(G,le,c),G)},E.flushRemux=function(c,u,L){var S=u.audioTrack,D=u.avcTrack,_=u.id3Track,B=u.textTrack,G=this.currentTransmuxState,V=G.accurateTimeOffset,I=G.timeOffset;m.logger.log("[transmuxer.ts]: Flushed fragment "+L.sn+(L.part>-1?" p: "+L.part:"")+" of level "+L.level);var N=this.remuxer.remux(S,D,_,B,I,V,!0,this.id);c.push({remuxResult:N,chunkMeta:L}),L.transmuxing.executeEnd=g()},E.resetInitialTimestamp=function(c){var u=this.demuxer,L=this.remuxer;if(!u||!L)return;u.resetTimeStamp(c),L.resetTimeStamp(c)},E.resetContiguity=function(){var c=this.demuxer,u=this.remuxer;if(!c||!u)return;c.resetContiguity(),u.resetNextTimestamp()},E.resetInitSegment=function(c,u,L,S){var D=this.demuxer,_=this.remuxer;if(!D||!_)return;D.resetInitSegment(u,L,S),_.resetInitSegment(c,u,L)},E.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},E.transmux=function(c,u,L,S,D){var _;return u&&u.method==="SAMPLE-AES"?_=this.transmuxSampleAes(c,u,L,S,D):_=this.transmuxUnencrypted(c,L,S,D),_},E.transmuxUnencrypted=function(c,u,L,S){var D=this.demuxer.demux(c,u,!1,!this.config.progressive),_=D.audioTrack,B=D.avcTrack,G=D.id3Track,V=D.textTrack,I=this.remuxer.remux(_,B,G,V,u,L,!1,this.id);return{remuxResult:I,chunkMeta:S}},E.transmuxSampleAes=function(c,u,L,S,D){var _=this;return this.demuxer.demuxSampleAes(c,u,L).then(function(B){var G=_.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,L,S,!1,_.id);return{remuxResult:G,chunkMeta:D}})},E.configureTransmuxer=function(c,u){for(var L=this.config,S=this.observer,D=this.typeSupported,_=this.vendor,B=u.audioCodec,G=u.defaultInitPts,V=u.duration,I=u.initSegmentData,N=u.videoCodec,Y,ee=0,le=a.length;ee<le;ee++)if(a[ee].demux.probe(c)){Y=a[ee];break}Y||(m.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:U.default,remux:f.default});var me=this.demuxer,Ie=this.remuxer,Te=Y.remux,Oe=Y.demux;(!Ie||!(Ie instanceof Te))&&(this.remuxer=new Te(S,L,D,_)),(!me||!(me instanceof Oe))&&(this.demuxer=new Oe(S,L,D),this.probe=Oe.probe),this.resetInitSegment(I,B,N,V),this.resetInitialTimestamp(G)},E.needsProbing=function(c,u,L){return!this.demuxer||!this.remuxer||u||L},E.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new M.default(this.observer,this.config)),c},w}();function l(w,E){var C=null;return w.byteLength>0&&E!=null&&E.key!=null&&E.iv!==null&&E.method!=null&&(C=E),C}var x=function(E){return{remuxResult:{},chunkMeta:E}};function v(w){return"then"in w&&w.then instanceof Function}var y=function(E,C,c,u,L){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=E,this.videoCodec=C,this.initSegmentData=c,this.duration=u,this.defaultInitPts=L},R=function(E,C,c,u,L){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=E,this.contiguous=C,this.accurateTimeOffset=c,this.trackSwitch=u,this.timeOffset=L}},"./src/demux/tsdemuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"discardEPB",function(){return x});var $=O("./src/demux/adts.ts"),F=O("./src/demux/mpegaudio.ts"),M=O("./src/demux/exp-golomb.ts"),j=O("./src/demux/id3.ts"),U=O("./src/demux/sample-aes.ts"),P=O("./src/events.ts"),A=O("./src/utils/mp4-tools.ts"),d=O("./src/utils/logger.ts"),f=O("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},p=function(){function v(R,w,E){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=R,this.config=w,this.typeSupported=E}v.probe=function(w){var E=v.syncOffset(w);return E<0?!1:(E&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+E+", junk ahead ?"),!0)},v.syncOffset=function(w){for(var E=Math.min(1e3,w.length-3*188),C=0;C<E;){if(w[C]===71&&w[C+188]===71&&w[C+2*188]===71)return C;C++}return-1},v.createTrack=function(w,E){return{container:w==="video"||w==="audio"?"video/mp2t":void 0,type:w,id:T[w],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:w==="audio"?E:void 0}};var y=v.prototype;return y.resetInitSegment=function(w,E,C){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",C),this._audioTrack=v.createTrack("audio",C),this._id3Track=v.createTrack("id3",C),this._txtTrack=v.createTrack("text",C),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=w,this.videoCodec=E,this._duration=C},y.resetTimeStamp=function(){},y.resetContiguity=function(){var w=this._audioTrack,E=this._avcTrack,C=this._id3Track;w&&(w.pesData=null),E&&(E.pesData=null),C&&(C.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},y.demux=function(w,E,C,c){C===void 0&&(C=!1),c===void 0&&(c=!1),C||(this.sampleAes=null);var u,L=this._avcTrack,S=this._audioTrack,D=this._id3Track,_=L.pid,B=L.pesData,G=S.pid,V=D.pid,I=S.pesData,N=D.pesData,Y=!1,ee=this.pmtParsed,le=this._pmtId,me=w.length;if(this.remainderData&&(w=Object(A.appendUint8Array)(this.remainderData,w),me=w.length,this.remainderData=null),me<188&&!c)return this.remainderData=w,{audioTrack:S,avcTrack:L,id3Track:D,textTrack:this._txtTrack};var Ie=Math.max(0,v.syncOffset(w));me-=(me+Ie)%188,me<w.byteLength&&!c&&(this.remainderData=new Uint8Array(w.buffer,me,w.buffer.byteLength-me));for(var Te=Ie;Te<me;Te+=188)if(w[Te]===71){var Oe=!!(w[Te+1]&64),Re=((w[Te+1]&31)<<8)+w[Te+2],Ee=(w[Te+3]&48)>>4,pe=void 0;if(Ee>1){if(pe=Te+5+w[Te+4],pe===Te+188)continue}else pe=Te+4;switch(Re){case _:Oe&&(B&&(u=i(B))&&this.parseAVCPES(u,!1),B={data:[],size:0}),B&&(B.data.push(w.subarray(pe,Te+188)),B.size+=Te+188-pe);break;case G:Oe&&(I&&(u=i(I))&&(S.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),I={data:[],size:0}),I&&(I.data.push(w.subarray(pe,Te+188)),I.size+=Te+188-pe);break;case V:Oe&&(N&&(u=i(N))&&this.parseID3PES(u),N={data:[],size:0}),N&&(N.data.push(w.subarray(pe,Te+188)),N.size+=Te+188-pe);break;case 0:Oe&&(pe+=w[pe]+1),le=this._pmtId=g(w,pe);break;case le:{Oe&&(pe+=w[pe]+1);var de=a(w,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,C);_=de.avc,_>0&&(L.pid=_),G=de.audio,G>0&&(S.pid=G,S.isAAC=de.isAAC),V=de.id3,V>0&&(D.pid=V),Y&&!ee&&(d.logger.log("reparse from beginning"),Y=!1,Te=Ie-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});L.pesData=B,S.pesData=I,D.pesData=N;var re={audioTrack:S,avcTrack:L,id3Track:D,textTrack:this._txtTrack};return c&&this.extractRemainingSamples(re),re},y.flush=function(){var w=this.remainderData;this.remainderData=null;var E;return w?E=this.demux(w,-1,!1,!0):E={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(E),this.sampleAes?this.decrypt(E,this.sampleAes):E},y.extractRemainingSamples=function(w){var E=w.audioTrack,C=w.avcTrack,c=w.id3Track,u=C.pesData,L=E.pesData,S=c.pesData,D;u&&(D=i(u))?(this.parseAVCPES(D,!0),C.pesData=null):C.pesData=u,L&&(D=i(L))?(E.isAAC?this.parseAACPES(D):this.parseMPEGPES(D),E.pesData=null):(L!=null&&L.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=L),S&&(D=i(S))?(this.parseID3PES(D),c.pesData=null):c.pesData=S},y.demuxSampleAes=function(w,E,C){var c=this.demux(w,C,!0,!this.config.progressive),u=this.sampleAes=new U.default(this.observer,this.config,E);return this.decrypt(c,u)},y.decrypt=function(w,E){return new Promise(function(C){var c=w.audioTrack,u=w.avcTrack;c.samples&&c.isAAC?E.decryptAacSamples(c.samples,0,function(){u.samples?E.decryptAvcSamples(u.samples,0,0,function(){C(w)}):C(w)}):u.samples&&E.decryptAvcSamples(u.samples,0,0,function(){C(w)})})},y.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},y.parseAVCPES=function(w,E){var C=this,c=this._avcTrack,u=this.parseAVCNALu(w.data),L=!1,S=this.avcSample,D,_=!1;w.data=null,S&&u.length&&!c.audFound&&(s(S,c),S=this.avcSample=m(!1,w.pts,w.dts,"")),u.forEach(function(B){switch(B.type){case 1:{D=!0,S||(S=C.avcSample=m(!0,w.pts,w.dts,"")),L&&(S.debug+="NDR "),S.frame=!0;var G=B.data;if(_&&G.length>4){var V=new M.default(G).readSliceType();(V===2||V===4||V===7||V===9)&&(S.key=!0)}break}case 5:D=!0,S||(S=C.avcSample=m(!0,w.pts,w.dts,"")),L&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{D=!0,L&&S&&(S.debug+="SEI ");var I=new M.default(x(B.data));I.readUByte();for(var N=0,Y=0,ee=!1,le=0;!ee&&I.bytesAvailable>1;){N=0;do le=I.readUByte(),N+=le;while(le===255);Y=0;do le=I.readUByte(),Y+=le;while(le===255);if(N===4&&I.bytesAvailable!==0){ee=!0;var me=I.readUByte();if(me===181){var Ie=I.readUShort();if(Ie===49){var Te=I.readUInt();if(Te===1195456820){var Oe=I.readUByte();if(Oe===3){for(var Re=I.readUByte(),Ee=I.readUByte(),pe=31&Re,de=[Re,Ee],re=0;re<pe;re++)de.push(I.readUByte()),de.push(I.readUByte()),de.push(I.readUByte());l(C._txtTrack.samples,{type:3,pts:w.pts,bytes:de})}}}}}else if(N===5&&I.bytesAvailable!==0){if(ee=!0,Y>16){for(var he=[],se=0;se<16;se++)he.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&he.push("-");for(var Ae=Y-16,ie=new Uint8Array(Ae),ae=0;ae<Ae;ae++)ie[ae]=I.readUByte();l(C._txtTrack.samples,{pts:w.pts,payloadType:N,uuid:he.join(""),userData:Object(j.utf8ArrayToStr)(ie),userDataBytes:ie})}}else if(Y<I.bytesAvailable)for(var ge=0;ge<Y;ge++)I.readUByte()}break}case 7:if(D=!0,_=!0,L&&S&&(S.debug+="SPS "),!c.sps){var we=new M.default(B.data),_e=we.readSPS();c.width=_e.width,c.height=_e.height,c.pixelRatio=_e.pixelRatio,c.sps=[B.data],c.duration=C._duration;for(var Fe=B.data.subarray(1,4),Ue="avc1.",Be=0;Be<3;Be++){var Ze=Fe[Be].toString(16);Ze.length<2&&(Ze="0"+Ze),Ue+=Ze}c.codec=Ue}break;case 8:D=!0,L&&S&&(S.debug+="PPS "),c.pps||(c.pps=[B.data]);break;case 9:D=!1,c.audFound=!0,S&&s(S,c),S=C.avcSample=m(!1,w.pts,w.dts,L?"AUD ":"");break;case 12:D=!1;break;default:D=!1,S&&(S.debug+="unknown NAL "+B.type+" ");break}if(S&&D){var et=S.units;et.push(B)}}),E&&S&&(s(S,c),this.avcSample=null)},y.getLastNalUnit=function(){var w,E=this.avcSample,C;if(!E||E.units.length===0){var c=this._avcTrack.samples;E=c[c.length-1]}if((w=E)!==null&&w!==void 0&&w.units){var u=E.units;C=u[u.length-1]}return C},y.parseAVCNALu=function(w){var E=w.byteLength,C=this._avcTrack,c=C.naluState||0,u=c,L=[],S=0,D,_,B,G=-1,V=0;for(c===-1&&(G=0,V=w[0]&31,c=0,S=1);S<E;){if(D=w[S++],!c){c=D?0:1;continue}if(c===1){c=D?0:2;continue}if(!D)c=3;else if(D===1){if(G>=0){var I={data:w.subarray(G,S-c-1),type:V};L.push(I)}else{var N=this.getLastNalUnit();if(N&&(u&&S<=4-u&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-u))),_=S-c-1,_>0)){var Y=new Uint8Array(N.data.byteLength+_);Y.set(N.data,0),Y.set(w.subarray(0,_),N.data.byteLength),N.data=Y,N.state=0}}S<E?(B=w[S]&31,G=S,V=B,c=0):c=-1}else c=0}if(G>=0&&c>=0){var ee={data:w.subarray(G,E),type:V,state:c};L.push(ee)}if(L.length===0){var le=this.getLastNalUnit();if(le){var me=new Uint8Array(le.data.byteLength+w.byteLength);me.set(le.data,0),me.set(w,le.data.byteLength),le.data=me}}return C.naluState=c,L},y.parseAACPES=function(w){var E=0,C=this._audioTrack,c=this.aacOverFlow,u=w.data;if(c){this.aacOverFlow=null;var L=c.sample.unit.byteLength,S=Math.min(c.missing,L),D=L-S;c.sample.unit.set(u.subarray(0,S),D),C.samples.push(c.sample),E=c.missing}var _,B;for(_=E,B=u.length;_<B-1&&!$.isHeader(u,_);_++);if(_!==E){var G,V;if(_<B-1?(G="AAC PES did not start with ADTS header,offset:"+_,V=!1):(G="no ADTS header found in AAC PES",V=!0),d.logger.warn("parsing error:"+G),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:G}),V)return}$.initTrackConfig(C,this.observer,u,_,this.audioCodec);var I;if(w.pts!==void 0)I=w.pts;else if(c){var N=$.getFrameDuration(C.samplerate);I=c.sample.pts+N}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;_<B;)if($.isHeader(u,_)){if(_+5<B){var ee=$.appendFrame(C,u,_,I,Y);if(ee)if(ee.missing)this.aacOverFlow=ee;else{_+=ee.length,Y++;continue}}break}else _++},y.parseMPEGPES=function(w){var E=w.data,C=E.length,c=0,u=0,L=w.pts;if(L===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<C;)if(F.isHeader(E,u)){var S=F.appendFrame(this._audioTrack,E,u,L,c);if(S)u+=S.length,c++;else break}else u++},y.parseID3PES=function(w){if(w.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(w)},v}();p.minProbeByteLength=188;function m(v,y,R,w){return{key:v,frame:!1,pts:y,dts:R,units:[],debug:w,length:0}}function g(v,y){return(v[y+10]&31)<<8|v[y+11]}function a(v,y,R,w){var E={audio:-1,avc:-1,id3:-1,isAAC:!0},C=(v[y+1]&15)<<8|v[y+2],c=y+3+C-4,u=(v[y+10]&15)<<8|v[y+11];for(y+=12+u;y<c;){var L=(v[y+1]&31)<<8|v[y+2];switch(v[y]){case 207:if(!w){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:E.audio===-1&&(E.audio=L);break;case 21:E.id3===-1&&(E.id3=L);break;case 219:if(!w){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:E.avc===-1&&(E.avc=L);break;case 3:case 4:R?E.audio===-1&&(E.audio=L,E.isAAC=!1):d.logger.log("MPEG audio found, not supported in this browser");break;case 36:d.logger.warn("Unsupported HEVC stream type found");break;default:break}y+=((v[y+3]&15)<<8|v[y+4])+5}return E}function i(v){var y=0,R,w,E,C,c,u=v.data;if(!v||v.size===0)return null;for(;u[0].length<19&&u.length>1;){var L=new Uint8Array(u[0].length+u[1].length);L.set(u[0]),L.set(u[1],u[0].length),u[0]=L,u.splice(1,1)}R=u[0];var S=(R[0]<<16)+(R[1]<<8)+R[2];if(S===1){if(w=(R[4]<<8)+R[5],w&&w>v.size-6)return null;var D=R[7];D&192&&(C=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,D&64?(c=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,C-c>60*9e4&&(d.logger.warn(Math.round((C-c)/9e4)+"s delta between PTS and DTS, align them"),C=c)):c=C),E=R[8];var _=E+9;if(v.size<=_)return null;v.size-=_;for(var B=new Uint8Array(v.size),G=0,V=u.length;G<V;G++){R=u[G];var I=R.byteLength;if(_)if(_>I){_-=I;continue}else R=R.subarray(_),I-=_,_=0;B.set(R,y),y+=I}return w&&(w-=E+3),{data:B,pts:C,dts:c,len:w}}return null}function s(v,y){if(v.units.length&&v.frame){if(v.pts===void 0){var R=y.samples,w=R.length;if(w){var E=R[w-1];v.pts=E.pts,v.dts=E.dts}else{y.dropped++;return}}y.samples.push(v)}v.debug.length&&d.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function l(v,y){var R=v.length;if(R>0){if(y.pts>=v[R-1].pts)v.push(y);else for(var w=R-1;w>=0;w--)if(y.pts<v[w].pts){v.splice(w,0,y);break}}else v.push(y)}function x(v){for(var y=v.byteLength,R=[],w=1;w<y-2;)v[w]===0&&v[w+1]===0&&v[w+2]===3?(R.push(w+2),w+=2):w++;if(R.length===0)return v;var E=y-R.length,C=new Uint8Array(E),c=0;for(w=0;w<E;c++,w++)c===R[0]&&(c++,R.shift()),C[w]=v[c];return C}J.default=p},"./src/errors.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ErrorTypes",function(){return $}),O.d(J,"ErrorDetails",function(){return F});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 F;(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"})(F||(F={}))},"./src/events.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"Events",function(){return $});var $;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return v});var $=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n($),M=O("./src/loader/playlist-loader.ts"),j=O("./src/loader/key-loader.ts"),U=O("./src/controller/id3-track-controller.ts"),P=O("./src/controller/latency-controller.ts"),A=O("./src/controller/level-controller.ts"),d=O("./src/controller/fragment-tracker.ts"),f=O("./src/controller/stream-controller.ts"),T=O("./src/is-supported.ts"),p=O("./src/utils/logger.ts"),m=O("./src/config.ts"),g=O("./node_modules/eventemitter3/index.js"),a=O.n(g),i=O("./src/events.ts"),s=O("./src/errors.ts");function l(y,R){for(var w=0;w<R.length;w++){var E=R[w];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(y,E.key,E)}}function x(y,R,w){return R&&l(y.prototype,R),w&&l(y,w),y}var v=function(){y.isSupported=function(){return Object(T.isSupported)()};function y(w){w===void 0&&(w={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.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 E=this.config=Object(m.mergeConfig)(y.DefaultConfig,w);this.userConfig=w,Object(p.enableLogs)(E.debug),this._autoLevelCapping=-1,E.progressive&&Object(m.enableStreamingMode)(E);var C=E.abrController,c=E.bufferController,u=E.capLevelController,L=E.fpsController,S=this.abrController=new C(this),D=this.bufferController=new c(this),_=this.capLevelController=new u(this),B=new L(this),G=new M.default(this),V=new j.default(this),I=new U.default(this),N=this.levelController=new A.default(this),Y=new d.FragmentTracker(this),ee=this.streamController=new f.default(this,Y);_.setStreamController(ee),B.setStreamController(ee);var le=[N,ee];this.networkControllers=le;var me=[G,V,S,D,_,B,I,Y];this.audioTrackController=this.createController(E.audioTrackController,null,le),this.createController(E.audioStreamController,Y,le),this.subtitleTrackController=this.createController(E.subtitleTrackController,null,le),this.createController(E.subtitleStreamController,Y,le),this.createController(E.timelineController,null,me),this.emeController=this.createController(E.emeController,null,me),this.cmcdController=this.createController(E.cmcdController,null,me),this.latencyController=this.createController(P.default,null,me),this.coreComponents=me}var R=y.prototype;return R.createController=function(E,C,c){if(E){var u=C?new E(this,C):new E(this);return c&&c.push(u),u}return null},R.on=function(E,C,c){c===void 0&&(c=this),this._emitter.on(E,C,c)},R.once=function(E,C,c){c===void 0&&(c=this),this._emitter.once(E,C,c)},R.removeAllListeners=function(E){this._emitter.removeAllListeners(E)},R.off=function(E,C,c,u){c===void 0&&(c=this),this._emitter.off(E,C,c,u)},R.listeners=function(E){return this._emitter.listeners(E)},R.emit=function(E,C,c){return this._emitter.emit(E,C,c)},R.trigger=function(E,C){if(this.config.debug)return this.emit(E,E,C);try{return this.emit(E,E,C)}catch(c){p.logger.error("An internal error happened while handling event "+E+'. Error message: "'+c.message+'". Here is a stacktrace:',c),this.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:E,error:c})}return!1},R.listenerCount=function(E){return this._emitter.listenerCount(E)},R.destroy=function(){p.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(E){return E.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(E){return E.destroy()}),this.coreComponents.length=0},R.attachMedia=function(E){p.logger.log("attachMedia"),this._media=E,this.trigger(i.Events.MEDIA_ATTACHING,{media:E})},R.detachMedia=function(){p.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},R.loadSource=function(E){this.stopLoad();var C=this.media,c=this.url,u=this.url=$.buildAbsoluteURL(self.location.href,E,{alwaysNormalize:!0});p.logger.log("loadSource:"+u),C&&c&&c!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(C)),this.trigger(i.Events.MANIFEST_LOADING,{url:E})},R.startLoad=function(E){E===void 0&&(E=-1),p.logger.log("startLoad("+E+")"),this.networkControllers.forEach(function(C){C.startLoad(E)})},R.stopLoad=function(){p.logger.log("stopLoad"),this.networkControllers.forEach(function(E){E.stopLoad()})},R.swapAudioCodec=function(){p.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},R.recoverMediaError=function(){p.logger.log("recoverMediaError");var E=this._media;this.detachMedia(),E&&this.attachMedia(E)},R.removeLevel=function(E,C){C===void 0&&(C=0),this.levelController.removeLevel(E,C)},x(y,[{key:"levels",get:function(){var E=this.levelController.levels;return E||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(E){p.logger.log("set currentLevel:"+E),this.loadLevel=E,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(E){p.logger.log("set nextLevel:"+E),this.levelController.manualLevel=E,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(E){p.logger.log("set loadLevel:"+E),this.levelController.manualLevel=E}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(E){this.levelController.nextLoadLevel=E}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(E){p.logger.log("set firstLevel:"+E),this.levelController.firstLevel=E}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(E){p.logger.log("set startLevel:"+E),E!==-1&&(E=Math.max(E,this.minAutoLevel)),this.levelController.startLevel=E}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(E){var C=!!E;C!==this.config.capLevelToPlayerSize&&(C?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=C)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(E){this._autoLevelCapping!==E&&(p.logger.log("set autoLevelCapping:"+E),this._autoLevelCapping=E)}},{key:"bandwidthEstimate",get:function(){var E=this.abrController.bwEstimator;return E?E.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var E=this.levels,C=this.config.minAutoBitrate;if(!E)return 0;for(var c=E.length,u=0;u<c;u++)if(E[u].maxBitrate>C)return u;return 0}},{key:"maxAutoLevel",get:function(){var E=this.levels,C=this.autoLevelCapping,c;return C===-1&&E&&E.length?c=E.length-1:c=C,c}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(E){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,E)}},{key:"audioTracks",get:function(){var E=this.audioTrackController;return E?E.audioTracks:[]}},{key:"audioTrack",get:function(){var E=this.audioTrackController;return E?E.audioTrack:-1},set:function(E){var C=this.audioTrackController;C&&(C.audioTrack=E)}},{key:"subtitleTracks",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTrack:-1},set:function(E){var C=this.subtitleTrackController;C&&(C.subtitleTrack=E)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var E=this.subtitleTrackController;return E?E.subtitleDisplay:!1},set:function(E){var C=this.subtitleTrackController;C&&(C.subtitleDisplay=E)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(E){this.config.lowLatencyMode=E}},{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 i.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return y.defaultConfig?y.defaultConfig:m.hlsDefaultConfig},set:function(E){y.defaultConfig=E}}]),y}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isSupported",function(){return M}),O.d(J,"changeTypeSupported",function(){return j});var $=O("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var U=Object($.getMediaSource)();if(!U)return!1;var P=F(),A=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!A&&!!d}function j(){var U,P=F();return typeof(P==null||((U=P.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return p}),O.d(J,"LoadError",function(){return g});var $=O("./src/polyfills/number.ts"),F=O("./src/errors.ts");function M(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,d(a,i)}function j(a){var i=typeof Map=="function"?new Map:void 0;return j=function(l){if(l===null||!A(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(l))return i.get(l);i.set(l,x)}function x(){return U(l,arguments,f(this).constructor)}return x.prototype=Object.create(l.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),d(x,l)},j(a)}function U(a,i,s){return P()?U=Reflect.construct:U=function(x,v,y){var R=[null];R.push.apply(R,v);var w=Function.bind.apply(x,R),E=new w;return y&&d(E,y.prototype),E},U.apply(null,arguments)}function P(){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(a){return!1}}function A(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function d(a,i){return d=Object.setPrototypeOf||function(l,x){return l.__proto__=x,l},d(a,i)}function f(a){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},f(a)}var T=Math.pow(2,17),p=function(){function a(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var i=a.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(l,x){var v=this,y=l.url;if(!y)return Promise.reject(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(y?"part list":"url")));this.abort();var R=this.config,w=R.fLoader,E=R.loader;return new Promise(function(C,c){v.loader&&v.loader.destroy();var u=v.loader=l.loader=w?new w(R):new E(R),L=m(l),S={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:T};l.stats=u.stats,u.load(L,S,{onSuccess:function(_,B,G,V){v.resetLoader(l,u),C({frag:l,part:null,payload:_.data,networkDetails:V})},onError:function(_,B,G){v.resetLoader(l,u),c(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:_,networkDetails:G}))},onAbort:function(_,B,G){v.resetLoader(l,u),c(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:G}))},onTimeout:function(_,B,G){v.resetLoader(l,u),c(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:G}))},onProgress:function(_,B,G,V){x&&x({frag:l,part:null,payload:G,networkDetails:V})}})})},i.loadPart=function(l,x,v){var y=this;this.abort();var R=this.config,w=R.fLoader,E=R.loader;return new Promise(function(C,c){y.loader&&y.loader.destroy();var u=y.loader=l.loader=w?new w(R):new E(R),L=m(l,x),S={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:T};x.stats=u.stats,u.load(L,S,{onSuccess:function(_,B,G,V){y.resetLoader(l,u),y.updateStatsFromPart(l,x);var I={frag:l,part:x,payload:_.data,networkDetails:V};v(I),C(I)},onError:function(_,B,G){y.resetLoader(l,u),c(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:x,response:_,networkDetails:G}))},onAbort:function(_,B,G){l.stats.aborted=x.stats.aborted,y.resetLoader(l,u),c(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:x,networkDetails:G}))},onTimeout:function(_,B,G){y.resetLoader(l,u),c(new g({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:x,networkDetails:G}))}})})},i.updateStatsFromPart=function(l,x){var v=l.stats,y=x.stats,R=y.total;if(v.loaded+=y.loaded,R){var w=Math.round(l.duration/x.duration),E=Math.min(Math.round(v.loaded/R),w),C=w-E,c=C*Math.round(v.loaded/E);v.total=v.loaded+c}else v.total=Math.max(v.loaded,v.total);var u=v.loading,L=y.loading;u.start?u.first+=L.first-L.start:(u.start=L.start,u.first=L.first),u.end=L.end},i.resetLoader=function(l,x){l.loader=null,this.loader===x&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),x.destroy()},a}();function m(a,i){i===void 0&&(i=null);var s=i||a,l={frag:a,part:i,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},x=s.byteRangeStartOffset,v=s.byteRangeEndOffset;return Object($.isFiniteNumber)(x)&&Object($.isFiniteNumber)(v)&&(l.rangeStart=x,l.rangeEnd=v),l}var g=function(a){M(i,a);function i(s){for(var l,x=arguments.length,v=new Array(x>1?x-1:0),y=1;y<x;y++)v[y-1]=arguments[y];return l=a.call.apply(a,[this].concat(v))||this,l.data=void 0,l.data=s,l}return i}(j(Error))},"./src/loader/fragment.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ElementaryStreamTypes",function(){return p}),O.d(J,"BaseSegment",function(){return m}),O.d(J,"Fragment",function(){return g}),O.d(J,"Part",function(){return a});var $=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),M=O.n(F),j=O("./src/utils/logger.ts"),U=O("./src/loader/level-key.ts"),P=O("./src/loader/load-stats.ts");function A(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,d(i,s)}function d(i,s){return d=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},d(i,s)}function f(i,s){for(var l=0;l<s.length;l++){var x=s[l];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(i,x.key,x)}}function T(i,s,l){return s&&f(i.prototype,s),l&&f(i,l),i}var p;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(p||(p={}));var m=function(){function i(l){var x;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(x={},x[p.AUDIO]=null,x[p.VIDEO]=null,x[p.AUDIOVIDEO]=null,x),this.baseurl=l}var s=i.prototype;return s.setByteRange=function(x,v){var y=x.split("@",2),R=[];y.length===1?R[0]=v?v.byteRangeEndOffset:0:R[0]=parseInt(y[1]),R[1]=parseInt(y[0])+R[0],this._byteRange=R},T(i,[{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(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(x){this._url=x}}]),i}(),g=function(i){A(s,i);function s(x,v){var y;return y=i.call(this,v)||this,y._decryptdata=null,y.rawProgramDateTime=null,y.programDateTime=null,y.tagList=[],y.duration=0,y.sn=0,y.levelkey=void 0,y.type=void 0,y.loader=null,y.level=-1,y.cc=0,y.startPTS=void 0,y.endPTS=void 0,y.appendedPTS=void 0,y.startDTS=void 0,y.endDTS=void 0,y.start=0,y.deltaPTS=void 0,y.maxStartPTS=void 0,y.minEndPTS=void 0,y.stats=new P.LoadStats,y.urlId=0,y.data=void 0,y.bitrateTest=!1,y.title=null,y.initSegment=null,y.type=x,y}var l=s.prototype;return l.createInitializationVector=function(v){for(var y=new Uint8Array(16),R=12;R<16;R++)y[R]=v>>8*(15-R)&255;return y},l.setDecryptDataFromLevelKey=function(v,y){var R=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(R=U.LevelKey.fromURI(v.uri),R.method=v.method,R.iv=this.createInitializationVector(y),R.keyFormat="identity"),R},l.setElementaryStreamInfo=function(v,y,R,w,E,C){C===void 0&&(C=!1);var c=this.elementaryStreams,u=c[v];if(!u){c[v]={startPTS:y,endPTS:R,startDTS:w,endDTS:E,partial:C};return}u.startPTS=Math.min(u.startPTS,y),u.endPTS=Math.max(u.endPTS,R),u.startDTS=Math.min(u.startDTS,w),u.endDTS=Math.max(u.endDTS,E)},l.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[p.AUDIO]=null,v[p.VIDEO]=null,v[p.AUDIOVIDEO]=null},T(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object($.isFiniteNumber)(this.programDateTime))return null;var v=Object($.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),s}(m),a=function(i){A(s,i);function s(l,x,v,y,R){var w;w=i.call(this,v)||this,w.fragOffset=0,w.duration=0,w.gap=!1,w.independent=!1,w.relurl=void 0,w.fragment=void 0,w.index=void 0,w.stats=new P.LoadStats,w.duration=l.decimalFloatingPoint("DURATION"),w.gap=l.bool("GAP"),w.independent=l.bool("INDEPENDENT"),w.relurl=l.enumeratedString("URI"),w.fragment=x,w.index=y;var E=l.enumeratedString("BYTERANGE");return E&&w.setByteRange(E,R),R&&(w.fragOffset=R.fragOffset+R.duration),w}return T(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 x=this.elementaryStreams;return!!(x.audio||x.video||x.audiovideo)}}]),s}(m)},"./src/loader/key-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return j});var $=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),j=function(){function U(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var P=U.prototype;return P._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var f=this.loaders[d];f&&f.destroy()}this.loaders={}},P.onKeyLoading=function(d,f){var T=f.frag,p=T.type,m=this.loaders[p];if(!T.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=T.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(m&&(M.logger.warn("abort previous key loader for type:"+p),m.abort()),!g){M.logger.warn("key uri is falsy");return}var i=a.loader,s=T.loader=this.loaders[p]=new i(a);this.decrypturl=g,this.decryptkey=null;var l={url:g,frag:T,responseType:"arraybuffer"},x={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,x,v)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:T}))},P.loadsuccess=function(d,f,T){var p=T.frag;if(!p.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=p.decryptdata.key=new Uint8Array(d.data),p.loader=null,delete this.loaders[p.type],this.hls.trigger($.Events.KEY_LOADED,{frag:p})},P.loaderror=function(d,f){var T=f.frag,p=T.loader;p&&p.abort(),delete this.loaders[T.type],this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:d})},P.loadtimeout=function(d,f){var T=f.frag,p=T.loader;p&&p.abort(),delete this.loaders[T.type],this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:T})},U}()},"./src/loader/level-details.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"LevelDetails",function(){return U});var $=O("./src/polyfills/number.ts");function F(P,A){for(var d=0;d<A.length;d++){var f=A[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function M(P,A,d){return A&&F(P.prototype,A),d&&F(P,d),P}var j=10,U=function(){function P(d){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=d}var A=P.prototype;return A.reloaded=function(f){if(!f){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-f.lastPartSn,p=this.lastPartIndex-f.lastPartIndex;this.updated=this.endSN!==f.endSN||!!p||!!T,this.advanced=this.endSN>f.endSN||T>0||T===0&&p>0,this.updated||this.advanced?this.misses=Math.floor(f.misses*.6):this.misses=f.misses+1,this.availabilityDelay=f.availabilityDelay},M(P,[{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||j}},{key:"drift",get:function(){var f=this.driftEndTime-this.driftStartTime;if(f>0){var T=this.driftEnd-this.driftStart;return T*1e3/f}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var f;return(f=this.fragments)!==null&&f!==void 0&&f.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 f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"LevelKey",function(){return U});var $=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n($);function M(P,A){for(var d=0;d<A.length;d++){var f=A[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function j(P,A,d){return A&&M(P.prototype,A),d&&M(P,d),P}var U=function(){P.fromURL=function(d,f){return new P(d,f)},P.fromURI=function(d){return new P(d)};function P(A,d){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,d?this._uri=Object($.buildAbsoluteURL)(A,d,{alwaysNormalize:!0}):this._uri=A}return j(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ue,J,O){"use strict";O.r(J),O.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(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s});var $=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),M=O.n(F),j=O("./src/loader/fragment.ts"),U=O("./src/loader/level-details.ts"),P=O("./src/loader/level-key.ts"),A=O("./src/utils/attr-list.ts"),d=O("./src/utils/logger.ts"),f=O("./src/utils/codecs.ts"),T=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,p=/#EXT-X-MEDIA:(.*)/g,m=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=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("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function i(R){var w,E;return a.test((w=(E=F.parseURL(R))===null||E===void 0?void 0:E.path)!=null?w:"")}var s=function(){function R(){}return R.findGroup=function(E,C){for(var c=0;c<E.length;c++){var u=E[c];if(u.id===C)return u}},R.convertAVC1ToAVCOTI=function(E){var C=E.split(".");if(C.length>2){var c=C.shift()+".";return c+=parseInt(C.shift()).toString(16),c+=("000"+parseInt(C.shift()).toString(16)).substr(-4),c}return E},R.resolve=function(E,C){return F.buildAbsoluteURL(C,E,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(E,C){var c=[],u={},L=!1;T.lastIndex=0;for(var S;(S=T.exec(E))!=null;)if(S[1]){var D=new A.AttrList(S[1]),_={attrs:D,bitrate:D.decimalInteger("AVERAGE-BANDWIDTH")||D.decimalInteger("BANDWIDTH"),name:D.NAME,url:R.resolve(S[2],C)},B=D.decimalResolution("RESOLUTION");B&&(_.width=B.width,_.height=B.height),l((D.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),_),_.videoCodec&&_.videoCodec.indexOf("avc1")!==-1&&(_.videoCodec=R.convertAVC1ToAVCOTI(_.videoCodec)),c.push(_)}else if(S[3]){var G=new A.AttrList(S[3]);G["DATA-ID"]&&(L=!0,u[G["DATA-ID"]]=G)}return{levels:c,sessionData:L?u:null}},R.parseMasterPlaylistMedia=function(E,C,c,u){u===void 0&&(u=[]);var L,S=[],D=0;for(p.lastIndex=0;(L=p.exec(E))!==null;){var _=new A.AttrList(L[1]);if(_.TYPE===c){var B={attrs:_,bitrate:0,id:D++,groupId:_["GROUP-ID"],instreamId:_["INSTREAM-ID"],name:_.NAME||_.LANGUAGE||"",type:c,default:_.bool("DEFAULT"),autoselect:_.bool("AUTOSELECT"),forced:_.bool("FORCED"),lang:_.LANGUAGE,url:_.URI?R.resolve(_.URI,C):""};if(u.length){var G=R.findGroup(u,B.groupId)||u[0];x(B,G,"audioCodec"),x(B,G,"textCodec")}S.push(B)}}return S},R.parseLevelPlaylist=function(E,C,c,u,L){var S=new U.LevelDetails(C),D=S.fragments,_=null,B=0,G=0,V=0,I=0,N=null,Y=new j.Fragment(u,C),ee,le,me,Ie=-1,Te=!1;for(m.lastIndex=0,S.m3u8=E;(ee=m.exec(E))!==null;){Te&&(Te=!1,Y=new j.Fragment(u,C),Y.start=V,Y.sn=B,Y.cc=I,Y.level=c,_&&(Y.initSegment=_,Y.rawProgramDateTime=_.rawProgramDateTime));var Oe=ee[1];if(Oe){Y.duration=parseFloat(Oe);var Re=(" "+ee[2]).slice(1);Y.title=Re||null,Y.tagList.push(Re?["INF",Oe,Re]:["INF",Oe])}else if(ee[3])Object($.isFiniteNumber)(Y.duration)&&(Y.start=V,me&&(Y.levelkey=me),Y.sn=B,Y.level=c,Y.cc=I,Y.urlId=L,D.push(Y),Y.relurl=(" "+ee[3]).slice(1),y(Y,N),N=Y,V+=Y.duration,B++,G=0,Te=!0);else if(ee[4]){var Ee=(" "+ee[4]).slice(1);N?Y.setByteRange(Ee,N):Y.setByteRange(Ee)}else if(ee[5])Y.rawProgramDateTime=(" "+ee[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Ie===-1&&(Ie=D.length);else{if(ee=ee[0].match(g),!ee){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(le=1;le<ee.length&&!(typeof ee[le]!="undefined");le++);var pe=(" "+ee[le]).slice(1),de=(" "+ee[le+1]).slice(1),re=ee[le+2]?(" "+ee[le+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":S.type=de.toUpperCase();break;case"MEDIA-SEQUENCE":B=S.startSN=parseInt(de);break;case"SKIP":{var he=new A.AttrList(de),se=he.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(se)){S.skippedSegments=se;for(var Ae=se;Ae--;)D.unshift(null);B+=se}var ie=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");ie&&(S.recentlyRemovedDateranges=ie.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(de);break;case"VERSION":S.version=parseInt(de);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(de||re)&&Y.tagList.push(re?[de,re]:[de]);break;case"DIS":I++;case"GAP":Y.tagList.push([pe]);break;case"BITRATE":Y.tagList.push([pe,de]);break;case"DISCONTINUITY-SEQ":I=parseInt(de);break;case"KEY":{var ae,ge=new A.AttrList(de),we=ge.enumeratedString("METHOD"),_e=ge.URI,Fe=ge.hexadecimalInteger("IV"),Ue=ge.enumeratedString("KEYFORMATVERSIONS"),Be=ge.enumeratedString("KEYID"),Ze=(ae=ge.enumeratedString("KEYFORMAT"))!=null?ae:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf(Ze)>-1){d.logger.warn("Keyformat "+Ze+" is not supported from the manifest");continue}else if(Ze!=="identity")continue;we&&(me=P.LevelKey.fromURL(C,_e),_e&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(me.method=we,me.keyFormat=Ze,Be&&(me.keyID=Be),Ue&&(me.keyFormatVersions=Ue),me.iv=Fe));break}case"START":{var rt=new A.AttrList(de),Ye=rt.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(Ye)&&(S.startTimeOffset=Ye);break}case"MAP":{var st=new A.AttrList(de);Y.relurl=st.URI,st.BYTERANGE&&Y.setByteRange(st.BYTERANGE),Y.level=c,Y.sn="initSegment",me&&(Y.levelkey=me),Y.initSegment=null,_=Y,Te=!0;break}case"SERVER-CONTROL":{var Je=new A.AttrList(de);S.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),S.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new A.AttrList(de);S.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Me=S.partList;Me||(Me=S.partList=[]);var $e=G>0?Me[Me.length-1]:void 0,ut=G++,je=new j.Part(new A.AttrList(de),Y,C,ut,$e);Me.push(je),Y.duration+=je.duration;break}case"PRELOAD-HINT":{var Ve=new A.AttrList(de);S.preloadHint=Ve;break}case"RENDITION-REPORT":{var Se=new A.AttrList(de);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Se);break}default:d.logger.warn("line parsed but not handled: "+ee);break}}}N&&!N.relurl?(D.pop(),V-=N.duration,S.partList&&(S.fragmentHint=N)):S.partList&&(y(Y,N),Y.cc=I,S.fragmentHint=Y);var be=D.length,Ce=D[0],ne=D[be-1];if(V+=S.skippedSegments*S.targetduration,V>0&&be&&ne){S.averagetargetduration=V/be;var oe=ne.sn;S.endSN=oe!=="initSegment"?oe:0,Ce&&(S.startCC=Ce.cc,Ce.initSegment||S.fragments.every(function(ce){return ce.relurl&&i(ce.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new j.Fragment(u,C),Y.relurl=ne.relurl,Y.level=c,Y.sn="initSegment",Ce.initSegment=Y,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(V+=S.fragmentHint.duration),S.totalduration=V,S.endCC=I,Ie>0&&v(D,Ie),S},R}();function l(R,w){["video","audio","text"].forEach(function(E){var C=R.filter(function(u){return Object(f.isCodecType)(u,E)});if(C.length){var c=C.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});w[E+"Codec"]=c.length>0?c[0]:C[0],R=R.filter(function(u){return C.indexOf(u)===-1})}}),w.unknownCodecs=R}function x(R,w,E){var C=w[E];C&&(R[E]=C)}function v(R,w){for(var E=R[w],C=w;C--;){var c=R[C];if(!c)return;c.programDateTime=E.programDateTime-c.duration*1e3,E=c}}function y(R,w){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):w!=null&&w.programDateTime&&(R.programDateTime=w.endProgramDateTime),Object($.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),M=O("./src/errors.ts"),j=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),P=O("./src/loader/m3u8-parser.ts"),A=O("./src/types/loader.ts"),d=O("./src/utils/attr-list.ts");function f(m){var g=m.type;switch(g){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function T(m,g){var a=m.url;return(a===void 0||a.indexOf("data:")===0)&&(a=g.url),a}var p=function(){function m(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var g=m.prototype;return g.registerListeners=function(){var i=this.hls;i.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var i=this.hls;i.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(i){var s=this.hls.config,l=s.pLoader,x=s.loader,v=l||x,y=new v(s);return i.loader=y,this.loaders[i.type]=y,y},g.getInternalLoader=function(i){return this.loaders[i.type]},g.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},g.destroyInternalLoaders=function(){for(var i in this.loaders){var s=this.loaders[i];s&&s.destroy(),this.resetInternalLoader(i)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(i,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},g.onLevelLoading=function(i,s){var l=s.id,x=s.level,v=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:null,level:x,responseType:"text",type:A.PlaylistContextType.LEVEL,url:v,deliveryDirectives:y})},g.onAudioTrackLoading=function(i,s){var l=s.id,x=s.groupId,v=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:x,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:y})},g.onSubtitleTrackLoading=function(i,s){var l=s.id,x=s.groupId,v=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:x,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:y})},g.load=function(i){var s,l=this.hls.config,x=this.getInternalLoader(i);if(x){var v=x.context;if(v&&v.url===i.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),x.abort()}var y,R,w,E;switch(i.type){case A.PlaylistContextType.MANIFEST:y=l.manifestLoadingMaxRetry,R=l.manifestLoadingTimeOut,w=l.manifestLoadingRetryDelay,E=l.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:y=0,R=l.levelLoadingTimeOut;break;default:y=l.levelLoadingMaxRetry,R=l.levelLoadingTimeOut,w=l.levelLoadingRetryDelay,E=l.levelLoadingMaxRetryTimeout;break}if(x=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var C;if(i.type===A.PlaylistContextType.LEVEL&&i.level!==null?C=this.hls.levels[i.level].details:i.type===A.PlaylistContextType.AUDIO_TRACK&&i.id!==null?C=this.hls.audioTracks[i.id].details:i.type===A.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(C=this.hls.subtitleTracks[i.id].details),C){var c=C.partTarget,u=C.targetduration;c&&u&&(R=Math.min(Math.max(c*3,u*.8)*1e3,R))}}var L={timeout:R,maxRetry:y,retryDelay:w,maxRetryDelay:E,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};x.load(i,L,S)},g.loadsuccess=function(i,s,l,x){if(x===void 0&&(x=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,s,l,x);return}this.resetInternalLoader(l.type);var v=i.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",x);return}s.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,l,x):this.handleMasterPlaylist(i,s,l,x)},g.loaderror=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,i)},g.loadtimeout=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},g.handleMasterPlaylist=function(i,s,l,x){var v=this.hls,y=i.data,R=T(i,l),w=P.default.parseMasterPlaylist(y,R),E=w.levels,C=w.sessionData;if(!E.length){this.handleManifestParsingError(i,l,"no level found in manifest",x);return}var c=E.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),u=E.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),L=P.default.parseMasterPlaylistMedia(y,R,"AUDIO",c),S=P.default.parseMasterPlaylistMedia(y,R,"SUBTITLES",u),D=P.default.parseMasterPlaylistMedia(y,R,"CLOSED-CAPTIONS");if(L.length){var _=L.some(function(B){return!B.url});!_&&E[0].audioCodec&&!E[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}v.trigger(F.Events.MANIFEST_LOADED,{levels:E,audioTracks:L,subtitles:S,captions:D,url:R,stats:s,networkDetails:x,sessionData:C})},g.handleTrackOrLevelPlaylist=function(i,s,l,x){var v=this.hls,y=l.id,R=l.level,w=l.type,E=T(i,l),C=Object($.isFiniteNumber)(y)?y:0,c=Object($.isFiniteNumber)(R)?R:C,u=f(l),L=P.default.parseLevelPlaylist(i.data,E,c,u,C);if(!L.fragments.length){v.trigger(F.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:E,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(w===A.PlaylistContextType.MANIFEST){var S={attrs:new d.AttrList({}),bitrate:0,details:L,name:"",url:E};v.trigger(F.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:E,stats:s,networkDetails:x,sessionData:null})}if(s.parsing.end=performance.now(),L.needSidxRanges){var D,_=(D=L.fragments[0].initSegment)===null||D===void 0?void 0:D.url;this.load({url:_,isSidxRequest:!0,type:w,level:R,levelDetails:L,id:y,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=L,this.handlePlaylistLoaded(i,s,l,x)},g.handleSidxRequest=function(i,s){var l=Object(U.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var x=l.references,v=s.levelDetails;x.forEach(function(y,R){var w=y.info,E=v.fragments[R];E.byteRange.length===0&&E.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),E.initSegment&&E.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(i,s,l,x){this.hls.trigger(F.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:s,networkDetails:x})},g.handleNetworkError=function(i,s,l,x){l===void 0&&(l=!1),j.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var v=M.ErrorDetails.UNKNOWN,y=!1,R=this.getInternalLoader(i);switch(i.type){case A.PlaylistContextType.MANIFEST:v=l?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,y=!0;break;case A.PlaylistContextType.LEVEL:v=l?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,y=!1;break;case A.PlaylistContextType.AUDIO_TRACK:v=l?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,y=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:v=l?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,y=!1;break}R&&this.resetInternalLoader(i.type);var w={type:M.ErrorTypes.NETWORK_ERROR,details:v,fatal:y,url:i.url,loader:R,context:i,networkDetails:s};x&&(w.response=x),this.hls.trigger(F.Events.ERROR,w)},g.handlePlaylistLoaded=function(i,s,l,x){var v=l.type,y=l.level,R=l.id,w=l.groupId,E=l.loader,C=l.levelDetails,c=l.deliveryDirectives;if(!(C!=null&&C.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",x);return}if(!E)return;C.live&&(E.getCacheAge&&(C.ageHeader=E.getCacheAge()||0),(!E.getCacheAge||isNaN(C.ageHeader))&&(C.ageHeader=0));switch(v){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:C,level:y||0,id:R||0,stats:s,networkDetails:x,deliveryDirectives:c});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:C,id:R||0,groupId:w||"",stats:s,networkDetails:x,deliveryDirectives:c});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:C,id:R||0,groupId:w||"",stats:s,networkDetails:x,deliveryDirectives:c});break}},m}();J.default=p},"./src/polyfills/number.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isFiniteNumber",function(){return $}),O.d(J,"MAX_SAFE_INTEGER",function(){return F});var $=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,J,O){"use strict";O.r(J);var $=function(){function F(){}return F.getSilentFrame=function(j,U){switch(j){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},F}();J.default=$},"./src/remux/mp4-generator.ts":function(ue,J,O){"use strict";O.r(J);var $=Math.pow(2,32)-1,F=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 U;for(U in M.types)M.types.hasOwnProperty(U)&&(M.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:P,audio:A};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),f=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=f,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 T=new Uint8Array([105,115,111,109]),p=new Uint8Array([97,118,99,49]),m=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,T,m,T,p),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,d))},M.box=function(U){for(var P=8,A=arguments.length,d=new Array(A>1?A-1:0),f=1;f<A;f++)d[f-1]=arguments[f];for(var T=d.length,p=T;T--;)P+=d[T].byteLength;var m=new Uint8Array(P);for(m[0]=P>>24&255,m[1]=P>>16&255,m[2]=P>>8&255,m[3]=P&255,m.set(U,4),T=0,P=8;T<p;T++)m.set(d[T],P),P+=d[T].byteLength;return m},M.hdlr=function(U){return M.box(M.types.hdlr,M.HDLR_TYPES[U])},M.mdat=function(U){return M.box(M.types.mdat,U)},M.mdhd=function(U,P){P*=U;var A=Math.floor(P/($+1)),d=Math.floor(P%($+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,U>>24&255,U>>16&255,U>>8&255,U&255,A>>24,A>>16&255,A>>8&255,A&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},M.mdia=function(U){return M.box(M.types.mdia,M.mdhd(U.timescale,U.duration),M.hdlr(U.type),M.minf(U))},M.mfhd=function(U){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},M.minf=function(U){return U.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(U)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(U))},M.moof=function(U,P,A){return M.box(M.types.moof,M.mfhd(U),M.traf(A,P))},M.moov=function(U){for(var P=U.length,A=[];P--;)A[P]=M.trak(U[P]);return M.box.apply(null,[M.types.moov,M.mvhd(U[0].timescale,U[0].duration)].concat(A).concat(M.mvex(U)))},M.mvex=function(U){for(var P=U.length,A=[];P--;)A[P]=M.trex(U[P]);return M.box.apply(null,[M.types.mvex].concat(A))},M.mvhd=function(U,P){P*=U;var A=Math.floor(P/($+1)),d=Math.floor(P%($+1)),f=new Uint8Array([1,0,0,0,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,A>>24,A>>16&255,A>>8&255,A&255,d>>24,d>>16&255,d>>8&255,d&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,f)},M.sdtp=function(U){var P=U.samples||[],A=new Uint8Array(4+P.length),d,f;for(d=0;d<P.length;d++)f=P[d].flags,A[d+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return M.box(M.types.sdtp,A)},M.stbl=function(U){return M.box(M.types.stbl,M.stsd(U),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(U){var P=[],A=[],d,f,T;for(d=0;d<U.sps.length;d++)f=U.sps[d],T=f.byteLength,P.push(T>>>8&255),P.push(T&255),P=P.concat(Array.prototype.slice.call(f));for(d=0;d<U.pps.length;d++)f=U.pps[d],T=f.byteLength,A.push(T>>>8&255),A.push(T&255),A=A.concat(Array.prototype.slice.call(f));var p=M.box(M.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|U.sps.length].concat(P).concat([U.pps.length]).concat(A))),m=U.width,g=U.height,a=U.pixelRatio[0],i=U.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,m>>8&255,m&255,g>>8&255,g&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]),p,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([a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255])))},M.esds=function(U){var P=U.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(U.config).concat([6,1,2]))},M.mp4a=function(U){var P=U.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,U.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),M.box(M.types.esds,M.esds(U)))},M.mp3=function(U){var P=U.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,U.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},M.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(U)):M.box(M.types.stsd,M.STSD,M.mp4a(U)):M.box(M.types.stsd,M.STSD,M.avc1(U))},M.tkhd=function(U){var P=U.id,A=U.duration*U.timescale,d=U.width,f=U.height,T=Math.floor(A/($+1)),p=Math.floor(A%($+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,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,p>>24,p>>16&255,p>>8&255,p&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,d>>8&255,d&255,0,0,f>>8&255,f&255,0,0]))},M.traf=function(U,P){var A=M.sdtp(U),d=U.id,f=Math.floor(P/($+1)),T=Math.floor(P%($+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,T>>24,T>>16&255,T>>8&255,T&255])),M.trun(U,A.length+16+20+8+16+8+8),A)},M.trak=function(U){return U.duration=U.duration||4294967295,M.box(M.types.trak,M.tkhd(U),M.mdia(U))},M.trex=function(U){var P=U.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(U,P){var A=U.samples||[],d=A.length,f=12+16*d,T=new Uint8Array(f),p,m,g,a,i,s;for(P+=8+f,T.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),p=0;p<d;p++)m=A[p],g=m.duration,a=m.size,i=m.flags,s=m.cts,T.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*p);return M.box(M.types.trun,T)},M.initSegment=function(U){M.types||M.init();var P=M.moov(U),A=new Uint8Array(M.FTYP.byteLength+P.byteLength);return A.set(M.FTYP),A.set(P,M.FTYP.byteLength),A},M}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,J.default=F},"./src/remux/mp4-remuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s}),O.d(J,"normalizePts",function(){return l});var $=O("./src/polyfills/number.ts"),F=O("./src/remux/aac-helper.ts"),M=O("./src/remux/mp4-generator.ts"),j=O("./src/events.ts"),U=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),A=O("./src/types/loader.ts"),d=O("./src/utils/timescale-conversion.ts");function f(){return f=Object.assign||function(R){for(var w=1;w<arguments.length;w++){var E=arguments[w];for(var C in E)Object.prototype.hasOwnProperty.call(E,C)&&(R[C]=E[C])}return R},f.apply(this,arguments)}var T=10*1e3,p=1024,m=1152,g=null,a=null,i=!1,s=function(){function R(E,C,c,u){if(u===void 0&&(u=""),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=E,this.config=C,this.typeSupported=c,this.ISGenerated=!1,g===null){var L=navigator.userAgent||"",S=L.match(/Chrome\/(\d+)/i);g=S?parseInt(S[1]):0}if(a===null){var D=navigator.userAgent.match(/Safari\/(\d+)/i);a=D?parseInt(D[1]):0}i=!!g&&g<75||!!a&&a<600}var w=R.prototype;return w.destroy=function(){},w.resetTimeStamp=function(C){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=C},w.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},w.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},w.getVideoStartPts=function(C){var c=!1,u=C.reduce(function(L,S){var D=S.pts-L;return D<-4294967296?(c=!0,l(L,S.pts)):D>0?L:S.pts},C[0].pts);return c&&P.logger.debug("PTS rollover detected"),u},w.remux=function(C,c,u,L,S,D,_,B){var G,V,I,N,Y,ee,le=S,me=S,Ie=C.pid>-1,Te=c.pid>-1,Oe=c.samples.length,Re=C.samples.length>0,Ee=Oe>1,pe=(!Ie||Re)&&(!Te||Ee)||this.ISGenerated||_;if(pe){this.ISGenerated||(I=this.generateIS(C,c,S));var de=this.isVideoContiguous,re=-1;if(Ee&&(re=x(c.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,re>0){P.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+Oe+" video samples due to a missing keyframe");var he=this.getVideoStartPts(c.samples);c.samples=c.samples.slice(re),c.dropped+=re,me+=(c.samples[0].pts-he)/(c.timescale||9e4)}else re===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Oe+" video samples"),ee=!1);if(this.ISGenerated){if(Re&&Ee){var se=this.getVideoStartPts(c.samples),Ae=l(C.samples[0].pts,se)-se,ie=Ae/c.inputTimeScale;le+=Math.max(0,ie),me+=Math.max(0,-ie)}if(Re){if(C.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(C,c,S)),V=this.remuxAudio(C,le,this.isAudioContiguous,D,Te||Ee||B===A.PlaylistLevelType.AUDIO?me:void 0),Ee){var ae=V?V.endPTS-V.startPTS:0;c.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(C,c,S)),G=this.remuxVideo(c,me,de,ae)}}else Ee&&(G=this.remuxVideo(c,me,de,0));G&&(G.firstKeyFrame=re,G.independent=re!==-1)}}return this.ISGenerated&&(u.samples.length&&(Y=this.remuxID3(u,S)),L.samples.length&&(N=this.remuxText(L,S))),{audio:V,video:G,initSegment:I,independent:ee,text:N,id3:Y}},w.generateIS=function(C,c,u){var L=C.samples,S=c.samples,D=this.typeSupported,_={},B=!Object($.isFiniteNumber)(this._initPTS),G="audio/mp4",V,I,N;if(B&&(V=I=Infinity),C.config&&L.length&&(C.timescale=C.samplerate,C.isAAC||(D.mpeg?(G="audio/mpeg",C.codec=""):D.mp3&&(C.codec="mp3")),_.audio={id:"audio",container:G,codec:C.codec,initSegment:!C.isAAC&&D.mpeg?new Uint8Array(0):M.default.initSegment([C]),metadata:{channelCount:C.channelCount}},B&&(N=C.inputTimeScale,V=I=L[0].pts-Math.round(N*u))),c.sps&&c.pps&&S.length&&(c.timescale=c.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:c.codec,initSegment:M.default.initSegment([c]),metadata:{width:c.width,height:c.height}},B)){N=c.inputTimeScale;var Y=this.getVideoStartPts(S),ee=Math.round(N*u);I=Math.min(I,l(S[0].dts,Y)-ee),V=Math.min(V,Y-ee)}if(Object.keys(_).length)return this.ISGenerated=!0,B&&(this._initPTS=V,this._initDTS=I),{tracks:_,initPTS:V,timescale:N}},w.remuxVideo=function(C,c,u,L){var S=C.inputTimeScale,D=C.samples,_=[],B=D.length,G=this._initPTS,V=this.nextAvcDts,I=8,N,Y,ee,le=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,Ie=0,Te=!1;if(!u||V===null){var Oe=c*S,Re=D[0].pts-l(D[0].dts,D[0].pts);V=Oe-Re}for(var Ee=0;Ee<B;Ee++){var pe=D[Ee];if(pe.pts=l(pe.pts-G,V),pe.dts=l(pe.dts-G,V),pe.dts>pe.pts){var de=9e4*.2;Ie=Math.max(Math.min(Ie,pe.pts-pe.dts),-1*de)}pe.dts<D[Ee>0?Ee-1:Ee].dts&&(Te=!0)}Te&&D.sort(function(Dt,At){var pt=Dt.dts-At.dts,jt=Dt.pts-At.pts;return pt||jt}),Y=D[0].dts,ee=D[D.length-1].dts;var re=Math.round((ee-Y)/(B-1));if(Ie<0){if(Ie<re*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-re,!0)+" ms");for(var he=Ie,se=0;se<B;se++)D[se].dts=he=Math.max(he,D[se].pts-re),D[se].pts=Math.max(he,D[se].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(Ie,!0)+" ms to overcome this issue");for(var Ae=0;Ae<B;Ae++)D[Ae].dts=D[Ae].dts+Ie}Y=D[0].dts}if(u){var ie=Y-V,ae=ie>re,ge=ie<-1;if(ae||ge){ae?P.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(ie,!0)+" ms ("+ie+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-ie,!0)+" ms ("+ie+"dts) overlapping between fragments detected"),Y=V;var we=D[0].pts-ie;D[0].dts=Y,D[0].pts=we,P.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(we,!0)+"/"+Object(d.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(ie,!0)+" ms")}}i&&(Y=Math.max(0,Y));for(var _e=0,Fe=0,Ue=0;Ue<B;Ue++){for(var Be=D[Ue],Ze=Be.units,et=Ze.length,rt=0,Ye=0;Ye<et;Ye++)rt+=Ze[Ye].data.length;Fe+=rt,_e+=et,Be.length=rt,Be.dts=Math.max(Be.dts,Y),Be.pts=Math.max(Be.pts,Be.dts,0),le=Math.min(Be.pts,le),me=Math.max(Be.pts,me)}ee=D[B-1].dts;var st=Fe+4*_e+8,Je;try{Je=new Uint8Array(st)}catch(Dt){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:st,reason:"fail allocating video mdat "+st});return}var Qe=new DataView(Je.buffer);Qe.setUint32(0,st),Je.set(M.default.types.mdat,4);for(var Me=0;Me<B;Me++){for(var $e=D[Me],ut=$e.units,je=0,Ve=0,Se=ut.length;Ve<Se;Ve++){var be=ut[Ve],Ce=be.data,ne=be.data.byteLength;Qe.setUint32(I,ne),I+=4,Je.set(Ce,I),I+=ne,je+=4+ne}if(Me<B-1)N=D[Me+1].dts-$e.dts;else{var oe=this.config,ce=$e.dts-D[Me>0?Me-1:Me].dts;if(oe.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(oe.maxBufferHole*S),Ne=(L?le+L*S:this.nextAudioPts)-$e.pts;Ne>ve?(N=Ne-ce,N<0&&(N=ce),P.logger.log("[mp4-remuxer]: It is approximately "+Ne/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=ce}else N=ce}var Le=Math.round($e.pts-$e.dts);_.push(new v($e.key,N,je,Le))}if(_.length&&g&&g<70){var ze=_[0].flags;ze.dependsOn=2,ze.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+N,this.isVideoContiguous=!0;var it=M.default.moof(C.sequenceNumber++,Y,f({},C,{samples:_})),ct="video",dt={data1:it,data2:Je,startPTS:le/S,endPTS:(me+N)/S,startDTS:Y/S,endDTS:V/S,type:ct,hasAudio:!1,hasVideo:!0,nb:_.length,dropped:C.dropped};return C.samples=[],C.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),dt},w.remuxAudio=function(C,c,u,L,S){var D=C.inputTimeScale,_=C.samplerate?C.samplerate:D,B=D/_,G=C.isAAC?p:m,V=G*B,I=this._initPTS,N=!C.isAAC&&this.typeSupported.mpeg,Y=[],ee=C.samples,le=N?0:8,me=this.nextAudioPts||-1,Ie=c*D;if(this.isAudioContiguous=u=u||ee.length&&me>0&&(L&&Math.abs(Ie-me)<9e3||Math.abs(l(ee[0].pts-I,Ie)-me)<20*V),ee.forEach(function(Ce){Ce.pts=l(Ce.pts-I,Ie)}),!u||me<0){if(ee=ee.filter(function(Ce){return Ce.pts>=0}),!ee.length)return;S===0?me=0:L?me=Math.max(0,Ie):me=ee[0].pts}if(C.isAAC)for(var Te=S!==void 0,Oe=this.config.maxAudioFramesDrift,Re=0,Ee=me;Re<ee.length;Re++){var pe=ee[Re],de=pe.pts,re=de-Ee,he=Math.abs(1e3*re/D);if(re<=-Oe*V&&Te)Re===0&&(P.logger.warn("Audio frame @ "+(de/D).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/D)+" ms."),this.nextAudioPts=me=Ee=de);else if(re>=Oe*V&&he<T&&Te){var se=Math.round(re/V);Ee=de-se*V,Ee<0&&(se--,Ee+=V),Re===0&&(this.nextAudioPts=me=Ee),P.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(Ee/D).toFixed(3)+"s due to "+Math.round(1e3*re/D)+" ms gap.");for(var Ae=0;Ae<se;Ae++){var ie=Math.max(Ee,0),ae=F.default.getSilentFrame(C.manifestCodec||C.codec,C.channelCount);ae||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ae=pe.unit.subarray()),ee.splice(Re,0,{unit:ae,pts:ie}),Ee+=V,Re++}}pe.pts=Ee,Ee+=V}for(var ge=null,we=null,_e,Fe=0,Ue=ee.length;Ue--;)Fe+=ee[Ue].unit.byteLength;for(var Be=0,Ze=ee.length;Be<Ze;Be++){var et=ee[Be],rt=et.unit,Ye=et.pts;if(we!==null){var st=Y[Be-1];st.duration=Math.round((Ye-we)/B)}else if(u&&C.isAAC&&(Ye=me),ge=Ye,Fe>0){Fe+=le;try{_e=new Uint8Array(Fe)}catch(Ce){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!N){var Je=new DataView(_e.buffer);Je.setUint32(0,Fe),_e.set(M.default.types.mdat,4)}}else return;_e.set(rt,le);var Qe=rt.byteLength;le+=Qe,Y.push(new v(!0,G,Qe,0)),we=Ye}var Me=Y.length;if(!Me)return;var $e=Y[Y.length-1];this.nextAudioPts=me=we+B*$e.duration;var ut=N?new Uint8Array(0):M.default.moof(C.sequenceNumber++,ge/B,f({},C,{samples:Y}));C.samples=[];var je=ge/D,Ve=me/D,Se="audio",be={data1:ut,data2:_e,startPTS:je,endPTS:Ve,startDTS:je,endDTS:Ve,type:Se,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(_e.length,"MDAT length must not be zero"),be},w.remuxEmptyAudio=function(C,c,u,L){var S=C.inputTimeScale,D=C.samplerate?C.samplerate:S,_=S/D,B=this.nextAudioPts,G=(B!==null?B:L.startDTS*S)+this._initDTS,V=L.endDTS*S+this._initDTS,I=_*p,N=Math.ceil((V-G)/I),Y=F.default.getSilentFrame(C.manifestCodec||C.codec,C.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],le=0;le<N;le++){var me=G+le*I;ee.push({unit:Y,pts:me,dts:me})}return C.samples=ee,this.remuxAudio(C,c,u,!1)},w.remuxID3=function(C,c){var u=C.samples.length;if(!u)return;for(var L=C.inputTimeScale,S=this._initPTS,D=this._initDTS,_=0;_<u;_++){var B=C.samples[_];B.pts=l(B.pts-S,c*L)/L,B.dts=l(B.dts-D,c*L)/L}var G=C.samples;return C.samples=[],{samples:G}},w.remuxText=function(C,c){var u=C.samples.length;if(!u)return;for(var L=C.inputTimeScale,S=this._initPTS,D=0;D<u;D++){var _=C.samples[D];_.pts=l(_.pts-S,c*L)/L}C.samples.sort(function(G,V){return G.pts-V.pts});var B=C.samples;return C.samples=[],{samples:B}},R}();function l(R,w){var E;if(w===null)return R;for(w<R?E=-8589934592:E=8589934592;Math.abs(R-w)>4294967296;)R+=E;return R}function x(R){for(var w=0;w<R.length;w++)if(R[w].key)return w;return-1}var v=function(w,E,C,c){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=E,this.size=C,this.cts=c,this.flags=new y(w)},y=function(w){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=w?2:1,this.isNonSync=w?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/polyfills/number.ts"),F=O("./src/utils/mp4-tools.ts"),M=O("./src/loader/fragment.ts"),j=O("./src/utils/logger.ts"),U=function(){function d(){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 f=d.prototype;return f.destroy=function(){},f.resetTimeStamp=function(p){this.initPTS=p,this.lastEndDTS=null},f.resetNextTimestamp=function(){this.lastEndDTS=null},f.resetInitSegment=function(p,m,g){this.audioCodec=m,this.videoCodec=g,this.generateInitSegment(p),this.emitInitSegment=!0},f.generateInitSegment=function(p){var m=this.audioCodec,g=this.videoCodec;if(!p||!p.byteLength){this.initTracks=void 0,this.initData=void 0;return}var a=this.initData=Object(F.parseInitSegment)(p);m||(m=A(a.audio,M.ElementaryStreamTypes.AUDIO)),g||(g=A(a.video,M.ElementaryStreamTypes.VIDEO));var i={};a.audio&&a.video?i.audiovideo={container:"video/mp4",codec:m+","+g,initSegment:p,id:"main"}:a.audio?i.audio={container:"audio/mp4",codec:m,initSegment:p,id:"audio"}:a.video?i.video={container:"video/mp4",codec:g,initSegment:p,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},f.remux=function(p,m,g,a,i){var s=this.initPTS,l=this.lastEndDTS,x={audio:void 0,video:void 0,text:a,id3:g,initSegment:void 0};Object($.isFiniteNumber)(l)||(l=this.lastEndDTS=i||0);var v=m.samples;if(!v||!v.length)return x;var y={initPTS:void 0,timescale:1},R=this.initData;if((!R||!R.length)&&(this.generateInitSegment(v),R=this.initData),!R||!R.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),x;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(s)||(this.initPTS=y.initPTS=s=P(R,v,l));var w=Object(F.getDuration)(v,R),E=l,C=w+E;Object(F.offsetStartDTS)(R,v,s),w>0?this.lastEndDTS=C:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var c=!!R.audio,u=!!R.video,L="";c&&(L+="audio"),u&&(L+="video");var S={data1:v,startPTS:E,startDTS:E,endPTS:C,endDTS:C,type:L,hasAudio:c,hasVideo:u,nb:1,dropped:0};return x.audio=S.type==="audio"?S:void 0,x.video=S.type!=="audio"?S:void 0,x.text=a,x.id3=g,x.initSegment=y,x},d}(),P=function(f,T,p){return Object(F.getStartDTS)(f,T)-p};function A(d,f){var T=d==null?void 0:d.codec;return T&&T.length>4?T:T==="hvc1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||f===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=U},"./src/task-loop.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return $});var $=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=F.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(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!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(){},F}()},"./src/types/cmcd.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"CMCDVersion",function(){return $}),O.d(J,"CMCDObjectType",function(){return F}),O.d(J,"CMCDStreamingFormat",function(){return M}),O.d(J,"CMCDStreamType",function(){return j});var $=1,F;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(F||(F={}));var M;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(M||(M={}));var j;(function(U){U.VOD="v",U.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"HlsSkip",function(){return M}),O.d(J,"getSkipValue",function(){return j}),O.d(J,"HlsUrlParameters",function(){return U}),O.d(J,"Level",function(){return P});function $(A,d){for(var f=0;f<d.length;f++){var T=d[f];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(A,T.key,T)}}function F(A,d,f){return d&&$(A.prototype,d),f&&$(A,f),A}var M;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(M||(M={}));function j(A,d){var f=A.canSkipUntil,T=A.canSkipDateRanges,p=A.endSN,m=d!==void 0?d-p:0;return f&&m<f?T?M.v2:M.Yes:M.No}var U=function(){function A(f,T,p){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=f,this.part=T,this.skip=p}var d=A.prototype;return d.addDirectives=function(T){var p=new self.URL(T);return this.msn!==void 0&&p.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&p.searchParams.set("_HLS_part",this.part.toString()),this.skip&&p.searchParams.set("_HLS_skip",this.skip),p.toString()},A}(),P=function(){function A(d){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=[d.url],this.attrs=d.attrs,this.bitrate=d.bitrate,d.details&&(this.details=d.details),this.id=d.id||0,this.name=d.name,this.width=d.width||0,this.height=d.height||0,this.audioCodec=d.audioCodec,this.videoCodec=d.videoCodec,this.unknownCodecs=d.unknownCodecs,this.codecSet=[d.videoCodec,d.audioCodec].filter(function(f){return f}).join(",").replace(/\.[^.,]+/g,"")}return F(A,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(f){var T=f%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),A}()},"./src/types/loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"PlaylistContextType",function(){return $}),O.d(J,"PlaylistLevelType",function(){return F});var $;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var F;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ChunkMetadata",function(){return $});var $=function(j,U,P,A,d,f){A===void 0&&(A=0),d===void 0&&(d=-1),f===void 0&&(f=!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=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=j,this.sn=U,this.id=P,this.size=A,this.part=d,this.partial=f};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"AttrList",function(){return M});var $=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function j(P){typeof P=="string"&&(P=j.parseAttrList(P));for(var A in P)P.hasOwnProperty(A)&&(this[A]=P[A])}var U=j.prototype;return U.decimalInteger=function(A){var d=parseInt(this[A],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},U.hexadecimalInteger=function(A){if(this[A]){var d=(this[A]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var f=new Uint8Array(d.length/2),T=0;T<d.length/2;T++)f[T]=parseInt(d.slice(T*2,T*2+2),16);return f}else return null},U.hexadecimalIntegerAsNumber=function(A){var d=parseInt(this[A],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},U.decimalFloatingPoint=function(A){return parseFloat(this[A])},U.optionalFloat=function(A,d){var f=this[A];return f?parseFloat(f):d},U.enumeratedString=function(A){return this[A]},U.bool=function(A){return this[A]==="YES"},U.decimalResolution=function(A){var d=$.exec(this[A]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},j.parseAttrList=function(A){var d,f={},T='"';for(F.lastIndex=0;(d=F.exec(A))!==null;){var p=d[2];p.indexOf(T)===0&&p.lastIndexOf(T)===p.length-1&&(p=p.slice(1,-1)),f[d[1]]=p}return f},j}()},"./src/utils/binary-search.ts":function(ue,J,O){"use strict";O.r(J);var $={search:function(M,j){for(var U=0,P=M.length-1,A=null,d=null;U<=P;){A=(U+P)/2|0,d=M[A];var f=j(d);if(f>0)U=A+1;else if(f<0)P=A-1;else return d}return null}};J.default=$},"./src/utils/buffer-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"BufferHelper",function(){return M});var $=O("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function j(){}return j.isBuffered=function(P,A){try{if(P){for(var d=j.getBuffered(P),f=0;f<d.length;f++)if(A>=d.start(f)&&A<=d.end(f))return!0}}catch(T){}return!1},j.bufferInfo=function(P,A,d){try{if(P){var f=j.getBuffered(P),T=[],p;for(p=0;p<f.length;p++)T.push({start:f.start(p),end:f.end(p)});return this.bufferedInfo(T,A,d)}}catch(m){}return{len:0,start:A,end:A,nextStart:void 0}},j.bufferedInfo=function(P,A,d){A=Math.max(0,A),P.sort(function(y,R){var w=y.start-R.start;return w||R.end-y.end});var f=[];if(d)for(var T=0;T<P.length;T++){var p=f.length;if(p){var m=f[p-1].end;P[T].start-m<d?P[T].end>m&&(f[p-1].end=P[T].end):f.push(P[T])}else f.push(P[T])}else f=P;for(var g=0,a,i=A,s=A,l=0;l<f.length;l++){var x=f[l].start,v=f[l].end;if(A+d>=x&&A<v)i=x,s=v,g=s-A;else if(A+d<x){a=x;break}}return{len:g,start:i||0,end:s||0,nextStart:a}},j.getBuffered=function(P){try{return P.buffered}catch(A){return $.logger.log("failed to get media.buffered",A),F}},j}()},"./src/utils/cea-608-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"Row",function(){return s}),O.d(J,"CaptionScreen",function(){return l});var $=O("./src/utils/logger.ts"),F={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(C){var c=C;return F.hasOwnProperty(C)&&(c=F[C]),String.fromCharCode(c)},j=15,U=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},T=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],p;(function(E){E[E.ERROR=0]="ERROR",E[E.TEXT=1]="TEXT",E[E.WARNING=2]="WARNING",E[E.INFO=2]="INFO",E[E.DEBUG=3]="DEBUG",E[E.DATA=3]="DATA"})(p||(p={}));var m=function(){function E(){this.time=null,this.verboseLevel=p.ERROR}var C=E.prototype;return C.log=function(u,L){this.verboseLevel>=u&&$.logger.log(this.time+" ["+u+"] "+L)},E}(),g=function(C){for(var c=[],u=0;u<C.length;u++)c.push(C[u].toString(16));return c},a=function(){function E(c,u,L,S,D){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=c||"white",this.underline=u||!1,this.italics=L||!1,this.background=S||"black",this.flash=D||!1}var C=E.prototype;return C.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},C.setStyles=function(u){for(var L=["foreground","underline","italics","background","flash"],S=0;S<L.length;S++){var D=L[S];u.hasOwnProperty(D)&&(this[D]=u[D])}},C.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},C.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},C.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},C.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},E}(),i=function(){function E(c,u,L,S,D,_){this.uchar=void 0,this.penState=void 0,this.uchar=c||" ",this.penState=new a(u,L,S,D,_)}var C=E.prototype;return C.reset=function(){this.uchar=" ",this.penState.reset()},C.setChar=function(u,L){this.uchar=u,this.penState.copy(L)},C.setPenState=function(u){this.penState.copy(u)},C.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},C.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},C.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},E}(),s=function(){function E(c){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<U;u++)this.chars.push(new i);this.logger=c,this.pos=0,this.currPenState=new a}var C=E.prototype;return C.equals=function(u){for(var L=!0,S=0;S<U;S++)if(!this.chars[S].equals(u.chars[S])){L=!1;break}return L},C.copy=function(u){for(var L=0;L<U;L++)this.chars[L].copy(u.chars[L])},C.isEmpty=function(){for(var u=!0,L=0;L<U;L++)if(!this.chars[L].isEmpty()){u=!1;break}return u},C.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(p.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(p.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},C.moveCursor=function(u){var L=this.pos+u;if(u>1)for(var S=this.pos+1;S<L+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(L)},C.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},C.insertChar=function(u){u>=144&&this.backSpace();var L=M(u);if(this.pos>=U){this.logger.log(p.ERROR,"Cannot insert "+u.toString(16)+" ("+L+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(L,this.currPenState),this.moveCursor(1)},C.clearFromPos=function(u){var L;for(L=u;L<U;L++)this.chars[L].reset()},C.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},C.clearToEndOfRow=function(){this.clearFromPos(this.pos)},C.getTextString=function(){for(var u=[],L=!0,S=0;S<U;S++){var D=this.chars[S].uchar;D!==" "&&(L=!1),u.push(D)}return L?"":u.join("")},C.setPenStyles=function(u){this.currPenState.setStyles(u);var L=this.chars[this.pos];L.setPenState(this.currPenState)},E}(),l=function(){function E(c){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<j;u++)this.rows.push(new s(c));this.logger=c,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var C=E.prototype;return C.reset=function(){for(var u=0;u<j;u++)this.rows[u].clear();this.currRow=j-1},C.equals=function(u){for(var L=!0,S=0;S<j;S++)if(!this.rows[S].equals(u.rows[S])){L=!1;break}return L},C.copy=function(u){for(var L=0;L<j;L++)this.rows[L].copy(u.rows[L])},C.isEmpty=function(){for(var u=!0,L=0;L<j;L++)if(!this.rows[L].isEmpty()){u=!1;break}return u},C.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},C.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},C.insertChar=function(u){var L=this.rows[this.currRow];L.insertChar(u)},C.setPen=function(u){var L=this.rows[this.currRow];L.setPenStyles(u)},C.moveCursor=function(u){var L=this.rows[this.currRow];L.moveCursor(u)},C.setCursor=function(u){this.logger.log(p.INFO,"setCursor: "+u);var L=this.rows[this.currRow];L.setCursor(u)},C.setPAC=function(u){this.logger.log(p.INFO,"pacData = "+JSON.stringify(u));var L=u.row-1;if(this.nrRollUpRows&&L<this.nrRollUpRows-1&&(L=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==L){for(var S=0;S<j;S++)this.rows[S].clear();var D=this.currRow+1-this.nrRollUpRows,_=this.lastOutputScreen;if(_){var B=_.rows[D].cueStartTime,G=this.logger.time;if(B&&G!==null&&B<G)for(var V=0;V<this.nrRollUpRows;V++)this.rows[L-this.nrRollUpRows+V+1].copy(_.rows[D+V])}}this.currRow=L;var I=this.rows[this.currRow];if(u.indent!==null){var N=u.indent,Y=Math.max(N-1,0);I.setCursor(u.indent),u.color=I.chars[Y].penState.foreground}var ee={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(ee)},C.setBkgData=function(u){this.logger.log(p.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},C.setRollUpRows=function(u){this.nrRollUpRows=u},C.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(p.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(p.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,L=this.rows.splice(u,1)[0];L.clear(),this.rows.splice(this.currRow,0,L),this.logger.log(p.INFO,"Rolling up")},C.getDisplayText=function(u){u=u||!1;for(var L=[],S="",D=-1,_=0;_<j;_++){var B=this.rows[_].getTextString();B&&(D=_+1,u?L.push("Row "+D+": '"+B+"'"):L.push(B.trim()))}return L.length>0&&(u?S="["+L.join(" | ")+"]":S=L.join(`
`)),S},C.getTextAndFormat=function(){return this.rows},E}(),x=function(){function E(c,u,L){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=c,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new l(L),this.nonDisplayedMemory=new l(L),this.lastOutputScreen=new l(L),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=L}var C=E.prototype;return C.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},C.getHandler=function(){return this.outputFilter},C.setHandler=function(u){this.outputFilter=u},C.setPAC=function(u){this.writeScreen.setPAC(u)},C.setBkgData=function(u){this.writeScreen.setBkgData(u)},C.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(p.INFO,"MODE="+u),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=u},C.insertChars=function(u){for(var L=0;L<u.length;L++)this.writeScreen.insertChar(u[L]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(p.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(p.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},C.ccRCL=function(){this.logger.log(p.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},C.ccBS=function(){if(this.logger.log(p.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},C.ccAOF=function(){},C.ccAON=function(){},C.ccDER=function(){this.logger.log(p.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},C.ccRU=function(u){this.logger.log(p.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},C.ccFON=function(){this.logger.log(p.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},C.ccRDC=function(){this.logger.log(p.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},C.ccTR=function(){this.logger.log(p.INFO,"TR"),this.setMode("MODE_TEXT")},C.ccRTD=function(){this.logger.log(p.INFO,"RTD"),this.setMode("MODE_TEXT")},C.ccEDM=function(){this.logger.log(p.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},C.ccCR=function(){this.logger.log(p.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},C.ccENM=function(){this.logger.log(p.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},C.ccEOC=function(){if(this.logger.log(p.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(p.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},C.ccTO=function(u){this.logger.log(p.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},C.ccMIDROW=function(u){var L={flash:!1};if(L.underline=u%2===1,L.italics=u>=46,L.italics)L.foreground="white";else{var S=Math.floor(u/2)-16,D=["white","green","blue","cyan","red","yellow","magenta"];L.foreground=D[S]}this.logger.log(p.INFO,"MIDROW: "+JSON.stringify(L)),this.writeScreen.setPen(L)},C.outputDataUpdate=function(u){u===void 0&&(u=!1);var L=this.logger.time;if(L===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=L:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,L,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:L),this.lastOutputScreen.copy(this.displayedMemory))},C.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},E}(),v=function(){function E(c,u,L){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new m;this.channels=[null,new x(c,u,S),new x(c+1,L,S)],this.cmdHistory=w(),this.logger=S}var C=E.prototype;return C.getHandler=function(u){return this.channels[u].getHandler()},C.setHandler=function(u,L){this.channels[u].setHandler(L)},C.addData=function(u,L){var S,D,_,B=!1;this.logger.time=u;for(var G=0;G<L.length;G+=2){if(D=L[G]&127,_=L[G+1]&127,D===0&&_===0)continue;if(this.logger.log(p.DATA,"["+g([L[G],L[G+1]])+"] -> ("+g([D,_])+")"),S=this.parseCmd(D,_),S||(S=this.parseMidrow(D,_)),S||(S=this.parsePAC(D,_)),S||(S=this.parseBackgroundAttributes(D,_)),!S&&(B=this.parseChars(D,_),B)){var V=this.currentChannel;if(V&&V>0){var I=this.channels[V];I.insertChars(B)}else this.logger.log(p.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!B&&this.logger.log(p.WARNING,"Couldn't parse cleaned data "+g([D,_])+" orig: "+g([L[G],L[G+1]]))}},C.parseCmd=function(u,L){var S=this.cmdHistory,D=(u===20||u===28||u===21||u===29)&&L>=32&&L<=47,_=(u===23||u===31)&&L>=33&&L<=35;if(!(D||_))return!1;if(R(u,L,S))return y(null,null,S),this.logger.log(p.DEBUG,"Repeated command ("+g([u,L])+") is dropped"),!0;var B=u===20||u===21||u===23?1:2,G=this.channels[B];return u===20||u===21||u===28||u===29?L===32?G.ccRCL():L===33?G.ccBS():L===34?G.ccAOF():L===35?G.ccAON():L===36?G.ccDER():L===37?G.ccRU(2):L===38?G.ccRU(3):L===39?G.ccRU(4):L===40?G.ccFON():L===41?G.ccRDC():L===42?G.ccTR():L===43?G.ccRTD():L===44?G.ccEDM():L===45?G.ccCR():L===46?G.ccENM():L===47&&G.ccEOC():G.ccTO(L-32),y(u,L,S),this.currentChannel=B,!0},C.parseMidrow=function(u,L){var S=0;if((u===17||u===25)&&L>=32&&L<=47){if(u===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(p.ERROR,"Mismatch channel in midrow parsing"),!1;var D=this.channels[S];return D?(D.ccMIDROW(L),this.logger.log(p.DEBUG,"MIDROW ("+g([u,L])+")"),!0):!1}return!1},C.parsePAC=function(u,L){var S,D=this.cmdHistory,_=(u>=17&&u<=23||u>=25&&u<=31)&&L>=64&&L<=127,B=(u===16||u===24)&&L>=64&&L<=95;if(!(_||B))return!1;if(R(u,L,D))return y(null,null,D),!0;var G=u<=23?1:2;L>=64&&L<=95?S=G===1?P[u]:d[u]:S=G===1?A[u]:f[u];var V=this.channels[G];return V?(V.setPAC(this.interpretPAC(S,L)),y(u,L,D),this.currentChannel=G,!0):!1},C.interpretPAC=function(u,L){var S,D={color:null,italics:!1,indent:null,underline:!1,row:u};return L>95?S=L-96:S=L-64,D.underline=(S&1)===1,S<=13?D.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(D.italics=!0,D.color="white"):D.indent=Math.floor((S-16)/2)*4,D},C.parseChars=function(u,L){var S,D=null,_=null;if(u>=25?(S=2,_=u-8):(S=1,_=u),_>=17&&_<=19){var B;_===17?B=L+80:_===18?B=L+112:B=L+144,this.logger.log(p.INFO,"Special char '"+M(B)+"' in channel "+S),D=[B]}else u>=32&&u<=127&&(D=L===0?[u]:[u,L]);if(D){var G=g(D);this.logger.log(p.DEBUG,"Char codes = "+G.join(",")),y(u,L,this.cmdHistory)}return D},C.parseBackgroundAttributes=function(u,L){var S=(u===16||u===24)&&L>=32&&L<=47,D=(u===23||u===31)&&L>=45&&L<=47;if(!(S||D))return!1;var _,B={};u===16||u===24?(_=Math.floor((L-32)/2),B.background=T[_],L%2===1&&(B.background=B.background+"_semi")):L===45?B.background="transparent":(B.foreground="black",L===47&&(B.underline=!0));var G=u<=23?1:2,V=this.channels[G];return V.setBkgData(B),y(u,L,this.cmdHistory),!0},C.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var L=this.channels[u];L&&L.reset()}this.cmdHistory=w()},C.cueSplitAtTime=function(u){for(var L=0;L<this.channels.length;L++){var S=this.channels[L];S&&S.cueSplitAtTime(u)}},E}();function y(E,C,c){c.a=E,c.b=C}function R(E,C,c){return c.a===E&&c.b===C}function w(){return{a:null,b:null}}J.default=v},"./src/utils/codecs.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isCodecType",function(){return F}),O.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 F(j,U){var P=$[U];return!!P&&P[j.slice(0,4)]===!0}function M(j,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/utils/vttparser.ts"),F=O("./src/utils/webvtt-parser.ts"),M=O("./src/utils/texttrack-utils.ts"),j=/\s/,U={newCue:function(A,d,f,T){for(var p=[],m,g,a,i,s,l=self.VTTCue||self.TextTrackCue,x=0;x<T.rows.length;x++)if(m=T.rows[x],a=!0,i=0,s="",!m.isEmpty()){for(var v=0;v<m.chars.length;v++)j.test(m.chars[v].uchar)&&a?i++:(s+=m.chars[v].uchar,a=!1);m.cueStartTime=d,d===f&&(f+=1e-4),i>=16?i--:i++;var y=Object($.fixLineBreaks)(s.trim()),R=Object(F.generateCueId)(d,f,y);(!A||!A.cues||!A.cues.getCueById(R))&&(g=new l(d,f,y),g.id=R,g.line=x+1,g.align="left",g.position=10+Math.min(80,Math.floor(i*8/32)*10),p.push(g))}return A&&p.length&&(p.sort(function(w,E){return w.line==="auto"||E.line==="auto"?0:w.line>8&&E.line>8?E.line-w.line:w.line-E.line}),p.forEach(function(w){return Object(M.addCueToTrack)(A,w)})),p}};J.default=U},"./src/utils/discontinuities.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"findFirstFragWithCC",function(){return j}),O.d(J,"shouldAlignOnDiscontinuities",function(){return U}),O.d(J,"findDiscontinuousReferenceFrag",function(){return P}),O.d(J,"adjustSlidingStart",function(){return d}),O.d(J,"alignStream",function(){return f}),O.d(J,"alignPDT",function(){return p}),O.d(J,"alignFragmentByPDTDelta",function(){return m}),O.d(J,"alignMediaPlaylistByPDT",function(){return g});var $=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts"),M=O("./src/controller/level-helper.ts");function j(a,i){for(var s=null,l=0,x=a.length;l<x;l++){var v=a[l];if(v&&v.cc===i){s=v;break}}return s}function U(a,i,s){return!!(i.details&&(s.endCC>s.startCC||a&&a.cc<s.startCC))}function P(a,i){var s=a.fragments,l=i.fragments;if(!l.length||!s.length){F.logger.log("No fragments to align");return}var x=j(s,l[0].cc);if(!x||x&&!x.startPTS){F.logger.log("No frag in previous level to align on");return}return x}function A(a,i){if(a){var s=a.start+i;a.start=a.startPTS=s,a.endPTS=s+a.duration}}function d(a,i){for(var s=i.fragments,l=0,x=s.length;l<x;l++)A(s[l],a);i.fragmentHint&&A(i.fragmentHint,a),i.alignedSliding=!0}function f(a,i,s){if(!i)return;T(a,s,i),!s.alignedSliding&&i.details&&p(s,i.details),!s.alignedSliding&&i.details&&!s.skippedSegments&&Object(M.adjustSliding)(i.details,s)}function T(a,i,s){if(U(a,s,i)){var l=P(s.details,i);l&&Object($.isFiniteNumber)(l.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),d(l.start,i))}}function p(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=a.fragments[0].programDateTime,x=(l-s)/1e3+i.fragments[0].start;x&&Object($.isFiniteNumber)(x)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+x.toFixed(3)+" "+a.url+" "),d(x,a))}function m(a,i){var s=a.programDateTime;if(!s)return;var l=(s-i)/1e3;a.start=a.startPTS=l,a.endPTS=l+a.duration}function g(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=i.fragments[0].start,x=s-l*1e3;a.fragments.forEach(function(v){m(v,x)}),a.fragmentHint&&m(a.fragmentHint,x),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/utils/ewma.ts"),F=function(){function M(U,P,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(U),this.fast_=new $.default(P)}var j=M.prototype;return j.update=function(P,A){var d=this.slow_,f=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new $.default(P,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new $.default(A,f.getEstimate(),f.getTotalWeight()))},j.sample=function(P,A){P=Math.max(P,this.minDelayMs_);var d=8*A,f=P/1e3,T=d/f;this.fast_.sample(f,T),this.slow_.sample(f,T)},j.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},M}();J.default=F},"./src/utils/ewma.ts":function(ue,J,O){"use strict";O.r(J);var $=function(){function F(j,U,P){U===void 0&&(U=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=U,this.totalWeight_=P}var M=F.prototype;return M.sample=function(U,P){var A=Math.pow(this.alpha_,U);this.estimate_=P*(1-A)+A*this.estimate_,this.totalWeight_+=U},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},F}();J.default=$},"./src/utils/fetch-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"fetchSupported",function(){return m});var $=O("./src/polyfills/number.ts"),F=O("./src/loader/load-stats.ts"),M=O("./src/demux/chunk-cache.ts");function j(l,x){l.prototype=Object.create(x.prototype),l.prototype.constructor=l,f(l,x)}function U(l){var x=typeof Map=="function"?new Map:void 0;return U=function(y){if(y===null||!d(y))return y;if(typeof y!="function")throw new TypeError("Super expression must either be null or a function");if(typeof x!="undefined"){if(x.has(y))return x.get(y);x.set(y,R)}function R(){return P(y,arguments,T(this).constructor)}return R.prototype=Object.create(y.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),f(R,y)},U(l)}function P(l,x,v){return A()?P=Reflect.construct:P=function(R,w,E){var C=[null];C.push.apply(C,w);var c=Function.bind.apply(R,C),u=new c;return E&&f(u,E.prototype),u},P.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function d(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function f(l,x){return f=Object.setPrototypeOf||function(y,R){return y.__proto__=R,y},f(l,x)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},T(l)}function p(){return p=Object.assign||function(l){for(var x=1;x<arguments.length;x++){var v=arguments[x];for(var y in v)Object.prototype.hasOwnProperty.call(v,y)&&(l[y]=v[y])}return l},p.apply(this,arguments)}function m(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var g=function(){function l(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||i,this.controller=new self.AbortController,this.stats=new F.LoadStats}var x=l.prototype;return x.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},x.abortInternal=function(){var y=this.response;(!y||!y.ok)&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(y,R,w){var E=this,C=this.stats;if(C.loading.start)throw new Error("Loader can only be used once.");C.loading.start=self.performance.now();var c=a(y,this.controller.signal),u=w.onProgress,L=y.responseType==="arraybuffer",S=L?"byteLength":"length";this.context=y,this.config=R,this.callbacks=w,this.request=this.fetchSetup(y,c),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){E.abortInternal(),w.onTimeout(C,y,E.response)},R.timeout),self.fetch(this.request).then(function(D){if(E.response=E.loader=D,!D.ok){var _=D.status,B=D.statusText;throw new s(B||"fetch, bad network response",_,D)}return C.loading.first=Math.max(self.performance.now(),C.loading.start),C.total=parseInt(D.headers.get("Content-Length")||"0"),u&&Object($.isFiniteNumber)(R.highWaterMark)?E.loadProgressively(D,C,y,R.highWaterMark,u):L?D.arrayBuffer():D.text()}).then(function(D){var _=E.response;self.clearTimeout(E.requestTimeout),C.loading.end=Math.max(self.performance.now(),C.loading.first),C.loaded=C.total=D[S];var B={url:_.url,data:D};u&&!Object($.isFiniteNumber)(R.highWaterMark)&&u(C,y,D,_),w.onSuccess(B,C,y,_)}).catch(function(D){if(self.clearTimeout(E.requestTimeout),C.aborted)return;var _=D.code||0;w.onError({code:_,text:D.message},y,D.details)})},x.getCacheAge=function(){var y=null;if(this.response){var R=this.response.headers.get("age");y=R?parseFloat(R):null}return y},x.loadProgressively=function(y,R,w,E,C){E===void 0&&(E=0);var c=new M.default,u=y.body.getReader(),L=function S(){return u.read().then(function(D){if(D.done)return c.dataLength&&C(R,w,c.flush(),y),Promise.resolve(new ArrayBuffer(0));var _=D.value,B=_.length;return R.loaded+=B,B<E||c.dataLength?(c.push(_),c.dataLength>=E&&C(R,w,c.flush(),y)):C(R,w,_,y),S()}).catch(function(){return Promise.reject()})};return L()},l}();function a(l,x){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(p({},l.headers))};return l.rangeEnd&&v.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),v}function i(l,x){return new self.Request(l.url,x)}var s=function(l){j(x,l);function x(v,y,R){var w;return w=l.call(this,v)||this,w.code=void 0,w.details=void 0,w.code=y,w.details=R,w}return x}(U(Error));J.default=g},"./src/utils/imsc1-ttml-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"IMSC1_CODEC",function(){return d}),O.d(J,"parseIMSC1",function(){return m});var $=O("./src/utils/mp4-tools.ts"),F=O("./src/utils/vttparser.ts"),M=O("./src/utils/vttcue.ts"),j=O("./src/demux/id3.ts"),U=O("./src/utils/timescale-conversion.ts"),P=O("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(E){for(var C=1;C<arguments.length;C++){var c=arguments[C];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(E[u]=c[u])}return E},A.apply(this,arguments)}var d="stpp.ttml.im1t",f=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,T=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,p={left:"start",center:"center",right:"end",start:"start",end:"end"};function m(E,C,c,u,L){var S=Object($.findBox)(new Uint8Array(E),["mdat"]);if(S.length===0){L(new Error("Could not parse IMSC1 mdat"));return}var D=S[0],_=Object(j.utf8ArrayToStr)(new Uint8Array(E,D.start,D.end-D.start)),B=Object(U.toTimescaleFromScale)(C,1,c);try{u(g(_,B))}catch(G){L(G)}}function g(E,C){var c=new DOMParser,u=c.parseFromString(E,"text/xml"),L=u.getElementsByTagName("tt")[0];if(!L)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(S).reduce(function(I,N){return I[N]=L.getAttribute("ttp:"+N)||S[N],I},{}),_=L.getAttribute("xml:space")!=="preserve",B=i(a(L,"styling","style")),G=i(a(L,"layout","region")),V=a(L,"body","[begin]");return[].map.call(V,function(I){var N=s(I,_);if(!N||!I.hasAttribute("begin"))return null;var Y=y(I.getAttribute("begin"),D),ee=y(I.getAttribute("dur"),D),le=y(I.getAttribute("end"),D);if(Y===null)throw v(I);if(le===null){if(ee===null)throw v(I);le=Y+ee}var me=new M.default(Y-C,le-C,N);me.id=Object(P.generateCueId)(me.startTime,me.endTime,me.text);var Ie=G[I.getAttribute("region")],Te=B[I.getAttribute("style")];me.position=10,me.size=80;var Oe=l(Ie,Te),Re=Oe.textAlign;if(Re){var Ee=p[Re];Ee&&(me.lineAlign=Ee),me.align=Re}return A(me,Oe),me}).filter(function(I){return I!==null})}function a(E,C,c){var u=E.getElementsByTagName(C)[0];return u?[].slice.call(u.querySelectorAll(c)):[]}function i(E){return E.reduce(function(C,c){var u=c.getAttribute("xml:id");return u&&(C[u]=c),C},{})}function s(E,C){return[].slice.call(E.childNodes).reduce(function(c,u,L){var S;return u.nodeName==="br"&&L?c+`
`:(S=u.childNodes)!==null&&S!==void 0&&S.length?s(u,C):C?c+u.textContent.trim().replace(/\s+/g," "):c+u.textContent},"")}function l(E,C){var c="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(L,S){var D=x(C,c,S)||x(E,c,S);return D&&(L[S]=D),L},{})}function x(E,C,c){return E.hasAttributeNS(C,c)?E.getAttributeNS(C,c):null}function v(E){return new Error("Could not parse ttml timestamp "+E)}function y(E,C){if(!E)return null;var c=Object(F.parseTimeStamp)(E);return c===null&&(f.test(E)?c=R(E,C):T.test(E)&&(c=w(E,C))),c}function R(E,C){var c=f.exec(E),u=(c[4]|0)+(c[5]|0)/C.subFrameRate;return(c[1]|0)*3600+(c[2]|0)*60+(c[3]|0)+u/C.frameRate}function w(E,C){var c=T.exec(E),u=Number(c[1]),L=c[2];switch(L){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/C.frameRate;case"t":return u/C.tickRate}return u}},"./src/utils/logger.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"enableLogs",function(){return P}),O.d(J,"logger",function(){return A});var $=function(){},F={trace:$,debug:$,log:$,warn:$,info:$,error:$},M=F;function j(d){var f=self.console[d];return f?f.bind(self.console,"["+d+"] >"):$}function U(d){for(var f=arguments.length,T=new Array(f>1?f-1:0),p=1;p<f;p++)T[p-1]=arguments[p];T.forEach(function(m){M[m]=d[m]?d[m].bind(d):j(m)})}function P(d){if(self.console&&d===!0||typeof d=="object"){U(d,"debug","log","info","warn","error");try{M.log()}catch(f){M=F}}else M=F}var A=M},"./src/utils/mediakeys-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"KeySystems",function(){return $}),O.d(J,"requestMediaKeySystemAccess",function(){return F});var $;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})($||($={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"bin2str",function(){return U}),O.d(J,"readUint16",function(){return P}),O.d(J,"readUint32",function(){return A}),O.d(J,"writeUint32",function(){return d}),O.d(J,"findBox",function(){return f}),O.d(J,"parseSegmentIndex",function(){return T}),O.d(J,"parseInitSegment",function(){return p}),O.d(J,"getStartDTS",function(){return m}),O.d(J,"getDuration",function(){return g}),O.d(J,"computeRawDurationFromSamples",function(){return a}),O.d(J,"offsetStartDTS",function(){return i}),O.d(J,"segmentValidRange",function(){return s}),O.d(J,"appendUint8Array",function(){return l});var $=O("./src/utils/typed-array.ts"),F=O("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,j=[].push;function U(x){return String.fromCharCode.apply(null,x)}function P(x,v){"data"in x&&(v+=x.start,x=x.data);var y=x[v]<<8|x[v+1];return y<0?65536+y:y}function A(x,v){"data"in x&&(v+=x.start,x=x.data);var y=x[v]<<24|x[v+1]<<16|x[v+2]<<8|x[v+3];return y<0?4294967296+y:y}function d(x,v,y){"data"in x&&(v+=x.start,x=x.data),x[v]=y>>24,x[v+1]=y>>16&255,x[v+2]=y>>8&255,x[v+3]=y&255}function f(x,v){var y=[];if(!v.length)return y;var R,w,E;"data"in x?(R=x.data,w=x.start,E=x.end):(R=x,w=0,E=R.byteLength);for(var C=w;C<E;){var c=A(R,C),u=U(R.subarray(C+4,C+8)),L=c>1?C+c:E;if(u===v[0])if(v.length===1)y.push({data:R,start:C+8,end:L});else{var S=f({data:R,start:C+8,end:L},v.slice(1));S.length&&j.apply(y,S)}C=L}return y}function T(x){var v=f(x,["moov"]),y=v[0],R=y?y.end:null,w=f(x,["sidx"]);if(!w||!w[0])return null;var E=[],C=w[0],c=C.data[0],u=c===0?8:16,L=A(C,u);u+=4;var S=0,D=0;c===0?u+=8:u+=16,u+=2;var _=C.end+D,B=P(C,u);u+=2;for(var G=0;G<B;G++){var V=u,I=A(C,V);V+=4;var N=I&2147483647,Y=(I&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=A(C,V);V+=4,E.push({referenceSize:N,subsegmentDuration:ee,info:{duration:ee/L,start:_,end:_+N-1}}),_+=N,V+=4,u=V}return{earliestPresentationTime:S,timescale:L,version:c,referencesCount:B,references:E,moovEndOffset:R}}function p(x){for(var v=[],y=f(x,["moov","trak"]),R=0;R<y.length;R++){var w=y[R],E=f(w,["tkhd"])[0];if(E){var C=E.data[E.start],c=C===0?12:20,u=A(E,c),L=f(w,["mdia","mdhd"])[0];if(L){C=L.data[L.start],c=C===0?12:20;var S=A(L,c),D=f(w,["mdia","hdlr"])[0];if(D){var _=U(D.data.subarray(D.start+8,D.start+12)),B={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[_];if(B){var G=f(w,["mdia","minf","stbl","stsd"])[0],V=void 0;G&&(V=U(G.data.subarray(G.start+12,G.start+16))),v[u]={timescale:S,type:B},v[B]={timescale:S,id:u,codec:V}}}}}}var I=f(x,["moov","mvex","trex"]);return I.forEach(function(N){var Y=A(N,4),ee=v[Y];ee&&(ee.default={duration:A(N,12),flags:A(N,20)})}),v}function m(x,v){return f(v,["moof","traf"]).reduce(function(y,R){var w=f(R,["tfdt"])[0],E=w.data[w.start],C=f(R,["tfhd"]).reduce(function(c,u){var L=A(u,4),S=x[L];if(S){var D=A(w,4);E===1&&(D*=Math.pow(2,32),D+=A(w,8));var _=S.timescale||9e4,B=D/_;if(isFinite(B)&&(c===null||B<c))return B}return c},null);return C!==null&&isFinite(C)&&(y===null||C<y)?C:y},null)||0}function g(x,v){for(var y=0,R=0,w=0,E=f(x,["moof","traf"]),C=0;C<E.length;C++){var c=E[C],u=f(c,["tfhd"])[0],L=A(u,4),S=v[L];if(!S)continue;var D=S.default,_=A(u,0)|(D==null?void 0:D.flags),B=D==null?void 0:D.duration;_&8&&(_&2?B=A(u,12):B=A(u,8));for(var G=S.timescale||9e4,V=f(c,["trun"]),I=0;I<V.length;I++){if(B){var N=A(V[I],4);y=B*N}else y=a(V[I]);S.type===F.ElementaryStreamTypes.VIDEO?R+=y/G:S.type===F.ElementaryStreamTypes.AUDIO&&(w+=y/G)}}if(R===0&&w===0){var Y=T(x);if(Y!=null&&Y.references)return Y.references.reduce(function(ee,le){return ee+le.info.duration||0},0)}return R||w}function a(x){var v=A(x,0),y=8;v&1&&(y+=4),v&4&&(y+=4);for(var R=0,w=A(x,4),E=0;E<w;E++){if(v&256){var C=A(x,y);R+=C,y+=4}v&512&&(y+=4),v&1024&&(y+=4),v&2048&&(y+=4)}return R}function i(x,v,y){f(v,["moof","traf"]).forEach(function(R){f(R,["tfhd"]).forEach(function(w){var E=A(w,4),C=x[E];if(!C)return;var c=C.timescale||9e4;f(R,["tfdt"]).forEach(function(u){var L=u.data[u.start],S=A(u,4);if(L===0)d(u,4,S-y*c);else{S*=Math.pow(2,32),S+=A(u,8),S-=y*c,S=Math.max(S,0);var D=Math.floor(S/(M+1)),_=Math.floor(S%(M+1));d(u,4,D),d(u,8,_)}})})})}function s(x){var v={valid:null,remainder:null},y=f(x,["moof"]);if(y){if(y.length<2)return v.remainder=x,v}else return v;var R=y[y.length-1];return v.valid=Object($.sliceUint8)(x,0,R.start-8),v.remainder=Object($.sliceUint8)(x,R.start-8),v}function l(x,v){var y=new Uint8Array(x.length+v.length);return y.set(x),y.set(v,x.length),y}},"./src/utils/output-filter.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return $});var $=function(){function F(j,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=U}var M=F.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(U,P,A){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=P,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"sendAddTrackEvent",function(){return F}),O.d(J,"addCueToTrack",function(){return M}),O.d(J,"clearCurrentCues",function(){return j}),O.d(J,"removeCuesInRange",function(){return U}),O.d(J,"getCuesInRange",function(){return A});var $=O("./src/utils/logger.ts");function F(d,f){var T;try{T=new Event("addtrack")}catch(p){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=d,f.dispatchEvent(T)}function M(d,f){var T=d.mode;if(T==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(f.id))try{if(d.addCue(f),!d.cues.getCueById(f.id))throw new Error("addCue is failed for: "+f)}catch(m){$.logger.debug("[texttrack-utils]: "+m);var p=new self.TextTrackCue(f.startTime,f.endTime,f.text);p.id=f.id,d.addCue(p)}T==="disabled"&&(d.mode=T)}function j(d){var f=d.mode;if(f==="disabled"&&(d.mode="hidden"),d.cues)for(var T=d.cues.length;T--;)d.removeCue(d.cues[T]);f==="disabled"&&(d.mode=f)}function U(d,f,T){var p=d.mode;if(p==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var m=A(d.cues,f,T),g=0;g<m.length;g++)d.removeCue(m[g]);p==="disabled"&&(d.mode=p)}function P(d,f){if(f<d[0].startTime)return 0;var T=d.length-1;if(f>d[T].endTime)return-1;for(var p=0,m=T;p<=m;){var g=Math.floor((m+p)/2);if(f<d[g].startTime)m=g-1;else if(f>d[g].startTime&&p<T)p=g+1;else return g}return d[p].startTime-f<f-d[m].startTime?p:m}function A(d,f,T){var p=[],m=P(d,f);if(m>-1)for(var g=m,a=d.length;g<a;g++){var i=d[g];if(i.startTime>=f&&i.endTime<=T)p.push(i);else if(i.startTime>T)return p}return p}},"./src/utils/time-ranges.ts":function(ue,J,O){"use strict";O.r(J);var $={toString:function(M){for(var j="",U=M.length,P=0;P<U;P++)j+="["+M.start(P).toFixed(3)+","+M.end(P).toFixed(3)+"]";return j}};J.default=$},"./src/utils/timescale-conversion.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"toTimescaleFromBase",function(){return F}),O.d(J,"toTimescaleFromScale",function(){return M}),O.d(J,"toMsFromMpegTsClock",function(){return j}),O.d(J,"toMpegTsClockFromTimescale",function(){return U});var $=9e4;function F(P,A,d,f){d===void 0&&(d=1),f===void 0&&(f=!1);var T=P*A*d;return f?Math.round(T):T}function M(P,A,d,f){return d===void 0&&(d=1),f===void 0&&(f=!1),F(P,A,1/d,f)}function j(P,A){return A===void 0&&(A=!1),F(P,1e3,1/$,A)}function U(P,A){return A===void 0&&(A=1),F(P,$,1/A)}},"./src/utils/typed-array.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"sliceUint8",function(){return $});function $(F,M,j){return Uint8Array.prototype.slice?F.slice(M,j):new Uint8Array(Array.prototype.slice.call(F,M,j))}},"./src/utils/vttcue.ts":function(ue,J,O){"use strict";O.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],F=["start","middle","end","left","right"];function M(d,f){if(typeof f!="string")return!1;if(!Array.isArray(d))return!1;var T=f.toLowerCase();return~d.indexOf(T)?T:!1}function j(d){return M($,d)}function U(d){return M(F,d)}function P(d){for(var f=arguments.length,T=new Array(f>1?f-1:0),p=1;p<f;p++)T[p-1]=arguments[p];for(var m=1;m<arguments.length;m++){var g=arguments[m];for(var a in g)d[a]=g[a]}return d}function A(d,f,T){var p=this,m={enumerable:!0};p.hasBeenReset=!1;var g="",a=!1,i=d,s=f,l=T,x=null,v="",y=!0,R="auto",w="start",E=50,C="middle",c=50,u="middle";Object.defineProperty(p,"id",P({},m,{get:function(){return g},set:function(S){g=""+S}})),Object.defineProperty(p,"pauseOnExit",P({},m,{get:function(){return a},set:function(S){a=!!S}})),Object.defineProperty(p,"startTime",P({},m,{get:function(){return i},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");i=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"endTime",P({},m,{get:function(){return s},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");s=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"text",P({},m,{get:function(){return l},set:function(S){l=""+S,this.hasBeenReset=!0}})),Object.defineProperty(p,"region",P({},m,{get:function(){return x},set:function(S){x=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"vertical",P({},m,{get:function(){return v},set:function(S){var D=j(S);if(D===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=D,this.hasBeenReset=!0}})),Object.defineProperty(p,"snapToLines",P({},m,{get:function(){return y},set:function(S){y=!!S,this.hasBeenReset=!0}})),Object.defineProperty(p,"line",P({},m,{get:function(){return R},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");R=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"lineAlign",P({},m,{get:function(){return w},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");w=D,this.hasBeenReset=!0}})),Object.defineProperty(p,"position",P({},m,{get:function(){return E},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");E=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"positionAlign",P({},m,{get:function(){return C},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");C=D,this.hasBeenReset=!0}})),Object.defineProperty(p,"size",P({},m,{get:function(){return c},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");c=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"align",P({},m,{get:function(){return u},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");u=D,this.hasBeenReset=!0}})),p.displayState=void 0}return A.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"parseTimeStamp",function(){return M}),O.d(J,"fixLineBreaks",function(){return f}),O.d(J,"VTTParser",function(){return T});var $=O("./src/utils/vttcue.ts"),F=function(){function p(){}var m=p.prototype;return m.decode=function(a,i){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},p}();function M(p){function m(a,i,s,l){return(a|0)*3600+(i|0)*60+(s|0)+parseFloat(l||0)}var g=p.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?m(g[2],g[3],0,g[4]):m(g[1],g[2],g[3],g[4]):null}var j=function(){function p(){this.values=Object.create(null)}var m=p.prototype;return m.set=function(a,i){!this.get(a)&&i!==""&&(this.values[a]=i)},m.get=function(a,i,s){return s?this.has(a)?this.values[a]:i[s]:this.has(a)?this.values[a]:i},m.has=function(a){return a in this.values},m.alt=function(a,i,s){for(var l=0;l<s.length;++l)if(i===s[l]){this.set(a,i);break}},m.integer=function(a,i){/^-?\d+$/.test(i)&&this.set(a,parseInt(i,10))},m.percent=function(a,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var s=parseFloat(i);if(s>=0&&s<=100)return this.set(a,s),!0}return!1},p}();function U(p,m,g,a){var i=a?p.split(a):[p];for(var s in i){if(typeof i[s]!="string")continue;var l=i[s].split(g);if(l.length!==2)continue;var x=l[0],v=l[1];m(x,v)}}var P=new $.default(0,0,""),A=P.align==="middle"?"middle":"center";function d(p,m,g){var a=p;function i(){var x=M(p);if(x===null)throw new Error("Malformed timestamp: "+a);return p=p.replace(/^[^\sa-zA-Z-]+/,""),x}function s(x,v){var y=new j;U(x,function(E,C){var c;switch(E){case"region":for(var u=g.length-1;u>=0;u--)if(g[u].id===C){y.set(E,g[u].region);break}break;case"vertical":y.alt(E,C,["rl","lr"]);break;case"line":c=C.split(","),y.integer(E,c[0]),y.percent(E,c[0])&&y.set("snapToLines",!1),y.alt(E,c[0],["auto"]),c.length===2&&y.alt("lineAlign",c[1],["start",A,"end"]);break;case"position":c=C.split(","),y.percent(E,c[0]),c.length===2&&y.alt("positionAlign",c[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":y.percent(E,C);break;case"align":y.alt(E,C,["start",A,"end","left","right"]);break}},/:/,/\s/),v.region=y.get("region",null),v.vertical=y.get("vertical","");var R=y.get("line","auto");R==="auto"&&P.line===-1&&(R=-1),v.line=R,v.lineAlign=y.get("lineAlign","start"),v.snapToLines=y.get("snapToLines",!0),v.size=y.get("size",100),v.align=y.get("align",A);var w=y.get("position","auto");w==="auto"&&P.position===50&&(w=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=w}function l(){p=p.replace(/^\s+/,"")}if(l(),m.startTime=i(),l(),p.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);p=p.substr(3),l(),m.endTime=i(),l(),s(p,m)}function f(p){return p.replace(/<br(?: \/)?>/gi,`
`)}var T=function(){function p(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var m=p.prototype;return m.parse=function(a){var i=this;a&&(i.buffer+=i.decoder.decode(a,{stream:!0}));function s(){var w=i.buffer,E=0;for(w=f(w);E<w.length&&w[E]!=="\r"&&w[E]!==`
`;)++E;var C=w.substr(0,E);return w[E]==="\r"&&++E,w[E]===`
`&&++E,i.buffer=w.substr(E),C}function l(w){U(w,function(E,C){},/:/)}try{var x="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;x=s();var v=x.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var y=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;y?y=!1:x=s();switch(i.state){case"HEADER":/:/.test(x)?l(x):x||(i.state="ID");continue;case"NOTE":x||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(x)){i.state="NOTE";break}if(!x)continue;if(i.cue=new $.default(0,0,""),i.state="CUE",x.indexOf("-->")===-1){i.cue.id=x;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{d(x,i.cue,i.regionList)}catch(w){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var R=x.indexOf("-->")!==-1;if(!x||R&&(y=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
`),i.cue.text+=x}continue;case"BADCUE":x||(i.state="ID")}}}catch(w){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},m.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=`
`,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){a.onparsingerror&&a.onparsingerror(i)}return a.onflush&&a.onflush(),this},p}()},"./src/utils/webvtt-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"generateCueId",function(){return T}),O.d(J,"parseWebVTT",function(){return m});var $=O("./src/polyfills/number.ts"),F=O("./src/utils/vttparser.ts"),M=O("./src/demux/id3.ts"),j=O("./src/utils/timescale-conversion.ts"),U=O("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,A=function(a,i,s){return s===void 0&&(s=0),a.substr(s,i.length)===i},d=function(a){var i=parseInt(a.substr(-3)),s=parseInt(a.substr(-6,2)),l=parseInt(a.substr(-9,2)),x=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object($.isFiniteNumber)(i)||!Object($.isFiniteNumber)(s)||!Object($.isFiniteNumber)(l)||!Object($.isFiniteNumber)(x))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*s,i+=60*1e3*l,i+=60*60*1e3*x,i},f=function(a){for(var i=5381,s=a.length;s;)i=i*33^a.charCodeAt(--s);return(i>>>0).toString()};function T(g,a,i){return f(g.toString())+f(a.toString())+f(i)}var p=function(a,i,s){var l=a[i],x=a[l.prevCC];if(!x||!x.new&&l.new){a.ccOffset=a.presentationOffset=l.start,l.new=!1;return}for(;(v=x)!==null&&v!==void 0&&v.new;){var v;a.ccOffset+=l.start-x.start,l.new=!1,l=x,x=a[l.prevCC]}a.presentationOffset=s};function m(g,a,i,s,l,x,v,y){var R=new F.VTTParser,w=Object(M.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(P,`
`).split(`
`),E=[],C=Object(j.toMpegTsClockFromTimescale)(a,i),c="00:00.000",u=0,L=0,S,D=!0,_=!1;R.oncue=function(B){var G=s[l],V=s.ccOffset,I=(u-C)/9e4;if(G!=null&&G.new&&(L!==void 0?V=s.ccOffset=G.start:p(s,l,I)),I&&(V=I-s.presentationOffset),_){var N=B.endTime-B.startTime,Y=Object(U.normalizePts)((B.startTime+V-L)*9e4,x*9e4)/9e4;B.startTime=Y,B.endTime=Y+N}var ee=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(ee)),B.id||(B.id=T(B.startTime,B.endTime,ee)),B.endTime>0&&E.push(B)},R.onparsingerror=function(B){S=B},R.onflush=function(){if(S){y(S);return}v(E)},w.forEach(function(B){if(D)if(A(B,"X-TIMESTAMP-MAP=")){D=!1,_=!0,B.substr(16).split(",").forEach(function(G){A(G,"LOCAL:")?c=G.substr(6):A(G,"MPEGTS:")&&(u=parseInt(G.substr(7)))});try{L=d(c)/1e3}catch(G){_=!1,S=G}return}else B===""&&(D=!1);R.parse(B+`
`)}),R.flush()}},"./src/utils/xhr-loader.ts":function(ue,J,O){"use strict";O.r(J);var $=O("./src/utils/logger.ts"),F=O("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,j=function(){function U(A){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=A?A.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var P=U.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},P.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(d,f,T){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=f,this.callbacks=T,this.retryDelay=f.retryDelay,this.loadInternal()},P.loadInternal=function(){var d=this.config,f=this.context;if(!d)return;var T=this.loader=new self.XMLHttpRequest,p=this.stats;p.loading.first=0,p.loaded=0;var m=this.xhrSetup;try{if(m)try{m(T,f.url)}catch(i){T.open("GET",f.url,!0),m(T,f.url)}T.readyState||T.open("GET",f.url,!0);var g=this.context.headers;if(g)for(var a in g)T.setRequestHeader(a,g[a])}catch(i){this.callbacks.onError({code:T.status,text:i.message},f,T);return}f.rangeEnd&&T.setRequestHeader("Range","bytes="+f.rangeStart+"-"+(f.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=f.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),T.send()},P.readystatechange=function(){var d=this.context,f=this.loader,T=this.stats;if(!d||!f)return;var p=f.readyState,m=this.config;if(T.aborted)return;if(p>=2)if(self.clearTimeout(this.requestTimeout),T.loading.first===0&&(T.loading.first=Math.max(self.performance.now(),T.loading.start)),p===4){f.onreadystatechange=null,f.onprogress=null;var g=f.status;if(g>=200&&g<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var a,i;if(d.responseType==="arraybuffer"?(a=f.response,i=a.byteLength):(a=f.responseText,i=a.length),T.loaded=T.total=i,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(T,d,a,f),!this.callbacks)return;var l={url:f.responseURL,data:a};this.callbacks.onSuccess(l,T,d,f)}else T.retry>=m.maxRetry||g>=400&&g<499?($.logger.error(g+" while loading "+d.url),this.callbacks.onError({code:g,text:f.statusText},d,f)):($.logger.warn(g+" while loading "+d.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,m.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout)},P.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(d){var f=this.stats;f.loaded=d.loaded,d.lengthComputable&&(f.total=d.total)},P.getCacheAge=function(){var d=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var f=this.loader.getResponseHeader("age");d=f?parseFloat(f):null}return d},U}();J.default=j}}).default})},vHTk:function(bt,De,q){bt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);