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.
376 lines
1.0 MiB
376 lines
1.0 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[252,5,6,7],{"+NIl":function(vt,Le,ee){(function(ue){ue(ee("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(J,O){"use strict";function X(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 H(p){for(var m=p.cmdState,b=m.length-1;b>=0;b--){var a=m[b];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function U(p,m,b){return function(){this.name=p,this.bracketNo=0,this.style=m,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var 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 L(p,m){p.f=m}function h(p,m){var b;if(p.match(/^\\[a-zA-Z@]+/)){var a=p.current().slice(1);return b=P.hasOwnProperty(a)?P[a]:P.DEFAULT,b=new b,X(m,b),L(m,T),b.style}if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/\\]/))return"tag";if(p.match("\\["))return L(m,function(s,u){return f(s,u,"\\]")}),"keyword";if(p.match("\\("))return L(m,function(s,u){return f(s,u,"\\)")}),"keyword";if(p.match("$$"))return L(m,function(s,u){return f(s,u,"$$")}),"keyword";if(p.match("$"))return L(m,function(s,u){return f(s,u,"$")}),"keyword";var i=p.next();if(i=="%")return p.skipToEnd(),"comment";if(i=="}"||i=="]"){if(b=F(m),b)b.closeBracket(i),L(m,T);else return"error";return"bracket"}else return i=="{"||i=="["?(b=P.DEFAULT,b=new b,X(m,b),"bracket"):/\d/.test(i)?(p.eatWhile(/[\w.%]/),"atom"):(p.eatWhile(/[\w\-_]/),b=H(m),b.name=="begin"&&(b.argument=p.current()),b.styleIdentifier())}function f(p,m,b){if(p.eatSpace())return null;if(b&&p.match(b))return L(m,h),"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 b=p.peek(),a;return b=="{"||b=="["?(a=F(m),a.openBracket(b),p.eat(b),L(m,h),"bracket"):/[ \t\r]/.test(b)?(p.eat(b),null):(L(m,h),M(m),h(p,m))}return{startState:function(){var p=O.inMathMode?function(m,b){return f(m,b)}:h;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=h,p.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(vt,Le,ee){},"/cxE":function(vt,Le,ee){"use strict";ee.d(Le,"e",function(){return O}),ee.d(Le,"f",function(){return X}),ee.d(Le,"g",function(){return F}),ee.d(Le,"d",function(){return H}),ee.d(Le,"a",function(){return U}),ee.d(Le,"b",function(){return P}),ee.d(Le,"c",function(){return L});var ue=function(){function h(){this.listeners=[],this.unexpectedErrorHandler=function(f){setTimeout(function(){throw f.stack?new Error(f.message+`
|
|
|
|
`+f.stack):f},0)}}return h.prototype.emit=function(f){this.listeners.forEach(function(T){T(f)})},h.prototype.onUnexpectedError=function(f){this.unexpectedErrorHandler(f),this.emit(f)},h.prototype.onUnexpectedExternalError=function(f){this.unexpectedErrorHandler(f)},h}(),J=new ue;function O(h){H(h)||J.onUnexpectedError(h);return}function X(h){H(h)||J.onUnexpectedExternalError(h);return}function F(h){if(h instanceof Error){var f=h.name,T=h.message,p=h.stacktrace||h.stack;return{$isError:!0,name:f,message:T,stack:p}}return h}var M="Canceled";function H(h){return h instanceof Error&&h.name===M&&h.message===M}function U(){var h=new Error(M);return h.name=h.message,h}function P(h){return h?new Error("Illegal argument: "+h):new Error("Illegal argument")}function L(h){return h?new Error("Illegal state: "+h):new Error("Illegal state")}},"19Vz":function(vt,Le,ee){(function(ue){ue(ee("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(U,P,L){var h=L&&L!=ue.Init;if(P&&!h)U.on("blur",F),U.on("change",M),U.on("swapDoc",M),ue.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){X(U)}),M(U);else if(!P&&h){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 L=U.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),P.appendChild(L),U.display.lineSpace.insertBefore(P,U.display.lineSpace.firstChild)}function X(U){setTimeout(function(){var P=!1,L=U.getInputField();L.nodeName=="TEXTAREA"?P=!L.value:U.lineCount()==1&&(P=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),P?O(U):J(U)},20)}function F(U){H(U)&&O(U)}function M(U){var P=U.getWrapperElement(),L=H(U);P.className=P.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?O(U):J(U)}function H(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(vt,Le,ee){(function(ue){ue(ee("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(X,F){var M=X.indentUnit,H={},U=F.htmlMode?J:O;for(var P in U)H[P]=U[P];for(var P in F)H[P]=F[P];var L,h;function f(l,A){function S(B){return A.tokenize=B,B(l,A)}var D=l.next();if(D=="<")return l.eat("!")?l.eat("[")?l.match("CDATA[")?S(m("atom","]]>")):null:l.match("--")?S(m("comment","-->")):l.match("DOCTYPE",!0,!0)?(l.eatWhile(/[\w\._\-]/),S(b(1))):null:l.eat("?")?(l.eatWhile(/[\w\._\-]/),A.tokenize=m("meta","?>"),"meta"):(L=l.eat("/")?"closeTag":"openTag",A.tokenize=T,"tag bracket");if(D=="&"){var I;return l.eat("#")?l.eat("x")?I=l.eatWhile(/[a-fA-F\d]/)&&l.eat(";"):I=l.eatWhile(/[\d]/)&&l.eat(";"):I=l.eatWhile(/[\w\.\-:]/)&&l.eat(";"),I?"atom":"error"}else return l.eatWhile(/[^&<]/),null}f.isInText=!0;function T(l,A){var S=l.next();if(S==">"||S=="/"&&l.eat(">"))return A.tokenize=f,L=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return L="equals",null;if(S=="<"){A.tokenize=f,A.state=u,A.tagName=A.tagStart=null;var D=A.tokenize(l,A);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(S)?(A.tokenize=p(S),A.stringStartCol=l.column(),A.tokenize(l,A)):(l.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function p(l){var A=function(S,D){for(;!S.eol();)if(S.next()==l){D.tokenize=T;break}return"string"};return A.isInAttribute=!0,A}function m(l,A){return function(S,D){for(;!S.eol();){if(S.match(A)){D.tokenize=f;break}S.next()}return l}}function b(l){return function(A,S){for(var D;(D=A.next())!=null;){if(D=="<")return S.tokenize=b(l+1),S.tokenize(A,S);if(D==">")if(l==1){S.tokenize=f;break}else return S.tokenize=b(l-1),S.tokenize(A,S)}return"meta"}}function a(l,A,S){this.prev=l.context,this.tagName=A,this.indent=l.indented,this.startOfLine=S,(H.doNotIndent.hasOwnProperty(A)||l.context&&l.context.noIndent)&&(this.noIndent=!0)}function i(l){l.context&&(l.context=l.context.prev)}function s(l,A){for(var S;;){if(!l.context)return;if(S=l.context.tagName,!H.contextGrabbers.hasOwnProperty(S)||!H.contextGrabbers[S].hasOwnProperty(A))return;i(l)}}function u(l,A,S){return l=="openTag"?(S.tagStart=A.column(),y):l=="closeTag"?g:u}function y(l,A,S){return l=="word"?(S.tagName=A.current(),h="tag",w):H.allowMissingTagName&&l=="endTag"?(h="tag bracket",w(l,A,S)):(h="error",y)}function g(l,A,S){if(l=="word"){var D=A.current();return S.context&&S.context.tagName!=D&&H.implicitlyClosed.hasOwnProperty(S.context.tagName)&&i(S),S.context&&S.context.tagName==D||H.matchClosing===!1?(h="tag",v):(h="tag error",R)}else return H.allowMissingTagName&&l=="endTag"?(h="tag bracket",v(l,A,S)):(h="error",R)}function v(l,A,S){return l!="endTag"?(h="error",v):(i(S),u)}function R(l,A,S){return h="error",v(l,A,S)}function w(l,A,S){if(l=="word")return h="attribute",C;if(l=="endTag"||l=="selfcloseTag"){var D=S.tagName,I=S.tagStart;return S.tagName=S.tagStart=null,l=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(D)?s(S,D):(s(S,D),S.context=new a(S,D,I==S.indented)),u}return h="error",w}function C(l,A,S){return l=="equals"?x:(H.allowMissing||(h="error"),w(l,A,S))}function x(l,A,S){return l=="string"?d:l=="word"&&H.allowUnquoted?(h="string",w):(h="error",w(l,A,S))}function d(l,A,S){return l=="string"?d:w(l,A,S)}return{startState:function(l){var A={tokenize:f,state:u,indented:l||0,tagName:null,tagStart:null,context:null};return l!=null&&(A.baseIndent=l),A},token:function(l,A){if(!A.tagName&&l.sol()&&(A.indented=l.indentation()),l.eatSpace())return null;L=null;var S=A.tokenize(l,A);return(S||L)&&S!="comment"&&(h=null,A.state=A.state(L||S,l,A),h&&(S=h=="error"?S+" error":h)),S},indent:function(l,A,S){var D=l.context;if(l.tokenize.isInAttribute)return l.tagStart==l.indented?l.stringStartCol+1:l.indented+M;if(D&&D.noIndent)return ue.Pass;if(l.tokenize!=T&&l.tokenize!=f)return S?S.match(/^(\s*)/)[0].length:0;if(l.tagName)return H.multilineTagIndentPastTag!==!1?l.tagStart+l.tagName.length+2:l.tagStart+M*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(A))return 0;var I=A&&/^<(\/)?([\w_:\.-]*)/.exec(A);if(I&&I[1])for(;D;)if(D.tagName==I[2]){D=D.prev;break}else if(H.implicitlyClosed.hasOwnProperty(D.tagName))D=D.prev;else break;else if(I)for(;D;){var B=H.contextGrabbers[D.tagName];if(B&&B.hasOwnProperty(I[2]))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+M:l.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(l){l.state==x&&(l.state=w)},xmlCurrentTag:function(l){return l.tagName?{name:l.tagName,close:l.type=="closeTag"}:null},xmlCurrentContext:function(l){for(var A=[],S=l.context;S;S=S.prev)S.tagName&&A.push(S.tagName);return A.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(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return O});var ue=ee("JYp7"),J=function(){function X(F){this.element=F,this.next=X.Undefined,this.prev=X.Undefined}return X.Undefined=new X(void 0),X}(),O=function(){function X(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}return Object.defineProperty(X.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),X.prototype.isEmpty=function(){return this._first===J.Undefined},X.prototype.clear=function(){this._first=J.Undefined,this._last=J.Undefined,this._size=0},X.prototype.unshift=function(F){return this._insert(F,!1)},X.prototype.push=function(F){return this._insert(F,!0)},X.prototype._insert=function(F,M){var H=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 L=this._first;this._first=U,U.next=L,L.prev=U}this._size+=1;var h=!1;return function(){h||(h=!0,H._remove(U))}},X.prototype.shift=function(){if(this._first===J.Undefined)return;var F=this._first.element;return this._remove(this._first),F},X.prototype.pop=function(){if(this._last===J.Undefined)return;var F=this._last.element;return this._remove(this._last),F},X.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},X.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)}}},X.prototype.toArray=function(){for(var F=[],M=this._first;M!==J.Undefined;M=M.next)F.push(M.element);return F},X}()},"55Ip":function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return s}),ee.d(Le,"b",function(){return w});var ue=ee("Ty5D"),J=ee("dI71"),O=ee("q1tI"),X=ee.n(O),F=ee("YS25"),M=ee("17x9"),H=ee.n(M),U=ee("wx14"),P=ee("zLVn"),L=ee("9R94"),h=function(x){Object(J.a)(d,x);function d(){for(var A,S=arguments.length,D=new Array(S),I=0;I<S;I++)D[I]=arguments[I];return A=x.call.apply(x,[this].concat(D))||this,A.history=Object(F.a)(A.props),A}var l=d.prototype;return l.render=function(){return X.a.createElement(ue.c,{history:this.history,children:this.props.children})},d}(X.a.Component),f=function(x){Object(J.a)(d,x);function d(){for(var A,S=arguments.length,D=new Array(S),I=0;I<S;I++)D[I]=arguments[I];return A=x.call.apply(x,[this].concat(D))||this,A.history=Object(F.b)(A.props),A}var l=d.prototype;return l.render=function(){return X.a.createElement(ue.c,{history:this.history,children:this.props.children})},d}(X.a.Component),T=function(d,l){return typeof d=="function"?d(l):d},p=function(d,l){return typeof d=="string"?Object(F.c)(d,null,null,l):d},m=function(d){return d},b=X.a.forwardRef;typeof b=="undefined"&&(b=m);function a(x){return!!(x.metaKey||x.altKey||x.ctrlKey||x.shiftKey)}var i=b(function(x,d){var l=x.innerRef,A=x.navigate,S=x.onClick,D=Object(P.a)(x,["innerRef","navigate","onClick"]),I=D.target,B=Object(U.a)({},D,{onClick:function(z){try{S&&S(z)}catch(_){throw z.preventDefault(),_}!z.defaultPrevented&&z.button===0&&(!I||I==="_self")&&!a(z)&&(z.preventDefault(),A())}});return m!==b?B.ref=d||l:B.ref=l,X.a.createElement("a",B)}),s=b(function(x,d){var l=x.component,A=l===void 0?i:l,S=x.replace,D=x.to,I=x.innerRef,B=Object(P.a)(x,["component","replace","to","innerRef"]);return X.a.createElement(ue.e.Consumer,null,function(j){j||Object(L.a)(!1);var z=j.history,_=p(T(D,j.location),j.location),N=_?z.createHref(_):"",$=Object(U.a)({},B,{href:N,navigate:function(){var le=T(D,j.location),pe=S?z.replace:z.push;pe(le)}});return m!==b?$.ref=d||I:$.innerRef=I,X.a.createElement(A,$)})});if(!1)var u,y;var g=function(d){return d},v=X.a.forwardRef;typeof v=="undefined"&&(v=g);function R(){for(var x=arguments.length,d=new Array(x),l=0;l<x;l++)d[l]=arguments[l];return d.filter(function(A){return A}).join(" ")}var w=v(function(x,d){var l=x["aria-current"],A=l===void 0?"page":l,S=x.activeClassName,D=S===void 0?"active":S,I=x.activeStyle,B=x.className,j=x.exact,z=x.isActive,_=x.location,N=x.sensitive,$=x.strict,q=x.style,le=x.to,pe=x.innerRef,Pe=Object(P.a)(x,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return X.a.createElement(ue.e.Consumer,null,function(Se){Se||Object(L.a)(!1);var ke=_||Se.location,Ae=p(T(le,ke),ke),Te=Ae.pathname,ge=Te&&Te.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),he=ge?Object(ue.f)(ke.pathname,{path:ge,exact:j,sensitive:N,strict:$}):null,re=!!(z?z(he,ke):he),de=re?R(B,D):B,se=re?Object(U.a)({},q,{},I):q,Oe=Object(U.a)({"aria-current":re&&A||null,className:de,style:se,to:Ae},Pe);return g!==v?Oe.ref=d||pe:Oe.innerRef=pe,X.a.createElement(s,Oe)})});if(!1)var C},"746U":function(vt,Le,ee){"use strict";ee.d(Le,"d",function(){return J}),ee.d(Le,"j",function(){return O}),ee.d(Le,"i",function(){return X}),ee.d(Le,"h",function(){return F}),ee.d(Le,"e",function(){return M}),ee.d(Le,"k",function(){return H}),ee.d(Le,"l",function(){return U}),ee.d(Le,"a",function(){return P}),ee.d(Le,"f",function(){return h}),ee.d(Le,"g",function(){return f}),ee.d(Le,"m",function(){return T}),ee.d(Le,"c",function(){return b}),ee.d(Le,"b",function(){return a}),ee.d(Le,"n",function(){return i}),ee.d(Le,"o",function(){return s});var ue={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function J(u){return Array.isArray?Array.isArray(u):!!(u&&typeof u.length===ue.number&&u.constructor===Array)}function O(u){return typeof u===ue.string||u instanceof String}function X(u){return typeof u===ue.object&&u!==null&&!Array.isArray(u)&&!(u instanceof RegExp)&&!(u instanceof Date)}function F(u){return(typeof u===ue.number||u instanceof Number)&&!isNaN(u)}function M(u){return u===!0||u===!1}function H(u){return typeof u===ue.undefined}function U(u){return H(u)||u===null}function P(u,y){if(!u)throw new Error(y?"Unexpected type, expected '"+y+"'":"Unexpected type")}var L=Object.prototype.hasOwnProperty;function h(u){if(!X(u))return!1;for(var y in u)if(L.call(u,y))return!1;return!0}function f(u){return typeof u===ue.function}function T(u,y){for(var g=Math.min(u.length,y.length),v=0;v<g;v++)p(u[v],y[v])}function p(u,y){if(O(y)){if(typeof u!==y)throw new Error("argument does not match constraint: typeof "+y)}else if(f(y)){try{if(u instanceof y)return}catch(g){}if(!U(u)&&u.constructor===y)return;if(y.length===1&&y.call(void 0,u)===!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(u){for(var y=[],g=Object.getPrototypeOf(u);Object.prototype!==g;)y=y.concat(Object.getOwnPropertyNames(g)),g=Object.getPrototypeOf(g);return y}function b(u){for(var y=[],g=0,v=m(u);g<v.length;g++){var R=v[g];typeof u[R]=="function"&&y.push(R)}return y}function a(u,y){for(var g=function(x){return function(){var d=Array.prototype.slice.call(arguments,0);return y(x,d)}},v={},R=0,w=u;R<w.length;R++){var C=w[R];v[C]=g(C)}return v}function i(u){return u===null?void 0:u}function s(u){return typeof u=="undefined"?null:u}},"7Cbv":function(vt,Le,ee){"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 X=/^(?:[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"&&X.test(T)}for(var M=F,H=[],U=0;U<256;++U)H.push((U+256).toString(16).substr(1));function P(T){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=(H[T[p+0]]+H[T[p+1]]+H[T[p+2]]+H[T[p+3]]+"-"+H[T[p+4]]+H[T[p+5]]+"-"+H[T[p+6]]+H[T[p+7]]+"-"+H[T[p+8]]+H[T[p+9]]+"-"+H[T[p+10]]+H[T[p+11]]+H[T[p+12]]+H[T[p+13]]+H[T[p+14]]+H[T[p+15]]).toLowerCase();if(!M(m))throw TypeError("Stringified UUID is invalid");return m}var L=P;function h(T,p,m){T=T||{};var b=T.random||(T.rng||O)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,p){m=m||0;for(var a=0;a<16;++a)p[m+a]=b[a];return p}return L(b)}var f=Le.a=h},"7ahc":function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return y});var ue=ee("k1fw"),J=ee("0Owb"),O=ee("+L6B"),X=ee("2/Rp"),F=ee("y8nQ"),M=ee("Vl3Y"),H=ee("tJVT"),U=ee("OaEy"),P=ee("2fM7"),L=ee("q1tI"),h=ee.n(L),f=ee("VrN/"),T=ee.n(f),p=ee("p77/"),m=ee.n(p),b=ee("c5Ni"),a=ee.n(b),i=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Le.b=function(g){var v=g.callback,R=g.onCancel,w=Object(L.useState)("python"),C=Object(H.a)(w,2),x=C[0],d=C[1];function l(S){d(u[S][1])}function A(S){v(S)}return h.a.createElement(M.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:A}),h.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},h.a.createElement(P.a,{onChange:l},Object.keys(u).map(function(S){return h.a.createElement(i,{key:S,value:S},u[S][0])}))),h.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},h.a.createElement(y,{mode:x})),h.a.createElement("div",{className:"flex-container flex-end"},h.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(X.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function y(g){var v=g.value,R=g.onChange,w=g.mode,C=g.options,x=C===void 0?{}:C,d=Object(L.useRef)(),l=Object(L.useState)(),A=Object(H.a)(l,2),S=A[0],D=A[1];return Object(L.useEffect)(function(){if(S){function I(B){var j=B.getValue();R&&R(j)}return S.on("change",I),function(){S.off("change",I)}}},[S,R]),Object(L.useEffect)(function(){S&&S.setOption("mode",w)},[S,w]),Object(L.useEffect)(function(){S&&((v!==S.getValue()||v==="")&&setTimeout(function(){S.setValue(v||" ")},300))},[S,v]),Object(L.useEffect)(function(){if(d.current&&!S){var I=T.a.fromTextArea(d.current,Object(ue.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},x));D(I)}},[d.current,S]),h.a.createElement("div",{className:"my-codemirror-container"},h.a.createElement("textarea",{ref:d}))}},"8EBN":function(vt,Le,ee){(function(ue){ue(ee("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(X){X=X.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.mime==X)return M;if(M.mimes){for(var H=0;H<M.mimes.length;H++)if(M.mimes[H]==X)return M}}if(/\+xml$/.test(X))return ue.findModeByMIME("application/xml");if(/\+json$/.test(X))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function(X){X=X.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.ext){for(var H=0;H<M.ext.length;H++)if(M.ext[H]==X)return M}}},ue.findModeByFileName=function(X){for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.file&&M.file.test(X))return M}var H=X.lastIndexOf("."),U=H>-1&&X.substring(H+1,X.length);if(U)return ue.findModeByExtension(U)},ue.findModeByName=function(X){X=X.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var M=ue.modeInfo[F];if(M.name.toLowerCase()==X)return M;if(M.alias){for(var H=0;H<M.alias.length;H++)if(M.alias[H].toLowerCase()==X)return M}}}})},"8HAY":function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return M}),ee.d(Le,"b",function(){return H});var ue=ee("pmY6"),J=ee("MI8n"),O=function(){var U=function(P,L){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var T in f)f.hasOwnProperty(T)&&(h[T]=f[T])},U(P,L)};return function(P,L){U(P,L);function h(){this.constructor=P}P.prototype=L===null?Object.create(L):(h.prototype=L.prototype,new h)}}(),X=function(U,P,L,h){function f(T){return T instanceof L?T:new L(function(p){p(T)})}return new(L||(L=Promise))(function(T,p){function m(i){try{a(h.next(i))}catch(s){p(s)}}function b(i){try{a(h.throw(i))}catch(s){p(s)}}function a(i){i.done?T(i.value):f(i.value).then(m,b)}a((h=h.apply(U,P||[])).next())})},F=function(U,P){var L={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},h,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 b([a,i])}}function b(a){if(h)throw new TypeError("Generator is already executing.");for(;L;)try{if(h=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 L.label++,{value:a[1],done:!1};case 5:L.label++,f=a[1],a=[0];continue;case 7:a=L.ops.pop(),L.trys.pop();continue;default:if(!(T=L.trys,T=T.length>0&&T[T.length-1])&&(a[0]===6||a[0]===2)){L=0;continue}if(a[0]===3&&(!T||a[1]>T[0]&&a[1]<T[3])){L.label=a[1];break}if(a[0]===6&&L.label<T[1]){L.label=T[1],T=a;break}if(T&&L.label<T[2]){L.label=T[2],L.ops.push(a);break}T[2]&&L.ops.pop(),L.trys.pop();continue}a=P.call(U,L)}catch(i){a=[6,i],f=0}finally{h=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(L,h,f,T,p){h===void 0&&(h=""),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=L,m._label=h,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(L){this._setLabel(L)},enumerable:!0,configurable:!0}),P.prototype._setLabel=function(L){this._label!==L&&(this._label=L,this._onDidChange.fire({label:L}))},Object.defineProperty(P.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(L){this._setTooltip(L)},enumerable:!0,configurable:!0}),P.prototype._setTooltip=function(L){this._tooltip!==L&&(this._tooltip=L,this._onDidChange.fire({tooltip:L}))},Object.defineProperty(P.prototype,"class",{get:function(){return this._cssClass},set:function(L){this._setClass(L)},enumerable:!0,configurable:!0}),P.prototype._setClass=function(L){this._cssClass!==L&&(this._cssClass=L,this._onDidChange.fire({class:L}))},Object.defineProperty(P.prototype,"enabled",{get:function(){return this._enabled},set:function(L){this._setEnabled(L)},enumerable:!0,configurable:!0}),P.prototype._setEnabled=function(L){this._enabled!==L&&(this._enabled=L,this._onDidChange.fire({enabled:L}))},Object.defineProperty(P.prototype,"checked",{get:function(){return this._checked},set:function(L){this._setChecked(L)},enumerable:!0,configurable:!0}),P.prototype._setChecked=function(L){this._checked!==L&&(this._checked=L,this._onDidChange.fire({checked:L}))},P.prototype.run=function(L,h){return this._actionCallback?this._actionCallback(L):Promise.resolve(!0)},P}(ue.a),H=function(U){O(P,U);function P(){var L=U!==null&&U.apply(this,arguments)||this;return L._onDidBeforeRun=L._register(new J.a),L.onDidBeforeRun=L._onDidBeforeRun.event,L._onDidRun=L._register(new J.a),L.onDidRun=L._onDidRun.event,L}return P.prototype.run=function(L,h){return X(this,void 0,void 0,function(){var f,T;return F(this,function(p){switch(p.label){case 0:if(!L.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:L}),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.runAction(L,h)];case 2:return f=p.sent(),this._onDidRun.fire({action:L,result:f}),[3,4];case 3:return T=p.sent(),this._onDidRun.fire({action:L,error:T}),[3,4];case 4:return[2]}})})},P.prototype.runAction=function(L,h){var f=h?L.run(h):L.run();return Promise.resolve(f)},P}(ue.a)},"8hTe":function(vt,Le,ee){vt.exports={button:"button___1wy9m"}},"9Bee":function(vt,Le,ee){"use strict";var ue=ee("DYRE"),J=ee("zeV3"),O=ee("+L6B"),X=ee("2/Rp"),F=ee("k1fw"),M=ee("9og8"),H=ee("tJVT"),U=ee("WmNS"),P=ee.n(U),L=ee("q1tI"),h=ee.n(L),f=ee("vg9a"),T=ee("DlQD"),p=ee.n(T),m=ee("rUJ1");function b(K,c){var E=K.match(/^(\s+)(?:```)/);if(E===null)return c;var G=E[1];return c.split(`
|
|
`).map(function(Y){var V=Y.match(/^\s+/);if(V===null)return Y;var xe=Object(H.a)(V,1),Ge=xe[0];return Ge.length>=G.length?Y.slice(G.length):Y}).join(`
|
|
`)}var a=[],i=["<ul>"],s=new p.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function y(){a.length=0,i=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(K,c,E,G){if(c>=K.length||K[c].level<=E)return c;var Y=K[c];G.push("<li><a href='#"+Y.anchor+"'>"+Y.text+"</a>"),c++;var V=[];return c=v(K,c,Y.level,V),V.length>0&&(G.push("<ul>"),V.forEach(function(xe){G.push(xe)}),G.push("</ul>")),G.push("</li>"),c=v(K,c,E,G),c}function R(){return v(a,0,0,i),i.push("</ul>"),i.join("")}var w={heading:function(c){var E=u.exec(c);if(E)return{type:"heading",raw:E[0],depth:E[1].length,text:E[2]}},fences:function(c){var E=this.rules.block.fences.exec(c);if(E){var G=E[0],Y=b(G,E[3]||""),V=E[2]?E[2].trim():E[2];if(["latex","katex","math"].indexOf(V)>=0){var xe=d(),Ge=Y;Y=xe,l[xe]={type:"block",expression:Ge}}return{type:"code",raw:G,lang:V,text:Y}}}},C=/(?:\${2})([^\n`]+?)(?:\${2})/gi,x=0,d=function(){return"__special_katext_id_".concat(x++,"__")},l={};function A(){return l}function S(){x=0,l={}}function D(K){return K=K.replace(C,function(c,E){var G=d();return l[G]={type:"inline",expression:E},G}),K}var I=s.listitem;s.listitem=function(K){return I(D(K))};var B=s.paragraph;s.paragraph=function(K){return B(D(K))};var j=s.tablecell;s.tablecell=function(K,c){return j(D(K),c)},s.code=function(K,c,E){var G=(c||"").match(/\S*/)[0];return G?["latex","katex","math"].indexOf(G)>=0?"<p class='editormd-tex'>".concat(K,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(c,'">').concat(E?K:Object(m.escape)(K,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(E?K:Object(m.escape)(K,!0))+"</code></pre>"},s.heading=function(K,c,E){var G=this.options.headerPrefix+E.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:G,level:c,text:K}),"<h"+c+' id="'+G+'">'+K+"</h"+c+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:w,renderer:s});var z=p.a,_=ee("SJMd"),N=ee("ulZh"),$=ee.n(N),q=ee("m3rI"),le=ee("Oy/b"),pe=ee("p5ED"),Pe=ee("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 Se=function(K,c){return(Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,G){E.__proto__=G}||function(E,G){for(var Y in G)Object.prototype.hasOwnProperty.call(G,Y)&&(E[Y]=G[Y])})(K,c)};function ke(K,c){function E(){this.constructor=K}Se(K,c),K.prototype=c===null?Object.create(c):(E.prototype=c.prototype,new E)}function Ae(K,c,E,G){return new(E||(E=Promise))(function(Y,V){function xe(pt){try{tt(G.next(pt))}catch(Ve){V(Ve)}}function Ge(pt){try{tt(G.throw(pt))}catch(Ve){V(Ve)}}function tt(pt){var Ve;pt.done?Y(pt.value):(Ve=pt.value,Ve instanceof E?Ve:new E(function(At){At(Ve)})).then(xe,Ge)}tt((G=G.apply(K,c||[])).next())})}function Te(K,c){var E,G,Y,V,xe={label:0,sent:function(){if(1&Y[0])throw Y[1];return Y[1]},trys:[],ops:[]};return V={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Ge(tt){return function(pt){return function(Ve){if(E)throw new TypeError("Generator is already executing.");for(;xe;)try{if(E=1,G&&(Y=2&Ve[0]?G.return:Ve[0]?G.throw||((Y=G.return)&&Y.call(G),0):G.next)&&!(Y=Y.call(G,Ve[1])).done)return Y;switch(G=0,Y&&(Ve=[2&Ve[0],Y.value]),Ve[0]){case 0:case 1:Y=Ve;break;case 4:return xe.label++,{value:Ve[1],done:!1};case 5:xe.label++,G=Ve[1],Ve=[0];continue;case 7:Ve=xe.ops.pop(),xe.trys.pop();continue;default:if(!(Y=xe.trys,(Y=Y.length>0&&Y[Y.length-1])||Ve[0]!==6&&Ve[0]!==2)){xe=0;continue}if(Ve[0]===3&&(!Y||Ve[1]>Y[0]&&Ve[1]<Y[3])){xe.label=Ve[1];break}if(Ve[0]===6&&xe.label<Y[1]){xe.label=Y[1],Y=Ve;break}if(Y&&xe.label<Y[2]){xe.label=Y[2],xe.ops.push(Ve);break}Y[2]&&xe.ops.pop(),xe.trys.pop();continue}Ve=c.call(K,xe)}catch(At){Ve=[6,At],G=0}finally{E=Y=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([tt,pt])}}}function ge(){for(var K=0,c=0,E=arguments.length;c<E;c++)K+=arguments[c].length;var G=Array(K),Y=0;for(c=0;c<E;c++)for(var V=arguments[c],xe=0,Ge=V.length;xe<Ge;xe++,Y++)G[Y]=V[xe];return G}var he=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(c,E){for(var G=0,Y=E;G<Y.length;G++){var V=Y[G],xe=V[0],Ge=V[1];c.setAttribute(xe,Ge)}},K.createRect=function(c,E,G){var Y=document.createElementNS("http://www.w3.org/2000/svg","rect");return Y.setAttribute("width",c.toString()),Y.setAttribute("height",E.toString()),G&&K.setAttributes(Y,G),Y},K.createLine=function(c,E,G,Y,V){var xe=document.createElementNS("http://www.w3.org/2000/svg","line");return xe.setAttribute("x1",c.toString()),xe.setAttribute("y1",E.toString()),xe.setAttribute("x2",G.toString()),xe.setAttribute("y2",Y.toString()),V&&K.setAttributes(xe,V),xe},K.createPolygon=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",c),E&&K.setAttributes(G,E),G},K.createCircle=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(c/2).toString()),G.setAttribute("cy",(c/2).toString()),G.setAttribute("r",c.toString()),E&&K.setAttributes(G,E),G},K.createEllipse=function(c,E,G){var Y=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Y.setAttribute("cx",(c/2).toString()),Y.setAttribute("cy",(E/2).toString()),Y.setAttribute("rx",(c/2).toString()),Y.setAttribute("ry",(E/2).toString()),G&&K.setAttributes(Y,G),Y},K.createGroup=function(c){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&K.setAttributes(E,c),E},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(c,E,G,Y,V,xe,Ge){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(tt,[["id",c],["orient",E],["markerWidth",G.toString()],["markerHeight",Y.toString()],["refX",V.toString()],["refY",xe.toString()]]),tt.appendChild(Ge),tt},K.createText=function(c){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),c&&K.setAttributes(E,c),E},K.createTSpan=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=c,E&&K.setAttributes(G,E),G},K.createImage=function(c){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&K.setAttributes(E,c),E},K.createPoint=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=c,G.y=E,G},K.createPath=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",c),E&&K.setAttributes(G,E),G},K}(),re=function(){function K(){}return K.addKey=function(c){K.key=c},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),de=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(c,E,G){var Y=this;return new Promise(function(V){var xe=G!==void 0?G:document.createElement("canvas");c===null&&(Y.markersOnly=!0,Y.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",E.width.baseVal.valueAsString),Ge.setAttribute("height",E.height.baseVal.valueAsString),Ge.setAttribute("viewBox","0 0 "+E.viewBox.baseVal.width.toString()+" "+E.viewBox.baseVal.height.toString()),Ge.innerHTML=E.innerHTML,Y.naturalSize===!0?(Ge.width.baseVal.value=c.naturalWidth,Ge.height.baseVal.value=c.naturalHeight):Y.width!==void 0&&Y.height!==void 0&&(Ge.width.baseVal.value=Y.width,Ge.height.baseVal.value=Y.height),xe.width=Ge.width.baseVal.value,xe.height=Ge.height.baseVal.value;var tt=Ge.outerHTML,pt=xe.getContext("2d");Y.markersOnly!==!0&&pt.drawImage(c,0,0,xe.width,xe.height);var Ve=window.URL,At=new Image(xe.width,xe.height);At.setAttribute("crossOrigin","anonymous");var It=new Blob([tt],{type:"image/svg+xml"}),er=Ve.createObjectURL(It);At.onload=function(){pt.drawImage(At,0,0),Ve.revokeObjectURL(er);var Kr=xe.toDataURL(Y.imageType,Y.imageQuality);V(Kr)},At.src=er})},K}(),se=function(){},Oe=function(){function K(c){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},K.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c: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 oe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new oe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),ie=function(K,c){this.selector=K,this.style=c},oe=function(K,c){this.localName=K,this.style=c},be=function(){function K(c,E,G,Y,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=c,this.displayMode=E,this.markerItems=G,this.uiStyleSettings=Y,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return K.prototype.show=function(c){var E=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",this.uiContainer.appendChild(G),this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(V){var xe=document.createElement("div");xe.className=""+E.toolbarButtonStyleClass.name,xe.setAttribute("data-type-name",V.typeName),xe.innerHTML=V.icon,xe.addEventListener("click",function(){E.markerToolbarButtonClicked(xe,V)}),E.buttons.push(xe),E.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 Y=document.createElement("div");Y.className=this.toolbarBlockStyleClass.name,Y.style.whiteSpace="nowrap",Y.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Y),this.addActionButton(Y,'<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(Y,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},K.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},K.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var c=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var E=0;E<this.markerButtons.length;E++)E<c||E===c&&this.markerButtons.length-1===c?this.markerButtonBlock.appendChild(this.markerButtons[E]):(E===c&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[E]))}},K.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},K.prototype.resetButtonStyles=function(){var c=this;this.buttons.forEach(function(E){E.className=E.className.replace(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name,"").trim(),E.className=E.className.replace(c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:c.toolbarActiveButtonStyleColorsClass.name,"").trim(),E.className+=" "+(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(c,E,G){var Y=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=E,V.setAttribute("data-action",G),V.addEventListener("click",function(){Y.actionToolbarButtonClicked(V,G)}),G){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}c.appendChild(V),this.buttons.push(V)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new oe("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 oe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new oe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new oe("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 oe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new oe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new oe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new oe("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+`
|
|
`))},K.prototype.markerToolbarButtonClicked=function(c,E){this.setActiveButton(c),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("marker",E)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(c,E){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",E)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(c){this.resetButtonStyles(),c.className=c.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),c.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(c){var E=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===c});E&&this.setActiveButton(E)},K.prototype.setCurrentMarker=function(c){var E=this;this.currentMarker=c,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){E.currentMarker===void 0?(G.style.fillOpacity="0.4",G.style.pointerEvents="none"):(G.style.fillOpacity="1",G.style.pointerEvents="all")})},K}(),De=function(){function K(c,E,G,Y){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=E,this.uiStyleSettings=G,this.styles=Y,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new oe("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 oe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var E=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new oe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new oe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new oe("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 oe("toolbox-panel-row_colors",`
|
|
background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new oe("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
|
|
padding: `+E+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new oe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new oe("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;
|
|
`))},K.prototype.show=function(c){var E;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((E=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(c){var E,G,Y=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((E=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((G=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&G!==void 0?G:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var xe;V.uiStyleSettings=Y.uiStyleSettings;var Ge=document.createElement("div");Ge.className=Y.toolboxButtonStyleClass.name+" "+((xe=Y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&xe!==void 0?xe:Y.toolboxButtonStyleColorsClass.name),Ge.innerHTML=V.icon,Ge.title=V.title,Ge.addEventListener("click",function(){Y.panelButtonClick(V)}),Y.panelButtons.push(Ge),Y.buttonRow.appendChild(Ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(c){var E=this,G=-1;if(c!==this.activePanel){G=this.panels.indexOf(c),this.panelRow.innerHTML="";var Y=c.getUi();Y.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Y),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=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){E.displayMode==="inline"?E.panelRow.style.display="none":E.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,xe){var Ge,tt;V.className=E.toolboxButtonStyleClass.name+" "+(xe===G?""+((Ge=E.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ge!==void 0?Ge:E.toolboxActiveButtonStyleColorsClass.name):""+((tt=E.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&tt!==void 0?tt:E.toolboxButtonStyleColorsClass.name))})},K}(),Ne=function(K,c){this.title=K,this.icon=c},Fe=function(K){function c(E,G,Y,V){var xe=K.call(this,E,V||'<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=G,xe.currentColor=Y,xe.setCurrentColor=xe.setCurrentColor.bind(xe),xe.getColorBox=xe.getColorBox.bind(xe),xe}return ke(c,K),c.prototype.getUi=function(){var E=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.whiteSpace="nowrap",this.colors.forEach(function(Y){var V=E.getColorBox(Y);G.appendChild(V),E.colorBoxes.push(V)}),G},c.prototype.getColorBox=function(E){var G=this,Y=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-Y,xe=document.createElement("div");xe.style.display="inline-block",xe.style.boxSizing="content-box",xe.style.width=V-2+"px",xe.style.height=V-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=(V+2)/2+"px",xe.style.borderColor=E===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",xe.addEventListener("click",function(){G.setCurrentColor(E,xe)});var Ge=document.createElement("div");return Ge.style.display="inline-block",Ge.style.width=V-2+"px",Ge.style.height=V-2+"px",Ge.style.backgroundColor=E,Ge.style.borderRadius=V/2+"px",E==="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},c.prototype.setCurrentColor=function(E,G){var Y=this;this.currentColor=E,this.colorBoxes.forEach(function(V){V.style.borderColor=V===G?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(E)},c}(Ne),je=function(){function K(c,E,G){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=E,this.globalSettings=G,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(K.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),K.prototype.ownsTarget=function(c){return!1},Object.defineProperty(K.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),K.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},K.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},K.prototype.pointerDown=function(c,E){},K.prototype.dblClick=function(c,E){},K.prototype.manipulate=function(c){},K.prototype.pointerUp=function(c){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},K.prototype.scale=function(c,E){},K.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},K.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var c=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),c.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(c)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),Ue=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(c){return this.topLeft.ownsTarget(c)?this.topLeft:this.topCenter.ownsTarget(c)?this.topCenter:this.topRight.ownsTarget(c)?this.topRight:this.centerLeft.ownsTarget(c)?this.centerLeft:this.centerRight.ownsTarget(c)?this.centerRight:this.bottomLeft.ownsTarget(c)?this.bottomLeft:this.bottomCenter.ownsTarget(c)?this.bottomCenter:this.bottomRight.ownsTarget(c)?this.bottomRight:void 0},K}(),rt=function(){function K(){this.GRIP_SIZE=10,this.visual=he.createGroup(),this.visual.appendChild(he.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(he.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},K}(),Qe=function(){function K(){}return K.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},K.toSVGMatrix=function(c,E){return c.a=E.a,c.b=E.b,c.c=E.c,c.d=E.d,c.e=E.e,c.f=E.f,c},K}(),qe=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(he.createTransform()),V.setupControlBox(),V}return ke(c,K),Object.defineProperty(c.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"visual",{get:function(){return this._visual},set:function(E){this._visual=E;var G=he.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(E){return!!K.prototype.ownsTarget.call(this,E)||!!(this.controlGrips.findGripByVisual(E)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(E))},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.state==="new"&&(this.left=E.x,this.top=E.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Y=this.unrotatePoint(E);if(this.manipulationStartX=Y.x,this.manipulationStartY=Y.y,this.offsetX=Y.x-this.left,this.offsetY=Y.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(G),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(G)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.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"},c.prototype.pointerUp=function(E){var G=this.state;K.prototype.pointerUp.call(this,E),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(E),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(E){this.visual.style.transform="translate("+E.x+"px, "+E.y+"px)"},c.prototype.manipulate=function(E){var G=this.unrotatePoint(E);this.state==="creating"?this.resize(E):this.state==="move"?(this.left=this.manipulationStartLeft+(G.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(G.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(G):this.state==="rotate"&&this.rotate(E)},c.prototype.resize=function(E){var G=this.manipulationStartLeft,Y=this.manipulationStartWidth,V=this.manipulationStartTop,xe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:G=this.manipulationStartLeft+E.x-this.manipulationStartX,Y=this.manipulationStartWidth+this.manipulationStartLeft-G;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Y=this.manipulationStartWidth+E.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+E.y-this.manipulationStartY,xe=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:xe=this.manipulationStartHeight+E.y-this.manipulationStartY}Y>=0?(this.left=G,this.width=Y):(this.left=G+Y,this.width=-Y),xe>=0?(this.top=V,this.height=xe):(this.top=V+xe,this.height=-xe),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(E){if(Math.abs(E.x-this.centerX)>.1){var G=Math.sign(E.x-this.centerX);this.rotationAngle=180*Math.atan((E.y-this.centerY)/(E.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},c.prototype.applyRotation=function(){var E=this.container.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(E,0)},c.prototype.rotatePoint=function(E){if(this.rotationAngle===0)return E;var G=this.container.getCTM(),Y=he.createPoint(E.x,E.y);return{x:(Y=Y.matrixTransform(G)).x,y:Y.y}},c.prototype.unrotatePoint=function(E){if(this.rotationAngle===0)return E;var G=this.container.getCTM();G=G.inverse();var Y=he.createPoint(E.x,E.y);return{x:(Y=Y.matrixTransform(G)).x,y:Y.y}},c.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=he.createGroup();var E=he.createTransform();E.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(E),this.container.appendChild(this.controlBox),this.controlRect=he.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=he.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ue,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var E=this.controlBox.transform.baseVal.getItem(0);E.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(E,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()},c.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()},c.prototype.createGrip=function(){var E=new rt;return E.visual.transform.baseVal.appendItem(he.createTransform()),this.controlBox.appendChild(E.visual),E},c.prototype.positionGrips=function(){var E=this.controlGrips.topLeft.GRIP_SIZE,G=-E/2,Y=G,V=(this.width+this.CB_DISTANCE)/2-E/2,xe=(this.height+this.CB_DISTANCE)/2-E/2,Ge=this.height+this.CB_DISTANCE-E/2,tt=this.width+this.CB_DISTANCE-E/2;this.positionGrip(this.controlGrips.topLeft.visual,G,Y),this.positionGrip(this.controlGrips.topCenter.visual,V,Y),this.positionGrip(this.controlGrips.topRight.visual,tt,Y),this.positionGrip(this.controlGrips.centerLeft.visual,G,xe),this.positionGrip(this.controlGrips.centerRight.visual,tt,xe),this.positionGrip(this.controlGrips.bottomLeft.visual,G,Ge),this.positionGrip(this.controlGrips.bottomCenter.visual,V,Ge),this.positionGrip(this.controlGrips.bottomRight.visual,tt,Ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,Y-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(E,G,Y){var V=E.transform.baseVal.getItem(0);V.setTranslate(G,Y),E.transform.baseVal.replaceItem(V,0)},c.prototype.hideControlBox=function(){this.controlBox.style.display="none"},c.prototype.showControlBox=function(){this.controlBox.style.display=""},c.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},c.prototype.restoreState=function(E){K.prototype.restoreState.call(this,E);var G=E;this.left=G.left,this.top=G.top,this.width=G.width,this.height=G.height,this.rotationAngle=G.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,G.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,G.containerTransformMatrix))},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G);var Y=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:Y.x*E,y:Y.y*G});this.left=V.x,this.top=V.y,this.width=this.width*E,this.height=this.height*G,this.adjustControlBox()},c}(je),Ye=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return ke(c,K),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.visual)},c.prototype.createVisual=function(){this.visual=he.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)},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},c.prototype.manipulate=function(E){K.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){K.prototype.resize.call(this,E),this.setSize()},c.prototype.setSize=function(){K.prototype.setSize.call(this),he.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(E){K.prototype.pointerUp.call(this,E),this.setSize()},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&he.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},c.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&he.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&he.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&he.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this))},c.prototype.restoreState=function(E){var G=E;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,E),this.setSize()},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G),this.setSize()},c.title="Rectangle marker",c}(qe),nt=function(K){function c(E,G,Y,V){var xe=K.call(this,E,V||'<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=G,xe.currentWidth=Y,xe.setCurrentWidth=xe.setCurrentWidth.bind(xe),xe}return ke(c,K),c.prototype.getUi=function(){var E=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.widths.forEach(function(Y){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=Y===E.currentWidth?E.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){E.setCurrentWidth(Y,V)}),G.appendChild(V);var xe=document.createElement("div");xe.innerText=Y.toString(),xe.style.marginRight="5px",V.appendChild(xe);var Ge=document.createElement("div");Ge.style.minHeight="20px",Ge.style.flexGrow="2",Ge.style.display="flex",Ge.style.alignItems="center";var tt=document.createElement("hr");tt.style.minWidth="20px",tt.style.border="0px",tt.style.borderTop=Y+"px solid "+E.uiStyleSettings.toolboxColor,tt.style.flexGrow="2",Ge.appendChild(tt),V.appendChild(Ge),E.widthBoxes.push(V)}),G},c.prototype.setCurrentWidth=function(E,G){var Y=this;this.currentWidth=E,this.widthBoxes.forEach(function(V){V.style.borderColor=V===G?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(Ne),$e=function(K){function c(E,G,Y,V){var xe=K.call(this,E,V||'<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=G,xe.currentStyle=Y,xe.setCurrentStyle=xe.setCurrentStyle.bind(xe),xe}return ke(c,K),c.prototype.getUi=function(){var E=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.styles.forEach(function(Y){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/E.styles.length-5+"%",V.style.borderColor=Y===E.currentStyle?E.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){E.setCurrentStyle(Y,V)}),G.appendChild(V);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="`+E.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Y!==""?'stroke-dasharray="'+Y+'"':"")+` />
|
|
</svg>`;xe.innerHTML=Ge,V.appendChild(xe),E.styleBoxes.push(V)}),G},c.prototype.setCurrentStyle=function(E,G){var Y=this;this.currentStyle=E,this.styleBoxes.forEach(function(V){V.style.borderColor=V===G?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(Ne),et=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.strokeColor=Y.defaultColor,V.strokeWidth=Y.defaultStrokeWidth,V.strokeDasharray=Y.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",Y.defaultColorSet,Y.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new nt("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new $e("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return ke(c,K),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=K.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="FrameMarker",c.title="Frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',c}(Ye),_e=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Je=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return ke(c,K),c.prototype.ownsTarget=function(E){return!!K.prototype.ownsTarget.call(this,E)||!(!this.grip1.ownsTarget(E)&&!this.grip2.ownsTarget(E))},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.manipulationStartX=E.x,this.manipulationStartY=E.y,this.state==="new"&&(this.x1=E.x,this.y1=E.y,this.x2=E.x,this.y2=E.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(G)?this.activeGrip=this.grip1:this.grip2.ownsTarget(G)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(E){var G=this.state;K.prototype.pointerUp.call(this,E),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(E),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(E){this.state==="creating"?this.resize(E):this.state==="move"?(this.x1=this.manipulationStartX1+E.x-this.manipulationStartX,this.y1=this.manipulationStartY1+E.y-this.manipulationStartY,this.x2=this.manipulationStartX2+E.x-this.manipulationStartX,this.y2=this.manipulationStartY2+E.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(E)},c.prototype.resize=function(E){switch(this.activeGrip){case this.grip1:this.x1=E.x,this.y1=E.y;break;case this.grip2:case void 0:this.x2=E.x,this.y2=E.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=he.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){this.positionGrips()},c.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},c.prototype.createGrip=function(){var E=new rt;return E.visual.transform.baseVal.appendItem(he.createTransform()),this.controlBox.appendChild(E.visual),E},c.prototype.positionGrips=function(){var E=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-E/2,this.y1-E/2),this.positionGrip(this.grip2.visual,this.x2-E/2,this.y2-E/2)},c.prototype.positionGrip=function(E,G,Y){var V=E.transform.baseVal.getItem(0);V.setTranslate(G,Y),E.transform.baseVal.replaceItem(V,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},c.prototype.restoreState=function(E){K.prototype.restoreState.call(this,E);var G=E;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G),this.x1=this.x1*E,this.y1=this.y1*G,this.x2=this.x2*E,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},c}(je),st=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=Y.defaultColor,V.strokeWidth=Y.defaultStrokeWidth,V.strokeDasharray=Y.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",Y.defaultColorSet,Y.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new nt("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new $e("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return ke(c,K),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorLine&&E!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=he.createGroup(),this.selectorLine=he.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=he.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)},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},c.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()),he.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),he.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),he.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){K.prototype.restoreState.call(this,E);var G=E;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',c}(Je),Be=function(K){function c(E,G,Y,V){var xe=K.call(this,E,V||'<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=G,xe.currentFont=Y,xe.setCurrentFont=xe.setCurrentFont.bind(xe),xe}return ke(c,K),c.prototype.getUi=function(){var E=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.flexGrow="2",this.fonts.forEach(function(Y){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/E.fonts.length-5+"%",V.style.borderColor=Y===E.currentFont?E.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){E.setCurrentFont(Y,V)}),G.appendChild(V);var xe=document.createElement("div");xe.style.display="flex",xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.fontFamily=Y,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),V.appendChild(xe),E.fontBoxes.push(V)}),G},c.prototype.setCurrentFont=function(E,G){var Y=this;this.currentFont=E,this.fontBoxes.forEach(function(V){V.style.borderColor=V===G?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(Ne),ze=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=Y.defaultColor,V.fontFamily=Y.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Fe("Color",Y.defaultColorSet,Y.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new Be("Font",Y.defaultFontFamilies,Y.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return ke(c,K),c.prototype.ownsTarget=function(E){if(K.prototype.ownsTarget.call(this,E)||E===this.visual||E===this.textElement||E===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function(Y){Y===E&&(G=!0)}),G},c.prototype.createVisual=function(){this.visual=he.createGroup(),this.bgRectangle=he.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=he.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(he.createTransform()),this.textElement.transform.baseVal.appendItem(he.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.isMoved=!1,this.pointerDownPoint=E,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},c.prototype.renderText=function(){var E=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(G){E.textElement.appendChild(he.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var E=this.textElement.getBBox(),G=1;if(E.width>0&&E.height>0){var Y=(1*this.width-this.width*this.padding*2/100)/E.width,V=(1*this.height-this.height*this.padding*2/100)/E.height;G=Math.min(Y,V)}return G},c.prototype.getTextPosition=function(E){var G=this.textElement.getBBox(),Y=0,V=0;return G.width>0&&G.height>0&&(Y=(this.width-G.width*E)/2,V=this.height/2-G.height*E/2),{x:Y,y:V}},c.prototype.sizeText=function(){var E=this.textElement.getBBox(),G=this.getTextScale(),Y=this.getTextPosition(G);Y.y-=E.y*G,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Y.x+"px, "+Y.y+"px) scale("+G+", "+G+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Y.x,Y.y),this.textElement.transform.baseVal.getItem(1).setScale(G,G))},c.prototype.manipulate=function(E){K.prototype.manipulate.call(this,E),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(E.x-this.pointerDownPoint.x)>5||Math.abs(E.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(E){K.prototype.resize.call(this,E),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(he.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),he.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(E){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,E),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var E=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(G){G.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var G=Number.parseFloat(E.textEditor.style.fontSize);E.textEditor.clientWidth>=Number.parseInt(E.textEditor.style.maxWidth)&&G>.9;)G-=.1,E.textEditor.style.fontSize=Math.max(G,.9)+"em"}),this.textEditor.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(G){if(G.clipboardData){var Y=G.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode(Y)),G.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){E.textEditDivClicked(E.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},c.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var E=this.getTextScale(),G=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Y=this.textElement.getBBox(),V={x:Y.width*E,y:Y.height*E};G.x-=V.x/2,G.y-=V.y/2,this.textEditor.style.top=G.y+"px",this.textEditor.style.left=G.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-G.x+"px",this.textEditor.style.fontSize=Math.max(16*E,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(E){this.text=E.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},c.prototype.dblClick=function(E,G){K.prototype.dblClick.call(this,E,G),this.showTextEditor()},c.prototype.setColor=function(E){this.textElement&&he.setAttributes(this.textElement,[["fill",E]]),this.color=E,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(E)},c.prototype.setFont=function(E){this.textElement&&he.setAttributes(this.textElement,[["font-family",E]]),this.fontFamily=E,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},c.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},c.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){var G=E;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),K.prototype.restoreState.call(this,E),this.setSize()},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.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>',c}(qe),Ce=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=Y.defaultColor,V.lineWidth=Y.defaultStrokeWidth,V.pixelRatio=Y.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Fe("Color",Y.defaultColorSet,Y.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new nt("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return ke(c,K),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=he.createGroup(),this.drawingImage=he.createImage(),this.visual.appendChild(this.drawingImage);var E=he.createTransform();this.visual.transform.baseVal.appendItem(E),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(E,G){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(E.x,E.y),this.drawing=!0):K.prototype.pointerDown.call(this,E,G)},c.prototype.manipulate=function(E){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(E.x,E.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){K.prototype.resize.call(this,E),he.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),he.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(E){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,E)},c.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)},c.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var E=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),G=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Y=G[0],V=G[1],xe=G[2],Ge=G[3],tt=!1,pt=0;pt<this.canvasElement.height;pt++)for(var Ve=0;Ve<this.canvasElement.width;Ve++)E.data[pt*this.canvasElement.width*4+4*Ve+3]>0&&(tt=!0,pt<V&&(V=pt),Ve<Y&&(Y=Ve),pt>Ge&&(Ge=pt),Ve>xe&&(xe=Ve));if(tt){this.left=Y/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(xe-Y)/this.pixelRatio,this.height=(Ge-V)/this.pixelRatio;var At=document.createElement("canvas");At.width=xe-Y,At.height=Ge-V,At.getContext("2d").putImageData(this.canvasContext.getImageData(Y,V,xe-Y,Ge-V),0,0),this.drawingImgUrl=At.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){he.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),he.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(E){this.color=E,this.colorChanged(E)},c.prototype.setLineWidth=function(E){this.lineWidth=E},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){this.createVisual(),K.prototype.restoreState.call(this,E),this.drawingImgUrl=E.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.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>',c}(qe),me=function(K){function c(E,G,Y){var V=K.call(this,E,Y||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=G,V.setCurrentType=V.setCurrentType.bind(V),V}return ke(c,K),c.prototype.getUi=function(){var E=this,G=document.createElement("div");G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2";for(var Y=function(Ge){var tt="both";switch(Ge){case 0:tt="both";break;case 1:tt="start";break;case 2:tt="end";break;case 3:tt="none"}var pt=document.createElement("div");if(pt.style.display="flex",pt.style.flexGrow="2",pt.style.alignItems="center",pt.style.justifyContent="space-between",pt.style.padding="5px",pt.style.borderWidth="2px",pt.style.borderStyle="solid",pt.style.borderColor=tt===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",pt.addEventListener("click",function(){E.setCurrentType(tt,pt)}),G.appendChild(pt),tt==="both"||tt==="start"){var Ve=document.createElement("div");Ve.style.display="flex",Ve.style.alignItems="center",Ve.style.minHeight="20px",Ve.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ve.style.marginLeft="5px",pt.appendChild(Ve)}var At=document.createElement("div");At.style.display="flex",At.style.alignItems="center",At.style.minHeight="20px",At.style.flexGrow="2";var It=document.createElement("hr");if(It.style.minWidth="20px",It.style.border="0px",It.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),It.style.flexGrow="2",At.appendChild(It),pt.appendChild(At),tt==="both"||tt==="end"){var er=document.createElement("div");er.style.display="flex",er.style.alignItems="center",er.style.minHeight="20px",er.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,er.style.marginRight="5px",pt.appendChild(er)}V.typeBoxes.push(pt)},V=this,xe=0;xe<4;xe++)Y(xe);return G},c.prototype.setCurrentType=function(E,G){var Y=this;this.currentType=E,this.typeBoxes.forEach(function(V){V.style.borderColor=V===G?Y.uiStyleSettings!==void 0?Y.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(Ne),Ee=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new me("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return ke(c,K),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.arrow1&&E!==this.arrow2)},c.prototype.getArrowPoints=function(E,G){var Y=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return E-Y/2+","+(G+V/2)+" "+E+","+(G-V/2)+" "+(E+Y/2)+","+(G+V/2)},c.prototype.createTips=function(){this.arrow1=he.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(he.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=he.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(he.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",he.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),he.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.arrow1.transform.baseVal.getItem(0);G.setRotate(E,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var Y=this.arrow2.transform.baseVal.getItem(0);Y.setRotate(E+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Y,0)}},c.prototype.setArrowType=function(E){this.arrowType=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){K.prototype.restoreState.call(this,E);var G=E;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',c}(st),ne=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.fillColor=Y.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Fe("Color",Y.defaultColorSet,Y.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return ke(c,K),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=K.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="CoverMarker",c.title="Cover marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',c}(Ye),ae=function(K){function c(E,G,Y,V){var xe=K.call(this,E,V||'<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=G,xe.currentOpacity=Y,xe.setCurrentOpacity=xe.setCurrentOpacity.bind(xe),xe}return ke(c,K),c.prototype.getUi=function(){var E=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",G.style.justifyContent="space-between",this.opacities.forEach(function(Y){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=Y===E.currentOpacity?E.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){E.setCurrentOpacity(Y,V)}),G.appendChild(V);var xe=document.createElement("div");xe.innerText=100*Y+"%",V.appendChild(xe),E.opacityBoxes.push(V)}),G},c.prototype.setCurrentOpacity=function(E,G){var Y=this;this.currentOpacity=E,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===G?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(Ne),ce=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=Y.defaultHighlightColor,V.strokeWidth=0,V.opacity=Y.defaultHighlightOpacity,V.fillPanel=new Fe("Color",Y.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new ae("Opacity",Y.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return ke(c,K),c.prototype.setOpacity=function(E){this.opacity=E,this.visual&&he.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=K.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="HighlightMarker",c.title="Highlight marker",c.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>',c}(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>',Ie=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=Y.defaultStrokeColor,V.bgColor=Y.defaultFillColor,V.fontFamily=Y.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Fe("Text color",Y.defaultColorSet,V.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>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Fe("Fill color",Y.defaultColorSet,V.bgColor,ve),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new Be("Font",Y.defaultFontFamilies,Y.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new rt,V.tipGrip.visual.transform.baseVal.appendItem(he.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return ke(c,K),c.prototype.ownsTarget=function(E){return K.prototype.ownsTarget.call(this,E)||this.tipGrip.ownsTarget(E)||this.tip===E},c.prototype.createTip=function(){he.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=he.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(E,G){this.state==="new"&&K.prototype.pointerDown.call(this,E,G),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(G)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,E,G)},c.prototype.pointerUp=function(E){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,E);else{var G=this.state==="creating";K.prototype.pointerUp.call(this,E),this.setTipPoints(G),this.positionTip()}},c.prototype.manipulate=function(E){if(this.tipMoving){var G=this.unrotatePoint(E);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,E)},c.prototype.setBgColor=function(E){this.bgRectangle&&this.tip&&(he.setAttributes(this.bgRectangle,[["fill",E]]),he.setAttributes(this.tip,[["fill",E]])),this.bgColor=E,this.fillColorChanged(E)},c.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},c.prototype.setTipPoints=function(E){E===void 0&&(E=!1);var G=Math.min(this.height/2,15),Y=this.height/5;E&&(this.tipPosition={x:G+Y/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Y=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:0},this.tipBase2Position={x:G+Y,y:0}):(this.tipBase1Position={x:0,y:G},this.tipBase2Position={x:0,y:G+Y}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Y=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-Y,y:0},this.tipBase2Position={x:this.width-G,y:0}):(this.tipBase1Position={x:this.width,y:G},this.tipBase2Position={x:this.width,y:G+Y}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Y=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-Y,y:this.height},this.tipBase2Position={x:this.width-G,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-G-Y},this.tipBase2Position={x:this.width,y:this.height-G}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Y=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:this.height},this.tipBase2Position={x:G+Y,y:this.height}):(this.tipBase1Position={x:0,y:this.height-G},this.tipBase2Position={x:0,y:this.height-G-Y})},c.prototype.resize=function(E){K.prototype.resize.call(this,E),this.positionTip()},c.prototype.positionTip=function(){he.setAttributes(this.tip,[["points",this.getTipPoints()]]);var E=this.tipGrip.visual.transform.baseVal.getItem(0);E.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(E,0)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},c.prototype.getState=function(){var E=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){var G=E;this.bgColor=G.bgColor,this.tipPosition=G.tipPosition,K.prototype.restoreState.call(this,E),this.createTip(),this.setTipPoints()},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G),this.tipPosition={x:this.tipPosition.x*E,y:this.tipPosition.y*G},this.positionTip()},c.typeName="CalloutMarker",c.title="Callout marker",c.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>',c}(ze),we=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=Y.defaultColor,V.strokeWidth=Y.defaultStrokeWidth,V.strokeDasharray=Y.defaultStrokeDasharray,V.fillColor=Y.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Fe("Line color",ge(Y.defaultColorSet,["transparent"]),Y.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Fe("Fill color",ge(Y.defaultColorSet,["transparent"]),V.fillColor,ve),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new nt("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new $e("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new ae("Opacity",Y.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return ke(c,K),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.visual)},c.prototype.createVisual=function(){this.visual=he.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)},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},c.prototype.manipulate=function(E){K.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){K.prototype.resize.call(this,E),this.setSize()},c.prototype.setSize=function(){K.prototype.setSize.call(this),he.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},c.prototype.pointerUp=function(E){K.prototype.pointerUp.call(this,E),this.setSize()},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&he.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},c.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&he.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(E),this.stateChanged()},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&he.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&he.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(E){this.opacity=E,this.visual&&he.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){var G=E;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,E),this.setSize()},c.prototype.scale=function(E,G){K.prototype.scale.call(this,E,G),this.setSize()},c.typeName="EllipseMarker",c.title="Ellipse marker",c.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>',c}(qe),Ke=function(K){function c(E,G,Y){return K.call(this,E,G,Y)||this}return ke(c,K),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.tip1&&E!==this.tip2)},c.prototype.createTips=function(){this.tip1=he.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(he.createTransform()),this.visual.appendChild(this.tip1),this.tip2=he.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(he.createTransform()),this.visual.appendChild(this.tip2)},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(he.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()]]),he.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 E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.tip1.transform.baseVal.getItem(0);G.setRotate(E,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var Y=this.tip2.transform.baseVal.getItem(0);Y.setRotate(E+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Y,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=K.prototype.getState.call(this);return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){K.prototype.restoreState.call(this,E),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.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>',c}(st),ot=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.strokePanel.colors=Y.defaultColorSet,V.fillColor="transparent",V}return ke(c,K),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=K.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.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>',c}(we),ct=function(){function K(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),K.prototype.addUndoStep=function(c){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(c)||(this.undoStack.push(c),JSON.stringify(this.lastRedoStep)!==JSON.stringify(c)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},K.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},K.prototype.undo=function(){if(this.undoStack.length>1){var c=this.undoStack.pop();return c!==void 0&&this.redoStack.push(c),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},K.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},K}(),dt=function(K){function c(E,G,Y){var V=K.call(this,E,G,Y)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=Y.defaultColor,V.strokeWidth=Y.defaultStrokeWidth,V.strokeDasharray=Y.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",Y.defaultColorSet,Y.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new nt("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new $e("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return ke(c,K),c.prototype.ownsTarget=function(E){return!(!K.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorCurve&&E!==this.visibleCurve&&!this.curveGrip.ownsTarget(E))},c.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},c.prototype.createVisual=function(){this.visual=he.createGroup(),this.selectorCurve=he.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=he.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)},c.prototype.pointerDown=function(E,G){K.prototype.pointerDown.call(this,E,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=E.x,this.curveY=E.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(this.activeGrip=this.curveGrip,this._state="resize")},c.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),he.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),he.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),he.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=he.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=he.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)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var E=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-E/2,this.curveY-E/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()))},c.prototype.manipulate=function(E){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+E.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+E.y-this.manipulationStartY),K.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){this.activeGrip===this.curveGrip&&(this.curveX=E.x,this.curveY=E.y),K.prototype.resize.call(this,E),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual()},c.prototype.scale=function(E,G){this.curveX=this.curveX*E,this.curveY=this.curveY*G,K.prototype.scale.call(this,E,G)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){K.prototype.restoreState.call(this,E);var G=E;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.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>',c}(Je),Lt=function(){function K(c,E){E===void 0&&(E=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=E}return Object.defineProperty(K.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),K.prototype.preventDefault=function(){this._defaultPrevented=!0},K}(),wt=function(K){function c(E,G,Y){var V=K.call(this,E,!1)||this;return V.dataUrl=G,V.state=Y,V}return ke(c,K),c}(Lt),ft=function(K){function c(E,G,Y){Y===void 0&&(Y=!1);var V=K.call(this,E,Y)||this;return V.marker=G,V}return ke(c,K),c}(Lt),zt=function(){function K(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return K.prototype.addEventListener=function(c,E){this[c].push(E)},K.prototype.removeEventListener=function(c,E){var G=this[c].indexOf(E);G>-1&&this[c].splice(G,1)},K}(),Ft=function(){function K(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new _e,this._isOpen=!1,this.undoRedoManager=new 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 zt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new Oe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=c,this.targetRoot=document.body,this.width=c.clientWidth,this.height=c.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[et,Ce,Ee,ze,ot,we,ce,Ie,Ke,ne,st,dt]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[et,Ce,Ee,ze,we,ce,Ie]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[et,Ce,Ee,ze,ce]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var E=this;this._availableMarkerTypes.splice(0),c.forEach(function(G){if(typeof G=="string"){var Y=E.ALL_MARKER_TYPES.find(function(V){return V.typeName===G});Y!==void 0&&E._availableMarkerTypes.push(Y)}else E._availableMarkerTypes.push(G)})},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(c){this._zoomLevel=c,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},K.prototype.show=function(){var c=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(E){return E(new Lt(c))})},K.prototype.render=function(){return Ae(this,void 0,void 0,function(){var c;return Te(this,function(E){switch(E.label){case 0:return this.setCurrentMarker(),(c=new de).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.markersOnly=this.renderMarkersOnly,c.width=this.renderWidth,c.height=this.renderHeight,[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return E.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,E.sent()]}})})},K.prototype.close=function(c){var E=this;if(c===void 0&&(c=!1),this.isOpen){var G=!1;c||this.eventListeners.beforeclose.forEach(function(Y){var V=new Lt(E,!0);Y(V),V.defaultPrevented&&(G=!0)}),G||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Y){return Y(new Lt(E))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var c,E=[],G=0;G<arguments.length;G++)E[G]=arguments[G];(c=this._availableMarkerTypes).push.apply(c,E)},K.prototype.addRenderEventListener=function(c){this.addEventListener("render",function(E){c(E.dataUrl,E.state)})},K.prototype.removeRenderEventListener=function(c){},K.prototype.addCloseEventListener=function(c){this.addEventListener("close",function(){c()})},K.prototype.removeCloseEventListener=function(c){},K.prototype.setupResizeObserver=function(){var c=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return c.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var c=1*this.target.clientWidth/this.target.clientHeight,E=this.editorCanvas.clientWidth/c>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,G=E<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/c;this.resize(E,G)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(c,E){this._isResizing=!0;var G=c/this.imageWidth,Y=E/this.imageHeight;this.imageWidth=Math.round(c),this.imageHeight=Math.round(E),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(G,Y),this._isResizing=!1},K.prototype.scaleMarkers=function(c,E){var G,Y=this;this._currentMarker&&this._currentMarker instanceof ze?this._currentMarker.scale(c,E):(G=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==Y._currentMarker&&V.scale(c,E)}),G!==void 0&&this.setCurrentMarker(G)},K.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},K.prototype.setTopLeft=function(){var c=this.editingTarget.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=c.left-E.left,this.top=c.top-E.top},K.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},K.prototype.addDefs=function(){for(var c,E=[],G=0;G<arguments.length;G++)E[G]=arguments[G];this.defs=he.createDefs(),this.addDefsToImage(),(c=this.defs).append.apply(c,E)},K.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},K.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},K.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},K.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},K.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},K.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},K.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},K.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var c=document.createElement("a");c.href="https://markerjs.com/",c.target="_blank",c.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>',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},K.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},K.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"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 be(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 De(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},K.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.removeMarker=function(c){this.markerImage.removeChild(c.container),this.markers.indexOf(c)>-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},K.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},K.prototype.toolbarButtonClicked=function(c,E){if(c==="marker"&&E!==void 0)this.createNewMarker(E);else if(c==="action")switch(E){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},K.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var E=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Y){var V=new ft(c,c._currentMarker,!0);Y(V),V.defaultPrevented&&(E=!0)}),!E){var G=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Y){return Y(new ft(c,G))})}}},K.prototype.clear=function(){var c=this,E=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(xe){var Ge=new ft(c,void 0,!0);xe(Ge),Ge.defaultPrevented&&(E=!0)}),!E)){this.setCurrentMarker();for(var G=function(xe){var Ge=Y.markers[xe];Y.setCurrentMarker(Y.markers[xe]),Y._currentMarker.dispose(),Y.markerImage.removeChild(Y._currentMarker.container),Y.markers.splice(Y.markers.indexOf(Y._currentMarker),1),Y.eventListeners.markerdelete.forEach(function(tt){return tt(new ft(c,Ge))})},Y=this,V=this.markers.length-1;V>=0;V--)G(V);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.prototype.showNotesEditor=function(){var c;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=(c=this._currentMarker.notes)!==null&&c!==void 0?c:"",this.overlayContainer.appendChild(this.notesArea))},K.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},K.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},K.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var E=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===E.width&&G.height===E.height){var Y=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(E),Y<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new Lt(c))})}else this.undoRedoManager.replaceLastUndoStep(E),this.eventListeners.statechange.forEach(function(V){return V(new Lt(c))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var c=this,E=this.undoRedoManager.undo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Lt(c))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var c=this,E=this.undoRedoManager.redo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Lt(c))}))},K.prototype.stepZoom=function(){var c=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=c<this.zoomSteps.length-1?this.zoomSteps[c+1]:this.zoomSteps[0]},K.prototype.panTo=function(c){this.contentDiv.scrollBy({left:this.prevPanPoint.x-c.x,top:this.prevPanPoint.y-c.y}),this.prevPanPoint=c},K.prototype.startRenderAndClose=function(){return Ae(this,void 0,void 0,function(){var c,E,G=this;return Te(this,function(Y){switch(Y.label){case 0:return[4,this.render()];case 1:return c=Y.sent(),E=this.getState(),this.eventListeners.render.forEach(function(V){return V(new wt(G,c,E))}),this.close(!0),[2]}})})},K.prototype.getState=function(c){c===!0&&this.setCurrentMarker();var E={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(G){return E.markers.push(G.getState())}),E},K.prototype.restoreState=function(c){var E=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);c.markers.forEach(function(G){var Y=E._availableMarkerTypes.find(function(xe){return xe.typeName===G.typeName});if(Y!==void 0){var V=E.addNewMarker(Y);V.restoreState(G),E.markers.push(V)}}),c.width&&c.height&&(c.width!==this.imageWidth||c.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/c.width,this.imageHeight/c.height),this.eventListeners.restorestate.forEach(function(G){return G(new Lt(E))})},K.prototype.addNewMarker=function(c){var E=he.createGroup();return this.markerImage.appendChild(E),new c(E,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(c){var E,G=this;(E=typeof c=="string"?this._availableMarkerTypes.find(function(Y){return Y.typeName===c}):c)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(E),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(E.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Y){return Y(new ft(G,G._currentMarker))}))},K.prototype.markerCreated=function(c){var E=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(c),this.setCurrentMarker(c),c instanceof Ce&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ce):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(G){return G(new ft(E,E._currentMarker))})},K.prototype.colorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=c,this.settings.defaultStrokeColor=c)},K.prototype.fillColorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=c)},K.prototype.markerStateChanged=function(c){var E=this;this.eventListeners.markerchange.forEach(function(G){return G(new ft(E,c))})},K.prototype.setCurrentMarker=function(c){var E=this;this._currentMarker!==c&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(G){return G(new ft(E,E._currentMarker))})),this._currentMarker=c,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(G){return G(new ft(E,E._currentMarker))}))},K.prototype.onPointerDown=function(c){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||c.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var E=this.markers.find(function(G){return G.ownsTarget(c.target)});E!==void 0?(this.setCurrentMarker(E),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:c.clientX,y:c.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY))},K.prototype.onDblClick=function(c){if(this._isFocused||this.focus(),this.mode==="select"){var E=this.markers.find(function(G){return G.ownsTarget(c.target)});E!==void 0&&E!==this._currentMarker&&this.setCurrentMarker(E),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(c){this.touchPoints!==1&&c.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||c.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(c.clientX,c.clientY)):this.zoomLevel>1&&this.panTo({x:c.clientX,y:c.clientY}))},K.prototype.onPointerUp=function(c){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(c.clientX,c.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(c,E){var G=this.markerImage.getBoundingClientRect();return{x:(c-G.left)/this.zoomLevel,y:(E-G.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},K.prototype.addLicenseKey=function(c){re.addKey(c)},K.prototype.addEventListener=function(c,E){this.eventListeners.addEventListener(c,E)},K.prototype.removeEventListener=function(c,E){this.eventListeners.removeEventListener(c,E)},K.prototype.renderState=function(c){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(c),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var c=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(E){return E(new Lt(c))}))},K.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(E){return E(new Lt(c))}))},K.instanceCounter=0,K}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Jt=function(K,c){return(Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,G){E.__proto__=G}||function(E,G){for(var Y in G)Object.prototype.hasOwnProperty.call(G,Y)&&(E[Y]=G[Y])})(K,c)};function Ht(K,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function E(){this.constructor=K}Jt(K,c),K.prototype=c===null?Object.create(c):(E.prototype=c.prototype,new E)}function Rt(K,c,E,G){return new(E||(E=Promise))(function(Y,V){function xe(pt){try{tt(G.next(pt))}catch(Ve){V(Ve)}}function Ge(pt){try{tt(G.throw(pt))}catch(Ve){V(Ve)}}function tt(pt){var Ve;pt.done?Y(pt.value):(Ve=pt.value,Ve instanceof E?Ve:new E(function(At){At(Ve)})).then(xe,Ge)}tt((G=G.apply(K,c||[])).next())})}function Ur(K,c){var E,G,Y,V,xe={label:0,sent:function(){if(1&Y[0])throw Y[1];return Y[1]},trys:[],ops:[]};return V={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Ge(tt){return function(pt){return function(Ve){if(E)throw new TypeError("Generator is already executing.");for(;xe;)try{if(E=1,G&&(Y=2&Ve[0]?G.return:Ve[0]?G.throw||((Y=G.return)&&Y.call(G),0):G.next)&&!(Y=Y.call(G,Ve[1])).done)return Y;switch(G=0,Y&&(Ve=[2&Ve[0],Y.value]),Ve[0]){case 0:case 1:Y=Ve;break;case 4:return xe.label++,{value:Ve[1],done:!1};case 5:xe.label++,G=Ve[1],Ve=[0];continue;case 7:Ve=xe.ops.pop(),xe.trys.pop();continue;default:if(!(Y=xe.trys,(Y=Y.length>0&&Y[Y.length-1])||Ve[0]!==6&&Ve[0]!==2)){xe=0;continue}if(Ve[0]===3&&(!Y||Ve[1]>Y[0]&&Ve[1]<Y[3])){xe.label=Ve[1];break}if(Ve[0]===6&&xe.label<Y[1]){xe.label=Y[1],Y=Ve;break}if(Y&&xe.label<Y[2]){xe.label=Y[2],xe.ops.push(Ve);break}Y[2]&&xe.ops.pop(),xe.trys.pop();continue}Ve=c.call(K,xe)}catch(At){Ve=[6,At],G=0}finally{E=Y=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([tt,pt])}}}var Zr=function(){function K(){}return K.addKey=function(c){K.key=c},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),bt=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(c,E){for(var G=0,Y=E;G<Y.length;G++){var V=Y[G],xe=V[0],Ge=V[1];c.setAttribute(xe,Ge)}},K.createRect=function(c,E,G){var Y=document.createElementNS("http://www.w3.org/2000/svg","rect");return Y.setAttribute("width",c.toString()),Y.setAttribute("height",E.toString()),G&&K.setAttributes(Y,G),Y},K.createLine=function(c,E,G,Y,V){var xe=document.createElementNS("http://www.w3.org/2000/svg","line");return xe.setAttribute("x1",c.toString()),xe.setAttribute("y1",E.toString()),xe.setAttribute("x2",G.toString()),xe.setAttribute("y2",Y.toString()),V&&K.setAttributes(xe,V),xe},K.createPolygon=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",c),E&&K.setAttributes(G,E),G},K.createCircle=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(c/2).toString()),G.setAttribute("cy",(c/2).toString()),G.setAttribute("r",c.toString()),E&&K.setAttributes(G,E),G},K.createEllipse=function(c,E,G){var Y=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Y.setAttribute("cx",(c/2).toString()),Y.setAttribute("cy",(E/2).toString()),Y.setAttribute("rx",(c/2).toString()),Y.setAttribute("ry",(E/2).toString()),G&&K.setAttributes(Y,G),Y},K.createGroup=function(c){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&K.setAttributes(E,c),E},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(c,E,G,Y,V,xe,Ge){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(tt,[["id",c],["orient",E],["markerWidth",G.toString()],["markerHeight",Y.toString()],["refX",V.toString()],["refY",xe.toString()]]),tt.appendChild(Ge),tt},K.createText=function(c){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),c&&K.setAttributes(E,c),E},K.createTSpan=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=c,E&&K.setAttributes(G,E),G},K.createImage=function(c){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&K.setAttributes(E,c),E},K.createPoint=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=c,G.y=E,G},K.createPath=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",c),E&&K.setAttributes(G,E),G},K.createElement=function(c,E){var G=document.createElementNS("http://www.w3.org/2000/svg",c);return E&&K.setAttributes(G,E),G},K.getHollowRectanglePath=function(c,E,G,Y,V,xe,Ge,tt){return"M"+c+","+E+"V"+(E+Y)+"H"+(c+G)+"V"+E+"H"+V+"V"+xe+"H"+(V+Ge)+"V"+(xe+tt)+"H"+V+"V"+E+"Z"},K}(),Ct=function(){function K(c){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},K.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c: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 xt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new xt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),lt=function(K,c){this.selector=K,this.style=c},xt=function(K,c){this.localName=K,this.style=c},Zt=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(c){c.className=this.blockClassName,c.buttonClassName=this.buttonClassName,c.buttonColorsClassName=this.buttonColorsClassName,c.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(c)},K.prototype.addElementBlock=function(c){c.className===void 0&&(c.className=this.blockClassName),this.blocks.push(c)},K.prototype.getUI=function(){var c=document.createElement("div");return c.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,c.style.display=this.display,this.blocks.forEach(function(E){return c.appendChild(E.getUI())}),c},K}(),nr=function(){function K(){}return K.prototype.getUI=function(){var c=document.createElement("div");if(c.className=this.className,this.minWidth!==void 0&&(c.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":c.style.justifyContent="flex-start";break;case"center":c.style.justifyContent="center";break;case"end":c.style.justifyContent="flex-end"}return c.style.whiteSpace="nowrap",c},K}(),rr=function(K){function c(){var E=K!==null&&K.apply(this,arguments)||this;return E.buttons=[],E}return Ht(c,K),c.prototype.addButton=function(E){E.className=this.buttonClassName,E.colorsClassName=this.buttonColorsClassName,E.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(E)},c.prototype.getUI=function(){var E=K.prototype.getUI.call(this);return this.buttons.forEach(function(G){return E.appendChild(G.getUI())}),E},c}(nr),kt=function(){function K(c,E){this._isActive=!1,this._isHidden=!1,this._icon=c,this.title=E,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(c){this._icon=c,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(c){this._isActive=c,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var c=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 c.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},K.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},K.prototype.hide=function(){this._isHidden=!0},K}(),gt=function(K){function c(){var E=K!==null&&K.apply(this,arguments)||this;return E.elements=[],E}return Ht(c,K),c.prototype.addElement=function(E){this.elements.push(E)},c.prototype.getUI=function(){var E=K.prototype.getUI.call(this);return this.elements.forEach(function(G){return E.appendChild(G)}),E},c}(nr),Rr=function(){function K(c,E){this.horizontal=c,this.vertical=E}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(c){return c/this.ratio},K.prototype.getHorizontalLength=function(c){return c*this.ratio},K}(),tn=function(){function K(){}return K.getIcon=function(c,E){if(c>0&&E>0){var G=new Rr(c,E),Y=G.ratio>=1?20:G.getHorizontalLength(20),V=G.ratio<1?20:G.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=bt.createDefs();xe.appendChild(Ge);var tt=bt.createElement("clipPath",[["id","text-bg-clip"]]);Ge.appendChild(tt);var pt=bt.createPath(bt.getHollowRectanglePath((24-Y)/2,(24-V)/2,Y,V,(24-Y)/2+2,(24-V)/2+2,Y-4,V-4));xe.appendChild(pt);var Ve=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ve.appendChild(bt.createTSpan(c+":"+E)),xe.appendChild(Ve);var At=Ve.getBBox();bt.setAttributes(Ve,[["x",((24-At.width)/2).toString()],["y",((24-At.height)/2-At.y).toString()]]);var It=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(At.width))/2,(24-Math.ceil(At.height))/2,Math.ceil(At.width),Math.ceil(At.height)));return tt.appendChild(It),bt.setAttributes(pt,[["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>'},K}(),Tr=function(K){function c(E,G,Y){var V=K.call(this,E,G)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=Y,V}return Ht(c,K),c.prototype.setupDropdown=function(){var E=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(G){G.className=E.className,G.colorsClassName=E.colorsClassName,E.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},c.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},c.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},c.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},c.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},c.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},c}(kt),Ot=function(){function K(c,E){this.GRIP_SIZE=10,this.color=c,this.fillColor=E,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},K.prototype.setCenter=function(c,E){this.visual.childNodes.forEach(function(G){return bt.setAttributes(G,[["cx",c.toString()],["cy",E.toString()]])})},K}(),Lr=function(){function K(c,E,G,Y){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=E,this.margin=G,this.container=Y,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(K.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(c){this._aspectRatio=c,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var c=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var E=0;E<this.numberOfGridLines;E++)this.horizontalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(G){return c.gridContainer.appendChild(G)}),this.verticalGridLines.forEach(function(G){return c.gridContainer.appendChild(G)}),this.cropRectElement=bt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},K.prototype.setCropRectangle=function(c){this.cropRect=c;var E=Object.assign({},this.cropRect);this.zoomFactor!==1&&(E.width=this.cropRect.width*this.zoomFactor,E.height=this.cropRect.height*this.zoomFactor,E.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-E.width/2,E.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-E.height/2),bt.setAttributes(this.cropRectElement,[["x",E.x.toString()],["y",E.y.toString()],["width",E.width.toString()],["height",E.height.toString()]]);var G=E.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,xe){var Ge=E.y+G*(xe+1);bt.setAttributes(V,[["x1",""+E.x],["y1",""+Ge],["x2",""+(E.x+E.width)],["y2",""+Ge]])});var Y=E.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,xe){var Ge=E.x+Y*(xe+1);bt.setAttributes(V,[["x1",""+Ge],["y1",""+E.y],["x2",""+Ge],["y2",""+(E.y+E.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,E.x,E.y,E.width,E.height)]]),this.topLeftGrip.setCenter(E.x,E.y),this.topRightGrip.setCenter(E.x+E.width,E.y),this.bottomLeftGrip.setCenter(E.x,E.y+E.height),this.bottomRightGrip.setCenter(E.x+E.width,E.y+E.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},K.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},K.prototype.clientToLocalCoordinates=function(c,E){var G=this.container.getBoundingClientRect();return{x:c-G.left+this.margin,y:E-G.top+this.margin}},K.prototype.onPointerDown=function(c){this.container.setPointerCapture(c.pointerId),this.previousPoint=this.clientToLocalCoordinates(c.clientX,c.clientY),this.cropRectElement===c.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(c.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(c.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(c.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(c.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var E=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(E)}c.preventDefault()},K.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},K.prototype.move=function(c){var E=c.x-this.previousPoint.x,G=c.y-this.previousPoint.y;this.zoomFactor!==1&&(E=-E/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+E),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+G),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},K.prototype.resize=function(c){var E=Object.assign({},this.cropRect),G=c.x-this.previousPoint.x,Y=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:E.x+G<this.margin&&(G=this.margin-E.x),E.x+=G,E.width=this.cropRect.x+this.cropRect.width-E.x;break;case this.bottomRightGrip:case this.topRightGrip:E.width+G>this.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-E.width),E.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(E.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),E.height=this.aspectRatio.getVerticalLength(E.width)):(E.y+=Y,E.height=this.cropRect.y+this.cropRect.height-E.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?E.height=this.aspectRatio.getVerticalLength(E.width):E.height+=Y}E.width<10&&(E.x=this.cropRect.x,E.width=10),E.height<10&&(E.y=this.cropRect.y,E.height=10),this.previousPoint=c,E.x>=this.margin&&E.y>=this.margin&&E.x-this.margin+E.width<=this.canvasWidth&&E.y-this.margin+E.height<=this.canvasHeight&&(this.cropRect=E,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},K.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var c=this.cropRect.x+this.cropRect.width/2,E=this.cropRect.y+this.cropRect.height/2,G=this.aspectRatio.getHorizontalLength(this.cropRect.height),Y=this.aspectRatio.getVerticalLength(this.cropRect.width);G/this.canvasWidth<Y/this.canvasHeight?this.cropRect.width=G:this.cropRect.height=Y,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=c-this.cropRect.width/2,this.cropRect.y=E-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},K.prototype.getRescaledRect=function(c,E,G,Y,V,xe){var Ge=G/c,tt=Y/E;return{x:(V.x-xe)*Ge+xe,y:(V.y-xe)*tt+xe,width:V.width*Ge,height:V.height*tt}},K.prototype.scaleCanvas=function(c,E){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,E,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=E,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},K}(),zr=function(){function K(c){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=c,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(K.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},K.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},K.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},K.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var c=this.scaleShape.transform.baseVal.getItem(0);c.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(c,0)}},K.prototype.getVisual=function(){var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",this.width+"px"),c.setAttribute("height",this.height+"px"),c.setAttribute("viewBox","0 0 "+this.width+" "+this.height),c.style.flexShrink="0",document.body.appendChild(c);for(var E="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,G=1;G<=this.width/5+10;G++){var Y=G%5==0?this.height/3:this.height/6;E+="h4v"+-Y+"h1v"+Y}E+="v1H0Z",this.scaleShape=bt.createPath(E);var V=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(V),c.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var xe=bt.createTSpan("");return xe.innerHTML="°",this.angleLabelElement.appendChild(xe),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},K}(),rn=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(c,E,G,Y,V,xe,Ge){var tt=this;return new Promise(function(pt){var Ve=document.createElement("canvas");Ve.width=c.width.baseVal.value-2*Y,Ve.height=c.height.baseVal.value-2*Y;var At=1,It=1;tt.naturalSize===!0?(At=E.naturalWidth/(c.width.baseVal.value-2*Y)/xe,It=E.naturalHeight/(c.height.baseVal.value-2*Y)/Ge,Ve.width=E.naturalWidth/xe,Ve.height=E.naturalHeight/Ge):tt.width!==void 0&&tt.height!==void 0&&(At=tt.width/G.width,It=tt.height/G.height,Ve.width*=At,Ve.height*=It);var er=Ve.getContext("2d");er.translate(Ve.width/2,Ve.height/2),er.rotate(V*Math.PI/180),er.scale(xe,Ge),er.translate(-Ve.width/2,-Ve.height/2),er.drawImage(E,0,0,Ve.width,Ve.height);var Kr=document.createElement("canvas");Kr.width=G.width*At,Kr.height=G.height*It,Kr.getContext("2d").putImageData(er.getImageData((G.x-Y)*At,(G.y-Y)*It,G.width*At,G.height*It),0,0),pt(Kr.toDataURL(tt.imageType,tt.imageQuality))})},K}(),He=function(){function K(c){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=K.instanceCounter++,this.styles=new Ct(this.instanceNo),this.target=c,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(c){this._gridLines=c,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(c){this._rotationAngle=c,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"aspectRatio",{get:function(){var c;return(c=this._aspectRatio)!==null&&c!==void 0?c:this.aspectRatios[0]},set:function(c){this._aspectRatio=c},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},K.prototype.show=function(){this.showUI(),this.open()},K.prototype.close=function(c){c===void 0&&(c=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),c||this.closeEventListeners.forEach(function(E){return E()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},K.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},K.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},K.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},K.prototype.setupResizeObserver=function(){var c=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,E=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=E+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/c;this.resize(E,G)}},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",bt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},K.prototype.resize=function(c,E){this.imageWidth=Math.round(c),this.imageHeight=Math.round(E),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},K.prototype.setEditingTarget=function(){var c=document.createElement("canvas");c.width=this.target.naturalWidth,c.height=this.target.naturalHeight,c.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var E=c.toDataURL();bt.setAttributes(this.editingTarget,[["href",E]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var c=this.target.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=c.left-E.left-this.CANVAS_MARGIN,this.top=c.top-E.top-this.CANVAS_MARGIN},K.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=bt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=bt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=bt.createGroup(),this.editingTargetRotationScaleContainer=bt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var c=bt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(c);var E=bt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(E),this.editingTargetContainer=bt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},K.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},K.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=bt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Lr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},K.prototype.zoomToCrop=function(){if(this.cropRect){var c=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,E=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=c+"px "+E+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-c+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-E+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},K.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},K.prototype.cropRectChanged=function(c){this.cropRect=c,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},K.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},K.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,E=this.target.offsetTop>c+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=E+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},K.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},K.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new Zt,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 E=new rr;E.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(E);var G=[];this.aspectRatios.forEach(function(It){var er=new kt(tn.getIcon(It.horizontal,It.vertical),It.horizontal===0&&It.vertical===0?"FREE":It.horizontal+":"+It.vertical);er.onClick=function(){return c.ratioButtonClicked(It)},G.push(er)}),this.aspectRatioButton=new Tr(tn.getIcon(0,0),"Aspect ratio",G),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,E.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Y=new kt('<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");Y.isActive=this.isGridVisible,Y.onClick=function(){c.isGridVisible=!c.isGridVisible,Y.isActive=c.isGridVisible},E.addButton(Y);var V=new kt('<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(V.isActive=this.zoomToCropEnabled,V.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,V.isActive=c.zoomToCropEnabled},E.addButton(V),!Zr.isLicensed){var xe=new gt;this.topToolbar.addElementBlock(xe);var Ge=document.createElement("div");Ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var tt=document.createElement("a");tt.style.color="currentColor",tt.href="https://markerjs.com/products/cropro",tt.target="_blank",tt.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(tt),xe.addElement(Ge)}var pt=new rr;pt.minWidth=3*this.toolbarHeight+"px",pt.contentAlign="end",this.topToolbar.addButtonBlock(pt);var Ve=new kt('<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");Ve.onClick=this.startRenderAndClose,pt.addButton(Ve),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ve.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var At=new kt('<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");At.onClick=this.close,pt.addButton(At),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(At.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},K.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new Zt,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 E=new rr;E.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(E);var G=new kt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");G.onClick=this.rotateLeftButtonClicked,E.addButton(G);var Y=new kt('<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");Y.onClick=this.rotateRightButtonClicked,E.addButton(Y);var V=new gt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new zr("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(pt){c.rotateBy(pt),c.straightener.angle=c.rotationAngle},V.addElement(this.straightener.getUI());var xe=new rr;xe.minWidth=2*this.toolbarHeight+"px",xe.contentAlign="end",this.bottomToolbar.addButtonBlock(xe);var Ge=new kt('<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 tt=new kt('<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");tt.onClick=this.flipVerticallyButtonClicked,xe.addButton(tt)},K.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},K.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},K.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Rr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},K.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},K.prototype.restoreState=function(c){if(c){var E=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(E),this.cropRectChanged(E),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(c,E){var G=this.cropImage.getBoundingClientRect();return{x:c-G.left,y:E-G.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var c=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},K.prototype.rotateLeftButtonClicked=function(){var c=this.rotationAngle-90;this.rotationAngle%90!=0&&(c+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(c)},K.prototype.rotateRightButtonClicked=function(){var c=this.rotationAngle+90;this.rotationAngle%90!=0&&(c-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(c)},K.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},K.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},K.prototype.applyRotation=function(){var c=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var E=this.editingTargetRotationContainer.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(E,0);var G=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/G.width,this.imageHeight/G.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},K.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},K.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},K.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},K.prototype.startRenderAndClose=function(){return Rt(this,void 0,void 0,function(){var c,E;return Ur(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return c=G.sent(),E=this.getState(),this.renderEventListeners.forEach(function(Y){return Y(c,E)}),this.close(!0),[2]}})})},K.prototype.render=function(){return Rt(this,void 0,void 0,function(){var c;return Ur(this,function(E){switch(E.label){case 0:return(c=new rn).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,c.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 E.sent(),[4,c.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,E.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xt("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 xt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*c)+`px;
|
|
height: `+(this.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xt("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 xt("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 xt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new xt("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 xt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new xt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},K.instanceCounter=0,K}(),ut=ee("8hTe"),Mt=ee.n(ut),Kt=/<pre[^>]*>/g;function Yt(K){var c=document.createElement("div");return c.innerHTML=K,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var qt=Le.a=function(K){var c=K.value,E=c===void 0?"":c,G=K.edit,Y=G===void 0?!1:G,V=K.className,xe=K.showTextOnly,Ge=K.showLines,tt=K.replaces,pt=K.zoomImg,Ve=K.hasMask,At=K.style,It=At===void 0?{}:At,er=K.stylesPrev,Kr=er===void 0?{}:er,Vr=String(E),pr=Object(L.useRef)(),Qr=Object(L.useRef)(),Gn=Object(L.useState)(""),Or=Object(H.a)(Gn,2),Xr=Or[0],jr=Or[1],bn=Object(L.useState)("office"),nn=Object(H.a)(bn,2),mn=nn[0],hn=nn[1],di=function(){var jt=new He(Qr.current);jt.displayMode="popup",jt.addRenderEventListener(function(){var Er=Object(M.a)(P.a.mark(function Ut(hr){var Vt;return P.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return pr.current.style.display="none",lr.next=3,Object(Pe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:hr}});case 3:Vt=lr.sent,Vt!=null&&Vt.id&&tt(Qr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return lr.stop()}},Ut)}));return function(Ut){return Er.apply(this,arguments)}}()),jt.show()},zn=function(){var jt=new Ft(Qr.current);jt.settings.displayMode="popup",jt.addEventListener("render",function(){var Er=Object(M.a)(P.a.mark(function Ut(hr){var Vt;return P.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:if(pr.current.style.display="none",!Qr.current){lr.next=6;break}return lr.next=4,Object(Pe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:hr.dataUrl}});case 4:Vt=lr.sent,Vt!=null&&Vt.id&&tt(Qr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return lr.stop()}},Ut)}));return function(Ut){return Er.apply(this,arguments)}}()),jt.show(),window.markerArea=jt},an=Object(L.useMemo)(function(){try{var or=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Er=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Vr=Vr.replace(or,"("+q.a.API_SERVER+"/api/attachments/").replace(jt,'"'+q.a.API_SERVER+"/api/attachments/").replace(Er,'"'+q.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,`
|
|
`),Vr=Vr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(dn){}var Ut=z(Vr),hr=A();if(Vr.match(/\[TOC\]/)&&(Ut=Ut.replace("<p>[TOC]</p>",R()),y()),Ut=Ut.replace(/(__special_katext_id_\d+__)/g,function(dn,lr){var Pr=hr[lr],Kn=Pr.type,Vn=Pr.expression;return Object(le.renderToString)(Yt(Vn)||"",{displayMode:Kn==="block",throwOnError:!1,output:"html"})}),Ut=Ut.replace(/▁/g,"\u2581\u2581\u2581"),S(),xe){var Vt=document.createElement("div");return Vt.innerHTML=Ut,Vt.innerText}return setTimeout(function(){return On()},500),Ut},[Vr]),Yr=Object(L.useRef)();g.WebkitLineClamp=Ge,Ge&&(It=Object(F.a)(Object(F.a)({},It),g));function Rn(or){var jt=or.target;if(jt.tagName.toUpperCase()==="IMG"){if(pt){var Er=jt.getAttribute("src");jr(Er),hn("image")}}else if(jt.tagName.toUpperCase()==="A"){var Ut=jt.getAttribute("href");if(Ut.indexOf("office")>-1)or.preventDefault(),jr(Ut),hn("office");else if(Ut.indexOf("application/pdf")>-1)or.preventDefault(),jr(Ut),hn("pdf");else if(Ut.indexOf("type=text")>-1)or.preventDefault(),jr(Ut),hn("html");else if(Ut.startsWith("#")){or.preventDefault();var hr=document.getElementById(Ut.replace("#",""));hr&&hr.scrollIntoView(!0)}}}var On=function(){var jt,Er=(jt=Yr.current)===null||jt===void 0?void 0:jt.querySelectorAll("video");Er==null||Er.forEach(function(Ut){if(Ut.oncontextmenu=function(){return!1},Ut.src.indexOf(".m3u8")>-1&&!Ut.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var hr=new $.a;hr.loadSource(Ut.src),hr.attachMedia(Ut)}}})};Object(L.useEffect)(function(){if(Yr.current&&an&&(an.match(Kt)&&window.PR.prettyPrint()),Yr.current)return Yr.current.addEventListener("click",Rn),function(){Yr.current.removeEventListener("click",Rn),S(),y()}},[an,Yr.current,Rn]);var ci=function(jt){if(!Y)return;jt.target.nodeName==="IMG"?(pr.current.style.display="flex",pr.current.style.width=jt.target.clientWidth+"px",pr.current.style.height=jt.target.clientHeight+"px",pr.current.style.top=jt.target.offsetTop+"px",pr.current.style.left=jt.target.offsetLeft+"px",Qr.current.src=jt.target.getAttribute("src")):pr.current.style.display="none"};return h.a.createElement("div",{style:{position:"relative"}},h.a.createElement("div",{ref:Yr,style:Object(F.a)({},It),className:"".concat(V||""," markdown-body ").concat(Mt.a.mdBody),onMouseOver:ci,dangerouslySetInnerHTML:{__html:an}}),h.a.createElement("div",{ref:pr,className:Mt.a.button},h.a.createElement(J.a,null,h.a.createElement(X.a,{onClick:function(){return di()}},"\u88C1\u526A"),h.a.createElement(X.a,{onClick:function(){return zn()}},"\u7F16\u8F91"))),h.a.createElement("img",{ref:Qr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),h.a.createElement(pe.a,{close:!0,data:Xr,hasMask:Ve,type:Xr!=null&&Xr.length?mn:"",style:Object(F.a)({},Kr),onClose:function(){return jr("")}}))}},"9VGf":function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return O});var ue=ee("q1tI"),J=ee.n(ue);function O(X,F){var M=Object(ue.useRef)();Object(ue.useEffect)(function(){M.current=X}),Object(ue.useEffect)(function(){function H(){M.current()}if(F!==null){var U=setInterval(H,F);return function(){return clearInterval(U)}}},[F])}},BU3w:function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return M});var ue=ee("MNnm"),J="rc-util-key";function O(H){if(H.attachTo)return H.attachTo;var U=document.querySelector("head");return U||document.body}function X(H){var U,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var L=document.createElement("style");if((U=P.csp)===null||U===void 0?void 0:U.nonce){var h;L.nonce=(h=P.csp)===null||h===void 0?void 0:h.nonce}L.innerHTML=H;var f=O(P),T=f.firstChild;return P.prepend&&f.prepend?f.prepend(L):P.prepend&&T?f.insertBefore(L,T):f.appendChild(L),L}var F=new Map;function M(H,U){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=O(P);if(!F.has(L)){var h=X("",P),f=h.parentNode;F.set(L,f),f.removeChild(h)}var T=Array.from(F.get(L).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 b;T.nonce=(b=P.csp)===null||b===void 0?void 0:b.nonce}return T.innerHTML!==H&&(T.innerHTML=H),T}var a=X(H,P);return a[J]=U,a}},Bd2K:function(vt,Le,ee){(function(ue){ue(ee("VrN/"),ee("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(P,L,h){if(h!=ue.Init&&h&&P.removeKeyMap("autoCloseTags"),!L)return;var f={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(f["'/'"]=function(T){return M(T)}),(typeof L!="object"||L.whenOpening!==!1)&&(f["'>'"]=function(T){return X(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 X(P){if(P.getOption("disableInput"))return ue.Pass;for(var L=P.listSelections(),h=[],f=P.getOption("autoCloseTags"),T=0;T<L.length;T++){if(!L[T].empty())return ue.Pass;var p=L[T].head,m=P.getTokenAt(p),b=ue.innerMode(P.getMode(),m.state),a=b.state,i=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(a),s=i&&i.name;if(!s)return ue.Pass;var u=b.mode.configuration=="html",y=typeof f=="object"&&f.dontCloseTags||u&&J,g=typeof f=="object"&&f.indentTags||u&&O;m.end>p.ch&&(s=s.slice(0,s.length-m.end+p.ch));var v=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||y&&H(y,v)>-1||U(P,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(a)||[],s,p,!0))return ue.Pass;var R=typeof f=="object"&&f.emptyTags;if(R&&H(R,s)>-1){h[T]={text:"/>",newPos:ue.Pos(p.line,p.ch+2)};continue}var w=g&&H(g,v)>-1;h[T]={indent:w,text:">"+(w?`
|
|
|
|
`:"")+"</"+s+">",newPos:w?ue.Pos(p.line+1,0):ue.Pos(p.line,p.ch+1)}}for(var C=typeof f=="object"&&f.dontIndentOnAutoClose,T=L.length-1;T>=0;T--){var x=h[T];P.replaceRange(x.text,L[T].head,L[T].anchor,"+insert");var d=P.listSelections().slice(0);d[T]={head:x.newPos,anchor:x.newPos},P.setSelections(d),!C&&x.indent&&(P.indentLine(x.newPos.line,null,!0),P.indentLine(x.newPos.line+1,null,!0))}}function F(P,L){for(var h=P.listSelections(),f=[],T=L?"/":"</",p=P.getOption("autoCloseTags"),m=typeof p=="object"&&p.dontIndentOnSlash,b=0;b<h.length;b++){if(!h[b].empty())return ue.Pass;var a=h[b].head,i=P.getTokenAt(a),s=ue.innerMode(P.getMode(),i.state),u=s.state;if(L&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=a.ch-1))return ue.Pass;var y,g=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")y=T+"script";else if(g&&s.mode.name=="css")y=T+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!v||v.length&&U(P,v,v[v.length-1],a))return ue.Pass;y=T+v[v.length-1]}P.getLine(a.line).charAt(i.end)!=">"&&(y+=">"),f[b]=y}if(P.replaceSelections(f),h=P.listSelections(),!m)for(var b=0;b<h.length;b++)(b==h.length-1||h[b].head.line<h[b+1].head.line)&&P.indentLine(h[b].head.line)}function M(P){return P.getOption("disableInput")?ue.Pass:F(P,!0)}ue.commands.closeTag=function(P){return F(P)};function H(P,L){if(P.indexOf)return P.indexOf(L);for(var h=0,f=P.length;h<f;++h)if(P[h]==L)return h;return-1}function U(P,L,h,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!=h)return!1;for(var b=T?1:0,a=L.length-1;a>=0&&L[a]==h;a--)++b;f=m.to;for(var a=1;a<b;a++){var i=ue.scanForClosingTag(P,f,null,p);if(!i||i.tag!=h)return!1;f=i.to}return!0}})},BjJ7:function(vt,Le,ee){"use strict";ee.d(Le,"d",function(){return J}),ee.d(Le,"c",function(){return O}),ee.d(Le,"e",function(){return X}),ee.d(Le,"b",function(){return F}),ee.d(Le,"a",function(){return H});var ue=ee("m3rI");function J(U){var P=!0;if(U.length>0){for(var L=0;L<U.length;L++)if(U[L].compile_success==0||!U[L].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]:"",L=[],h=0;h<U.length;h++){var f=U[h],T=P?"".concat(P,"/").concat(f.name):"".concat(f.name);L.push({title:f.name,isLeaf:!(f.type==="tree"),key:T})}return L}function X(U,P,L){for(var h=0;h<U.length;h++){var f=U[h];if(f.key===P){f.children=L;break}f.children&&X(f.children,P,L)}return U}function F(U,P,L){var h;return function(){var f=this,T=arguments,p=function(){h=null,L||U.apply(f,T)},m=L&&!h;clearTimeout(h),h=setTimeout(p,P),m&&U.apply(f,T)}}var M=!0,H=ue.a.API_SERVER},"C+DQ":function(vt,Le,ee){},"C/vA":function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return ue});function ue(J){var O=this,X=!1,F;return function(){return X||(X=!0,F=J.apply(O,arguments)),F}}},"Cg/j":function(vt,Le,ee){"use strict";ee.d(Le,"b",function(){return ue}),ee.d(Le,"a",function(){return J}),ee.d(Le,"c",function(){return X}),ee.d(Le,"d",function(){return F});var ue;(function(M){M.serviceIds=new Map,M.DI_TARGET="$di$target",M.DI_DEPENDENCIES="$di$dependencies";function H(U){return U[M.DI_DEPENDENCIES]||[]}M.getServiceDependencies=H})(ue||(ue={}));var J=X("instantiationService");function O(M,H,U,P){H[ue.DI_TARGET]===H?H[ue.DI_DEPENDENCIES].push({id:M,index:U,optional:P}):(H[ue.DI_DEPENDENCIES]=[{id:M,index:U,optional:P}],H[ue.DI_TARGET]=H)}function X(M){if(ue.serviceIds.has(M))return ue.serviceIds.get(M);var H=function(U,P,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");O(H,U,L,!1)};return H.toString=function(){return M},ue.serviceIds.set(M,H),H}function F(M){return function(H,U,P){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");O(M,H,P,!0)}}},DlQD:function(vt,Le,ee){(function(ue,J){vt.exports=J()})(this,function(){"use strict";function ue(Ce,me){for(var Ee=0;Ee<me.length;Ee++){var ne=me[Ee];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(Ce,ne.key,ne)}}function J(Ce,me,Ee){return me&&ue(Ce.prototype,me),Ee&&ue(Ce,Ee),Ce}function O(Ce,me){if(!Ce)return;if(typeof Ce=="string")return X(Ce,me);var Ee=Object.prototype.toString.call(Ce).slice(8,-1);if(Ee==="Object"&&Ce.constructor&&(Ee=Ce.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(Ce);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return X(Ce,me)}function X(Ce,me){(me==null||me>Ce.length)&&(me=Ce.length);for(var Ee=0,ne=new Array(me);Ee<me;Ee++)ne[Ee]=Ce[Ee];return ne}function F(Ce,me){var Ee;if(typeof Symbol=="undefined"||Ce[Symbol.iterator]==null){if(Array.isArray(Ce)||(Ee=O(Ce))||me&&Ce&&typeof Ce.length=="number"){Ee&&(Ce=Ee);var ne=0;return function(){return ne>=Ce.length?{done:!0}:{done:!1,value:Ce[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 Ee=Ce[Symbol.iterator](),Ee.next.bind(Ee)}function M(Ce,me){return me={exports:{}},Ce(me,me.exports),me.exports}var H=M(function(Ce){function me(){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 Ee(ne){Ce.exports.defaults=ne}Ce.exports={defaults:me(),getDefaults:me,changeDefaults:Ee}}),U=H.defaults,P=H.getDefaults,L=H.changeDefaults,h=/[&<>"']/,f=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,p=/[<>"']|&(?!#?\w+;)/g,m={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(me){return m[me]};function a(Ce,me){if(me){if(h.test(Ce))return Ce.replace(f,b)}else if(T.test(Ce))return Ce.replace(p,b);return Ce}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ce){return Ce.replace(i,function(me,Ee){return Ee=Ee.toLowerCase(),Ee==="colon"?":":Ee.charAt(0)==="#"?Ee.charAt(1)==="x"?String.fromCharCode(parseInt(Ee.substring(2),16)):String.fromCharCode(+Ee.substring(1)):""})}var u=/(^|[^\[])\^/g;function y(Ce,me){Ce=Ce.source||Ce,me=me||"";var Ee={replace:function(ae,ce){return ce=ce.source||ce,ce=ce.replace(u,"$1"),Ce=Ce.replace(ae,ce),Ee},getRegex:function(){return new RegExp(Ce,me)}};return Ee}var g=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Ce,me,Ee){if(Ce){var ne;try{ne=decodeURIComponent(s(Ee)).replace(g,"").toLowerCase()}catch(ae){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}me&&!v.test(Ee)&&(Ee=l(me,Ee));try{Ee=encodeURI(Ee).replace(/%25/g,"%")}catch(ae){return null}return Ee}var w={},C=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(Ce,me){w[" "+Ce]||(C.test(Ce)?w[" "+Ce]=Ce+"/":w[" "+Ce]=I(Ce,"/",!0)),Ce=w[" "+Ce];var Ee=Ce.indexOf(":")===-1;return me.substring(0,2)==="//"?Ee?me:Ce.replace(x,"$1")+me:me.charAt(0)==="/"?Ee?me:Ce.replace(d,"$1")+me:Ce+me}var A={exec:function(){}};function S(Ce){for(var me=1,Ee,ne;me<arguments.length;me++){Ee=arguments[me];for(ne in Ee)Object.prototype.hasOwnProperty.call(Ee,ne)&&(Ce[ne]=Ee[ne])}return Ce}function D(Ce,me){var Ee=Ce.replace(/\|/g,function(ce,ve,Ie){for(var we=!1,Ke=ve;--Ke>=0&&Ie[Ke]==="\\";)we=!we;return we?"|":" |"}),ne=Ee.split(/ \|/),ae=0;if(ne.length>me)ne.splice(me);else for(;ne.length<me;)ne.push("");for(;ae<ne.length;ae++)ne[ae]=ne[ae].trim().replace(/\\\|/g,"|");return ne}function I(Ce,me,Ee){var ne=Ce.length;if(ne===0)return"";for(var ae=0;ae<ne;){var ce=Ce.charAt(ne-ae-1);if(ce===me&&!Ee)ae++;else if(ce!==me&&Ee)ae++;else break}return Ce.substr(0,ne-ae)}function B(Ce,me){if(Ce.indexOf(me[1])===-1)return-1;for(var Ee=Ce.length,ne=0,ae=0;ae<Ee;ae++)if(Ce[ae]==="\\")ae++;else if(Ce[ae]===me[0])ne++;else if(Ce[ae]===me[1]&&(ne--,ne<0))return ae;return-1}function j(Ce){Ce&&Ce.sanitize&&!Ce.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 z={escape:a,unescape:s,edit:y,cleanUrl:R,resolveUrl:l,noopTest:A,merge:S,splitCells:D,rtrim:I,findClosingBracket:B,checkSanitizeDeprecation:j},_=H.defaults,N=z.rtrim,$=z.splitCells,q=z.escape,le=z.findClosingBracket;function pe(Ce,me,Ee){var ne=me.href,ae=me.title?q(me.title):null,ce=Ce[1].replace(/\\([\[\]])/g,"$1");return Ce[0].charAt(0)!=="!"?{type:"link",raw:Ee,href:ne,title:ae,text:ce}:{type:"image",raw:Ee,href:ne,title:ae,text:q(ce)}}function Pe(Ce,me){var Ee=Ce.match(/^(\s+)(?:```)/);if(Ee===null)return me;var ne=Ee[1];return me.split(`
|
|
`).map(function(ae){var ce=ae.match(/^\s+/);if(ce===null)return ae;var ve=ce[0];return ve.length>=ne.length?ae.slice(ne.length):ae}).join(`
|
|
`)}var Se=function(){function Ce(Ee){this.options=Ee||_}var me=Ce.prototype;return me.space=function(ne){var ae=this.rules.block.newline.exec(ne);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
|
|
`}},me.code=function(ne,ae){var ce=this.rules.block.code.exec(ne);if(ce){var ve=ae[ae.length-1];if(ve&&ve.type==="paragraph")return{raw:ce[0],text:ce[0].trimRight()};var Ie=ce[0].replace(/^ {4}/gm,"");return{type:"code",raw:ce[0],codeBlockStyle:"indented",text:this.options.pedantic?Ie:N(Ie,`
|
|
`)}}},me.fences=function(ne){var ae=this.rules.block.fences.exec(ne);if(ae){var ce=ae[0],ve=Pe(ce,ae[3]||"");return{type:"code",raw:ce,lang:ae[2]?ae[2].trim():ae[2],text:ve}}},me.heading=function(ne){var ae=this.rules.block.heading.exec(ne);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},me.nptable=function(ne){var ae=this.rules.block.nptable.exec(ne);if(ae){var ce={type:"table",header:$(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ae[0]};if(ce.header.length===ce.align.length){var ve=ce.align.length,Ie;for(Ie=0;Ie<ve;Ie++)/^ *-+: *$/.test(ce.align[Ie])?ce.align[Ie]="right":/^ *:-+: *$/.test(ce.align[Ie])?ce.align[Ie]="center":/^ *:-+ *$/.test(ce.align[Ie])?ce.align[Ie]="left":ce.align[Ie]=null;for(ve=ce.cells.length,Ie=0;Ie<ve;Ie++)ce.cells[Ie]=$(ce.cells[Ie],ce.header.length);return ce}}},me.hr=function(ne){var ae=this.rules.block.hr.exec(ne);if(ae)return{type:"hr",raw:ae[0]}},me.blockquote=function(ne){var ae=this.rules.block.blockquote.exec(ne);if(ae){var ce=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:ce}}},me.list=function(ne){var ae=this.rules.block.list.exec(ne);if(ae){for(var ce=ae[0],ve=ae[2],Ie=ve.length>1,we=ve[ve.length-1]===")",Ke={type:"list",raw:ce,ordered:Ie,start:Ie?+ve.slice(0,-1):"",loose:!1,items:[]},ot=ae[0].match(this.rules.block.item),ct=!1,dt,Lt,wt,ft,zt,Ft,Jt,Ht=ot.length,Rt=0;Rt<Ht;Rt++)dt=ot[Rt],ce=dt,Lt=dt.length,dt=dt.replace(/^ *([*+-]|\d+[.)]) */,""),~dt.indexOf(`
|
|
`)&&(Lt-=dt.length,dt=this.options.pedantic?dt.replace(/^ {1,4}/gm,""):dt.replace(new RegExp("^ {1,"+Lt+"}","gm"),"")),Rt!==Ht-1&&(wt=this.rules.block.bullet.exec(ot[Rt+1])[0],(Ie?wt.length===1||!we&&wt[wt.length-1]===")":wt.length>1||this.options.smartLists&&wt!==ve)&&(ft=ot.slice(Rt+1).join(`
|
|
`),Ke.raw=Ke.raw.substring(0,Ke.raw.length-ft.length),Rt=Ht-1)),zt=ct||/\n\n(?!\s*$)/.test(dt),Rt!==Ht-1&&(ct=dt.charAt(dt.length-1)===`
|
|
`,zt||(zt=ct)),zt&&(Ke.loose=!0),Ft=/^\[[ xX]\] /.test(dt),Jt=void 0,Ft&&(Jt=dt[1]!==" ",dt=dt.replace(/^\[[ xX]\] +/,"")),Ke.items.push({type:"list_item",raw:ce,task:Ft,checked:Jt,loose:zt,text:dt});return Ke}},me.html=function(ne){var ae=this.rules.block.html.exec(ne);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):q(ae[0]):ae[0]}},me.def=function(ne){var ae=this.rules.block.def.exec(ne);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var ce=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:ce,raw:ae[0],href:ae[2],title:ae[3]}}},me.table=function(ne){var ae=this.rules.block.table.exec(ne);if(ae){var ce={type:"table",header:$(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ce.header.length===ce.align.length){ce.raw=ae[0];var ve=ce.align.length,Ie;for(Ie=0;Ie<ve;Ie++)/^ *-+: *$/.test(ce.align[Ie])?ce.align[Ie]="right":/^ *:-+: *$/.test(ce.align[Ie])?ce.align[Ie]="center":/^ *:-+ *$/.test(ce.align[Ie])?ce.align[Ie]="left":ce.align[Ie]=null;for(ve=ce.cells.length,Ie=0;Ie<ve;Ie++)ce.cells[Ie]=$(ce.cells[Ie].replace(/^ *\| *| *\| *$/g,""),ce.header.length);return ce}}},me.lheading=function(ne){var ae=this.rules.block.lheading.exec(ne);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},me.paragraph=function(ne){var ae=this.rules.block.paragraph.exec(ne);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
|
|
`?ae[1].slice(0,-1):ae[1]}},me.text=function(ne,ae){var ce=this.rules.block.text.exec(ne);if(ce){var ve=ae[ae.length-1];return ve&&ve.type==="text"?{raw:ce[0],text:ce[0]}:{type:"text",raw:ce[0],text:ce[0]}}},me.escape=function(ne){var ae=this.rules.inline.escape.exec(ne);if(ae)return{type:"escape",raw:ae[0],text:q(ae[1])}},me.tag=function(ne,ae,ce){var ve=this.rules.inline.tag.exec(ne);if(ve)return!ae&&/^<a /i.test(ve[0])?ae=!0:ae&&/^<\/a>/i.test(ve[0])&&(ae=!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:ae,inRawBlock:ce,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):q(ve[0]):ve[0]}},me.link=function(ne){var ae=this.rules.inline.link.exec(ne);if(ae){var ce=le(ae[2],"()");if(ce>-1){var ve=ae[0].indexOf("!")===0?5:4,Ie=ve+ae[1].length+ce;ae[2]=ae[2].substring(0,ce),ae[0]=ae[0].substring(0,Ie).trim(),ae[3]=""}var we=ae[2],Ke="";if(this.options.pedantic){var ot=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);ot?(we=ot[1],Ke=ot[3]):Ke=""}else Ke=ae[3]?ae[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=pe(ae,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:Ke&&Ke.replace(this.rules.inline._escapes,"$1")},ae[0]);return ct}},me.reflink=function(ne,ae){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=ae[ve.toLowerCase()],!ve||!ve.href){var Ie=ce[0].charAt(0);return{type:"text",raw:Ie,text:Ie}}var we=pe(ce,ve,ce[0]);return we}},me.strong=function(ne,ae,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)))){ae=ae.slice(-1*ne.length);var Ie=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ie.lastIndex=0;for(var we;(ve=Ie.exec(ae))!=null;)if(we=this.rules.inline.strong.middle.exec(ae.slice(0,ve.index+3)),we)return{type:"strong",raw:ne.slice(0,we[0].length),text:ne.slice(2,we[0].length-2)}}},me.em=function(ne,ae,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)))){ae=ae.slice(-1*ne.length);var Ie=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ie.lastIndex=0;for(var we;(ve=Ie.exec(ae))!=null;)if(we=this.rules.inline.em.middle.exec(ae.slice(0,ve.index+2)),we)return{type:"em",raw:ne.slice(0,we[0].length),text:ne.slice(1,we[0].length-1)}}},me.codespan=function(ne){var ae=this.rules.inline.code.exec(ne);if(ae){var ce=ae[2].replace(/\n/g," "),ve=/[^ ]/.test(ce),Ie=ce.startsWith(" ")&&ce.endsWith(" ");return ve&&Ie&&(ce=ce.substring(1,ce.length-1)),ce=q(ce,!0),{type:"codespan",raw:ae[0],text:ce}}},me.br=function(ne){var ae=this.rules.inline.br.exec(ne);if(ae)return{type:"br",raw:ae[0]}},me.del=function(ne){var ae=this.rules.inline.del.exec(ne);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},me.autolink=function(ne,ae){var ce=this.rules.inline.autolink.exec(ne);if(ce){var ve,Ie;return ce[2]==="@"?(ve=q(this.options.mangle?ae(ce[1]):ce[1]),Ie="mailto:"+ve):(ve=q(ce[1]),Ie=ve),{type:"link",raw:ce[0],text:ve,href:Ie,tokens:[{type:"text",raw:ve,text:ve}]}}},me.url=function(ne,ae){var ce;if(ce=this.rules.inline.url.exec(ne)){var ve,Ie;if(ce[2]==="@")ve=q(this.options.mangle?ae(ce[0]):ce[0]),Ie="mailto:"+ve;else{var we;do we=ce[0],ce[0]=this.rules.inline._backpedal.exec(ce[0])[0];while(we!==ce[0]);ve=q(ce[0]),ce[1]==="www."?Ie="http://"+ve:Ie=ve}return{type:"link",raw:ce[0],text:ve,href:Ie,tokens:[{type:"text",raw:ve,text:ve}]}}},me.inlineText=function(ne,ae,ce){var ve=this.rules.inline.text.exec(ne);if(ve){var Ie;return ae?Ie=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):q(ve[0]):ve[0]:Ie=q(this.options.smartypants?ce(ve[0]):ve[0]),{type:"text",raw:ve[0],text:Ie}}},Ce}(),ke=z.noopTest,Ae=z.edit,Te=z.merge,ge={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:ke,table:ke,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=Ae(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=Ae(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=Ae(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._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",ge._comment=/<!--(?!-?>)[\s\S]*?-->/,ge.html=Ae(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=Ae(ge._paragraph).replace("hr",ge.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",ge._tag).getRegex(),ge.blockquote=Ae(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=Te({},ge),ge.gfm=Te({},ge.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*|$)"}),ge.gfm.nptable=Ae(ge.gfm.nptable).replace("hr",ge.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",ge._tag).getRegex(),ge.gfm.table=Ae(ge.gfm.table).replace("hr",ge.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",ge._tag).getRegex(),ge.pedantic=Te({},ge.normal,{html:Ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._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:ke,paragraph:Ae(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ke,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:ke,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=Ae(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=Ae(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=Ae(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=Ae(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=Ae(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=Ae(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=Ae(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=Ae(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=Ae(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=Ae(he._blockSkip,"g").getRegex(),he.overlapSkip=Ae(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._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])?)+(?![-_])/,he.autolink=Ae(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=Ae(he.tag).replace("comment",ge._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=Ae(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=Ae(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=Ae(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=Te({},he),he.pedantic=Te({},he.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:Ae(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:Ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=Te({},he.normal,{escape:Ae(he.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=Ae(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=Te({},he.gfm,{br:Ae(he.br).replace("{2,}","*").getRegex(),text:Ae(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var re={block:ge,inline:he},de=H.defaults,se=re.block,Oe=re.inline;function ie(Ce){return Ce.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function oe(Ce){var me="",Ee,ne,ae=Ce.length;for(Ee=0;Ee<ae;Ee++)ne=Ce.charCodeAt(Ee),Math.random()>.5&&(ne="x"+ne.toString(16)),me+="&#"+ne+";";return me}var be=function(){function Ce(Ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ee||de,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:se.normal,inline:Oe.normal};this.options.pedantic?(ne.block=se.pedantic,ne.inline=Oe.pedantic):this.options.gfm&&(ne.block=se.gfm,this.options.breaks?ne.inline=Oe.breaks:ne.inline=Oe.gfm),this.tokenizer.rules=ne}Ce.lex=function(ne,ae){var ce=new Ce(ae);return ce.lex(ne)};var me=Ce.prototype;return me.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},me.blockTokens=function(ne,ae,ce){ae===void 0&&(ae=[]),ce===void 0&&(ce=!0),ne=ne.replace(/^ +$/gm,"");for(var ve,Ie,we,Ke;ne;){if(ve=this.tokenizer.space(ne)){ne=ne.substring(ve.raw.length),ve.type&&ae.push(ve);continue}if(ve=this.tokenizer.code(ne,ae)){ne=ne.substring(ve.raw.length),ve.type?ae.push(ve):(Ke=ae[ae.length-1],Ke.raw+=`
|
|
`+ve.raw,Ke.text+=`
|
|
`+ve.text);continue}if(ve=this.tokenizer.fences(ne)){ne=ne.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.heading(ne)){ne=ne.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.nptable(ne)){ne=ne.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.hr(ne)){ne=ne.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.blockquote(ne)){ne=ne.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],ce),ae.push(ve);continue}if(ve=this.tokenizer.list(ne)){for(ne=ne.substring(ve.raw.length),we=ve.items.length,Ie=0;Ie<we;Ie++)ve.items[Ie].tokens=this.blockTokens(ve.items[Ie].text,[],!1);ae.push(ve);continue}if(ve=this.tokenizer.html(ne)){ne=ne.substring(ve.raw.length),ae.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),ae.push(ve);continue}if(ve=this.tokenizer.lheading(ne)){ne=ne.substring(ve.raw.length),ae.push(ve);continue}if(ce&&(ve=this.tokenizer.paragraph(ne))){ne=ne.substring(ve.raw.length),ae.push(ve);continue}if(ve=this.tokenizer.text(ne,ae)){ne=ne.substring(ve.raw.length),ve.type?ae.push(ve):(Ke=ae[ae.length-1],Ke.raw+=`
|
|
`+ve.raw,Ke.text+=`
|
|
`+ve.text);continue}if(ne){var ot="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(ot);break}else throw new Error(ot)}}return ae},me.inline=function(ne){var ae,ce,ve,Ie,we,Ke,ot=ne.length;for(ae=0;ae<ot;ae++){Ke=ne[ae];switch(Ke.type){case"paragraph":case"text":case"heading":{Ke.tokens=[],this.inlineTokens(Ke.text,Ke.tokens);break}case"table":{for(Ke.tokens={header:[],cells:[]},Ie=Ke.header.length,ce=0;ce<Ie;ce++)Ke.tokens.header[ce]=[],this.inlineTokens(Ke.header[ce],Ke.tokens.header[ce]);for(Ie=Ke.cells.length,ce=0;ce<Ie;ce++)for(we=Ke.cells[ce],Ke.tokens.cells[ce]=[],ve=0;ve<we.length;ve++)Ke.tokens.cells[ce][ve]=[],this.inlineTokens(we[ve],Ke.tokens.cells[ce][ve]);break}case"blockquote":{this.inline(Ke.tokens);break}case"list":{for(Ie=Ke.items.length,ce=0;ce<Ie;ce++)this.inline(Ke.items[ce].tokens);break}}}return ne},me.inlineTokens=function(ne,ae,ce,ve,Ie){ae===void 0&&(ae=[]),ce===void 0&&(ce=!1),ve===void 0&&(ve=!1),Ie===void 0&&(Ie="");var we,Ke=ne,ot;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(ot=this.tokenizer.rules.inline.reflinkSearch.exec(Ke))!=null;)ct.includes(ot[0].slice(ot[0].lastIndexOf("[")+1,-1))&&(Ke=Ke.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+Ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ot=this.tokenizer.rules.inline.blockSkip.exec(Ke))!=null;)Ke=Ke.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+Ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(we=this.tokenizer.escape(ne)){ne=ne.substring(we.raw.length),ae.push(we);continue}if(we=this.tokenizer.tag(ne,ce,ve)){ne=ne.substring(we.raw.length),ce=we.inLink,ve=we.inRawBlock,ae.push(we);continue}if(we=this.tokenizer.link(ne)){ne=ne.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,ve)),ae.push(we);continue}if(we=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,ve)),ae.push(we);continue}if(we=this.tokenizer.strong(ne,Ke,Ie)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ce,ve),ae.push(we);continue}if(we=this.tokenizer.em(ne,Ke,Ie)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ce,ve),ae.push(we);continue}if(we=this.tokenizer.codespan(ne)){ne=ne.substring(we.raw.length),ae.push(we);continue}if(we=this.tokenizer.br(ne)){ne=ne.substring(we.raw.length),ae.push(we);continue}if(we=this.tokenizer.del(ne)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ce,ve),ae.push(we);continue}if(we=this.tokenizer.autolink(ne,oe)){ne=ne.substring(we.raw.length),ae.push(we);continue}if(!ce&&(we=this.tokenizer.url(ne,oe))){ne=ne.substring(we.raw.length),ae.push(we);continue}if(we=this.tokenizer.inlineText(ne,ve,ie)){ne=ne.substring(we.raw.length),Ie=we.raw.slice(-1),ae.push(we);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 ae},J(Ce,null,[{key:"rules",get:function(){return{block:se,inline:Oe}}}]),Ce}(),De=H.defaults,Ne=z.cleanUrl,Fe=z.escape,je=function(){function Ce(Ee){this.options=Ee||De}var me=Ce.prototype;return me.code=function(ne,ae,ce){var ve=(ae||"").match(/\S*/)[0];if(this.options.highlight){var Ie=this.options.highlight(ne,ve);Ie!=null&&Ie!==ne&&(ce=!0,ne=Ie)}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>
|
|
`},me.blockquote=function(ne){return`<blockquote>
|
|
`+ne+`</blockquote>
|
|
`},me.html=function(ne){return ne},me.heading=function(ne,ae,ce,ve){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+ve.slug(ce)+'">'+ne+"</h"+ae+`>
|
|
`:"<h"+ae+">"+ne+"</h"+ae+`>
|
|
`},me.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},me.list=function(ne,ae,ce){var ve=ae?"ol":"ul",Ie=ae&&ce!==1?' start="'+ce+'"':"";return"<"+ve+Ie+`>
|
|
`+ne+"</"+ve+`>
|
|
`},me.listitem=function(ne){return"<li>"+ne+`</li>
|
|
`},me.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},me.paragraph=function(ne){return"<p>"+ne+`</p>
|
|
`},me.table=function(ne,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ne+`</thead>
|
|
`+ae+`</table>
|
|
`},me.tablerow=function(ne){return`<tr>
|
|
`+ne+`</tr>
|
|
`},me.tablecell=function(ne,ae){var ce=ae.header?"th":"td",ve=ae.align?"<"+ce+' align="'+ae.align+'">':"<"+ce+">";return ve+ne+"</"+ce+`>
|
|
`},me.strong=function(ne){return"<strong>"+ne+"</strong>"},me.em=function(ne){return"<em>"+ne+"</em>"},me.codespan=function(ne){return"<code>"+ne+"</code>"},me.br=function(){return this.options.xhtml?"<br/>":"<br>"},me.del=function(ne){return"<del>"+ne+"</del>"},me.link=function(ne,ae,ce){if(ne=Ne(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ce;var ve='<a href="'+Fe(ne)+'"';return ae&&(ve+=' title="'+ae+'"'),ve+=">"+ce+"</a>",ve},me.image=function(ne,ae,ce){if(ne=Ne(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ce;var ve='<img src="'+ne+'" alt="'+ce+'"';return ae&&(ve+=' title="'+ae+'"'),ve+=this.options.xhtml?"/>":">",ve},me.text=function(ne){return ne},Ce}(),Ue=function(){function Ce(){}var me=Ce.prototype;return me.strong=function(ne){return ne},me.em=function(ne){return ne},me.codespan=function(ne){return ne},me.del=function(ne){return ne},me.html=function(ne){return ne},me.text=function(ne){return ne},me.link=function(ne,ae,ce){return""+ce},me.image=function(ne,ae,ce){return""+ce},me.br=function(){return""},Ce}(),rt=function(){function Ce(){this.seen={}}var me=Ce.prototype;return me.slug=function(ne){var ae=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var ce=ae;do this.seen[ce]++,ae=ce+"-"+this.seen[ce];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},Ce}(),Qe=H.defaults,qe=z.unescape,Ye=function(){function Ce(Ee){this.options=Ee||Qe,this.options.renderer=this.options.renderer||new je,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new rt}Ce.parse=function(ne,ae){var ce=new Ce(ae);return ce.parse(ne)};var me=Ce.prototype;return me.parse=function(ne,ae){ae===void 0&&(ae=!0);var ce="",ve,Ie,we,Ke,ot,ct,dt,Lt,wt,ft,zt,Ft,Jt,Ht,Rt,Ur,Zr,bt,Ct=ne.length;for(ve=0;ve<Ct;ve++){ft=ne[ve];switch(ft.type){case"space":continue;case"hr":{ce+=this.renderer.hr();continue}case"heading":{ce+=this.renderer.heading(this.parseInline(ft.tokens),ft.depth,qe(this.parseInline(ft.tokens,this.textRenderer)),this.slugger);continue}case"code":{ce+=this.renderer.code(ft.text,ft.lang,ft.escaped);continue}case"table":{for(Lt="",dt="",Ke=ft.header.length,Ie=0;Ie<Ke;Ie++)dt+=this.renderer.tablecell(this.parseInline(ft.tokens.header[Ie]),{header:!0,align:ft.align[Ie]});for(Lt+=this.renderer.tablerow(dt),wt="",Ke=ft.cells.length,Ie=0;Ie<Ke;Ie++){for(ct=ft.tokens.cells[Ie],dt="",ot=ct.length,we=0;we<ot;we++)dt+=this.renderer.tablecell(this.parseInline(ct[we]),{header:!1,align:ft.align[we]});wt+=this.renderer.tablerow(dt)}ce+=this.renderer.table(Lt,wt);continue}case"blockquote":{wt=this.parse(ft.tokens),ce+=this.renderer.blockquote(wt);continue}case"list":{for(zt=ft.ordered,Ft=ft.start,Jt=ft.loose,Ke=ft.items.length,wt="",Ie=0;Ie<Ke;Ie++)Rt=ft.items[Ie],Ur=Rt.checked,Zr=Rt.task,Ht="",Rt.task&&(bt=this.renderer.checkbox(Ur),Jt?Rt.tokens.length>0&&Rt.tokens[0].type==="text"?(Rt.tokens[0].text=bt+" "+Rt.tokens[0].text,Rt.tokens[0].tokens&&Rt.tokens[0].tokens.length>0&&Rt.tokens[0].tokens[0].type==="text"&&(Rt.tokens[0].tokens[0].text=bt+" "+Rt.tokens[0].tokens[0].text)):Rt.tokens.unshift({type:"text",text:bt}):Ht+=bt),Ht+=this.parse(Rt.tokens,Jt),wt+=this.renderer.listitem(Ht,Zr,Ur);ce+=this.renderer.list(wt,zt,Ft);continue}case"html":{ce+=this.renderer.html(ft.text);continue}case"paragraph":{ce+=this.renderer.paragraph(this.parseInline(ft.tokens));continue}case"text":{for(wt=ft.tokens?this.parseInline(ft.tokens):ft.text;ve+1<Ct&&ne[ve+1].type==="text";)ft=ne[++ve],wt+=`
|
|
`+(ft.tokens?this.parseInline(ft.tokens):ft.text);ce+=ae?this.renderer.paragraph(wt):wt;continue}default:{var lt='Token with "'+ft.type+'" type was not found.';if(this.options.silent){console.error(lt);return}else throw new Error(lt)}}}return ce},me.parseInline=function(ne,ae){ae=ae||this.renderer;var ce="",ve,Ie,we=ne.length;for(ve=0;ve<we;ve++){Ie=ne[ve];switch(Ie.type){case"escape":{ce+=ae.text(Ie.text);break}case"html":{ce+=ae.html(Ie.text);break}case"link":{ce+=ae.link(Ie.href,Ie.title,this.parseInline(Ie.tokens,ae));break}case"image":{ce+=ae.image(Ie.href,Ie.title,Ie.text);break}case"strong":{ce+=ae.strong(this.parseInline(Ie.tokens,ae));break}case"em":{ce+=ae.em(this.parseInline(Ie.tokens,ae));break}case"codespan":{ce+=ae.codespan(Ie.text);break}case"br":{ce+=ae.br();break}case"del":{ce+=ae.del(this.parseInline(Ie.tokens,ae));break}case"text":{ce+=ae.text(Ie.text);break}default:{var Ke='Token with "'+Ie.type+'" type was not found.';if(this.options.silent){console.error(Ke);return}else throw new Error(Ke)}}}return ce},Ce}(),nt=z.merge,$e=z.checkSanitizeDeprecation,et=z.escape,_e=H.getDefaults,Je=H.changeDefaults,st=H.defaults;function Be(Ce,me,Ee){if(typeof Ce=="undefined"||Ce===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ce!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ce)+", string expected");if(typeof me=="function"&&(Ee=me,me=null),me=nt({},Be.defaults,me||{}),$e(me),Ee){var ne=me.highlight,ae;try{ae=be.lex(Ce,me)}catch(we){return Ee(we)}var ce=function(Ke){var ot;if(!Ke)try{ot=Ye.parse(ae,me)}catch(ct){Ke=ct}return me.highlight=ne,Ke?Ee(Ke):Ee(null,ot)};if(!ne||ne.length<3)return ce();if(delete me.highlight,!ae.length)return ce();var ve=0;Be.walkTokens(ae,function(we){we.type==="code"&&(ve++,setTimeout(function(){ne(we.text,we.lang,function(Ke,ot){if(Ke)return ce(Ke);ot!=null&&ot!==we.text&&(we.text=ot,we.escaped=!0),ve--,ve===0&&ce()})},0))}),ve===0&&ce();return}try{var Ie=be.lex(Ce,me);return me.walkTokens&&Be.walkTokens(Ie,me.walkTokens),Ye.parse(Ie,me)}catch(we){if(we.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,me.silent)return"<p>An error occurred:</p><pre>"+et(we.message+"",!0)+"</pre>";throw we}}Be.options=Be.setOptions=function(Ce){return nt(Be.defaults,Ce),Je(Be.defaults),Be},Be.getDefaults=_e,Be.defaults=st,Be.use=function(Ce){var me=nt({},Ce);if(Ce.renderer&&function(){var ne=Be.defaults.renderer||new je,ae=function(Ie){var we=ne[Ie];ne[Ie]=function(){for(var Ke=arguments.length,ot=new Array(Ke),ct=0;ct<Ke;ct++)ot[ct]=arguments[ct];var dt=Ce.renderer[Ie].apply(ne,ot);return dt===!1&&(dt=we.apply(ne,ot)),dt}};for(var ce in Ce.renderer)ae(ce);me.renderer=ne}(),Ce.tokenizer&&function(){var ne=Be.defaults.tokenizer||new Se,ae=function(Ie){var we=ne[Ie];ne[Ie]=function(){for(var Ke=arguments.length,ot=new Array(Ke),ct=0;ct<Ke;ct++)ot[ct]=arguments[ct];var dt=Ce.tokenizer[Ie].apply(ne,ot);return dt===!1&&(dt=we.apply(ne,ot)),dt}};for(var ce in Ce.tokenizer)ae(ce);me.tokenizer=ne}(),Ce.walkTokens){var Ee=Be.defaults.walkTokens;me.walkTokens=function(ne){Ce.walkTokens(ne),Ee&&Ee(ne)}}Be.setOptions(me)},Be.walkTokens=function(Ce,me){for(var Ee=F(Ce),ne;!(ne=Ee()).done;){var ae=ne.value;me(ae);switch(ae.type){case"table":{for(var ce=F(ae.tokens.header),ve;!(ve=ce()).done;){var Ie=ve.value;Be.walkTokens(Ie,me)}for(var we=F(ae.tokens.cells),Ke;!(Ke=we()).done;)for(var ot=Ke.value,ct=F(ot),dt;!(dt=ct()).done;){var Lt=dt.value;Be.walkTokens(Lt,me)}break}case"list":{Be.walkTokens(ae.items,me);break}default:ae.tokens&&Be.walkTokens(ae.tokens,me)}}},Be.Parser=Ye,Be.parser=Ye.parse,Be.Renderer=je,Be.TextRenderer=Ue,Be.Lexer=be,Be.lexer=be.lex,Be.Tokenizer=Se,Be.Slugger=rt,Be.parse=Be;var ze=Be;return ze})},ELLl:function(vt,Le,ee){(function(ue){ue(ee("VrN/"))})(function(ue){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(m,b,a){a&&a!=ue.Init&&(m.removeKeyMap(F),m.state.closeBrackets=null),b&&(M(X(b,"pairs")),m.state.closeBrackets=b,m.addKeyMap(F))});function X(m,b){return b=="pairs"&&typeof m=="string"?m:typeof m=="object"&&m[b]!=null?m[b]:J[b]}var F={Backspace:P,Enter:L};function M(m){for(var b=0;b<m.length;b++){var a=m.charAt(b),i="'"+a+"'";F[i]||(F[i]=H(a))}}M(J.pairs+"`");function H(m){return function(b){return f(b,m)}}function U(m){var b=m.state.closeBrackets;if(!b||b.override)return b;var a=m.getModeAt(m.getCursor());return a.closeBrackets||b}function P(m){var b=U(m);if(!b||m.getOption("disableInput"))return ue.Pass;for(var a=X(b,"pairs"),i=m.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var u=T(m,i[s].head);if(!u||a.indexOf(u)%2!=0)return ue.Pass}for(var s=i.length-1;s>=0;s--){var y=i[s].head;m.replaceRange("",O(y.line,y.ch-1),O(y.line,y.ch+1),"+delete")}}function L(m){var b=U(m),a=b&&X(b,"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 u=T(m,i[s].head);if(!u||a.indexOf(u)%2!=0)return ue.Pass}m.operation(function(){var y=m.lineSeparator()||`
|
|
`;m.replaceSelection(y+y,null),m.execCommand("goCharLeft"),i=m.listSelections();for(var g=0;g<i.length;g++){var v=i[g].head.line;m.indentLine(v,null,!0),m.indentLine(v+1,null,!0)}})}function h(m){var b=ue.cmpPos(m.anchor,m.head)>0;return{anchor:new O(m.anchor.line,m.anchor.ch+(b?-1:1)),head:new O(m.head.line,m.head.ch+(b?1:-1))}}function f(m,b){var a=U(m);if(!a||m.getOption("disableInput"))return ue.Pass;var i=X(a,"pairs"),s=i.indexOf(b);if(s==-1)return ue.Pass;for(var u=X(a,"closeBefore"),y=X(a,"triples"),g=i.charAt(s+1)==b,v=m.listSelections(),R=s%2==0,w,C=0;C<v.length;C++){var x=v[C],d=x.head,l,A=m.getRange(d,O(d.line,d.ch+1));if(R&&!x.empty())l="surround";else if((g||!R)&&A==b)g&&p(m,d)?l="both":y.indexOf(b)>=0&&m.getRange(d,O(d.line,d.ch+3))==b+b+b?l="skipThree":l="skip";else if(g&&d.ch>1&&y.indexOf(b)>=0&&m.getRange(O(d.line,d.ch-2),d)==b+b){if(d.ch>2&&/\bstring/.test(m.getTokenTypeAt(O(d.line,d.ch-2))))return ue.Pass;l="addFour"}else if(g){var S=d.ch==0?" ":m.getRange(O(d.line,d.ch-1),d);if(!ue.isWordChar(A)&&S!=b&&!ue.isWordChar(S))l="both";else return ue.Pass}else if(R&&(A.length===0||/\s/.test(A)||u.indexOf(A)>-1))l="both";else return ue.Pass;if(!w)w=l;else if(w!=l)return ue.Pass}var D=s%2?i.charAt(s-1):b,I=s%2?b: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 j=m.getSelections(),B=0;B<j.length;B++)j[B]=D+j[B]+I;m.replaceSelections(j,"around"),j=m.listSelections().slice();for(var B=0;B<j.length;B++)j[B]=h(j[B]);m.setSelections(j)}else w=="both"?(m.replaceSelection(D+I,null),m.triggerElectric(D+I),m.execCommand("goCharLeft")):w=="addFour"&&(m.replaceSelection(D+D+D+D,"before"),m.execCommand("goCharRight"))})}function T(m,b){var a=m.getRange(O(b.line,b.ch-1),O(b.line,b.ch+1));return a.length==2?a:null}function p(m,b){var a=m.getTokenAt(O(b.line,b.ch+1));return/\bstring/.test(a.type)&&a.start==b.ch&&(b.ch==0||!/\bstring/.test(m.getTokenTypeAt(b)))}})},GfqC:function(vt,Le,ee){"use strict";var ue=ee("q1tI"),J=ee.n(ue),O=ee("TSYQ"),X=ee.n(O);function F(z,_){var N="cannot "+z.method+" "+z.action+" "+_.status+"'",$=new Error(N);return $.status=_.status,$.method=z.method,$.url=z.action,$}function M(z){var _=z.responseText||z.response;if(!_)return _;try{return JSON.parse(_)}catch(N){return _}}function H(z){var _=new XMLHttpRequest;z.onProgress&&_.upload&&(_.upload.onprogress=function(le){le.total>0&&(le.percent=le.loaded/le.total*100),z.onProgress(le)});var N=new FormData;z.data&&Object.keys(z.data).forEach(function(q){var le=z.data[q];if(Array.isArray(le)){le.forEach(function(pe){N.append(q+"[]",pe)});return}N.append(q,z.data[q])}),z.file instanceof Blob?N.append(z.filename,z.file,z.file.name):N.append(z.filename,z.file),_.onerror=function(le){z.onError(le)},_.onload=function(){return _.status<200||_.status>=300?z.onError(F(z,_),M(_)):z.onSuccess(M(_),_)},_.open(z.method,z.action,!0),z.withCredentials&&"withCredentials"in _&&(_.withCredentials=!0);var $=z.headers||{};return $["X-Requested-With"]!==null&&_.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(q){$[q]!==null&&_.setRequestHeader(q,$[q])}),_.send(N),{abort:function(){_.abort()}}}var U=+new Date,P=0;function L(){return"rc-upload-"+U+"-"+ ++P}function h(z,_){return z.indexOf(_,z.length-_.length)!==-1}var f=function(z,_){if(z&&_){var N=Array.isArray(_)?_:_.split(","),$=z.name||"",q=z.type||"",le=q.replace(/\/.*$/,"");return N.some(function(pe){var Pe=pe.trim();return Pe.charAt(0)==="."?h($.toLowerCase(),Pe.toLowerCase()):/\/\*$/.test(Pe)?le===Pe.replace(/\/.*$/,""):q===Pe})}return!0};function T(z,_){var N=z.createReader(),$=[];function q(){N.readEntries(function(le){var pe=Array.prototype.slice.apply(le);$=$.concat(pe);var Pe=!pe.length;Pe?_($):q()})}q()}var p=function(_,N,$){var q=function le(pe,Pe){Pe=Pe||"",pe.isFile?pe.file(function(Se){$(Se)&&(pe.fullPath&&!Se.webkitRelativePath&&(Object.defineProperties(Se,{webkitRelativePath:{writable:!0}}),Se.webkitRelativePath=pe.fullPath.replace(/^\//,""),Object.defineProperties(Se,{webkitRelativePath:{writable:!1}})),N([Se]))}):pe.isDirectory&&T(pe,function(Se){Se.forEach(function(ke){le(ke,""+Pe+pe.name+"/")})})};_.forEach(function(le){q(le.webkitGetAsEntry())})},m=p,b=Object.assign||function(z){for(var _=1;_<arguments.length;_++){var N=arguments[_];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(z[$]=N[$])}return z},a=function(){function z(_,N){var $=[],q=!0,le=!1,pe=void 0;try{for(var Pe=_[Symbol.iterator](),Se;!(q=(Se=Pe.next()).done)&&!($.push(Se.value),N&&$.length===N);q=!0);}catch(ke){le=!0,pe=ke}finally{try{!q&&Pe.return&&Pe.return()}finally{if(le)throw pe}}return $}return function(_,N){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return z(_,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function z(_,N){for(var $=0;$<N.length;$++){var q=N[$];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(_,q.key,q)}}return function(_,N,$){return N&&z(_.prototype,N),$&&z(_,$),_}}();function s(z,_,N){return _ in z?Object.defineProperty(z,_,{value:N,enumerable:!0,configurable:!0,writable:!0}):z[_]=N,z}function u(z,_){var N={};for(var $ in z){if(_.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(z,$))continue;N[$]=z[$]}return N}function y(z,_){if(!(z instanceof _))throw new TypeError("Cannot call a class as a function")}function g(z,_){if(!z)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:z}function v(z,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);z.prototype=Object.create(_&&_.prototype,{constructor:{value:z,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(z,_):z.__proto__=_)}var R=function(_){return Object.keys(_).reduce(function(N,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(N[$]=_[$]),N},{})},w=function(z){v(_,z);function _(){var N,$,q,le;y(this,_);for(var pe=arguments.length,Pe=Array(pe),Se=0;Se<pe;Se++)Pe[Se]=arguments[Se];return le=($=(q=g(this,(N=_.__proto__||Object.getPrototypeOf(_)).call.apply(N,[this].concat(Pe))),q),q.state={uid:L()},q.reqs={},q.onChange=function(ke){var Ae=ke.target.files;q.uploadFiles(Ae),q.reset()},q.onClick=function(ke){var Ae=q.fileInput;if(!Ae)return;var Te=q.props,ge=Te.children,he=Te.onClick;ge&&ge.type==="button"&&(Ae.parentNode.focus(),Ae.parentNode.querySelector("button").blur()),Ae.click(),he&&he(ke)},q.onKeyDown=function(ke){ke.key==="Enter"&&q.onClick()},q.onFileDrop=function(ke){var Ae=q.props.multiple;if(ke.preventDefault(),ke.type==="dragover")return;if(q.props.directory)m(Array.prototype.slice.call(ke.dataTransfer.items),q.uploadFiles,function(ge){return f(ge,q.props.accept)});else{var Te=Array.prototype.slice.call(ke.dataTransfer.files).filter(function(ge){return f(ge,q.props.accept)});Ae===!1&&(Te=Te.slice(0,1)),q.uploadFiles(Te)}},q.uploadFiles=function(ke){var Ae=Array.prototype.slice.call(ke);Ae.map(function(Te){return Te.uid=L(),Te}).forEach(function(Te){q.upload(Te,Ae)})},q.saveFileInput=function(ke){q.fileInput=ke},$),g(q,le)}return i(_,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,q){var le=this,pe=this.props;if(!pe.beforeUpload)return setTimeout(function(){return le.post($)},0);var Pe=pe.beforeUpload($,q);Pe&&Pe.then?Pe.then(function(Se){var ke=Object.prototype.toString.call(Se);return ke==="[object File]"||ke==="[object Blob]"?le.post(Se):le.post($)}).catch(function(Se){console.log(Se)}):Pe!==!1&&setTimeout(function(){return le.post($)},0);return}},{key:"post",value:function($){var q=this;if(!this._isMounted)return;var le=this.props,pe=le.onStart,Pe=le.onProgress,Se=le.transformFile,ke=Se===void 0?function(Ae){return Ae}:Se;new Promise(function(Ae){var Te=le.action;return typeof Te=="function"&&(Te=Te($)),Ae(Te)}).then(function(Ae){var Te=$.uid,ge=le.customRequest||H,he=Promise.resolve(ke($)).then(function(re){var de=le.data;return typeof de=="function"&&(de=de(re)),Promise.all([re,de])}).catch(function(re){console.error(re)});he.then(function(re){var de=a(re,2),se=de[0],Oe=de[1],ie={action:Ae,filename:le.name,data:Oe,file:se,headers:le.headers,withCredentials:le.withCredentials,method:le.method||"post",onProgress:Pe?function(oe){Pe(oe,$)}:null,onSuccess:function(be,De){delete q.reqs[Te],le.onSuccess(be,$,De)},onError:function(be,De){delete q.reqs[Te],le.onError(be,De,$)}};pe($),q.reqs[Te]=ge(ie)})})}},{key:"reset",value:function(){this.setState({uid:L()})}},{key:"abort",value:function($){var q=this.reqs;if($){var le=$;$&&$.uid&&(le=$.uid),q[le]&&q[le].abort&&q[le].abort(),delete q[le]}else Object.keys(q).forEach(function(pe){q[pe]&&q[pe].abort&&q[pe].abort(),delete q[pe]})}},{key:"render",value:function(){var $,q=this.props,le=q.component,pe=q.prefixCls,Pe=q.className,Se=q.disabled,ke=q.id,Ae=q.style,Te=q.multiple,ge=q.accept,he=q.children,re=q.directory,de=q.openFileDialogOnClick,se=q.onMouseEnter,Oe=q.onMouseLeave,ie=u(q,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),oe=X()(($={},s($,pe,!0),s($,pe+"-disabled",Se),s($,Pe,Pe),$)),be=Se?{}:{onClick:de?this.onClick:function(){},onKeyDown:de?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:Oe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(le,b({},be,{className:oe,role:"button",style:Ae}),J.a.createElement("input",b({},R(ie),{id:ke,type:"file",ref:this.saveFileInput,onClick:function(Ne){return Ne.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ge,directory:re?"directory":null,webkitdirectory:re?"webkitdirectory":null,multiple:Te,onChange:this.onChange})),he)}}]),_}(ue.Component),C=w,x=Object.assign||function(z){for(var _=1;_<arguments.length;_++){var N=arguments[_];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(z[$]=N[$])}return z},d=function(){function z(_,N){for(var $=0;$<N.length;$++){var q=N[$];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(_,q.key,q)}}return function(_,N,$){return N&&z(_.prototype,N),$&&z(_,$),_}}();function l(z,_){if(!(z instanceof _))throw new TypeError("Cannot call a class as a function")}function A(z,_){if(!z)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:z}function S(z,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);z.prototype=Object.create(_&&_.prototype,{constructor:{value:z,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(z,_):z.__proto__=_)}function D(){}var I=function(z){S(_,z);function _(){var N,$,q,le;l(this,_);for(var pe=arguments.length,Pe=Array(pe),Se=0;Se<pe;Se++)Pe[Se]=arguments[Se];return le=($=(q=A(this,(N=_.__proto__||Object.getPrototypeOf(_)).call.apply(N,[this].concat(Pe))),q),q.saveUploader=function(ke){q.uploader=ke},$),A(q,le)}return d(_,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return J.a.createElement(C,x({},this.props,{ref:this.saveUploader}))}}]),_}(ue.Component);I.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=I,j=Le.a=B},HmJG:function(vt,Le,ee){},JYp7:function(vt,Le,ee){"use strict";ee.d(Le,"c",function(){return J}),ee.d(Le,"d",function(){return O}),ee.d(Le,"f",function(){return F}),ee.d(Le,"a",function(){return M}),ee.d(Le,"b",function(){return H}),ee.d(Le,"e",function(){return U});var ue=function(){var P=function(L,h){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(L,h)};return function(L,h){P(L,h);function f(){this.constructor=L}L.prototype=h===null?Object.create(h):(f.prototype=h.prototype,new f)}}(),J={done:!0,value:void 0},O;(function(P){var L={next:function(){return J}};function h(){return L}P.empty=h;function f(g){var v=!1;return{next:function(){return v?J:(v=!0,{done:!1,value:g})}}}P.single=f;function T(g,v,R){return v===void 0&&(v=0),R===void 0&&(R=g.length),{next:function(){return v>=R?J:{done:!1,value:g[v++]}}}}P.fromArray=T;function p(g){return{next:function(){var v=g.next();return v.done?J:{done:!1,value:v.value}}}}P.fromNativeIterator=p;function m(g){return g?Array.isArray(g)?P.fromArray(g):g:P.empty()}P.from=m;function b(g,v){return{next:function(){var R=g.next();return R.done?J:{done:!1,value:v(R.value)}}}}P.map=b;function a(g,v){return{next:function(){for(;;){var R=g.next();if(R.done)return J;if(v(R.value))return{done:!1,value:R.value}}}}}P.filter=a;function i(g,v){for(var R=g.next();!R.done;R=g.next())v(R.value)}P.forEach=i;function s(g,v){v===void 0&&(v=Number.POSITIVE_INFINITY);var R=[];if(v===0)return R;for(var w=0,C=g.next();!C.done&&!(R.push(C.value),++w>=v);C=g.next());return R}P.collect=s;function u(){for(var g=[],v=0;v<arguments.length;v++)g[v]=arguments[v];var R=0;return{next:function(){if(R>=g.length)return J;var w=g[R],C=w.next();return C.done?(R++,this.next()):C}}}P.concat=u;function y(g){return new X(g)}P.chain=y})(O||(O={}));var X=function(){function P(L){this.it=L}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(L,h,f,T){h===void 0&&(h=0),f===void 0&&(f=L.length),T===void 0&&(T=h-1),this.items=L,this.start=h,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}(),H=function(P){ue(L,P);function L(h,f,T,p){return f===void 0&&(f=0),T===void 0&&(T=h.length),p===void 0&&(p=f-1),P.call(this,h,f,T,p)||this}return L.prototype.current=function(){return P.prototype.current.call(this)},L.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},L.prototype.first=function(){return this.index=this.start,this.current()},L.prototype.last=function(){return this.index=this.end-1,this.current()},L.prototype.parent=function(){return null},L}(M),U=function(){function P(L,h){this.iterator=L,this.fn=h}return P.prototype.next=function(){return this.fn(this.iterator.next())},P}()},LdHM:function(vt,Le,ee){"use strict";ee.d(Le,"b",function(){return u}),ee.d(Le,"a",function(){return g});var ue=ee("1OyB"),J=ee("vuIU"),O=ee("Ji7U"),X=ee("LK+K"),F=ee("q1tI"),M=ee("rePB"),H=ee("Ff2n"),U=ee("ODXe"),P=ee("4IlW"),L=ee("bX4T"),h=ee("YrtM"),f=ee("TSYQ"),T=ee.n(f),p=ee("+nKL"),m=ee("8OUc"),b=function($,q){var le=$.prefixCls,pe=$.id,Pe=$.flattenOptions,Se=$.childrenAsData,ke=$.values,Ae=$.searchValue,Te=$.multiple,ge=$.defaultActiveFirstOption,he=$.height,re=$.itemHeight,de=$.notFoundContent,se=$.open,Oe=$.menuItemSelectedIcon,ie=$.virtual,oe=$.onSelect,be=$.onToggleOpen,De=$.onActiveValue,Ne=$.onScroll,Fe=$.onMouseEnter,je="".concat(le,"-item"),Ue=Object(h.a)(function(){return Pe},[se,Pe],function(ze,Ce){return Ce[0]&&ze[1]!==Ce[1]}),rt=F.useRef(null),Qe=function(Ce){Ce.preventDefault()},qe=function(Ce){rt.current&&rt.current.scrollTo({index:Ce})},Ye=function(Ce){for(var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ee=Ue.length,ne=0;ne<Ee;ne+=1){var ae=(Ce+ne*me+Ee)%Ee,ce=Ue[ae],ve=ce.group,Ie=ce.data;if(!ve&&!Ie.disabled)return ae}return-1},nt=F.useState(function(){return Ye(0)}),$e=Object(U.a)(nt,2),et=$e[0],_e=$e[1],Je=function(Ce){_e(Ce);var me=Ue[Ce];if(!me){De(null,-1);return}De(me.data.value,Ce)};F.useEffect(function(){Je(ge!==!1?Ye(0):-1)},[Ue.length,Ae]),F.useEffect(function(){var ze=setTimeout(function(){if(!Te&&se&&ke.size===1){var Ce=Array.from(ke)[0],me=Ue.findIndex(function(Ee){var ne=Ee.data;return ne.value===Ce});Je(me),qe(me)}});return function(){return clearTimeout(ze)}},[se]);var st=function(Ce){Ce!==void 0&&oe(Ce,{selected:!ke.has(Ce)}),Te||be(!1)};if(F.useImperativeHandle(q,function(){return{onKeyDown:function(Ce){var me=Ce.which;switch(me){case P.a.UP:case P.a.DOWN:{var Ee=0;if(me===P.a.UP?Ee=-1:me===P.a.DOWN&&(Ee=1),Ee!==0){var ne=Ye(et+Ee,Ee);qe(ne),Je(ne)}break}case P.a.ENTER:{var ae=Ue[et];ae&&!ae.data.disabled?st(ae.data.value):st(void 0),se&&Ce.preventDefault();break}case P.a.ESC:be(!1)}},onKeyUp:function(){},scrollTo:function(Ce){qe(Ce)}}}),Ue.length===0)return F.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),className:"".concat(je,"-empty"),onMouseDown:Qe},de);function Be(ze){var Ce=Ue[ze];if(!Ce)return null;var me=Ce.data||{},Ee=me.value,ne=me.label,ae=me.children,ce=Object(L.a)(me,!0),ve=Se?ae:ne;return Ce?F.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},ce,{key:ze,role:"option",id:"".concat(pe,"_list_").concat(ze),"aria-selected":ke.has(Ee)}),Ee):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Be(et-1),Be(et),Be(et+1)),F.createElement(p.a,{itemKey:"key",ref:rt,data:Ue,height:he,itemHeight:re,fullHeight:!1,onMouseDown:Qe,onScroll:Ne,virtual:ie,onMouseEnter:Fe},function(ze,Ce){var me,Ee=ze.group,ne=ze.groupOption,ae=ze.data,ce=ae.label,ve=ae.key;if(Ee)return F.createElement("div",{className:T()(je,"".concat(je,"-group"))},ce!==void 0?ce:ve);var Ie=ae.disabled,we=ae.value,Ke=ae.title,ot=ae.children,ct=ae.style,dt=ae.className,Lt=Object(H.a)(ae,["disabled","value","title","children","style","className"]),wt=ke.has(we),ft="".concat(je,"-option"),zt=T()(je,ft,dt,(me={},Object(M.a)(me,"".concat(ft,"-grouped"),ne),Object(M.a)(me,"".concat(ft,"-active"),et===Ce&&!Ie),Object(M.a)(me,"".concat(ft,"-disabled"),Ie),Object(M.a)(me,"".concat(ft,"-selected"),wt),me)),Ft=Se?ot:ce,Jt=!Oe||typeof Oe=="function"||wt;return F.createElement("div",Object.assign({},Lt,{"aria-selected":wt,className:zt,title:Ke,onMouseMove:function(){if(et===Ce||Ie)return;Je(Ce)},onClick:function(){Ie||st(we)},style:ct}),F.createElement("div",{className:"".concat(ft,"-content")},Ft||we),F.isValidElement(Oe)||wt,Jt&&F.createElement(m.a,{className:"".concat(je,"-option-state"),customizeIcon:Oe,customizeIconProps:{isSelected:wt}},wt?"\u2713":null))}))},a=F.forwardRef(b);a.displayName="OptionList";var i=a,s=function(){return null};s.isSelectOption=!0;var u=s,y=function(){return null};y.isSelectOptGroup=!0;var g=y,v=ee("VTBJ"),R=ee("Zm9Q");function w(N){var $=N.key,q=N.props,le=q.children,pe=q.value,Pe=Object(H.a)(q,["children","value"]);return Object(v.a)({key:$,value:pe!==void 0?pe:$,children:le},Pe)}function C(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(N).map(function(q,le){if(!F.isValidElement(q)||!q.type)return null;var pe=q.type.isSelectOptGroup,Pe=q.key,Se=q.props,ke=Se.children,Ae=Object(H.a)(Se,["children"]);return $||!pe?w(q):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Pe===null?le:Pe,"__"),label:Pe},Ae),{},{options:C(ke)})}).filter(function(q){return q})}var x=ee("2Qr1"),d=ee("qNPg"),l=ee("U8pU"),A=ee("Kwbf"),S=ee("WKfj");function D(N){var $=N.mode,q=N.options,le=N.children,pe=N.backfill,Pe=N.allowClear,Se=N.placeholder,ke=N.getInputElement,Ae=N.showSearch,Te=N.onSearch,ge=N.defaultOpen,he=N.autoFocus,re=N.labelInValue,de=N.value,se=N.inputValue,Oe=N.optionLabelProp,ie=$==="multiple"||$==="tags",oe=Ae!==void 0?Ae:ie||$==="combobox",be=q||C(le);if(Object(A.a)($!=="tags"||be.every(function(je){return!je.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var De=be.some(function(je){return je.options?je.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in je?je.value:je.key)=="number"});Object(A.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(A.a)($!=="combobox"||!Oe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(A.a)($==="combobox"||!pe,"`backfill` only works with `combobox` mode."),Object(A.a)($==="combobox"||!ke,"`getInputElement` only work with `combobox` mode."),Object(A.b)($!=="combobox"||!ke||!Pe||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Te&&!oe&&$!=="combobox"&&$!=="tags"&&Object(A.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(A.b)(!ge||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var Ne=Object(S.d)(de);Object(A.a)(!re||Ne.every(function(je){return Object(l.a)(je)==="object"&&("key"in je||"value"in je)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(A.a)(!ie||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(le){var Fe=null;Object(R.a)(le).some(function(je){if(!F.isValidElement(je)||!je.type)return!1;var Ue=je.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var rt=Object(R.a)(je.props.children).every(function(Qe){return!F.isValidElement(Qe)||!je.type||Qe.type.isSelectOption?!0:(Fe=Qe.type,!1)});return!rt}return Fe=Ue,!0}),Fe&&Object(A.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(A.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=D,B=Object(d.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:C,flattenOptions:x.d,getLabeledValue:x.e,filterOptions:x.b,isValueDisabled:x.g,findValueOption:x.c,warningProps:I,fillOptionsWithMissingValue:x.a}),j=function(N){Object(O.a)(q,N);var $=Object(X.a)(q);function q(){var le;return Object(ue.a)(this,q),le=$.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)(q,[{key:"render",value:function(){return F.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),q}(F.Component);j.Option=u,j.OptGroup=g;var z=j,_=Le.c=z},M8RZ:function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return P});var ue=ee("fWQN"),J=ee("mtLc"),O=ee("yKVA"),X=ee("879j"),F=ee("q1tI"),M=ee.n(F),H=ee("i8i4"),U=ee.n(H),P=function(L){Object(O.a)(f,L);var h=Object(X.a)(f);function f(T){var p;Object(ue.a)(this,f),p=h.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(H.createPortal)(p,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),f}(M.a.Component)},MI8n:function(vt,Le,ee){"use strict";ee.d(Le,"b",function(){return M}),ee.d(Le,"a",function(){return P}),ee.d(Le,"e",function(){return L}),ee.d(Le,"d",function(){return h}),ee.d(Le,"c",function(){return f}),ee.d(Le,"f",function(){return T});var ue=ee("/cxE"),J=ee("C/vA"),O=ee("pmY6"),X=ee("24hK"),F=function(){var p=function(m,b){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,b)};return function(m,b){p(m,b);function a(){this.constructor=m}m.prototype=b===null?Object.create(b):(a.prototype=b.prototype,new a)}}(),M;(function(p){p.None=function(){return O.a.None};function m(I){return function(B,j,z){j===void 0&&(j=null);var _=!1,N;return N=I(function($){return _?void 0:(N?N.dispose():_=!0,B.call(j,$))},null,z),_&&N.dispose(),N}}p.once=m;function b(I,B){return g(function(j,z,_){return z===void 0&&(z=null),I(function(N){return j.call(z,B(N))},null,_)})}p.map=b;function a(I,B){return g(function(j,z,_){return z===void 0&&(z=null),I(function(N){B(N),j.call(z,N)},null,_)})}p.forEach=a;function i(I,B){return g(function(j,z,_){return z===void 0&&(z=null),I(function(N){return B(N)&&j.call(z,N)},null,_)})}p.filter=i;function s(I){return I}p.signal=s;function u(){for(var I=[],B=0;B<arguments.length;B++)I[B]=arguments[B];return function(j,z,_){return z===void 0&&(z=null),O.e.apply(void 0,I.map(function(N){return N(function($){return j.call(z,$)},null,_)}))}}p.any=u;function y(I,B,j){var z=j;return b(I,function(_){return z=B(z,_),z})}p.reduce=y;function g(I){var B,j=new P({onFirstListenerAdd:function(){B=I(j.fire,j)},onLastListenerRemove:function(){B.dispose()}});return j.event}p.snapshot=g;function v(I,B,j,z,_){j===void 0&&(j=100),z===void 0&&(z=!1);var N,$=void 0,q=void 0,le=0,pe=new P({leakWarningThreshold:_,onFirstListenerAdd:function(){N=I(function(Pe){le++,$=B($,Pe),z&&!q&&(pe.fire($),$=void 0),clearTimeout(q),q=setTimeout(function(){var Se=$;$=void 0,q=void 0,(!z||le>1)&&pe.fire(Se),le=0},j)})},onLastListenerRemove:function(){N.dispose()}});return pe.event}p.debounce=v;function R(I){var B=new Date().getTime();return b(m(I),function(j){return new Date().getTime()-B})}p.stopwatch=R;function w(I){var B=!0,j;return i(I,function(z){var _=B||z!==j;return B=!1,j=z,_})}p.latch=w;function C(I,B,j){B===void 0&&(B=!1),j===void 0&&(j=[]);var z=j.slice(),_=I(function(q){z?z.push(q):$.fire(q)}),N=function(){z&&z.forEach(function(q){return $.fire(q)}),z=null},$=new P({onFirstListenerAdd:function(){_||(_=I(function(q){return $.fire(q)}))},onFirstListenerDidAdd:function(){z&&(B?setTimeout(N):N())},onLastListenerRemove:function(){_&&_.dispose(),_=null}});return $.event}p.buffer=C;var x=function(){function I(B){this.event=B}return I.prototype.map=function(B){return new I(b(this.event,B))},I.prototype.forEach=function(B){return new I(a(this.event,B))},I.prototype.filter=function(B){return new I(i(this.event,B))},I.prototype.reduce=function(B,j){return new I(y(this.event,B,j))},I.prototype.latch=function(){return new I(w(this.event))},I.prototype.debounce=function(B,j,z,_){return j===void 0&&(j=100),z===void 0&&(z=!1),new I(v(this.event,B,j,z,_))},I.prototype.on=function(B,j,z){return this.event(B,j,z)},I.prototype.once=function(B,j,z){return m(this.event)(B,j,z)},I}();function d(I){return new x(I)}p.chain=d;function l(I,B,j){j===void 0&&(j=function(q){return q});var z=function(){for(var q=[],le=0;le<arguments.length;le++)q[le]=arguments[le];return $.fire(j.apply(void 0,q))},_=function(){return I.on(B,z)},N=function(){return I.removeListener(B,z)},$=new P({onFirstListenerAdd:_,onLastListenerRemove:N});return $.event}p.fromNodeEventEmitter=l;function A(I,B,j){j===void 0&&(j=function(q){return q});var z=function(){for(var q=[],le=0;le<arguments.length;le++)q[le]=arguments[le];return $.fire(j.apply(void 0,q))},_=function(){return I.addEventListener(B,z)},N=function(){return I.removeEventListener(B,z)},$=new P({onFirstListenerAdd:_,onLastListenerRemove:N});return $.event}p.fromDOMEventEmitter=A;function S(I){var B=new P,j=!1;return I.then(void 0,function(){return null}).then(function(){j?B.fire(void 0):setTimeout(function(){return B.fire(void 0)},0)}),j=!0,B.event}p.fromPromise=S;function D(I){return new Promise(function(B){return m(I)(B)})}p.toPromise=D})(M||(M={}));var H=-1,U=function(){function p(m,b){b===void 0&&(b=Math.random().toString(18).slice(2,5)),this.customThreshold=m,this.name=b,this._warnCountdown=0}return p.prototype.dispose=function(){this._stacks&&this._stacks.clear()},p.prototype.check=function(m){var b=this,a=H;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 u,y=0;this._stacks.forEach(function(g,v){(!u||y<g)&&(u=v,y=g)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+m+" listeners already. MOST frequent listener ("+y+"):"),console.warn(u)}return function(){var g=b._stacks.get(i)||0;b._stacks.set(i,g-1)}},p}(),P=function(){function p(m){this._disposed=!1,this._options=m,this._leakageMon=H>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(b,a,i){m._listeners||(m._listeners=new X.a);var s=m._listeners.isEmpty();s&&m._options&&m._options.onFirstListenerAdd&&m._options.onFirstListenerAdd(m);var u=m._listeners.push(a?[b,a]:b);s&&m._options&&m._options.onFirstListenerDidAdd&&m._options.onFirstListenerDidAdd(m),m._options&&m._options.onListenerDidAdd&&m._options.onListenerDidAdd(m,b,a);var y;m._leakageMon&&(y=m._leakageMon.check(m._listeners.size));var g;return g={dispose:function(){if(y&&y(),g.dispose=p._noop,!m._disposed&&(u(),m._options&&m._options.onLastListenerRemove)){var v=m._listeners&&!m._listeners.isEmpty();v||m._options.onLastListenerRemove(m)}}},i instanceof O.b?i.add(g):Array.isArray(i)&&i.push(g),g}),this._event},enumerable:!0,configurable:!0}),p.prototype.fire=function(m){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new X.a);for(var b=this._listeners.iterator(),a=b.next();!a.done;a=b.next())this._deliveryQueue.push([a.value,m]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),s=i[0],u=i[1];try{typeof s=="function"?s.call(void 0,u):s[0].call(s[1],u)}catch(y){Object(ue.e)(y)}}}},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}(),L=function(p){F(m,p);function m(b){var a=p.call(this,b)||this;return a._isPaused=0,a._eventQueue=new X.a,a._mergeFn=b&&b.merge,a}return m.prototype.pause=function(){this._isPaused++},m.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var b=this._eventQueue.toArray();this._eventQueue.clear(),p.prototype.fire.call(this,this._mergeFn(b))}else for(;!this._isPaused&&this._eventQueue.size!==0;)p.prototype.fire.call(this,this._eventQueue.shift())},m.prototype.fire=function(b){this._listeners&&(this._isPaused!==0?this._eventQueue.push(b):p.prototype.fire.call(this,b))},m}(P),h=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 b=this,a={event:m,listener:null};this.events.push(a),this.hasListeners&&this.hook(a);var i=function(){b.hasListeners&&b.unhook(a);var s=b.events.indexOf(a);b.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(b){return m.hook(b)})},p.prototype.onLastListenerRemove=function(){var m=this;this.hasListeners=!1,this.events.forEach(function(b){return m.unhook(b)})},p.prototype.hook=function(m){var b=this;m.listener=m.event(function(a){return b.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 b=this;return function(a,i,s){return m(function(u){var y=b.buffers[b.buffers.length-1];y?y.push(function(){return a.call(i,u)}):a.call(i,u)},void 0,s)}},p.prototype.bufferEvents=function(m){var b=[];this.buffers.push(b);var a=m();return this.buffers.pop(),b.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(vt,Le,ee){"use strict";ee.d(Le,"x",function(){return ue}),ee.d(Le,"F",function(){return J}),ee.d(Le,"r",function(){return X}),ee.d(Le,"o",function(){return F}),ee.d(Le,"p",function(){return M}),ee.d(Le,"Q",function(){return H}),ee.d(Le,"K",function(){return P}),ee.d(Le,"k",function(){return L}),ee.d(Le,"N",function(){return h}),ee.d(Le,"m",function(){return f}),ee.d(Le,"l",function(){return T}),ee.d(Le,"I",function(){return p}),ee.d(Le,"H",function(){return m}),ee.d(Le,"q",function(){return b}),ee.d(Le,"t",function(){return a}),ee.d(Le,"D",function(){return i}),ee.d(Le,"e",function(){return s}),ee.d(Le,"f",function(){return u}),ee.d(Le,"B",function(){return y}),ee.d(Le,"C",function(){return g}),ee.d(Le,"n",function(){return R}),ee.d(Le,"O",function(){return C}),ee.d(Le,"c",function(){return x}),ee.d(Le,"d",function(){return d}),ee.d(Le,"z",function(){return l}),ee.d(Le,"A",function(){return A}),ee.d(Le,"u",function(){return S}),ee.d(Le,"E",function(){return I}),ee.d(Le,"G",function(){return B}),ee.d(Le,"i",function(){return z}),ee.d(Le,"g",function(){return N}),ee.d(Le,"v",function(){return q}),ee.d(Le,"h",function(){return le}),ee.d(Le,"y",function(){return pe}),ee.d(Le,"w",function(){return Pe}),ee.d(Le,"a",function(){return Se}),ee.d(Le,"P",function(){return ke}),ee.d(Le,"L",function(){return Ae}),ee.d(Le,"J",function(){return Te}),ee.d(Le,"j",function(){return ge}),ee.d(Le,"M",function(){return he}),ee.d(Le,"s",function(){return re}),ee.d(Le,"b",function(){return de});function ue(ie){return!ie||typeof ie!="string"?!0:ie.trim().length===0}function J(ie,oe,be){be===void 0&&(be="0");for(var De=""+ie,Ne=[De],Fe=De.length;Fe<oe;Fe++)Ne.push(be);return Ne.reverse().join("")}var O=/{(\d+)}/g;function X(ie){for(var oe=[],be=1;be<arguments.length;be++)oe[be-1]=arguments[be];return oe.length===0?ie:ie.replace(O,function(De,Ne){var Fe=parseInt(Ne,10);return isNaN(Fe)||Fe<0||Fe>=oe.length?De:oe[Fe]})}function F(ie){return ie.replace(/[<>&]/g,function(oe){switch(oe){case"<":return"<";case">":return">";case"&":return"&";default:return oe}})}function M(ie){return ie.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function H(ie,oe){oe===void 0&&(oe=" ");var be=U(ie,oe);return P(be,oe)}function U(ie,oe){if(!ie||!oe)return ie;var be=oe.length;if(be===0||ie.length===0)return ie;for(var De=0;ie.indexOf(oe,De)===De;)De=De+be;return ie.substring(De)}function P(ie,oe){if(!ie||!oe)return ie;var be=oe.length,De=ie.length;if(be===0||De===0)return ie;for(var Ne=De,Fe=-1;!(Fe=ie.lastIndexOf(oe,Ne-1),Fe===-1||Fe+be!==Ne);){if(Fe===0)return"";Ne=Fe}return ie.substring(0,Ne)}function L(ie){return ie.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function h(ie,oe){if(ie.length<oe.length)return!1;if(ie===oe)return!0;for(var be=0;be<oe.length;be++)if(ie[be]!==oe[be])return!1;return!0}function f(ie,oe){var be=ie.length-oe.length;return be>0?ie.indexOf(oe,be)===be:be===0?ie===oe:!1}function T(ie,oe,be){if(be===void 0&&(be={}),!ie)throw new Error("Cannot create regex from empty string");oe||(ie=M(ie)),be.wholeWord&&(/\B/.test(ie.charAt(0))||(ie="\\b"+ie),/\B/.test(ie.charAt(ie.length-1))||(ie=ie+"\\b"));var De="";return be.global&&(De+="g"),be.matchCase||(De+="i"),be.multiline&&(De+="m"),be.unicode&&(De+="u"),new RegExp(ie,De)}function p(ie){if(ie.source==="^"||ie.source==="^$"||ie.source==="$"||ie.source==="^\\s*$")return!1;var oe=ie.exec("");return!!(oe&&ie.lastIndex===0)}function m(ie){return(ie.global?"g":"")+(ie.ignoreCase?"i":"")+(ie.multiline?"m":"")+(ie.unicode?"u":"")}function b(ie){for(var oe=0,be=ie.length;oe<be;oe++){var De=ie.charCodeAt(oe);if(De!==32&&De!==9)return oe}return-1}function a(ie,oe,be){oe===void 0&&(oe=0),be===void 0&&(be=ie.length);for(var De=oe;De<be;De++){var Ne=ie.charCodeAt(De);if(Ne!==32&&Ne!==9)return ie.substring(oe,De)}return ie.substring(oe,be)}function i(ie,oe){oe===void 0&&(oe=ie.length-1);for(var be=oe;be>=0;be--){var De=ie.charCodeAt(be);if(De!==32&&De!==9)return be}return-1}function s(ie,oe){return ie<oe?-1:ie>oe?1:0}function u(ie,oe){for(var be=Math.min(ie.length,oe.length),De=0;De<be;De++){var Ne=ie.charCodeAt(De),Fe=oe.charCodeAt(De);if(Ne===Fe)continue;g(Ne)&&(Ne+=32),g(Fe)&&(Fe+=32);var je=Ne-Fe;if(je===0)continue;return y(Ne)&&y(Fe)?je:s(ie.toLowerCase(),oe.toLowerCase())}return ie.length<oe.length?-1:ie.length>oe.length?1:0}function y(ie){return ie>=97&&ie<=122}function g(ie){return ie>=65&&ie<=90}function v(ie){return y(ie)||g(ie)}function R(ie,oe){return ie.length===oe.length&&w(ie,oe)}function w(ie,oe,be){be===void 0&&(be=ie.length);for(var De=0;De<be;De++){var Ne=ie.charCodeAt(De),Fe=oe.charCodeAt(De);if(Ne===Fe)continue;if(v(Ne)&&v(Fe)){var je=Math.abs(Ne-Fe);if(je!==0&&je!==32)return!1}else if(String.fromCharCode(Ne).toLowerCase()!==String.fromCharCode(Fe).toLowerCase())return!1}return!0}function C(ie,oe){var be=oe.length;return oe.length>ie.length?!1:w(ie,oe,be)}function x(ie,oe){var be,De=Math.min(ie.length,oe.length);for(be=0;be<De;be++)if(ie.charCodeAt(be)!==oe.charCodeAt(be))return be;return De}function d(ie,oe){var be,De=Math.min(ie.length,oe.length),Ne=ie.length-1,Fe=oe.length-1;for(be=0;be<De;be++)if(ie.charCodeAt(Ne-be)!==oe.charCodeAt(Fe-be))return be;return De}function l(ie){return 55296<=ie&&ie<=56319}function A(ie){return 56320<=ie&&ie<=57343}function S(ie,oe,be){var De=ie.charCodeAt(be);if(l(De)&&be+1<oe){var Ne=ie.charCodeAt(be+1);if(A(Ne))return(De-55296<<10)+(Ne-56320)+65536}return De}function D(ie,oe){var be=ie.charCodeAt(oe-1);if(A(be)&&oe>1){var De=ie.charCodeAt(oe-2);if(l(De))return(De-55296<<10)+(be-56320)+65536}return be}function I(ie,oe){var be=se.getInstance(),De=oe,Ne=ie.length,Fe=S(ie,Ne,oe);oe+=Fe>=65536?2:1;for(var je=be.getGraphemeBreakType(Fe);oe<Ne;){var Ue=S(ie,Ne,oe),rt=be.getGraphemeBreakType(Ue);if(de(je,rt))break;oe+=Ue>=65536?2:1,je=rt}return oe-De}function B(ie,oe){var be=se.getInstance(),De=oe,Ne=D(ie,oe);oe-=Ne>=65536?2:1;for(var Fe=be.getGraphemeBreakType(Ne);oe>0;){var je=D(ie,oe),Ue=be.getGraphemeBreakType(je);if(de(Ue,Fe))break;oe-=je>=65536?2:1,Fe=Ue}return De-oe}var j=/(?:[\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 z(ie){return j.test(ie)}var _=/(?:[\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 _.test(ie)}var $=/^[\t\n\r\x20-\x7E]*$/;function q(ie){return $.test(ie)}function le(ie){for(var oe=0,be=ie.length;oe<be;oe++)if(pe(ie.charCodeAt(oe)))return!0;return!1}function pe(ie){return ie=+ie,ie>=11904&&ie<=55215||ie>=63744&&ie<=64255||ie>=65281&&ie<=65374}function Pe(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 Se=String.fromCharCode(65279);function ke(ie){return!!(ie&&ie.length>0&&ie.charCodeAt(0)===65279)}function Ae(ie){return btoa(encodeURIComponent(ie))}function Te(ie,oe){for(var be="",De=0;De<oe;De++)be+=ie;return be}function ge(ie,oe){return oe===void 0&&(oe=!1),ie?(oe&&(ie=ie.replace(/\\./g,"")),ie.toLowerCase()!==ie):!1}function he(ie){var oe=90-65+1;return ie=ie%(2*oe),ie<oe?String.fromCharCode(97+ie):String.fromCharCode(65+ie-oe)}function re(ie){var oe=se.getInstance();return oe.getGraphemeBreakType(ie)}function de(ie,oe){return ie===0?oe!==5&&oe!==7:ie===2&&oe===3?!1:ie===4||ie===2||ie===3||(oe===4||oe===2||oe===3)?!0:ie===8&&(oe===8||oe===9||oe===11||oe===12)||((ie===11||ie===9)&&(oe===9||oe===10)||((ie===12||ie===10)&&oe===10||(oe===5||oe===13||(oe===7||(ie===1||ie===13&&oe===14)))))?!1:!(ie===6&&oe===6)}var se=function(){function ie(){this._data=Oe()}return ie.getInstance=function(){return ie._INSTANCE||(ie._INSTANCE=new ie),ie._INSTANCE},ie.prototype.getGraphemeBreakType=function(oe){if(oe<32)return oe===10?3:oe===13?2:4;if(oe<127)return 0;for(var be=this._data,De=be.length/3,Ne=1;Ne<=De;)if(oe<be[3*Ne])Ne=2*Ne;else if(oe>be[3*Ne+1])Ne=2*Ne+1;else return be[3*Ne+2];return 0},ie._INSTANCE=null,ie}();function Oe(){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(vt,Le,ee){"use strict";var ue=ee("2qtc"),J=ee("kLXV"),O=ee("rAM+"),X=ee("miYZ"),F=ee("tsqr"),M=ee("9og8"),H=ee("tJVT"),U=ee("jrin"),P=ee("WmNS"),L=ee.n(P),h=ee("q1tI"),f=ee.n(h),T=ee("VrN/"),p=ee.n(T),m=ee("bdgK"),b=ee("p77/"),a=ee("Bd2K"),i=ee("ELLl"),s=ee("19Vz"),u=ee("lZu9"),y=ee("+NIl"),g=ee("kSUc"),v=ee("9Bee"),R=function(we){var Ke=we.value,ot=Ke===void 0?"":Ke,ct=we.className,dt=we.showTextOnly,Lt=we.showLines,wt=we.style,ft=wt===void 0?{}:wt,zt=Object(h.useMemo)(function(){return""},[ot]);return f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{dangerouslySetInnerHTML:{__html:zt}}))},w=ee("0Owb"),C=ee("dejd"),x=ee("C+DQ"),d=ee("1vsH"),l=ee("m3rI"),A=[{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(we){var Ke=we.onActionCallback,ot=we.title,ct=we.icon,dt=we.actionName,Lt=we.className,wt=Lt===void 0?"":Lt,ft=we.children;function zt(){Ke(dt)}return f.a.createElement("a",{title:ot,className:wt,onClick:zt},f.a.createElement("i",{className:"md-iconfont ".concat(ct)}),ft)}var D=function(we){var Ke=we.watch,ot=we.showNullButton,ct=we.onActionCallback,dt=we.fullScreen,Lt=we.insertTemp,wt=we.hidetoolBar,ft=we.uuid,zt=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.D)("_educoder_session"),"&key=").concat(ft,"&api=").concat(encodeURIComponent(l.a.PROXY_SERVER)));var Ft=[].concat(A,[{title:"".concat(Ke?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ke?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return f.a.createElement("ul",{className:"markdown-toolbar-container"},!wt&&Ft.map(function(Jt,Ht){return f.a.createElement("li",{key:Ht},Jt.actionName?f.a.createElement(S,Object(w.a)({},Jt,{onActionCallback:ct})):f.a.createElement("span",{className:"v-line"}))}),ot?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,Lt&&f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Lt),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})))},I=ee("M8RZ"),B=ee("+L6B"),j=ee("2/Rp"),z=ee("y8nQ"),_=ee("Vl3Y"),N=ee("5NDa"),$=ee("5rEg"),q={labelCol:{span:4},wrapperCol:{span:20}},le=function(we){var Ke=we.callback,ot=we.onCancel;function ct(dt){Ke(dt)}return f.a.createElement(_.a,Object(w.a)({},q,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ct}),f.a.createElement(_.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},f.a.createElement($.a,null)),f.a.createElement(_.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},f.a.createElement($.a,null)),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(j.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))},pe=ee("7ahc"),Pe=ee("k1fw"),Se=ee("HmJG"),ke=ee("BjJ7"),Ae=_.a.useForm,Te={width:280,marginRight:10},ge={labelCol:{span:5},wrapperCol:{span:19}},he=function(we){var Ke=we.callback,ot=we.onCancel,ct=Ae(),dt=Object(H.a)(ct,1),Lt=dt[0],wt=Object(h.useRef)();function ft(Jt){Ke(Object(Pe.a)(Object(Pe.a)({},Jt),{},{name:wt.current}))}function zt(Jt,Ht){Lt.setFieldsValue({src:"/api/attachments/".concat(Jt.id,"?type=").concat(Jt.content_type),type:Ht.type})}function Ft(Jt){var Ht=Jt.target.files[0];wt.current=Ht.name,de(Ht,zt)}return f.a.createElement(_.a,Object(w.a)({form:Lt},ge,{className:"upload-image-panel",onFinish:ft}),f.a.createElement(_.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},f.a.createElement("div",{className:"flex-container"},f.a.createElement(_.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},f.a.createElement($.a,{style:Te})),f.a.createElement(re,{onFileChange:Ft}))),f.a.createElement(_.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},f.a.createElement($.a,{style:{width:264}})),f.a.createElement(_.a.Item,{style:{textAlign:"right"}},f.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(j.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))};function re(we){var Ke=we.onFileChange;return f.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",f.a.createElement("input",{type:"file",onChange:Ke}))}function de(we,Ke){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var ot=new FormData;ot.append("editormd-image-file",we),ot.append("file_param_name","editormd-image-file"),ot.append("byxhr","true");var ct=new window.XMLHttpRequest;ct.withCredentials=!0,ct.addEventListener("load",function(dt){Ke(JSON.parse(dt.target.responseText),we)},!1),ct.addEventListener("error",function(dt){console.error(dt)},!1),ct.open("POST","".concat(ke.a,"/api/attachments.json")),ct.send(ot)}var se=ee("giR+"),Oe=ee("fyUT"),ie=ee("7Kak"),oe=ee("9yH6"),be=oe.a.Group,De={margin:"0 8px"},Ne=function(we){var Ke=we.callback,ot=we.onCancel;function ct(dt){Ke(dt)}return f.a.createElement(_.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:De},"\u5355\u5143\u683C\u6570\uFF1A"),f.a.createElement("span",{style:De},"\u884C\u6570"),f.a.createElement(_.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},f.a.createElement(Oe.a,null)),f.a.createElement("span",{style:De},"\u5217\u6570"),f.a.createElement(_.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},f.a.createElement(Oe.a,null))),f.a.createElement("div",{className:"flex-container",style:{marginTop:12}},f.a.createElement("span",{style:De},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),f.a.createElement(_.a.Item,{name:"align"},f.a.createElement(be,null,f.a.createElement(oe.a,{value:"default"},f.a.createElement("i",{className:"fa fa-align-justify"})),f.a.createElement(oe.a,{value:"left"},f.a.createElement("i",{className:"fa fa-align-left"})),f.a.createElement(oe.a,{value:"center"},f.a.createElement("i",{className:"fa fa-align-center"})),f.a.createElement(oe.a,{value:"right"},f.a.createElement("i",{className:"fa fa-align-right"}))))),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(j.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))},Fe=ee("ErOA"),je=ee("7Cbv"),Ue="link",rt="upload-image",Qe="code-block",qe="add-table",Ye="------------",nt={default:Ye,left:":".concat(Ye),center:":".concat(Ye,":"),right:"".concat(Ye,":")},$e=ee("9VGf"),et,_e;function Je(){}var st=0,Be=1e4,ze="\u2581",Ce=`
|
|
**\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 me(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var Ee=navigator.platform.toUpperCase().indexOf("MAC")>=0,ne=Ee?"Cmd":"Ctrl",ae=["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=(et={},Object(U.a)(et,ne+"-B","bold"),Object(U.a)(et,ne+"-I","italic"),et),ve=(_e={},Object(U.a)(_e,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(_e,Qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(_e,rt,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(_e,qe,"\u6DFB\u52A0\u8868\u683C"),_e),Ie=Le.a=function(we){var Ke=we.defaultValue,ot=Ke===void 0?"":Ke,ct=we.onChange,dt=we.width,Lt=dt===void 0?"100%":dt,wt=we.height,ft=wt===void 0?400:wt,zt=we.miniToolbar,Ft=zt===void 0?!1:zt,Jt=we.isFocus,Ht=Jt===void 0?!1:Jt,Rt=we.watch,Ur=we.insertTemp,Zr=we.mode,bt=Zr===void 0?"markdown":Zr,Ct=we.id,lt=Ct===void 0?"markdown-editor-id":Ct,xt=we.showResizeBar,Zt=xt===void 0?!1:xt,nr=we.noStorage,rr=nr===void 0?!1:nr,kt=we.showNullButton,gt=kt===void 0?!1:kt,Rr=we.hidetoolBar,tn=Rr===void 0?!1:Rr,Tr=we.fullScreen,Ot=Tr===void 0?!1:Tr,Lr=we.onBlur,zr=we.onCMBeforeChange,rn=we.onFullScreen,He=we.className,ut=He===void 0?"":He,Mt=we.disablePaste,Kt=Mt===void 0?!1:Mt,Yt=we.placeholder,qt=Yt===void 0?"":Yt,K=we.values,c=K===void 0?"":K,E=Object(h.useState)(null),G=Object(H.a)(E,2),Y=G[0],V=G[1],xe=Object(h.useState)(ot),Ge=Object(H.a)(xe,2),tt=Ge[0],pt=Ge[1],Ve=Object(h.useState)(Rt),At=Object(H.a)(Ve,2),It=At[0],er=At[1],Kr=Object(h.useState)(Ot),Vr=Object(H.a)(Kr,2),pr=Vr[0],Qr=Vr[1],Gn=Object(h.useState)(""),Or=Object(H.a)(Gn,2),Xr=Or[0],jr=Or[1],bn=Object(h.useState)(0),nn=Object(H.a)(bn,2),mn=nn[0],hn=nn[1],di=Object(h.useState)(ft),zn=Object(H.a)(di,2),an=zn[0],Yr=zn[1],Rn=Object(h.useState)(!1),On=Object(H.a)(Rn,2),ci=On[0],or=On[1],jt=Object(h.useRef)(Object(je.a)()),Er=Object(h.useRef)(!1),Ut=Object(h.useRef)(),hr=Object(h.useRef)(),Vt=Object(h.useRef)(),dn=Object(h.useRef)(),lr=Object(h.useRef)(),Pr=function(){var yt=Object(M.a)(L.a.mark(function Dt(){var St,_t;return L.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,Object(Fe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:jt.current}});case 2:_t=$t.sent,_t!=null&&(St=_t.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",Y,hr),_t.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?Y.replaceSelection(".concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?Y.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Bt.content_type.indexOf("pdf")>-1?Y.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,'&disposition=inline" target="_blank">').concat(Bt.name,"</a>")):Y.replaceSelection("[".concat(Bt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return $t.stop()}},Dt)}));return function(){return yt.apply(this,arguments)}}();Object(h.useEffect)(function(){pt(c),Y==null||Y.setValue(c)},[c]),Object(h.useEffect)(function(){rn==null||rn(pr)},[pr]),Object(h.useEffect)(function(){if(hr.current){var yt=p.a.fromTextArea(hr.current,{mode:bt,lineNumbers:!Ft,lineWrapping:!0,value:ot,autoCloseTags:!0,autoCloseBrackets:!0});Ht&&yt.focus();function Dt(St,_t){if(Kt){_t.preventDefault();return}var Wt=_t.clipboardData;if(Wt){var $t=Wt.types.toString(),Bt=Wt.items;if($t==="Files"||Wt.types.indexOf("Files")>-1){if(_t.preventDefault(),bt=="stex")return;try{var dr,Mr=Bt[1];((dr=Bt[0])===null||dr===void 0?void 0:dr.kind)==="file"&&(Mr=Bt[0]);var Nt=Mr.getAsFile(),En=Nt.name.split(".").pop();de(Nt,function(Gt){if(Gt.id){var gr,qr,en;(Nt==null||((gr=Nt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((qr=Nt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((en=Nt.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):ae.includes(En)?yt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return yt.on("paste",Dt),yt.on("dragleave",function(St,_t){Vt.current.classList.remove("mouse-hover-md")}),yt.on("dragover",function(St,_t){Vt.current.classList.add("mouse-hover-md")}),yt.on("drop",function(St,_t){Vt.current.classList.add("mouse-hover-md");var Wt;if(Wt=_t.dataTransfer.files,Wt.length>0){_t.preventDefault(),_t.stopPropagation();for(var $t=function(Mr){var Nt=Wt[Mr],En=Nt.name.split(".").pop();de(Nt,function(Gt){if(Gt.id){var gr,qr,en;(Nt==null||((gr=Nt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((qr=Nt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((en=Nt.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):ae.includes(En)?yt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt<Wt.length;Bt++)$t(Bt)}}),V(yt),function(){yt.off("paste",Dt)}}},[]);var Kn=Object(h.useCallback)(function(){if(Vt.current)try{}catch(yt){console.log(yt,"---- to set md editor body height")}},[an,Vt,pr]);Object(h.useEffect)(function(){function yt(){var St=new m.default(function(_t){var Wt=Object(O.a)(_t),$t;try{for(Wt.s();!($t=Wt.n()).done;){var Bt=$t.value;(Bt.target.offsetHeight>0||Bt.target.offsetWidth>0)&&(Kn(),Y.setSize("100%","100%"),Y.refresh())}}catch(dr){Wt.e(dr)}finally{Wt.f()}});return St.observe(hr.current.parentElement),St}if(Y){var Dt=yt();return function(){Dt.unobserve(hr.current.parentElement)}}},[Y,Kn]),Object(h.useEffect)(function(){if(Y){for(var yt=[],Dt=function(){var Bt=_t[St];Wt=Object(H.a)(Bt,2);var dr=Wt[0],Mr=Wt[1],Nt=Object(U.a)({},dr,function(){Vn(Mr)});yt.push(Nt),Y.addKeyMap(Nt)},St=0,_t=Object.entries(ce);St<_t.length;St++){var Wt;Dt()}return Ut.current=setInterval(function(){Er.current&&Pr()},4e3),function(){clearInterval(Ut.current);var $t=Object(O.a)(yt),Bt;try{for($t.s();!(Bt=$t.n()).done;){var dr=Bt.value;Y.removeKeyMap(dr)}}catch(Mr){$t.e(Mr)}finally{$t.f()}}}},[Y]),Object(h.useEffect)(function(){Ot!==pr&&Qr(Ot)},[Ot]),Object($e.a)(function(){if(!rr&&mn>0){var yt=new Date().getTime(),Dt=window.sessionStorage.getItem(lt);yt>=mn+Be&&(!Dt||Dt!==tt)&&(window.sessionStorage.setItem(lt,tt),or(!0))}},Be),Object(h.useEffect)(function(){er(Rt)},[Y,Rt]),Object(h.useEffect)(function(){Y&&(Ht&&Y.focus())},[Y,Ht]),Object(h.useEffect)(function(){if(It&&Y){var yt=Y.getScrollerElement();function Dt(St){var _t=St.target;if(lr.current){var Wt=_t.scrollTop/_t.scrollHeight;lr.current.scrollTop=lr.current.scrollHeight*Wt}}return yt.addEventListener("scroll",Dt),function(){yt.removeEventListener("scroll",Dt)}}},[Y,It]),Object(h.useEffect)(function(){if(Y&&zr){function yt(Dt,St){zr(Dt,St)}return Y.on("beforeChange",yt),function(){Y.off("beforeChange",yt)}}},[Y,zr]),Object(h.useEffect)(function(){if(Y&&Lr){function yt(){Lr(Y.getValue())}return Y.on("blur",yt),function(){Y.off("blur",yt)}}},[Y,Lr]),Object(h.useEffect)(function(){if(Y){function yt(Dt){var St=Dt.getValue();pt(St),hn(new Date().getTime()),Dt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ct&&ct(St)}return Y.on("change",yt),function(){Y.off("change",yt)}}},[Y,ct]),Object(h.useEffect)(function(){Y&&(ot==null?(Y.setValue(""),pt("")):ot!==Y.getValue()&&(Y.setValue(ot),pt(ot),Y.setCursor(Y.lineCount(),0)))},[Y,ot]);var Vn=Object(h.useCallback)(function(yt){var Dt=Y.getCursor(),St=Y.getSelection(),_t=St.split(`
|
|
`);switch(yt){case"bold":return Y.replaceSelection("**"+St+"**"),St===""&&Y.setCursor(Dt.line,Dt.ch+2),Y.focus();case"italic":return Y.replaceSelection("*"+St+"*"),St===""&&Y.setCursor(Dt.line,Dt.ch+1),Y.focus();case"code":return Y.replaceSelection("`"+St+"`"),St===""&&Y.setCursor(Dt.line,Dt.ch+1),Y.focus();case"inline-latex":return Y.replaceSelection("`$$"+St+"$$`"),St===""&&Y.setCursor(Dt.line,Dt.ch+3),Y.focus();case"latex":return Y.replaceSelection("```latex\n"+St+"\n```"),Y.setCursor(Dt.line+1,St.length+1),Y.focus();case"line-break":return Y.replaceSelection(`<br/>
|
|
`),Y.focus();case"list-ul":return St===""?Y.replaceSelection("- "+St):Y.replaceSelection(_t.map(function(Wt){return Wt===""?"":"- ".concat(Wt)}).join(`
|
|
`)),Y.focus();case"list-ol":return St===""?Y.replaceSelection("1. "+St):Y.replaceSelection(_t.map(function(Wt,$t){return Wt===""?"":"".concat($t+1,". ").concat(Wt)}).join(`
|
|
`)),Y.focus();case"add-null-ch":return St===""&&Y.setCursor(Dt.line,Dt.ch+1),Y.replaceSelection(ze),Y.focus();case"inster-template-1":return St===""&&Y.setCursor(Dt.line,Dt.ch),Y.replaceSelection(Ce),Y.focus();case"eraser":return Y.setValue(""),Y.focus();case"trigger-watch":return er(!It),Y.focus();case"trigger-full-screen":return Qr(!pr),Y.focus();case Ue:jr(Ue);return;case Qe:jr(Qe);return;case rt:jr(rt);return;case qe:jr(qe);return;default:throw new Error}},[Y,It,pr]),xn=Object(h.useCallback)(function(yt){jr("");switch(Xr){case Ue:var Dt=yt.title,St=yt.link;return Y.replaceSelection("[".concat(Dt,"](").concat(St,")")),Y.focus();case Qe:var _t=yt.language,Wt=yt.content;return Y.replaceSelection(["```"+_t,Wt,"```"].join(`
|
|
`)),Y.focus();case rt:var $t=yt.src,Bt=yt.alt,dr=yt.name;return $t.indexOf("type=image")>-1?Y.replaceSelection(".concat($t,' "').concat(Bt||"",'" )')):$t.indexOf("type=application/pdf")>-1?Y.replaceSelection('<a href="'.concat($t,'&disposition=inline" target="_blank">').concat(dr,"</a>")):Y.replaceSelection('<a href="'.concat($t,'" target="_blank">').concat(dr,"</a>")),Y.focus();case qe:for(var Mr=yt.row,Nt=yt.col,En=yt.align,Gt=`
|
|
`,gr=0;gr<Mr;gr++){for(var qr=[],en=[],Wi=0;Wi<Nt;Wi++)gr===1&&en.push(nt[En]),qr.push(" ");gr===1&&(Gt+="| ".concat(en.join(" | "),` |
|
|
`)),Gt+="| ".concat(qr.join(Nt===1?"":" | "),` |
|
|
`)}return Y.replaceSelection(Gt+`
|
|
`),Y.focus();default:throw new Error}},[Y,Xr]),Ui=Object(h.useMemo)(function(){switch(Xr){case Ue:return f.a.createElement(le,{callback:xn,onCancel:Wr});case Qe:return f.a.createElement(pe.b,{callback:xn,onCancel:Wr});case rt:return f.a.createElement(he,{callback:xn,onCancel:Wr});case qe:return f.a.createElement(Ne,{callback:xn,onCancel:Wr});default:return null}},[Xr]);function Wr(){jr("")}Object(h.useEffect)(function(){if(dn.current){var yt=dn.current,Dt=!1,St=0;function _t(Bt){Dt=!0,St=Bt.pageY}function Wt(){Dt=!1}function $t(Bt){if(Dt){var dr=Bt.pageY-St;dr<0&&(dr=0),dr>300&&(dr=300);var Mr=ft+dr+"px";Yr(Mr)}}return yt.addEventListener("mousedown",_t),document.addEventListener("mousemove",$t),document.addEventListener("mouseup",Wt),function(){yt.removeEventListener("mousedown",_t),document.removeEventListener("mousemove",$t),document.removeEventListener("mouseup",Wt)}}},[Y,dn]),Object(h.useEffect)(function(){Yr(ft)},[ft]);var fi=me(Lt),on=me(an),Xn={width:fi,height:on},ji=Object(h.useMemo)(function(){if(mn){var yt=new Date(mn),Dt=yt.getHours(),St=yt.getMinutes(),_t=yt.getSeconds();return Dt=Dt<10?"0"+Dt:Dt,St=St<10?"0"+St:St,_t=_t<10?"0"+_t:_t,"".concat(Dt,":").concat(St,":").concat(_t)}return 0},[mn]);function Pn(){window.sessionStorage.removeItem(lt),or(!1),hn(0)}function $a(){or(!1),hn(0),Y.setValue(window.sessionStorage.getItem(lt))}function ha(yt,Dt){var St=Y.getValue();St=St.replace(yt,Dt),pt(St),Y==null||Y.setValue(St)}return f.a.createElement(h.Fragment,null,f.a.createElement("div",{className:"markdown-editor-wrapper",ref:Vt},f.a.createElement("div",{className:"markdown-editor-container ".concat(ut," ").concat(It?"on-preview":""," ").concat(Ft?"mini":""," ").concat(pr?"full-screen":""),style:Xn},f.a.createElement(D,{insertTemp:Ur,watch:It,fullScreen:pr,showNullButton:gt,onActionCallback:Vn,hidetoolBar:tn,uuid:jt.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:hr,placeholder:qt})),It?f.a.createElement("div",{ref:lr,className:"preview-container"},bt==="stex"&&f.a.createElement(R,{value:tt}),bt!=="stex"&&f.a.createElement(v.a,{edit:!0,value:tt,replaces:ha})):null))),Zt?f.a.createElement("a",{ref:dn,className:"editor-resize"}):null,f.a.createElement(I.a,null,ve[Xr]?f.a.createElement(J.a,{centered:!0,title:ve[Xr],visible:!0,onCancel:Wr,footer:null},Ui):null))}},QDVR:function(vt,Le,ee){"use strict";ee.d(Le,"e",function(){return J}),ee.d(Le,"d",function(){return O}),ee.d(Le,"c",function(){return H}),ee.d(Le,"b",function(){return U}),ee.d(Le,"a",function(){return L});var ue=function(){var h=function(f,T){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,m){p.__proto__=m}||function(p,m){for(var b in m)m.hasOwnProperty(b)&&(p[b]=m[b])},h(f,T)};return function(f,T){h(f,T);function p(){this.constructor=f}f.prototype=T===null?Object.create(T):(p.prototype=T.prototype,new p)}}();function J(h){var f=[];return h.forEach(function(T){return f.push(T)}),f}function O(h){var f=[];return h.forEach(function(T,p){return f.push(p)}),f}var X=function(){function h(){this._value="",this._pos=0}return h.prototype.reset=function(f){return this._value=f,this._pos=0,this},h.prototype.next=function(){return this._pos+=1,this},h.prototype.hasNext=function(){return this._pos<this._value.length-1},h.prototype.cmp=function(f){var T=f.charCodeAt(0),p=this._value.charCodeAt(this._pos);return T-p},h.prototype.value=function(){return this._value[this._pos]},h}(),F=function(){function h(f){f===void 0&&(f=!0),this._splitOnBackslash=f}return h.prototype.reset=function(f){return this._value=f.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},h.prototype.hasNext=function(){return this._to<this._value.length},h.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},h.prototype.cmp=function(f){for(var T=0,p=f.length,m=this._from;T<p&&m<this._to;){var b=f.charCodeAt(T)-this._value.charCodeAt(m);if(b!==0)return b;T+=1,m+=1}return p===this._to-this._from?0:T<p?-1:1},h.prototype.value=function(){return this._value.substring(this._from,this._to)},h}(),M=function(){function h(){}return h}(),H=function(){function h(f){this._iter=f}return h.forPaths=function(){return new h(new F)},h.forStrings=function(){return new h(new X)},h.prototype.clear=function(){this._root=void 0},h.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 b=p.cmp(m.segment);if(b>0)m.left||(m.left=new M,m.left.segment=p.value()),m=m.left;else if(b<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},h.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},h.prototype.findSubstr=function(f){for(var T=this._iter.reset(f),p=this._root,m=void 0;p;){var b=T.cmp(p.segment);if(b>0)p=p.left;else if(b<0)p=p.right;else if(T.hasNext())T.next(),m=p.value||m,p=p.mid;else break}return p&&p.value||m},h.prototype.forEach=function(f){this._forEach(this._root,f)},h.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))},h}(),U=function(){function h(){this.map=new Map,this.ignoreCase=!1}return h.prototype.set=function(f,T){this.map.set(this.toKey(f),T)},h.prototype.get=function(f){return this.map.get(this.toKey(f))},h.prototype.toKey=function(f){var T=f.toString();return this.ignoreCase&&(T=T.toLowerCase()),T},h}(),P=function(){function h(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return h.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(h.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),h.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},h.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++}},h.prototype.delete=function(f){return!!this.remove(f)},h.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},h.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},h.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)},h.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},h.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},h.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},h.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}},h.prototype.toJSON=function(){var f=[];return this.forEach(function(T,p){f.push([p,T])}),f},h}(),L=function(h){ue(f,h);function f(T,p){p===void 0&&(p=1);var m=h.call(this)||this;return m._limit=T,m._ratio=Math.min(Math.max(0,p),1),m}return f.prototype.get=function(T){return h.prototype.get.call(this,T,2)},f.prototype.peek=function(T){return h.prototype.get.call(this,T,0)},f.prototype.set=function(T,p){h.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)},R7cW:function(vt,Le,ee){"use strict";ee.r(Le);var ue=ee("+L6B"),J=ee("2/Rp"),O=ee("DZo9"),X=ee("8z0m"),F=ee("0Owb"),M=ee("5NDa"),H=ee("5rEg"),U=ee("sPJy"),P=ee("bE4q"),L=ee("k1fw"),h=ee("oBTY"),f=ee("9og8"),T=ee("miYZ"),p=ee("tsqr"),m=ee("y8nQ"),b=ee("Vl3Y"),a=ee("tJVT"),i=ee("WmNS"),s=ee.n(i),u=ee("q1tI"),y=ee.n(u),g=ee("Ty5D"),v=ee("9kvl"),R=ee("55Ip"),w=ee("Ot1p"),C=ee("XYT7"),x=ee("m3rI"),d=ee("YiJy"),l=ee.n(d),A=function(D){var I,B=D.shixunHomeworks,j=D.newCourse,z=D.globalSetting,_=D.loading,N=D.dispatch,$=D.match,q=Object(g.i)(),le=b.a.useForm(),pe=Object(a.a)(le,1),Pe=pe[0],Se=Object(u.useState)({}),ke=Object(a.a)(Se,2),Ae=ke[0],Te=ke[1],ge=Object(u.useState)(!1),he=Object(a.a)(ge,2),re=he[0],de=he[1],se=Object(u.useState)([]),Oe=Object(a.a)(se,2),ie=Oe[0],oe=Oe[1],be=Object(u.useState)([]),De=Object(a.a)(be,2),Ne=De[0],Fe=De[1],je=B.commonHomeWorkEditDefaultData,Ue={name:"file",multiple:!0,action:x.a.API_SERVER+"/api/attachments.json",defaultFileList:ie,onChange:function(nt){var $e=nt.file.status;$e!=="uploading",$e==="done"?p.b.success("".concat(nt.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):$e==="error"&&p.b.error("".concat(nt.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(u.useEffect)(function(){Qe()},[q.topicId]);var rt=function(nt){return nt==null?void 0:nt.map(function($e){return{uid:$e.id,response:{id:$e.id},name:$e.title,status:"done",url:$e.url}})},Qe=function(){var Ye=Object(f.a)(s.a.mark(function nt(){var $e;return s.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,N({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:q.topicId}});case 2:$e=_e.sent,$e&&(Pe.setFieldsValue({name:$e.name}),Pe.setFieldsValue({description:$e.description}),Pe.setFieldsValue({reference_answer:$e.reference_answer}),oe(Object(h.a)(rt($e.attachments))),Fe(Object(h.a)(rt($e.reference_attachments))),de(!0));case 4:case"end":return _e.stop()}},nt)}));return function(){return Ye.apply(this,arguments)}}(),qe=function(){var Ye=Object(f.a)(s.a.mark(function nt($e){var et,_e,Je,st;return s.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:return et=Object(L.a)({},Ae),et.attachment_ids&&(et.attachment_ids=et==null||((_e=et.attachment_ids.fileList)===null||_e===void 0)?void 0:_e.map(function(Ce){var me;return(me=Ce.response)===null||me===void 0?void 0:me.id})),et.reference_attachment_ids&&(et.reference_attachment_ids=et==null||((Je=et.reference_attachment_ids.fileList)===null||Je===void 0)?void 0:Je.map(function(Ce){var me;return(me=Ce.response)===null||me===void 0?void 0:me.id})),ze.next=5,Object(C.n)(Object(L.a)(Object(L.a)({id:q.topicId},et),{},{base_on_project:null,type:1}));case 5:st=ze.sent,st&&v.d.push("/users/".concat(q.username,"/topics/").concat(q.topicId,"/").concat(q.topictype,"/normal/detail"));case 7:case"end":return ze.stop()}},nt)}));return function($e){return Ye.apply(this,arguments)}}();return y.a.createElement("section",{className:l.a.bg},y.a.createElement("section",{className:"animated fadeIn"},y.a.createElement("aside",{className:"mt10"},y.a.createElement(P.a,{separator:">"},y.a.createElement(P.a.Item,null,y.a.createElement(R.a,{to:"/users/".concat(q.username,"/").concat(q.topictype==="personal"?"topics":"topicbank","/").concat(q.topictype)},q.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),y.a.createElement(P.a.Item,null,y.a.createElement(R.a,{to:"/users/".concat(q.username,"/topics/").concat(q.topicId,"/").concat(q.topictype,"/normal/detail")},"\u8BE6\u60C5")),y.a.createElement(P.a.Item,null,"\u7F16\u8F91")))),y.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),y.a.createElement(b.a,{form:Pe,className:l.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){Te(Object(L.a)({},Pe.getFieldsValue()))},onFinish:qe},y.a.createElement("div",{className:l.a.fieldWrap},y.a.createElement(b.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},y.a.createElement(H.a,{maxLength:60,suffix:"".concat(((I=Ae.name)===null||I===void 0?void 0:I.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),y.a.createElement("div",{className:l.a.mdWrap},y.a.createElement(b.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},y.a.createElement(w.a,{id:"topic-normal-description",watch:!0,defaultValue:je.description})),y.a.createElement("div",null,y.a.createElement(b.a.Item,{name:"attachment_ids"},re&&y.a.createElement(X.a,Object(F.a)({defaultFileList:ie},Ue),y.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),y.a.createElement("div",{className:l.a.mdWrap},y.a.createElement(b.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},y.a.createElement(w.a,{id:"topic-normal-reference_answer",defaultValue:je.reference_answer,watch:!0})),y.a.createElement("div",null,y.a.createElement(b.a.Item,{name:"reference_attachment_ids"},re&&y.a.createElement(X.a,Object(F.a)({},Ue,{defaultFileList:Ne}),y.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),y.a.createElement("div",{className:l.a.backgroundFa},y.a.createElement("div",{className:"pt40 mb30"},y.a.createElement(b.a.Item,null,y.a.createElement(J.a,{size:"large",type:"primary",className:"".concat(l.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),y.a.createElement(J.a,{size:"large",type:"primary",ghost:!0,className:l.a.button,onClick:function(){return v.d.push("/users/".concat(q.username,"/topics/").concat(q.topicId,"/").concat(q.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};Le.default=Object(v.a)(function(S){var D=S.shixunHomeworks,I=S.newCourse,B=S.loading,j=S.globalSetting;return{shixunHomeworks:D,newCourse:I,globalSetting:j,loading:B.effects}})(A)},SJMd:function(vt,Le){/**
|
|
* @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 ee,ue,J,O=!1,X,F;window.PR_SHOULD_USE_CONTINUATION=!0;var M,H;(function(){var U=window,P=["break,continue,do,else,for,if,return,while"],L=[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"],h=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],f=[h,"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=[h,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[h,"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",b=[h,"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"],u=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],y=[f,p,T,b,a,i,s,u],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",R="kwd",w="com",C="typ",x="lit",d="pun",l="pln",A="tag",S="dec",D="src",I="atn",B="atv",j="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function _(oe){for(var be=0,De=!1,Ne=!1,Fe=0,je=oe.length;Fe<je;++Fe){var Ue=oe[Fe];if(Ue.ignoreCase)Ne=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Ne=!1;break}}var rt={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(et){var _e=et.charCodeAt(0);if(_e!==92)return _e;var Je=et.charAt(1);return _e=rt[Je],_e||("0"<=Je&&Je<="7"?parseInt(et.substring(1),8):Je==="u"||Je==="x"?parseInt(et.substring(2),16):et.charCodeAt(1))}function qe(et){if(et<32)return(et<16?"\\x0":"\\x")+et.toString(16);var _e=String.fromCharCode(et);return _e==="\\"||_e==="-"||_e==="]"||_e==="^"?"\\"+_e:_e}function Ye(et){var _e=et.substring(1,et.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Je=[],st=_e[0]==="^",Be=["["];st&&Be.push("^");for(var ze=st?1:0,Ce=_e.length;ze<Ce;++ze){var me=_e[ze];if(/\\[bdsw]/i.test(me))Be.push(me);else{var Ee=Qe(me),ne;ze+2<Ce&&_e[ze+1]==="-"?(ne=Qe(_e[ze+2]),ze+=2):ne=Ee,Je.push([Ee,ne]),ne<65||Ee>122||(ne<65||Ee>90||Je.push([Math.max(65,Ee)|32,Math.min(ne,90)|32]),ne<97||Ee>122||Je.push([Math.max(97,Ee)&~32,Math.min(ne,122)&~32]))}}Je.sort(function(Ie,we){return Ie[0]-we[0]||we[1]-Ie[1]});for(var ae=[],ce=[],ze=0;ze<Je.length;++ze){var ve=Je[ze];ve[0]<=ce[1]+1?ce[1]=Math.max(ce[1],ve[1]):ae.push(ce=ve)}for(var ze=0;ze<ae.length;++ze){var ve=ae[ze];Be.push(qe(ve[0])),ve[1]>ve[0]&&(ve[1]+1>ve[0]&&Be.push("-"),Be.push(qe(ve[1])))}return Be.push("]"),Be.join("")}function nt(et){for(var _e=et.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Je=_e.length,st=[],Be=0,ze=0;Be<Je;++Be){var Ce=_e[Be];if(Ce==="(")++ze;else if(Ce.charAt(0)==="\\"){var me=+Ce.substring(1);me&&(me<=ze?st[me]=-1:_e[Be]=qe(me))}}for(var Be=1;Be<st.length;++Be)st[Be]===-1&&(st[Be]=++be);for(var Be=0,ze=0;Be<Je;++Be){var Ce=_e[Be];if(Ce==="(")++ze,st[ze]||(_e[Be]="(?:");else if(Ce.charAt(0)==="\\"){var me=+Ce.substring(1);me&&me<=ze&&(_e[Be]="\\"+st[me])}}for(var Be=0;Be<Je;++Be)_e[Be]==="^"&&_e[Be+1]!=="^"&&(_e[Be]="");if(et.ignoreCase&&De)for(var Be=0;Be<Je;++Be){var Ce=_e[Be],Ee=Ce.charAt(0);Ce.length>=2&&Ee==="["?_e[Be]=Ye(Ce):Ee!=="\\"&&(_e[Be]=Ce.replace(/[a-zA-Z]/g,function(ce){var ve=ce.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return _e.join("")}for(var $e=[],Fe=0,je=oe.length;Fe<je;++Fe){var Ue=oe[Fe];if(Ue.global||Ue.multiline)throw new Error(""+Ue);$e.push("(?:"+nt(Ue)+")")}return new RegExp($e.join("|"),Ne?"gi":"g")}function N(oe,be){var De=/(?:^|\s)nocode(?:\s|$)/,Ne=[],Fe=0,je=[],Ue=0;function rt(Qe){var qe=Qe.nodeType;if(qe==1){if(De.test(Qe.className))return;for(var Ye=Qe.firstChild;Ye;Ye=Ye.nextSibling)rt(Ye);var nt=Qe.nodeName.toLowerCase();(nt==="br"||nt==="li")&&(Ne[Ue]=`
|
|
`,je[Ue<<1]=Fe++,je[Ue++<<1|1]=Qe)}else if(qe==3||qe==4){var $e=Qe.nodeValue;$e.length&&(be?$e=$e.replace(/\r\n?/g,`
|
|
`):$e=$e.replace(/[ \t\r\n]+/g," "),Ne[Ue]=$e,je[Ue<<1]=Fe,Fe+=$e.length,je[Ue++<<1|1]=Qe)}}return rt(oe),{sourceCode:Ne.join("").replace(/\n$/,""),spans:je}}function $(oe,be,De,Ne,Fe){if(!De)return;var je={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:be,decorations:null};Ne(je),Fe.push.apply(Fe,je.decorations)}var q=/\S/;function le(oe){for(var be=void 0,De=oe.firstChild;De;De=De.nextSibling){var Ne=De.nodeType;be=Ne===1?be?oe:De:Ne===3&&q.test(De.nodeValue)?oe:be}return be===oe?void 0:be}function pe(oe,be){var De={},Ne;(function(){for(var Ue=oe.concat(be),rt=[],Qe={},qe=0,Ye=Ue.length;qe<Ye;++qe){var nt=Ue[qe],$e=nt[3];if($e)for(var et=$e.length;--et>=0;)De[$e.charAt(et)]=nt;var _e=nt[1],Je=""+_e;Qe.hasOwnProperty(Je)||(rt.push(_e),Qe[Je]=null)}rt.push(/[\0-\uffff]/),Ne=_(rt)})();var Fe=be.length,je=function(Ue){for(var rt=Ue.sourceCode,Qe=Ue.basePos,qe=Ue.sourceNode,Ye=[Qe,l],nt=0,$e=rt.match(Ne)||[],et={},_e=0,Je=$e.length;_e<Je;++_e){var st=$e[_e],Be=et[st],ze=void 0,Ce;if(typeof Be=="string")Ce=!1;else{var me=De[st.charAt(0)];if(me)ze=st.match(me[1]),Be=me[0];else{for(var Ee=0;Ee<Fe;++Ee)if(me=be[Ee],ze=st.match(me[1]),ze){Be=me[0];break}ze||(Be=l)}Ce=Be.length>=5&&Be.substring(0,5)==="lang-",Ce&&!(ze&&typeof ze[1]=="string")&&(Ce=!1,Be=D),Ce||(et[st]=Be)}var ne=nt;if(nt+=st.length,!Ce)Ye.push(Qe+ne,Be);else{var ae=ze[1],ce=st.indexOf(ae),ve=ce+ae.length;ze[2]&&(ve=st.length-ze[2].length,ce=ve-ae.length);var Ie=Be.substring(5);$(qe,Qe+ne,st.substring(0,ce),je,Ye),$(qe,Qe+ne+ce,ae,he(Ie,ae),Ye),$(qe,Qe+ne+ve,st.substring(ve),je,Ye)}}Ue.decorations=Ye};return je}function Pe(oe){var be=[],De=[];oe.tripleQuotedStrings?be.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?be.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&De.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ne=oe.hashComments;Ne&&(oe.cStyleComments?(Ne>1?be.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([w,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(De.push([w,/^\/\/[^\r\n]*/,null]),De.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=oe.regexLiterals;if(Fe){var je=Fe>1?"":`
|
|
\r`,Ue=je?".":"[\\S\\s]",rt="/(?=[^/*"+je+"])(?:[^/\\x5B\\x5C"+je+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+je+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+z+"("+rt+")")])}var Qe=oe.types;Qe&&De.push([C,Qe]);var qe=(""+oe.keywords).replace(/^ | $/g,"");qe.length&&De.push([R,new RegExp("^(?:"+qe.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([l,/^\s+/,null,` \r
|
|
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(Ye+="(?!s*/)"),De.push([x,/^@[a-z_$][a-z_$@0-9]*/i,null],[C,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[l,/^[a-z_$][a-z_$@0-9]*/i,null],[x,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[l,/^\\[\s\S]?/,null],[d,new RegExp(Ye),null]),pe(be,De)}var Se=Pe({keywords:y,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ke(oe,be,De){for(var Ne=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,je=oe.ownerDocument,Ue=je.createElement("li");oe.firstChild;)Ue.appendChild(oe.firstChild);var rt=[Ue];function Qe(_e){var Je=_e.nodeType;if(Je==1&&!Ne.test(_e.className))if(_e.nodeName==="br")qe(_e),_e.parentNode&&_e.parentNode.removeChild(_e);else for(var st=_e.firstChild;st;st=st.nextSibling)Qe(st);else if((Je==3||Je==4)&&De){var Be=_e.nodeValue,ze=Be.match(Fe);if(ze){var Ce=Be.substring(0,ze.index);_e.nodeValue=Ce;var me=Be.substring(ze.index+ze[0].length);if(me){var Ee=_e.parentNode;Ee.insertBefore(je.createTextNode(me),_e.nextSibling)}qe(_e),Ce||_e.parentNode.removeChild(_e)}}}function qe(_e){for(;!_e.nextSibling;)if(_e=_e.parentNode,!_e)return;function Je(ze,Ce){var me=Ce?ze.cloneNode(!1):ze,Ee=ze.parentNode;if(Ee){var ne=Je(Ee,1),ae=ze.nextSibling;ne.appendChild(me);for(var ce=ae;ce;ce=ae)ae=ce.nextSibling,ne.appendChild(ce)}return me}for(var st=Je(_e.nextSibling,0),Be;(Be=st.parentNode)&&Be.nodeType===1;)st=Be;rt.push(st)}for(var Ye=0;Ye<rt.length;++Ye)Qe(rt[Ye]);be===(be|0)&&rt[0].setAttribute("value",be);var nt=je.createElement("ol");nt.className="linenums";for(var $e=Math.max(0,be-1|0)||0,Ye=0,et=rt.length;Ye<et;++Ye)Ue=rt[Ye],Ue.className="L"+(Ye+$e)%10,Ue.firstChild||Ue.appendChild(je.createTextNode("\xA0")),nt.appendChild(Ue);oe.appendChild(nt)}function Ae(oe){var be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);be=be&&+be[1]<=8;var De=/\n/g,Ne=oe.sourceCode,Fe=Ne.length,je=0,Ue=oe.spans,rt=Ue.length,Qe=0,qe=oe.decorations,Ye=qe.length,nt=0;qe[Ye]=Fe;var $e,et;for(et=$e=0;et<Ye;)qe[et]!==qe[et+2]?(qe[$e++]=qe[et++],qe[$e++]=qe[et++]):et+=2;for(Ye=$e,et=$e=0;et<Ye;){for(var _e=qe[et],Je=qe[et+1],st=et+2;st+2<=Ye&&qe[st+1]===Je;)st+=2;qe[$e++]=_e,qe[$e++]=Je,et=st}Ye=qe.length=$e;var Be=oe.sourceNode,ze="";Be&&(ze=Be.style.display,Be.style.display="none");try{for(var Ce=null;Qe<rt;){var me=Ue[Qe],Ee=Ue[Qe+2]||Fe,ne=qe[nt+2]||Fe,st=Math.min(Ee,ne),ae=Ue[Qe+1],ce;if(ae.nodeType!==1&&(ce=Ne.substring(je,st))){be&&(ce=ce.replace(De,"\r")),ae.nodeValue=ce;var ve=ae.ownerDocument,Ie=ve.createElement("span");Ie.className=qe[nt+1];var we=ae.parentNode;we.replaceChild(Ie,ae),Ie.appendChild(ae),je<Ee&&(Ue[Qe+1]=ae=ve.createTextNode(Ne.substring(st,Ee)),we.insertBefore(ae,Ie.nextSibling))}je=st,je>=Ee&&(Qe+=2),je>=ne&&(nt+=2)}}finally{Be&&(Be.style.display=ze)}}var Te={};function ge(oe,be){for(var De=be.length;--De>=0;){var Ne=be[De];Te.hasOwnProperty(Ne)?U.console&&console.warn("cannot override language handler %s",Ne):Te[Ne]=oe}}function he(oe,be){return oe&&Te.hasOwnProperty(oe)||(oe=/^\s*</.test(be)?"default-markup":"default-code"),Te[oe]}ge(Se,["default-code"]),ge(pe([],[[l,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[w,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ge(pe([[l,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[A,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ge(pe([],[[B,/^[\s\S]+/]]),["uq.val"]),ge(Pe({keywords:f,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ge(Pe({keywords:"null,true,false"}),["json"]),ge(Pe({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ge(Pe({keywords:T,cStyleComments:!0}),["java"]),ge(Pe({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(Pe({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(Pe({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(Pe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(Pe({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(Pe({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(pe([],[[v,/^[\s\S]+/]]),["regex"]);function re(oe){var be=oe.langExtension;try{var De=N(oe.sourceNode,oe.pre),Ne=De.sourceCode;oe.sourceCode=Ne,oe.spans=De.spans,oe.basePos=0,he(be,Ne)(oe),Ae(oe)}catch(Fe){U.console&&console.log(Fe&&Fe.stack||Fe)}}function de(oe,be,De){var Ne=De||!1,Fe=be||null,je=document.createElement("div");je.innerHTML="<pre>"+oe+"</pre>",je=je.firstChild,Ne&&ke(je,Ne,!0);var Ue={langExtension:Fe,numberLines:Ne,sourceNode:je,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return re(Ue),je.innerHTML}function se(oe,be){var De=be||document.body,Ne=De.ownerDocument||document;function Fe(me){return De.getElementsByTagName(me)}for(var je=[Fe("pre"),Fe("code"),Fe("xmp")],Ue=[],rt=0;rt<je.length;++rt)for(var Qe=0,qe=je[rt].length;Qe<qe;++Qe)Ue.push(je[rt][Qe]);je=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var nt=0,$e=/\blang(?:uage)?-([\w.]+)(?!\S)/,et=/\bprettyprint\b/,_e=/\bprettyprinted\b/,Je=/pre|xmp/i,st=/^code$/i,Be=/^(?:pre|code|xmp)$/i,ze={};function Ce(){for(var me=U.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:Infinity;nt<Ue.length&&Ye.now()<me;nt++){for(var Ee=Ue[nt],ne=ze,ae=Ee;ae=ae.previousSibling;){var ce=ae.nodeType,ve=(ce===7||ce===8)&&ae.nodeValue;if(ve?!/^\??prettify\b/.test(ve):ce!==3||/\S/.test(ae.nodeValue))break;if(ve){ne={},ve.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ht,Rt,Ur){ne[Rt]=Ur});break}}var Ie=Ee.className;if((ne!==ze||et.test(Ie))&&!_e.test(Ie)){for(var we=!1,Ke=Ee.parentNode;Ke;Ke=Ke.parentNode){var ot=Ke.tagName;if(Be.test(ot)&&Ke.className&&et.test(Ke.className)){we=!0;break}}if(!we){Ee.className+=" prettyprinted";var ct=ne.lang;if(!ct){ct=Ie.match($e);var dt;!ct&&(dt=le(Ee))&&st.test(dt.tagName)&&(ct=dt.className.match($e)),ct&&(ct=ct[1])}var Lt;if(Je.test(Ee.tagName))Lt=1;else{var wt=Ee.currentStyle,ft=Ne.defaultView,zt=wt?wt.whiteSpace:ft&&ft.getComputedStyle?ft.getComputedStyle(Ee,null).getPropertyValue("white-space"):0;Lt=zt&&zt.substring(0,3)==="pre"}var Ft=ne.linenums;(Ft=Ft==="true"||+Ft)||(Ft=Ie.match(/\blinenums\b(?::(\d+))?/),Ft=Ft?Ft[1]&&Ft[1].length?+Ft[1]:!0:!1),Ft&&ke(Ee,Ft,Lt);var Jt={langExtension:ct,sourceNode:Ee,numberLines:Ft,pre:Lt,sourceCode:null,basePos:null,spans:null,decorations:null};re(Jt)}}}nt<Ue.length?U.setTimeout(Ce,250):typeof oe=="function"&&oe()}Ce()}var Oe=U.PR={createSimpleLexer:pe,registerLangHandler:ge,sourceDecorator:Pe,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:B,PR_COMMENT:w,PR_DECLARATION:S,PR_KEYWORD:R,PR_LITERAL:x,PR_NOCODE:j,PR_PLAIN:l,PR_PUNCTUATION:d,PR_SOURCE:D,PR_STRING:v,PR_TAG:A,PR_TYPE:C,prettyPrintOne:O?U.prettyPrintOne=de:M=de,prettyPrint:H=O?U.prettyPrint=se:H=se},ie=U.define;typeof ie=="function"&&ie.amd&&ie("google-code-prettify",[],function(){return Oe})})()},T8No:function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return X}),ee.d(Le,"b",function(){return T}),ee.d(Le,"d",function(){return p}),ee.d(Le,"c",function(){return m}),ee.d(Le,"e",function(){return b});var ue=ee("N0LK"),J=ee("Cg/j"),O=function(){var a=function(i,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,y){u.__proto__=y}||function(u,y){for(var g in y)y.hasOwnProperty(g)&&(u[g]=y[g])},a(i,s)};return function(i,s){a(i,s);function u(){this.constructor=i}i.prototype=s===null?Object.create(s):(u.prototype=s.prototype,new u)}}(),X=function(){function a(){}return a.has=function(i){return M.create(i)},a.equals=function(i,s){return H.create(i,s)},a.regex=function(i,s){return L.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 u=this,y=i.split("||");return T.create(y.map(function(g){return u._deserializeAndExpression(g,s)}))},a._deserializeAndExpression=function(i,s){var u=this,y=i.split("&&");return f.create(y.map(function(g){return u._deserializeOne(g,s)}))},a._deserializeOne=function(i,s){if(i=i.trim(),i.indexOf("!=")>=0){var u=i.split("!=");return U.create(u[0].trim(),this._deserializeValue(u[1],s))}if(i.indexOf("==")>=0){var u=i.split("==");return H.create(u[0].trim(),this._deserializeValue(u[1],s))}if(i.indexOf("=~")>=0){var u=i.split("=~");return L.create(u[0].trim(),this._deserializeRegexValue(u[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 u=/^'([^']*)'$/.exec(i);return u?u[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 u=i.indexOf("/"),y=i.lastIndexOf("/");if(u===y||u<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var g=i.slice(u+1,y),v=i[y+1]==="i"?"i":"";try{return new RegExp(g,v)}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(),u=i.getType();if(s!==u)return s-u;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}(),H=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 H.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}(),L=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:"",u=i.regexp?i.regexp.source:"";return s<u?-1:s>u?1:0},a.prototype.equals=function(i){if(i instanceof a){var s=this.regexp?this.regexp.source:"",u=i.regexp?i.regexp.source:"";return this.key===i.key&&s===u}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 h.create(this)},a}(),h=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,u=this.expr.length;s<u;s++){var y=F(this.expr[s],i.expr[s]);if(y!==0)return y}return 0},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,u=this.expr.length;s<u;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,u=this.expr.length;s<u;s++)if(!this.expr[s].evaluate(i))return!1;return!0},a._normalizeArr=function(i){var s=[];if(i){for(var u=0,y=i.length;u<y;u++){var g=i[u];if(!g)continue;if(g instanceof a){s=s.concat(g.expr);continue}if(g 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(g)}s.sort(F)}return s},a.prototype.keys=function(){for(var i=[],s=0,u=this.expr;s<u.length;s++){var y=u[s];i.push.apply(i,y.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,u=this.expr;s<u.length;s++){var y=u[s];i.push(y.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,u=this.expr.length;s<u;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,u=this.expr.length;s<u;s++)if(this.expr[s].evaluate(i))return!0;return!1},a._normalizeArr=function(i){var s=[];if(i){for(var u=0,y=i.length;u<y;u++){var g=i[u];if(!g)continue;if(g instanceof a){s=s.concat(g.expr);continue}s.push(g)}s.sort(F)}return s},a.prototype.keys=function(){for(var i=[],s=0,u=this.expr;s<u.length;s++){var y=u[s];i.push.apply(i,y.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,u=this.expr;s<u.length;s++){var y=u[s];i.push(y.negate())}for(var g=function(D){return D instanceof a?D.expr:[D]};i.length>1;){for(var v=i.shift(),R=i.shift(),w=[],C=0,x=g(v);C<x.length;C++)for(var d=x[C],l=0,A=g(R);l<A.length;l++){var S=A[l];w.push(X.and(d,S))}i.unshift(X.or.apply(X,w))}return i[0]},a}(),p=function(a){O(i,a);function i(s,u){var y=a.call(this,s)||this;return y._defaultValue=u,y}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 X.not(this.key)},i}(M),m=Object(J.c)("contextKeyService"),b="setContext"},"VrN/":function(vt,Le,ee){(function(ue,J){vt.exports=J()})(this,function(){"use strict";var ue=navigator.userAgent,J=navigator.platform,O=/gecko\/\d/i.test(ue),X=/MSIE \d/.test(ue),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),M=/Edge\/(\d+)/.exec(ue),H=X||F||M,U=H&&(X?document.documentMode||6:+(M||F)[1]),P=!M&&/WebKit\//.test(ue),L=P&&/Qt\/\d+\.\d+/.test(ue),h=!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),b=!M&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),a=/Android/.test(ue),i=b||a||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),s=b||/Mac/.test(J),u=/\bCrOS\b/.test(ue),y=/win/i.test(J),g=f&&ue.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(f=!1,P=!0);var v=s&&(L||f&&(g==null||g<12.11)),R=O||H&&U>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C=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 x(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return x(e).appendChild(t)}function l(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 A(e,t,n,r){var o=l(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 I(){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 j(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 z=function(e){e.select()};b?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(z=function(e){try{e.select()}catch(t){}});function _(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 $(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 Z=e.indexOf(" ",k);if(Z<0||Z>=t)return W+(t-k);W+=Z-k,W+=n-W%n,k=Z+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=_(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.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 pe=50,Pe={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},ke={origin:"*mouse"},Ae={origin:"+move"};function Te(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 ge=[""];function he(e){for(;ge.length<=e;)ge.push(re(ge)+" ");return ge[e]}function re(e){return e[e.length-1]}function de(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 Oe(){}function ie(e,t){var n;return Object.create?n=Object.create(e):(Oe.prototype=e,n=new Oe),t&&N(t,n),n}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function Ne(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 je(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Ue(e,t,n){for(;(n<0?t>0:t<e.length)&&je(e.charAt(t));)t+=n;return t}function rt(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 Qe(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 qe=null;function Ye(e,t,n){var r;qe=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:qe=o),k.from==t&&(k.from!=k.to&&n!="before"?r=o:qe=o)}return r!=null?r:qe}var nt=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]/,Z=/[1n]/;function Q(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 Me=te.length,Re=[],We=0;We<Me;++We)Re.push(n(te.charCodeAt(We)));for(var Xe=0,Ze=ye;Xe<Me;++Xe){var it=Re[Xe];it=="m"?Re[Xe]=Ze:Ze=it}for(var ht=0,at=ye;ht<Me;++ht){var mt=Re[ht];mt=="1"&&at=="r"?Re[ht]="n":k.test(mt)&&(at=mt,mt=="r"&&(Re[ht]="R"))}for(var Tt=1,Et=Re[0];Tt<Me-1;++Tt){var Pt=Re[Tt];Pt=="+"&&Et=="1"&&Re[Tt+1]=="1"?Re[Tt]="1":Pt==","&&Et==Re[Tt+1]&&(Et=="1"||Et=="n")&&(Re[Tt]=Et),Et=Pt}for(var tr=0;tr<Me;++tr){var br=Re[tr];if(br==",")Re[tr]="N";else if(br=="%"){var ar=void 0;for(ar=tr+1;ar<Me&&Re[ar]=="%";++ar);for(var Gr=tr&&Re[tr-1]=="!"||ar<Me&&Re[ar]=="1"?"1":"N",Nr=tr;Nr<ar;++Nr)Re[Nr]=Gr;tr=ar-1}}for(var cr=0,Fr=ye;cr<Me;++cr){var Sr=Re[cr];Fr=="L"&&Sr=="1"?Re[cr]="L":k.test(Sr)&&(Fr=Sr)}for(var mr=0;mr<Me;++mr)if(o.test(Re[mr])){var fr=void 0;for(fr=mr+1;fr<Me&&o.test(Re[fr]);++fr);for(var sr=(mr?Re[mr-1]:ye)=="L",Br=(fr<Me?Re[fr]:ye)=="L",ui=sr==Br?sr?"L":"R":ye,kn=mr;kn<fr;++kn)Re[kn]=ui;mr=fr-1}for(var Ar=[],pn,xr=0;xr<Me;)if(W.test(Re[xr])){var Xa=xr;for(++xr;xr<Me&&W.test(Re[xr]);++xr);Ar.push(new Q(0,Xa,xr))}else{var yn=xr,Wn=Ar.length,Hn=fe=="rtl"?1:0;for(++xr;xr<Me&&Re[xr]!="L";++xr);for(var kr=yn;kr<xr;)if(Z.test(Re[kr])){yn<kr&&(Ar.splice(Wn,0,new Q(1,yn,kr)),Wn+=Hn);var hi=kr;for(++kr;kr<xr&&Z.test(Re[kr]);++kr);Ar.splice(Wn,0,new Q(2,hi,kr)),Wn+=Hn,yn=kr}else++kr;yn<xr&&Ar.splice(Wn,0,new Q(1,yn,xr))}return fe=="ltr"&&(Ar[0].level==1&&(pn=te.match(/^\s+/))&&(Ar[0].from=pn[0].length,Ar.unshift(new Q(0,0,pn[0].length))),re(Ar).level==1&&(pn=te.match(/\s+$/))&&(re(Ar).to-=pn[0].length,Ar.push(new Q(0,Me-pn[0].length,Me)))),fe=="rtl"?Ar.reverse():Ar}}();function $e(e,t){var n=e.order;return n==null&&(n=e.order=nt(e.text,t)),n}var et=[],_e=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]||et).concat(n)}};function Je(e,t){return e._handlers&&e._handlers[t]||et}function st(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 Be(e,t){var n=Je(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 ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Be(e,n||t.type,e,t),ce(t)||t.codemirrorIgnore}function Ce(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 me(e,t){return Je(e,t).length>0}function Ee(e){e.prototype.on=function(t,n){_e(this,t,n)},e.prototype.off=function(t,n){st(this,t,n)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(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),ae(e)}function Ie(e){return e.target||e.srcElement}function we(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 Ke=function(){if(H&&U<9)return!1;var e=l("div");return"draggable"in e||"dragDrop"in e}(),ot;function ct(e){if(ot==null){var t=l("span","\u200B");d(e,l("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ot=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&U<8))}var n=ot?l("span","\u200B"):l("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var dt;function Lt(e){if(dt!=null)return dt;var t=d(e,document.createTextNode("A\u062EA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return x(e),!n||n.left==n.right?!1:dt=r.right-n.right<3}var wt=`
|
|
|
|
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/)},ft=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},zt=function(){var e=l("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ft=null;function Jt(e){if(Ft!=null)return Ft;var t=d(e,l("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return Ft=Math.abs(n.left-r.left)>1}var Ht={},Rt={};function Ur(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ht[e]=t}function Zr(e,t){Rt[e]=t}function bt(e){if(typeof e=="string"&&Rt.hasOwnProperty(e))e=Rt[e];else if(e&&typeof e.name=="string"&&Rt.hasOwnProperty(e.name)){var t=Rt[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 bt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return bt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ct(e,t){t=bt(t);var n=Ht[t.name];if(!n)return Ct(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 xt(e,t){var n=lt.hasOwnProperty(e)?lt[e]:lt[e]={};N(t,n)}function Zt(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 nr(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 rr(e,t,n){return e.startState?e.startState(t,n):!0}var kt=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};kt.prototype.eol=function(){return this.pos>=this.string.length},kt.prototype.sol=function(){return this.pos==this.lineStart},kt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},kt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},kt.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},kt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},kt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},kt.prototype.skipToEnd=function(){this.pos=this.string.length},kt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},kt.prototype.backUp=function(e){this.pos-=e},kt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},kt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},kt.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)}},kt.prototype.current=function(){return this.string.slice(this.start,this.pos)},kt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},kt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},kt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function gt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var 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 Rr(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 Tr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ot(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 Lr(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 Z=e.lines[W],Q=Z.height;if(t<Q)break;t-=Q}return n+W}function zr(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 ut(e,t){return e.line-t.line||e.ch-t.ch}function Mt(e,t){return e.sticky==t.sticky&&ut(e,t)==0}function Kt(e){return He(e.line,e.ch)}function Yt(e,t){return ut(e,t)<0?t:e}function qt(e,t){return ut(e,t)<0?e:t}function K(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function c(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,gt(e,n).text.length):E(t,gt(e,t.line).text.length)}function E(e,t){var n=e.ch;return n==null||n>t?He(e.line,t):n<0?He(e.line,0):e}function G(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=c(e,t[r]);return n}var Y=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,n){return t instanceof Y?new V(e,Zt(e.mode,t.state),n,t.lookAhead):new V(e,Zt(e.mode,t),n)},V.prototype.save=function(e){var t=e!==!1?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Y(t,this.maxLookAhead):t};function xe(e,t,n,r){var o=[e.state.modeGen],k={};Vr(e,t.text,e.doc.mode,n,function(te,fe){return o.push(te,fe)},k,r);for(var W=n.state,Z=function(te){n.baseTokens=o;var fe=e.state.overlays[te],ye=1,Me=0;n.state=!0,Vr(e,t.text,fe.mode,n,function(Re,We){for(var Xe=ye;Me<Re;){var Ze=o[ye];Ze>Re&&o.splice(ye,1,Re,o[ye+1],Ze),ye+=2,Me=Math.min(Re,Ze)}if(!We)return;if(fe.opaque)o.splice(Xe,ye-Xe,Re,"overlay "+We),ye=Xe+2;else for(;Xe<ye;Xe+=2){var it=o[Xe+1];o[Xe+1]=(it?it+" ":"")+"overlay "+We}},k),n.state=W,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Z(Q);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=tt(e,Ot(t)),o=t.text.length>e.options.maxHighlightLength&&Zt(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 tt(e,t,n){var r=e.doc,o=e.display;if(!r.mode.startState)return new V(r,!0,t);var k=pr(e,t,n),W=k>r.first&>(r,k-1).stateAfter,Z=W?V.fromSaved(r,W,k):new V(r,rr(r.mode),k);return r.iter(k,t,function(Q){pt(e,Q.text,Z);var te=Z.line;Q.stateAfter=te==t-1||te%5==0||te>=o.viewFrom&&te<o.viewTo?Z.save():null,Z.nextLine()}),n&&(r.modeFrontier=Z.line),Z}function pt(e,t,n,r){var o=e.doc.mode,k=new kt(t,e.options.tabSize,n);for(k.start=k.pos=r||0,t==""&&Ve(o,n.state);!k.eol();)At(o,k,n.state),k.start=k.pos}function Ve(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=nr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function At(e,t,n,r){for(var o=0;o<10;o++){r&&(r[0]=nr(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 It=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function er(e,t,n,r){var o=e.doc,k=o.mode,W;t=c(o,t);var Z=gt(o,t.line),Q=tt(e,t.line,n),te=new kt(Z.text,e.options.tabSize,Q),fe;for(r&&(fe=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,W=At(k,te,Q.state),r&&fe.push(new It(te,W,Zt(o.mode,Q.state)));return r?fe:new It(te,W,Q.state)}function Kr(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 Vr(e,t,n,r,o,k,W){var Z=n.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var Q=0,te=null,fe=new kt(t,e.options.tabSize,r),ye,Me=e.options.addModeClass&&[null];for(t==""&&Kr(Ve(n,r.state),k);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(Z=!1,W&&pt(e,t,r,fe.pos),fe.pos=t.length,ye=null):ye=Kr(At(n,fe,r.state,Me),k),Me){var Re=Me[0].name;Re&&(ye="m-"+(ye?Re+" "+ye:Re))}if(!Z||te!=ye){for(;Q<fe.start;)Q=Math.min(fe.start,Q+5e3),o(Q,te);te=ye}fe.start=fe.pos}for(;Q<fe.pos;){var We=Math.min(fe.pos,Q+5e3);o(We,te),Q=We}}function pr(e,t,n){for(var r,o,k=e.doc,W=n?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>W;--Z){if(Z<=k.first)return k.first;var Q=gt(k,Z-1),te=Q.stateAfter;if(te&&(!n||Z+(te instanceof Y?te.lookAhead:0)<=k.modeFrontier))return Z;var fe=$(Q.text,null,e.options.tabSize);(o==null||r>fe)&&(o=Z-1,r=fe)}return o}function Qr(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=gt(e,r).stateAfter;if(o&&(!(o instanceof Y)||r+o.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Gn=!1,Or=!1;function Xr(){Gn=!0}function jr(){Or=!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 hn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function di(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var k=e[o],W=k.marker,Z=k.from==null||(W.inclusiveLeft?k.from<=t:k.from<t);if(Z||k.from==t&&W.type=="bookmark"&&(!n||!k.marker.insertLeft)){var Q=k.to==null||(W.inclusiveRight?k.to>=t:k.to>t);(r||(r=[])).push(new bn(W,k.from,Q?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,Z=k.to==null||(W.inclusiveRight?k.to>=t:k.to>t);if(Z||k.from==t&&W.type=="bookmark"&&(!n||k.marker.insertLeft)){var Q=k.from==null||(W.inclusiveLeft?k.from<=t:k.from<t);(r||(r=[])).push(new bn(W,Q?null:k.from-t,k.to==null?null:k.to-t))}}return r}function an(e,t){if(t.full)return null;var n=zr(e,t.from.line)&>(e,t.from.line).markedSpans,r=zr(e,t.to.line)&>(e,t.to.line).markedSpans;if(!n&&!r)return null;var o=t.from.ch,k=t.to.ch,W=ut(t.from,t.to)==0,Z=di(n,o,W),Q=zn(r,k,W),te=t.text.length==1,fe=re(t.text).length+(te?o:0);if(Z)for(var ye=0;ye<Z.length;++ye){var Me=Z[ye];if(Me.to==null){var Re=nn(Q,Me.marker);Re?te&&(Me.to=Re.to==null?null:Re.to+fe):Me.to=o}}if(Q)for(var We=0;We<Q.length;++We){var Xe=Q[We];if(Xe.to!=null&&(Xe.to+=fe),Xe.from==null){var Ze=nn(Z,Xe.marker);Ze||(Xe.from=fe,te&&(Z||(Z=[])).push(Xe))}else Xe.from+=fe,te&&(Z||(Z=[])).push(Xe)}Z&&(Z=Yr(Z)),Q&&Q!=Z&&(Q=Yr(Q));var it=[Z];if(!te){var ht=t.text.length-2,at;if(ht>0&&Z)for(var mt=0;mt<Z.length;++mt)Z[mt].to==null&&(at||(at=[])).push(new bn(Z[mt].marker,null,null));for(var Tt=0;Tt<ht;++Tt)it.push(at);it.push(Q)}return it}function Yr(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(Re){if(Re.markedSpans)for(var We=0;We<Re.markedSpans.length;++We){var Xe=Re.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],Z=W.find(0),Q=0;Q<o.length;++Q){var te=o[Q];if(ut(te.to,Z.from)<0||ut(te.from,Z.to)>0)continue;var fe=[Q,1],ye=ut(te.from,Z.from),Me=ut(te.to,Z.to);(ye<0||!W.inclusiveLeft&&!ye)&&fe.push({from:te.from,to:Z.from}),(Me>0||!W.inclusiveRight&&!Me)&&fe.push({from:Z.to,to:te.to}),o.splice.apply(o,fe),Q+=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 jt(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=ut(r.from,o.from)||or(e)-or(t);if(k)return-k;var W=ut(r.to,o.to)||jt(e)-jt(t);return W||t.id-e.id}function Ut(e,t){var n=Or&&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 hr(e){return Ut(e,!0)}function Vt(e){return Ut(e,!1)}function dn(e,t){var n=Or&&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=gt(e,t),W=Or&&k.markedSpans;if(W)for(var Z=0;Z<W.length;++Z){var Q=W[Z];if(!Q.marker.collapsed)continue;var te=Q.marker.find(0),fe=ut(te.from,n)||or(Q.marker)-or(o),ye=ut(te.to,r)||jt(Q.marker)-jt(o);if(fe>=0&&ye<=0||fe<=0&&ye>=0)continue;if(fe<=0&&(Q.marker.inclusiveRight&&o.inclusiveLeft?ut(te.to,n)>=0:ut(te.to,n)>0)||fe>=0&&(Q.marker.inclusiveRight&&o.inclusiveLeft?ut(te.from,r)<=0:ut(te.from,r)<0))return!0}}function Pr(e){for(var t;t=hr(e);)e=t.find(-1,!0).line;return e}function Kn(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function Vn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xn(e,t){var n=gt(e,t),r=Pr(n);return n==r?t:Ot(r)}function Ui(e,t){if(t>e.lastLine())return t;var n=gt(e,t),r;if(!Wr(e,n))return t;for(;r=Vt(n);)n=r.find(1,!0).line;return Ot(n)+1}function Wr(e,t){var n=Or&&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=Pr(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 Z=k.children[W];if(Z==n)break;t+=Z.height}return t}function Xn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=hr(r);){var o=n.find(0,!0);r=o.from.line,t+=o.from.ch-o.to.ch}for(r=e;n=Vt(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=gt(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 Pn=function(e,t,n){this.text=e,ci(this,t),this.height=n?n(this):1};Pn.prototype.lineNo=function(){return Ot(this)},Ee(Pn);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&&Tr(e,o)}function ha(e){e.parent=null,On(e)}var yt={},Dt={};function St(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Dt:yt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function _t(e,t){var n=A("span",null,null,P?"padding-right: .1px":null),r={pre:A("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=$t,Lt(e.display.measure)&&(W=$e(k,e.doc.direction))&&(r.addToken=dr(r.addToken,W)),r.map=[];var Z=t!=e.display.externalMeasured&&Ot(k);Nt(k,r,Ge(e,k,Z)),k.styleClasses&&(k.styleClasses.bgClass&&(r.bgClass=j(k.styleClasses.bgClass,r.bgClass||"")),k.styleClasses.textClass&&(r.textClass=j(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 Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Wt(e){var t=l("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function $t(e,t,n,r,o,k,W){if(!t)return;var Z=e.splitSpaces?Bt(t,e.trailingSpace):t,Q=e.cm.state.specialChars,te=!1,fe;if(!Q.test(t))e.col+=t.length,fe=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,fe),H&&U<9&&(te=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var ye=0;;){Q.lastIndex=ye;var Me=Q.exec(t),Re=Me?Me.index-ye:t.length-ye;if(Re){var We=document.createTextNode(Z.slice(ye,ye+Re));H&&U<9?fe.appendChild(l("span",[We])):fe.appendChild(We),e.map.push(e.pos,e.pos+Re,We),e.col+=Re,e.pos+=Re}if(!Me)break;ye+=Re+1;var Xe=void 0;if(Me[0]==" "){var Ze=e.cm.options.tabSize,it=Ze-e.col%Ze;Xe=fe.appendChild(l("span",he(it),"cm-tab")),Xe.setAttribute("role","presentation"),Xe.setAttribute("cm-text"," "),e.col+=it}else Me[0]=="\r"||Me[0]==`
|
|
`?(Xe=fe.appendChild(l("span",Me[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Xe.setAttribute("cm-text",Me[0]),e.col+=1):(Xe=e.cm.options.specialCharPlaceholder(Me[0]),Xe.setAttribute("cm-text",Me[0]),H&&U<9?fe.appendChild(l("span",[Xe])):fe.appendChild(Xe),e.col+=1);e.map.push(e.pos,e.pos+1,Xe),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,n||r||o||te||k||W){var ht=n||"";r&&(ht+=r),o&&(ht+=o);var at=l("span",[fe],ht,k);if(W)for(var mt in W)W.hasOwnProperty(mt)&&mt!="style"&&mt!="class"&&at.setAttribute(mt,W[mt]);return e.content.appendChild(at)}e.content.appendChild(fe)}function Bt(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 dr(e,t){return function(n,r,o,k,W,Z,Q){o=o?o+" cm-force-border":"cm-force-border";for(var te=n.pos,fe=te+r.length;;){for(var ye=void 0,Me=0;Me<t.length&&!(ye=t[Me],ye.to>te&&ye.from<=te);Me++);if(ye.to>=fe)return e(n,r,o,k,W,Z,Q);e(n,r.slice(0,ye.to-te),o,k,null,Z,Q),k=null,r=r.slice(ye.to-te),te=ye.to}}}function Mr(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 Nt(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]),St(n[W+1],t.cm.options));return}for(var Z=o.length,Q=0,te=1,fe="",ye,Me,Re=0,We,Xe,Ze,it,ht;;){if(Re==Q){We=Xe=Ze=Me="",ht=null,it=null,Re=Infinity;for(var at=[],mt=void 0,Tt=0;Tt<r.length;++Tt){var Et=r[Tt],Pt=Et.marker;if(Pt.type=="bookmark"&&Et.from==Q&&Pt.widgetNode)at.push(Pt);else if(Et.from<=Q&&(Et.to==null||Et.to>Q||Pt.collapsed&&Et.to==Q&&Et.from==Q)){if(Et.to!=null&&Et.to!=Q&&Re>Et.to&&(Re=Et.to,Xe=""),Pt.className&&(We+=" "+Pt.className),Pt.css&&(Me=(Me?Me+";":"")+Pt.css),Pt.startStyle&&Et.from==Q&&(Ze+=" "+Pt.startStyle),Pt.endStyle&&Et.to==Re&&(mt||(mt=[])).push(Pt.endStyle,Et.to),Pt.title&&((ht||(ht={})).title=Pt.title),Pt.attributes)for(var tr in Pt.attributes)(ht||(ht={}))[tr]=Pt.attributes[tr];Pt.collapsed&&(!it||Er(it.marker,Pt)<0)&&(it=Et)}else Et.from>Q&&Re>Et.from&&(Re=Et.from)}if(mt)for(var br=0;br<mt.length;br+=2)mt[br+1]==Re&&(Xe+=" "+mt[br]);if(!it||it.from==Q)for(var ar=0;ar<at.length;++ar)Mr(t,0,at[ar]);if(it&&(it.from||0)==Q){if(Mr(t,(it.to==null?Z+1:it.to)-Q,it.marker,it.from==null),it.to==null)return;it.to==Q&&(it=!1)}}if(Q>=Z)break;for(var Gr=Math.min(Z,Re);;){if(fe){var Nr=Q+fe.length;if(!it){var cr=Nr>Gr?fe.slice(0,Gr-Q):fe;t.addToken(t,cr,ye?ye+We:We,Ze,Q+cr.length==Re?Xe:"",Me,ht)}if(Nr>=Gr){fe=fe.slice(Gr-Q),Q=Gr;break}Q=Nr,Ze=""}fe=o.slice(k,k=n[te++]),ye=St(n[te++],t.cm.options)}}}function En(e,t,n){this.line=t,this.rest=Vn(t),this.size=this.rest?Ot(re(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wr(e,t)}function Gt(e,t,n){for(var r=[],o,k=t;k<n;k=o){var W=new En(e.doc,gt(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=Je(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(Ps,0));for(var k=function(Z){o.push(function(){return n[Z].apply(null,r)})},W=0;W<n.length;++W)k(W)}function Ps(){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"?_s(e,t):k=="gutter"?Qa(e,t,n,r):k=="class"?da(e,t):k=="widget"&&Is(e,t,r)}t.changes=null}function mi(e){return e.node==e.text&&(e.node=l("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&U<8&&(e.node.style.zIndex=2)),e.node}function Ms(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(l("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):_t(e,t)}function _s(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ms(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 Qa(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=l("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),Z=t.gutter=l("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),W.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(l("div",rn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=e.display.gutterSpecs[Q].className,fe=k.hasOwnProperty(te)&&k[te];fe&&Z.appendChild(l("div",[fe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function Is(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=Za(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),da(e,t),Qa(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,Z=t.widgets;W<Z.length;++W){var Q=Z[W],te=l("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Fs(Q,te,n,r),e.display.input.setUneditable(te),o&&Q.above?k.insertBefore(te,n.gutter||n.text):k.appendChild(te),Cr(Q,"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;"),d(t.display.measure,l("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function gn(e,t){for(var n=Ie(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=d(e.measure,l("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 pe-e.display.nativeBarWidth}function Mn(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&&Mn(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(),Z=0;Z<W.length-1;Z++){var Q=W[Z],te=W[Z+1];Math.abs(Q.bottom-te.bottom)>2&&k.push((Q.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(Ot(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Us(e,t){t=Pr(t);var n=Ot(t),r=e.display.externalMeasured=new En(e.doc,t,n);r.lineN=n;var o=r.built=_t(e,r);return r.text=o.pre,d(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=Ot(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,Z,Q,te=0;te<e.length;te+=3)if(Z=e[te],Q=e[te+1],t<Z?(o=0,k=1,W="left"):t<Q?(o=t-Z,k=o+1):(te==e.length-3||t==Q&&e[te+3]>t)&&(k=Q-Z,o=k-1,t>=Q&&(W="right")),o!=null){if(r=e[te+2],Z==Q&&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==Q-Z)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:Z,coverEnd:Q}}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,Z=o.end,Q=o.collapse,te;if(k.nodeType==3){for(var fe=0;fe<4;fe++){for(;W&&je(t.line.text.charAt(o.coverStart+W));)--W;for(;o.coverStart+Z<o.coverEnd&&je(t.line.text.charAt(o.coverStart+Z));)++Z;if(H&&U<9&&W==0&&Z==o.coverEnd-o.coverStart?te=k.parentNode.getBoundingClientRect():te=js(S(k,W,Z).getClientRects(),r),te.left||te.right||W==0)break;Z=W,W=W-1,Q="right"}H&&U<11&&(te=Hs(e.display.measure,te))}else{W>0&&(Q=r="right");var ye;e.options.lineWrapping&&(ye=k.getClientRects()).length>1?te=ye[r=="right"?ye.length-1:0]:te=k.getBoundingClientRect()}if(H&&U<9&&!W&&(!te||!te.left&&!te.right)){var Me=k.parentNode.getClientRects()[0];Me?te={left:Me.left,right:Me.left+Jn(e.display),top:Me.top,bottom:Me.bottom}:te=io}for(var Re=te.top-t.rect.top,We=te.bottom-t.rect.top,Xe=(Re+We)/2,Ze=t.view.measure.heights,it=0;it<Ze.length-1&&!(Xe<Ze[it]);it++);var ht=it?Ze[it-1]:0,at=Ze[it],mt={left:(Q=="right"?te.right:te.left)-t.rect.left,right:(Q=="left"?te.left:te.right)-t.rect.left,top:ht,bottom:at};return!te.left&&!te.right&&(mt.bogus=!0),e.options.singleCursorHeightPerLine||(mt.rtop=Re,mt.rbottom=We),mt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Jt(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,x(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 h&&a?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return h&&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 Z=e.display.lineSpace.getBoundingClientRect();W+=Z.top+(r=="window"?0:uo());var Q=Z.left+(r=="window"?0:lo());n.left+=Q,n.right+=Q}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=gt(e.doc,t.line)),Gi(e,r,no(e,r,t.ch,o),n)}function sn(e,t,n,r,o,k){r=r||gt(e.doc,t.line),o||(o=Yn(e,r));function W(We,Xe){var Ze=fn(e,o,We,Xe?"right":"left",k);return Xe?Ze.left=Ze.right:Ze.right=Ze.left,Gi(e,r,Ze,n)}var Z=$e(r,e.doc.direction),Q=t.ch,te=t.sticky;if(Q>=r.text.length?(Q=r.text.length,te="before"):Q<=0&&(Q=0,te="after"),!Z)return W(te=="before"?Q-1:Q,te=="before");function fe(We,Xe,Ze){var it=Z[Xe],ht=it.level==1;return W(Ze?We-1:We,ht!=Ze)}var ye=Ye(Z,Q,te),Me=qe,Re=fe(Q,ye,te=="before");return Me!=null&&(Re.other=fe(Q,Me,te!="before")),Re}function co(e,t){var n=0;t=c(e.doc,t),e.options.lineWrapping||(n=Jn(e.display)*t.ch);var r=gt(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=Lr(r,n),k=r.first+r.size-1;if(o>k)return va(r.first+r.size-1,gt(r,k).text.length,null,1,1);t<0&&(t=0);for(var W=gt(r,o);;){var Z=Gs(e,W,o,t,n),Q=dn(W,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!Q)return Z;var te=Q.find(1);if(te.line==o)return te;W=gt(r,o=te.line)}}function fo(e,t,n,r){r-=ma(t);var o=t.text.length,k=rt(function(W){return fn(e,n,W-1).bottom<=r},o,0);return o=rt(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),Z=0,Q=t.text.length,te=!0,fe=$e(t,e.doc.direction);if(fe){var ye=(e.options.lineWrapping?Ks:zs)(e,t,n,k,fe,r,o);te=ye.level!=1,Z=te?ye.from:ye.to-1,Q=te?ye.to:ye.from-1}var Me=null,Re=null,We=rt(function(Tt){var Et=fn(e,k,Tt);return Et.top+=W,Et.bottom+=W,ba(Et,r,o,!1)?(Et.top<=o&&Et.left<=r&&(Me=Tt,Re=Et),!0):!1},Z,Q),Xe,Ze,it=!1;if(Re){var ht=r-Re.left<Re.right-r,at=ht==te;We=Me+(at?0:1),Ze=at?"after":"before",Xe=ht?Re.left:Re.right}else{!te&&(We==Q||We==Z)&&We++,Ze=We==0?"after":We==t.text.length?"before":fn(e,k,We-(te?1:0)).bottom+W<=o==te?"after":"before";var mt=sn(e,He(n,We,Ze),"line",t,k);Xe=mt.left,it=o<mt.top?-1:o>=mt.bottom?1:0}return We=Ue(t.text,We,1),va(n,We,Ze,it,r-Xe)}function zs(e,t,n,r,o,k,W){var Z=rt(function(ye){var Me=o[ye],Re=Me.level!=1;return ba(sn(e,He(n,Re?Me.to:Me.from,Re?"before":"after"),"line",t,r),k,W,!0)},0,o.length-1),Q=o[Z];if(Z>0){var te=Q.level!=1,fe=sn(e,He(n,te?Q.from:Q.to,te?"after":"before"),"line",t,r);ba(fe,k,W,!0)&&fe.top>W&&(Q=o[Z-1])}return Q}function Ks(e,t,n,r,o,k,W){var Z=fo(e,t,r,W),Q=Z.begin,te=Z.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var fe=null,ye=null,Me=0;Me<o.length;Me++){var Re=o[Me];if(Re.from>=te||Re.to<=Q)continue;var We=Re.level!=1,Xe=fn(e,r,We?Math.min(te,Re.to)-1:Math.max(Q,Re.from)).right,Ze=Xe<k?k-Xe+1e9:Xe-k;(!fe||ye>Ze)&&(fe=Re,ye=Ze)}return fe||(fe=o[o.length-1]),fe.from<Q&&(fe={from:Q,to:fe.to,level:fe.level}),fe.to>te&&(fe={from:fe.from,to:te,level:fe.level}),fe}var _n;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(_n==null){_n=l("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)_n.appendChild(document.createTextNode("x")),_n.appendChild(l("br"));_n.appendChild(document.createTextNode("x"))}d(e.measure,_n);var n=_n.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),x(e.measure),n||1}function Jn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=l("span","xxxxxxxxxx"),n=l("pre",[t],"CodeMirror-line-like");d(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 Z=e.display.gutterSpecs[W].className;n[Z]=k.offsetLeft+k.clientLeft+o,r[Z]=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(Wr(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&&Tr(r,o)})}function In(e,t,n,r){var o=e.display;if(!n&&Ie(t).getAttribute("cm-not-content")=="true")return null;var k,W,Z=o.lineSpace.getBoundingClientRect();try{k=t.clientX-Z.left,W=t.clientY-Z.top}catch(ye){return null}var Q=ya(e,k,W),te;if(r&&Q.xRel>0&&(te=gt(e.doc,Q.line).text).length==Q.ch){var fe=$(te,te.length,e.options.tabSize)-te.length;Q=He(Q.line,Math.max(0,Math.round((k-to(e.display).left)/Jn(e.display))-fe))}return Q}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 _r(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)Or&&xn(e.doc,t)<o.viewTo&&Sn(e);else if(n<=o.viewFrom)Or&&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 Z=zi(e,t,t,-1),Q=zi(e,n,n+r,1);Z&&Q?(o.view=o.view.slice(0,Z.index).concat(Gt(e,Z.lineN,Q.lineN)).concat(o.view.slice(Q.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(!Or||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var Z=e.display.viewFrom,Q=0;Q<o;Q++)Z+=W[Q].size;if(Z!=t){if(r>0){if(o==W.length-1)return null;k=Z+W[o].size-t,o++}else k=Z-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=Gt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Gt(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(Gt(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 Z=n.sel.ranges[W];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var Q=Z.empty();(Q||e.options.showCursorWhenSelecting)&&yo(e,Z.head,o),Q||Xs(e,Z,k)}return r}function yo(e,t,n){var r=sn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=n.appendChild(l("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(l("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),Z=W.left,Q=Math.max(r.sizerWidth,Mn(e)-r.sizer.offsetLeft)-W.right,te=o.direction=="ltr";function fe(at,mt,Tt,Et){mt<0&&(mt=0),mt=Math.round(mt),Et=Math.round(Et),k.appendChild(l("div",null,"CodeMirror-selected","position: absolute; left: "+at+`px;
|
|
top: `+mt+"px; width: "+(Tt==null?Q-at:Tt)+`px;
|
|
height: `+(Et-mt)+"px"))}function ye(at,mt,Tt){var Et=gt(o,at),Pt=Et.text.length,tr,br;function ar(cr,Fr){return ga(e,He(at,cr),"div",Et,Fr)}function Gr(cr,Fr,Sr){var mr=po(e,Et,null,cr),fr=Fr=="ltr"==(Sr=="after")?"left":"right",sr=Sr=="after"?mr.begin:mr.end-(/\s/.test(Et.text.charAt(mr.end-1))?2:1);return ar(sr,fr)[fr]}var Nr=$e(Et,o.direction);return Qe(Nr,mt||0,Tt==null?Pt:Tt,function(cr,Fr,Sr,mr){var fr=Sr=="ltr",sr=ar(cr,fr?"left":"right"),Br=ar(Fr-1,fr?"right":"left"),ui=mt==null&&cr==0,kn=Tt==null&&Fr==Pt,Ar=mr==0,pn=!Nr||mr==Nr.length-1;if(Br.top-sr.top<=3){var xr=(te?ui:kn)&&Ar,Xa=(te?kn:ui)&&pn,yn=xr?Z:(fr?sr:Br).left,Wn=Xa?Q:(fr?Br:sr).right;fe(yn,sr.top,Wn-yn,sr.bottom)}else{var Hn,kr,hi,Ya;fr?(Hn=te&&ui&&Ar?Z:sr.left,kr=te?Q:Gr(cr,Sr,"before"),hi=te?Z:Gr(Fr,Sr,"after"),Ya=te&&kn&&pn?Q:Br.right):(Hn=te?Gr(cr,Sr,"before"):Z,kr=!te&&ui&&Ar?Q:sr.right,hi=!te&&kn&&pn?Z:Br.left,Ya=te?Gr(Fr,Sr,"after"):Q),fe(Hn,sr.top,kr-Hn,sr.bottom),sr.bottom<Br.top&&fe(Z,sr.bottom,null,Br.top),fe(hi,Br.top,Ya-hi,Br.bottom)}(!tr||Ki(sr,tr)<0)&&(tr=sr),Ki(Br,tr)<0&&(tr=Br),(!br||Ki(sr,br)<0)&&(br=sr),Ki(Br,br)<0&&(br=Br)}),{start:tr,end:br}}var Me=t.from(),Re=t.to();if(Me.line==Re.line)ye(Me.line,Me.ch,Re.ch);else{var We=gt(o,Me.line),Xe=gt(o,Re.line),Ze=Pr(We)==Pr(Xe),it=ye(Me.line,Me.ch,Ze?We.text.length+1:null).end,ht=ye(Re.line,Ze?0:null,Re.ch).start;Ze&&(it.top<ht.top-2?(fe(it.right,it.top,null,it.bottom),fe(Z,ht.top,ht.left,ht.bottom)):fe(it.right,it.top,ht.left-it.right,it.bottom)),it.bottom<ht.top&&fe(Z,it.bottom,null,ht.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()||Zn(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,Zn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Be(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Zn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Be(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function 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,Z=0;if(o.hidden)continue;if(H&&U<8){var Q=o.node.offsetTop+o.node.offsetHeight;W=Q-n,n=Q}else{var te=o.node.getBoundingClientRect();W=te.bottom-te.top,!k&&o.text.firstChild&&(Z=o.text.firstChild.getBoundingClientRect().right-te.left-1)}var fe=o.line.height-W;if((fe>.005||fe<-.005)&&(Tr(o.line,W),Eo(o.line),o.rest))for(var ye=0;ye<o.rest.length;ye++)Eo(o.rest[ye]);if(Z>e.display.sizerWidth){var Me=Math.ceil(Z/Jn(e.display));Me>e.display.maxLineLength&&(e.display.maxLineLength=Me,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=Lr(t,r),W=Lr(t,o);if(n&&n.ensure){var Z=n.ensure.from.line,Q=n.ensure.to.line;Z<k?(k=Z,W=Lr(t,on(gt(t,Z))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=W&&(k=Lr(t,on(gt(t,Q))-e.wrapper.clientHeight),W=Q)}return{from:k,to:Math.max(W,k+1)}}function Ys(e,t){if(ze(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=l("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,Z=sn(e,t),Q=!n||n==t?Z:sn(e,n);o={left:Math.min(Z.left,Q.left),top:Math.min(Z.top,Q.top)-r,right:Math.max(Z.left,Q.left),bottom:Math.max(Z.bottom,Q.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 Z=e.doc.height+ca(n),Q=t.top<r,te=t.bottom>Z-r;if(t.top<o)W.scrollTop=Q?0:t.top;else if(t.bottom>o+k){var fe=Math.min(t.top,(te?Z:t.bottom)-k);fe!=o&&(W.scrollTop=fe)}var ye=e.options.fixedGutter?0:n.gutters.offsetWidth,Me=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ye,Re=Mn(e)-n.gutters.offsetWidth,We=t.right-t.left>Re;return We&&(t.right=t.left+Re),t.left<10?W.scrollLeft=0:t.left<Me?W.scrollLeft=Math.max(0,t.left+ye-(We?0:10)):t.right>Re+Me-3&&(W.scrollLeft=t.right+(We?0:10)-Re),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 Qn(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 Zs(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=l("div",[l("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=l("div",[l("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),_e(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),_e(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&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 q,this.disableVert=new q},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&&C(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),_e(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 Qs=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:++Qs},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-Mn(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==I();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,c(r,e.scrollToPos.from),c(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,o)}var k=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(k)for(var Z=0;Z<k.length;++Z)k[Z].lines.length||Be(k[Z],"hide");if(W)for(var Q=0;Q<W.length;++Q)W[Q].lines.length&&Be(W[Q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Hr(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 Dr(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,_(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=tt(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,Z=k.text.length>e.options.maxHighlightLength?Zt(t.mode,r.state):null,Q=xe(e,k,r,!0);Z&&(r.state=Z),k.styles=Q.styles;var te=k.styleClasses,fe=Q.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),Me=0;!ye&&Me<W.length;++Me)ye=W[Me]!=k.styles[Me];ye&&o.push(r.line),k.stateAfter=r.save(),r.nextLine()}else k.text.length<=e.options.maxHighlightLength&&pt(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&&Hr(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=Mn(e),this.force=n,this.dims=xa(e),this.events=[]};$i.prototype.signal=function(e,t){me(e,t)&&this.events.push(arguments)},$i.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Be.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=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=I();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==I())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)),Or&&(k=xn(e.doc,k),W=Ui(e.doc,W));var Z=k!=n.viewFrom||W!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,k,W),n.viewOffset=on(gt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=go(e);if(!Z&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=sl(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(te),x(n.cursorDiv),x(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Z&&(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==Mn(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 Z(We){var Xe=We.nextSibling;return P&&s&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),Xe}for(var Q=r.view,te=r.viewFrom,fe=0;fe<Q.length;fe++){var ye=Q[fe];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=k){var Me=Ns(e,ye,te,n);k.insertBefore(Me,W)}else{for(;W!=ye.node;)W=Z(W);var Re=o&&t!=null&&t<=te&&ye.lineNumber;ye.changes&&(le(ye.changes,"gutter")>-1&&(Re=!1),Ja(e,ye,te,n)),Re&&(x(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(rn(e.options,te)))),W=ye.node.nextSibling}te+=ye.size}for(;W;)W=Z(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 Z=n[W].alignable;if(Z)for(var Q=0;Q<Z.length;Q++)Z[Q].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(l("div",[l("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;x(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var o=n[r],k=o.className,W=o.style,Z=t.appendChild(l("div",null,"CodeMirror-gutter "+k));W&&(Z.style.cssText=W),k=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ka(e)}function Ti(e){Ro(e.display),_r(e),Do(e)}function hl(e,t,n,r){var o=this;this.input=n,o.scrollbarFiller=l("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=l("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=A("div",null,"CodeMirror-code"),o.selectionDiv=l("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=l("div",null,"CodeMirror-cursors"),o.measure=l("div",null,"CodeMirror-measure"),o.lineMeasure=l("div",null,"CodeMirror-measure"),o.lineSpace=A("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var k=A("div",[o.lineSpace],"CodeMirror-lines");o.mover=l("div",[k],null,"position: relative"),o.sizer=l("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=l("div",null,null,"position: absolute; height: "+pe+"px; width: 1px;"),o.gutters=l("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=l("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=l("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),H&&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,$r=null;H?$r=-.53:O?$r=15:h?$r=-.7:T&&($r=-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 dl(e){var t=Oo(e);return t.x*=$r,t.y*=$r,t}function Po(e,t){var n=Oo(t),r=n.x,o=n.y,k=e.display,W=k.scroller,Z=W.scrollWidth>W.clientWidth,Q=W.scrollHeight>W.clientHeight;if(!(r&&Z||o&&Q))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&&$r!=null){o&&Q&&xi(e,Math.max(0,W.scrollTop+o*$r)),Fn(e,Math.max(0,W.scrollLeft+r*$r)),(!o||o&&Q)&&ne(t),k.wheelStartX=null;return}if(o&&$r!=null){var Me=o*$r,Re=e.doc.scrollTop,We=Re+k.wrapper.clientHeight;Me<0?Re=Math.max(0,Re+Me-50):We=Math.min(e.doc.height,We+Me+50),Da(e,{top:Re,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,Ze=W.scrollTop-k.wheelStartY,it=Ze&&k.wheelDY&&Ze/k.wheelDY||Xe&&k.wheelDX&&Xe/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!it)return;$r=($r*Ji+it)/(Ji+1),++Ji},200)):(k.wheelDX+=r,k.wheelDY+=o))}var Jr=function(e,t){this.ranges=e,this.primIndex=t};Jr.prototype.primary=function(){return this.ranges[this.primIndex]},Jr.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(!Mt(n.anchor,r.anchor)||!Mt(n.head,r.head))return!1}return!0},Jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Xt(Kt(this.ranges[t].anchor),Kt(this.ranges[t].head));return new Jr(e,this.primIndex)},Jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Jr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ut(t,r.from())>=0&&ut(e,r.to())<=0)return n}return-1};var Xt=function(e,t){this.anchor=e,this.head=t};Xt.prototype.from=function(){return qt(this.anchor,this.head)},Xt.prototype.to=function(){return Yt(this.anchor,this.head)},Xt.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(Me,Re){return ut(Me.from(),Re.from())}),n=le(t,o);for(var k=1;k<t.length;k++){var W=t[k],Z=t[k-1],Q=ut(Z.to(),W.from());if(r&&!W.empty()?Q>0:Q>=0){var te=qt(Z.from(),W.from()),fe=Yt(Z.to(),W.to()),ye=Z.empty()?W.from()==W.head:Z.from()==Z.head;k<=n&&--n,t.splice(--k,2,new Xt(ye?fe:te,ye?te:fe))}}return new Jr(t,n)}function Tn(e,t){return new Jr([new Xt(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 Mo(e,t){if(ut(e,t.from)<0)return e;if(ut(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 Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var o=e.sel.ranges[r];n.push(new Xt(Mo(o.anchor,t),Mo(o.head,t)))}return ln(e.cm,n,e.sel.primIndex)}function _o(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 Z=t[W],Q=_o(Z.from,o,k),te=_o(wn(Z),o,k);if(o=Z.to,k=te,n=="around"){var fe=e.sel.ranges[W],ye=ut(fe.head,fe.anchor)<0;r[W]=new Xt(ye?te:Q,ye?Q:te)}else r[W]=new Xt(Q,Q)}return new Jr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Ct(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&&_r(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _a(e,t,n,r){function o(ht){return n?n[ht]:null}function k(ht,at,mt){$a(ht,at,mt,r),Cr(ht,"change",ht,t)}function W(ht,at){for(var mt=[],Tt=ht;Tt<at;++Tt)mt.push(new Pn(te[Tt],o(Tt),r));return mt}var Z=t.from,Q=t.to,te=t.text,fe=gt(e,Z.line),ye=gt(e,Q.line),Me=re(te),Re=o(te.length-1),We=Q.line-Z.line;if(t.full)e.insert(0,W(0,te.length)),e.remove(te.length,e.size-te.length);else if(Io(e,t)){var Xe=W(0,te.length-1);k(ye,ye.text,Re),We&&e.remove(Z.line,We),Xe.length&&e.insert(Z.line,Xe)}else if(fe==ye)if(te.length==1)k(fe,fe.text.slice(0,Z.ch)+Me+fe.text.slice(Q.ch),Re);else{var Ze=W(1,te.length-1);Ze.push(new Pn(Me+fe.text.slice(Q.ch),Re,r)),k(fe,fe.text.slice(0,Z.ch)+te[0],o(0)),e.insert(Z.line+1,Ze)}else if(te.length==1)k(fe,fe.text.slice(0,Z.ch)+te[0]+ye.text.slice(Q.ch),o(0)),e.remove(Z.line+1,We);else{k(fe,fe.text.slice(0,Z.ch)+te[0],o(0)),k(ye,Me+ye.text.slice(Q.ch),Re);var it=W(1,te.length-1);We>1&&e.remove(Z.line+1,We-1),e.insert(Z.line+1,it)}Cr(e,"change",e,t)}function An(e,t,n){function r(o,k,W){if(o.linked)for(var Z=0;Z<o.linked.length;++Z){var Q=o.linked[Z];if(Q.doc==k)continue;var te=W&&Q.sharedHist;if(n&&!te)continue;t(Q.doc,te),r(Q.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),Ma(e),Fo(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,_r(e)}function Fo(e){(e.doc.direction=="rtl"?B:C)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Hr(e,function(){Fo(e),_r(e)})}function Zi(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 Ia(e,t){var n={from:Kt(t.from),to:wn(t),text:Rr(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,Z;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)))Z=re(W.changes),ut(t.from,t.to)==0&&ut(t.from,Z.to)==0?Z.to=wn(t):W.changes.push(Ia(e,t));else{var Q=re(o.done);for((!Q||!Q.ranges)&&Qi(e.sel,o.done),W={changes:[Ia(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,Z||Be(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:Qi(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=k,o.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(o.undone)}function Qi(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 Z=0;Z<W.length;++Z){for(var Q=W[Z],te=0;te<k.length;++te)if(k[te].marker==Q.marker)continue e;k.push(Q)}}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?Jr.prototype.deepCopy.call(k):k);continue}var W=k.changes,Z=[];r.push({changes:Z});for(var Q=0;Q<W.length;++Q){var te=W[Q],fe=void 0;if(Z.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(Z)[ye]=te[ye],delete te[ye]))}}return r}function Na(e,t,n,r){if(r){var o=e.anchor;if(n){var k=ut(t,o)<0;k!=ut(n,o)<0?(o=t,t=n):k!=ut(t,n)<0&&(t=n)}return new Xt(o,t)}else return new Xt(n||t,t)}function qi(e,t,n,r,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),wr(e,new Jr([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);wr(e,W,n)}function Fa(e,t,n,r){var o=e.sel.ranges.slice(0);o[t]=n,wr(e,ln(e.cm,o,e.sel.primIndex),r)}function Go(e,t,n,r){wr(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 Xt(c(e,o[k].anchor),c(e,o[k].head))},origin:n&&n.origin};return Be(e,"beforeSelectionChange",e,r),e.cm&&Be(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)):wr(e,t,n)}function wr(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(me(e,"beforeSelectionChange")||e.cm&&me(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ut(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Qn(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,Ce(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],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],Q=ta(e,W.anchor,Z&&Z.anchor,n,r),te=ta(e,W.head,Z&&Z.head,n,r);(o||Q!=W.anchor||te!=W.head)&&(o||(o=t.ranges.slice(0,k)),o[k]=new Xt(Q,te))}return o?ln(e.cm,o,t.primIndex):t}function ti(e,t,n,r,o){var k=gt(e,t.line);if(k.markedSpans)for(var W=0;W<k.markedSpans.length;++W){var Z=k.markedSpans[W],Q=Z.marker,te="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,fe="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Z.from==null||(te?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(fe?Z.to>=t.ch:Z.to>t.ch))){if(o&&(Be(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(k.markedSpans){--W;continue}else break;if(!Q.atomic)continue;if(n){var ye=Q.find(r<0?1:-1),Me=void 0;if((r<0?fe:te)&&(ye=Yo(e,ye,-r,ye&&ye.line==t.line?k:null)),ye&&ye.line==t.line&&(Me=ut(ye,n))&&(r<0?Me<0:Me>0))return ti(e,ye,t,r,o)}var Re=Q.find(r<0?-1:1);return(r<0?te:fe)&&(Re=Yo(e,Re,r,Re.line==t.line?k:null)),Re?ti(e,Re,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?c(e,He(t.line-1)):null:n>0&&t.ch==(r||gt(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()),Se)}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,Z){o&&(r.from=c(e,o)),k&&(r.to=c(e,k)),W&&(r.text=W),Z!==void 0&&(r.origin=Z)}),Be(e,"beforeChange",e,r),e.cm&&Be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function 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((me(e,"beforeChange")||e.cm&&me(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)Zo(e,{from:r[o].from,to:r[o].to,text:o?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ut(t.from,t.to)==0)return;var n=Pa(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,Z=t=="undo"?o.done:o.undone,Q=t=="undo"?o.undone:o.done,te=0;te<Z.length&&!(k=Z[te],n?k.ranges&&!k.equals(e.sel):!k.ranges);te++);if(te==Z.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(k=Z.pop(),k.ranges){if(Qi(k,Q),n&&!k.equals(e.sel)){wr(e,k,{clearRedo:!1});return}W=k}else if(r){Z.push(k);return}else break;var fe=[];Qi(W,Q),Q.push({changes:fe,generation:o.generation}),o.generation=k.generation||++o.maxGeneration;for(var ye=me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"),Me=function(Xe){var Ze=k.changes[Xe];if(Ze.origin=t,ye&&!Jo(e,Ze,!1))return Z.length=0,{};fe.push(Ia(e,Ze));var it=Xe?Pa(e,Ze):re(Z);Ai(e,Ze,it,Wo(e,Ze)),!Xe&&e.cm&&e.cm.scrollIntoView({from:Ze.from,to:wn(Ze)});var ht=[];An(e,function(at,mt){!mt&&le(ht,at.history)==-1&&(ts(at.history,Ze),ht.push(at.history)),Ai(at,Ze,null,Wo(at,Ze))})},Re=k.changes.length-1;Re>=0;--Re){var We=Me(Re);if(We)return We.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Jr(de(e.sel.ranges,function(o){return new Xt(He(o.anchor.line+t,o.anchor.ch),He(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){_r(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){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);Qo(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,gt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Rr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?xl(e.cm,t,r):_a(e,t,r),ea(e,n,Se),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,Z=!1,Q=k.line;e.options.lineWrapping||(Q=Ot(Pr(gt(r,k.line))),r.iter(Q,W.line+1,function(Re){if(Re==o.maxLine)return Z=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ce(e),_a(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(Q,k.line+t.text.length,function(Re){var We=Xn(Re);We>o.maxLineLength&&(o.maxLine=Re,o.maxLineLength=We,o.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),Qr(r,k.line),Si(e,400);var te=t.text.length-(W.line-k.line)-1;t.full?_r(e):k.line==W.line&&t.text.length==1&&!Io(e.doc,t)?Cn(e,k.line,"text"):_r(e,k.line,W.line+1,te);var fe=me(e,"changes"),ye=me(e,"change");if(ye||fe){var Me={from:k,to:W,text:t.text,removed:t.removed,origin:t.origin};ye&&Cr(e,"change",e,Me),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Me)}e.display.selForContextMenu=null}function ni(e,t,n,r,o){var k;r||(r=n),ut(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 Z=0;Z<k.ranges.length;Z++)qo(k.ranges[Z].anchor,t,n,r),qo(k.ranges[Z].head,t,n,r);continue}for(var Q=0;Q<k.changes.length;++Q){var te=k.changes[Q];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=gt(e,K(e,t)):o=Ot(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,ha(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 Z=[];this.collapse(Z),this.children=[new Di(Z)],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,Z=W;Z<o.lines.length;){var Q=new Di(o.lines.slice(Z,Z+=25));o.height-=Q.height,this.children.splice(++r,0,Q),Q.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=Ot(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);Tr(n,Math.max(0,n.height-k)),e&&(Hr(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;Wr(this.doc,r)||Tr(r,r.height+o),n&&Hr(n,function(){n.curOp.forceUpdate=!0,rs(n,r,o),Cr(n,"lineWidgetChanged",n,e,Ot(r))})},Ee(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 Z=W.widgets||(W.widgets=[]);if(o.insertAt==null?Z.push(o):Z.splice(Math.min(Z.length-1,Math.max(0,o.insertAt)),0,o),o.line=W,k&&!Wr(e,W)){var Q=on(W)<e.scrollTop;Tr(W,W.height+gi(o)),Q&&Aa(k,o.height),k.curOp.forceUpdate=!0}return!0}),k&&Cr(k,"lineWidgetAdded",k,o,typeof t=="number"?t:Ot(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),me(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],Z=nn(W.markedSpans,this);e&&!this.collapsed?Cn(e,Ot(W),"text"):e&&(Z.to!=null&&(o=Ot(W)),Z.from!=null&&(r=Ot(W))),W.markedSpans=mn(W.markedSpans,Z),Z.from==null&&this.collapsed&&!Wr(this.doc,W)&&e&&Tr(W,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var te=Pr(this.lines[Q]),fe=Xn(te);fe>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&_r(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:Ot(k),W.from),e==-1))return n;if(W.to!=null&&(r=He(t?k:Ot(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;Hr(r,function(){var o=t.line,k=Ot(t.line),W=pa(r,k);if(W&&(oo(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Wr(n.doc,o)&&n.height!=null){var Z=n.height;n.height=null;var Q=gi(n)-Z;Q&&Tr(o,o.height+Q)}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)}},Ee(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=ut(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=A("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");jr()}k.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Z=t.line,Q=e.cm,te;if(e.iter(Z,n.line+1,function(ye){Q&&k.collapsed&&!Q.options.lineWrapping&&Pr(ye)==Q.display.maxLine&&(te=!0),k.collapsed&&Z!=t.line&&Tr(ye,0),hn(ye,new bn(k,Z==t.line?t.ch:null,Z==n.line?n.ch:null)),++Z}),k.collapsed&&e.iter(t.line,n.line+1,function(ye){Wr(e,ye)&&Tr(ye,0)}),k.clearOnEnter&&_e(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Xr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++ns,k.atomic=!0),Q){if(te&&(Q.curOp.updateMaxLine=!0),k.collapsed)_r(Q,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(Q,fe,"text");k.atomic&&Vo(Q.doc),Cr(Q,"markerAdded",Q,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)},Ee(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],Z=r.widgetNode;return An(e,function(Q){Z&&(r.widgetNode=Z.cloneNode(!0)),k.push(ii(Q,c(Q,t),c(Q,n),r,o));for(var te=0;te<Q.linked.length;++te)if(Q.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(ut(k,W)){var Z=ii(e,k,W,r.primary,r.primary.type);r.markers.push(Z),Z.parent=r}}}function Tl(e){for(var t=function(r){var o=e[r],k=[o.primary.doc];An(o.primary.doc,function(Q){return k.push(Q)});for(var W=0;W<o.markers.length;W++){var Z=o.markers[W];le(k,Z.doc)==-1&&(Z.parent=null,o.markers.splice(W--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Ir=function(e,t,n,r,o){if(!(this instanceof Ir))return new Ir(e,t,n,r,o);n==null&&(n=0),ki.call(this,[new Di([new Pn("",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 Zi(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)),_a(this,{from:k,to:k,text:e}),wr(this,Tn(k),Se)};Ir.prototype=ie(ki.prototype,{constructor:Ir,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,gt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),wr(this,Tn(t),Se)}),replaceRange:function(e,t,n,r){t=c(this,t),n=n?c(this,n):t,ni(this,e,t,n,r)},getRange:function(e,t,n){var r=Rr(this,c(this,e),c(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(zr(this,e))return gt(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=gt(this,e)),Pr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return c(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,c(this,typeof e=="number"?He(e,t||0):e),null,n)}),setSelection:yr(function(e,t,n){Go(this,c(this,e),c(this,t||e),n)}),extendSelection:yr(function(e,t,n){qi(this,c(this,e),t&&c(this,t),n)}),extendSelections:yr(function(e,t){Ho(this,G(this,e),t)}),extendSelectionsBy:yr(function(e,t){var n=de(this.sel.ranges,e);Ho(this,G(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 Xt(c(this,e[o].anchor),c(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),wr(this,ln(this.cm,r,t),n)}),addSelection:yr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Xt(c(this,e),c(this,t||e))),wr(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=Rr(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=Rr(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 Z=t&&t!="end"&&cl(this,r,t),Q=r.length-1;Q>=0;Q--)ri(this,r[Q]);Z?zo(this,Z):this.cm&&Qn(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 Zi(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 Zi(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&&Ne(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,Ne(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!zr(this,e))return null;if(t=e,e=gt(this,e),!e)return null}else if(t=Ot(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 Z=W.index+W[0].length;r[o]=k.slice(0,W.index)+(!W.index||Z==k.length?"":" ")+k.slice(Z)||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,c(this,e),c(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=c(this,e),ii(this,e,e,n,"bookmark")},findMarksAt:function(e){e=c(this,e);var t=[],n=gt(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=c(this,e),t=c(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 Z=0;Z<W.length;Z++){var Q=W[Z];!(Q.to!=null&&o==e.line&&e.ch>=Q.to||Q.from==null&&o!=e.line||Q.from!=null&&o==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&r.push(Q.marker.parent||Q.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}),c(this,He(n,t))},indexFromPos:function(e){e=c(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 Ir(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 Ir(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 Zi(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):wt(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)})}),Ir.prototype.eachLine=Ir.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),ze(t,e)||gn(t.display,e))return;ne(e),H&&(as=+new Date);var n=In(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,Z=function(){++W==o&&vr(t,function(){n=c(t.doc,n);var Re={from:n,to:n,text:t.doc.splitLines(k.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};ri(t.doc,Re),zo(t.doc,Tn(c(t.doc,n),c(t.doc,wn(Re))))})()},Q=function(Re,We){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,Re.type)==-1){Z();return}var Xe=new FileReader;Xe.onerror=function(){return Z()},Xe.onload=function(){var Ze=Xe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ze)){Z();return}k[We]=Ze,Z()},Xe.readAsText(Re)},te=0;te<r.length;te++)Q(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 Me=0;Me<ye.length;++Me)ni(t.doc,"",ye[Me].anchor,ye[Me].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(Re){}}}function Ll(e,t){if(H&&(!e.state.draggingText||+new Date-as<100)){ve(t);return}if(ze(e,t)||gn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!T){var n=l("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=In(e,t);if(!n)return;var r=document.createDocumentFragment();yo(e,n,r),e.display.dragCursor||(e.display.dragCursor=l("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(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;_e(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ol)},100))}),_e(window,"blur",function(){return ss(Zn)})}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"},Pi=0;Pi<10;Pi++)Dn[Pi+48]=Dn[Pi+96]=String(Pi);for(var na=65;na<=90;na++)Dn[na]=String.fromCharCode(na);for(var Mi=1;Mi<=12;Mi++)Dn[Mi+111]=Dn[Mi+63235]="F"+Mi;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 Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,o,k,W=0;W<t.length-1;W++){var Z=t[W];if(/^(cmd|meta|m)$/i.test(Z))k=!0;else if(/^a(lt)?$/i.test(Z))n=!0;else if(/^(c|ctrl|control)$/i.test(Z))r=!0;else if(/^s(hift)?$/i.test(Z))o=!0;else throw new Error("Unrecognized modifier name: "+Z)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function Ml(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=de(n.split(" "),Pl),k=0;k<o.length;k++){var W=void 0,Z=void 0;k==o.length-1?(Z=o.join(" "),W=r):(Z=o.slice(0,k+1).join(" "),W="...");var Q=t[Z];if(!Q)t[Z]=W;else if(Q!=W)throw new Error("Inconsistent bindings for "+Z)}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 hs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(v?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(v?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ds(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),hs(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&&ut(k.from,re(r).to)<=0;){var W=r.pop();if(ut(W.from,k.from)<0){k.from=W.from;break}}r.push(k)}Hr(e,function(){for(var Z=r.length-1;Z>=0;Z--)ni(e.doc,"",r[Z].from,r[Z].to,"+delete");Qn(e)})}function Ba(e,t,n){var r=Ue(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=$e(n,t.doc.direction);if(k){var W=o<0?re(k):k[0],Z=o<0==(W.level==1),Q=Z?"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=rt(function(Me){return fn(t,fe,Me).top==ye},o<0==(W.level==1)?W.from:W.to-1,te),Q=="before"&&(te=Ba(n,te,1))}else te=o<0?W.to:W.from;return new He(r,te,Q)}}return new He(r,o<0?n.text.length:0,o<0?"before":"after")}function _l(e,t,n,r){var o=$e(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 Z=function(it,ht){return Ba(t,it instanceof He?it.ch:it,ht)},Q,te=function(it){return e.options.lineWrapping?(Q=Q||Yn(e,t),po(e,t,Q,it)):{begin:0,end:t.text.length}},fe=te(n.sticky=="before"?Z(n,-1):n.ch);if(e.doc.direction=="rtl"||W.level==1){var ye=W.level==1==r<0,Me=Z(n,ye?1:-1);if(Me!=null&&(ye?Me<=W.to&&Me<=fe.end:Me>=W.from&&Me>=fe.begin)){var Re=ye?"before":"after";return new He(n.line,Me,Re)}}var We=function(it,ht,at){for(var mt=function(tr,br){return br?new He(n.line,Z(tr,1),"before"):new He(n.line,tr,"after")};it>=0&&it<o.length;it+=ht){var Tt=o[it],Et=ht>0==(Tt.level!=1),Pt=Et?at.begin:Z(at.end,-1);if(Tt.from<=Pt&&Pt<Tt.to)return mt(Pt,Et);if(Pt=Et?Tt.from:Z(Tt.to,-1),at.begin<=Pt&&Pt<at.end)return mt(Pt,Et)}},Xe=We(k+r,r,fe);if(Xe)return Xe;var Ze=r>0?fe.end:Z(fe.begin,-1);return Ze!=null&&!(r>0&&Ze==t.text.length)&&(Xe=We(r>0?0:o.length-1,r,te(Ze)),Xe)?Xe:null}var _i={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return oi(e,function(t){if(t.empty()){var n=gt(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:c(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 Il(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")},Ae)},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")},Ae)},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},Ae)},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=$(e.getLine(k.line),k.ch,r);t.push(he(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Hr(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=gt(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=gt(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 Xt(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return Hr(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);Qn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var n=gt(e.doc,t),r=Pr(n);return r!=n&&(t=Ot(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=gt(e.doc,t),r=Kn(n);return r!=n&&(t=Ot(r)),ja(!0,e,n,t,-1)}function fs(e,t){var n=cs(e,t.line),r=gt(e.doc,n.line),o=$e(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=_i[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)!=Pe}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 q;function Ii(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=ds(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ii(e,"Shift-"+n,t,function(r){return aa(e,r,!0)})||Ii(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):Ii(e,n,t,function(r){return aa(e,r)}):!1}function Bl(e,t,n){return Ii(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=I(),ze(t,e))return;H&&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&&!zt&&(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)&&(C(t,"CodeMirror-crosshair"),st(document,"keyup",n),st(document,"mouseover",n))}_e(document,"keyup",n),_e(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),ze(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(gn(t.display,e)||ze(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&&ut(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(ze(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=In(t,e),o=we(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):Ie(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,Ii(e,hs(k,o),o,function(W){if(typeof W=="string"&&(W=_i[W]),!W)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=W(e,n)!=Pe}finally{e.state.suppressEdits=!1}return Z})}function Gl(e,t,n){var r=e.getOption("configureMouse"),o=r?r(e,t,n):{};if(o.unit==null){var k=u?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){H?setTimeout(_(bo,e),0):e.curOp.focus=I();var o=Gl(e,n,r),k=e.doc.sel,W;e.options.dragDrop&&Ke&&!e.isReadOnly()&&n=="single"&&(W=k.contains(t))>-1&&(ut((W=k.ranges[W]).from(),t)<0||t.xRel>0)&&(ut(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,st(o.wrapper.ownerDocument,"mouseup",W),st(o.wrapper.ownerDocument,"mousemove",Z),st(o.scroller,"dragstart",Q),st(o.scroller,"drop",W),k||(ne(te),r.addNew||qi(e.doc,n,null,null,r.extend),P&&!T||H&&U==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),Z=function(te){k=k||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Q=function(){return k=!0};P&&(o.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),_e(o.wrapper.ownerDocument,"mouseup",W),_e(o.wrapper.ownerDocument,"mousemove",Z),_e(o.scroller,"dragstart",Q),_e(o.scroller,"drop",W),xo(e),setTimeout(function(){return o.input.focus()},20)}function xs(e,t,n){if(n=="char")return new Xt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Xt(He(t.line,0),c(e.doc,He(t.line+1,0)));var r=n(e,t);return new Xt(r.from,r.to)}function Vl(e,t,n,r){var o=e.display,k=e.doc;ne(t);var W,Z,Q=k.sel,te=Q.ranges;if(r.addNew&&!r.extend?(Z=k.sel.contains(n),Z>-1?W=te[Z]:W=new Xt(n,n)):(W=k.sel.primary(),Z=k.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new Xt(n,n)),n=In(e,t,!0,!0),Z=-1;else{var fe=xs(e,n,r.unit);r.extend?W=Na(W,fe.anchor,fe.head,r.extend):W=fe}r.addNew?Z==-1?(Z=te.length,wr(k,ln(e,te.concat([W]),Z),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Z].empty()&&r.unit=="char"&&!r.extend?(wr(k,ln(e,te.slice(0,Z).concat(te.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),Q=k.sel):Fa(k,Z,W,ke):(Z=0,wr(k,new Jr([W],0),ke),Q=k.sel);var ye=n;function Me(at){if(ut(ye,at)==0)return;if(ye=at,r.unit=="rectangle"){for(var mt=[],Tt=e.options.tabSize,Et=$(gt(k,n.line).text,n.ch,Tt),Pt=$(gt(k,at.line).text,at.ch,Tt),tr=Math.min(Et,Pt),br=Math.max(Et,Pt),ar=Math.min(n.line,at.line),Gr=Math.min(e.lastLine(),Math.max(n.line,at.line));ar<=Gr;ar++){var Nr=gt(k,ar).text,cr=Te(Nr,tr,Tt);tr==br?mt.push(new Xt(He(ar,cr),He(ar,cr))):Nr.length>cr&&mt.push(new Xt(He(ar,cr),He(ar,Te(Nr,br,Tt))))}mt.length||mt.push(new Xt(n,n)),wr(k,ln(e,Q.ranges.slice(0,Z).concat(mt),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(at)}else{var Fr=W,Sr=xs(e,at,r.unit),mr=Fr.anchor,fr;ut(Sr.anchor,mr)>0?(fr=Sr.head,mr=qt(Fr.from(),Sr.anchor)):(fr=Sr.anchor,mr=Yt(Fr.to(),Sr.head));var sr=Q.ranges.slice(0);sr[Z]=Xl(e,new Xt(c(k,mr),fr)),wr(k,ln(e,sr,Z),ke)}}var Re=o.wrapper.getBoundingClientRect(),We=0;function Xe(at){var mt=++We,Tt=In(e,at,!0,r.unit=="rectangle");if(!Tt)return;if(ut(Tt,ye)!=0){e.curOp.focus=I(),Me(Tt);var Et=Xi(o,k);(Tt.line>=Et.to||Tt.line<Et.from)&&setTimeout(vr(e,function(){We==mt&&Xe(at)}),150)}else{var Pt=at.clientY<Re.top?-20:at.clientY>Re.bottom?20:0;Pt&&setTimeout(vr(e,function(){if(We!=mt)return;o.scroller.scrollTop+=Pt,Xe(at)}),50)}}function Ze(at){e.state.selectingText=!1,We=Infinity,at&&(ne(at),o.input.focus()),st(o.wrapper.ownerDocument,"mousemove",it),st(o.wrapper.ownerDocument,"mouseup",ht),k.history.lastSelOrigin=null}var it=vr(e,function(at){at.buttons===0||!we(at)?Ze(at):Xe(at)}),ht=vr(e,Ze);e.state.selectingText=ht,_e(o.wrapper.ownerDocument,"mousemove",it),_e(o.wrapper.ownerDocument,"mouseup",ht)}function Xl(e,t){var n=t.anchor,r=t.head,o=gt(e.doc,n.line);if(ut(n,r)==0&&n.sticky==r.sticky)return t;var k=$e(o);if(!k)return t;var W=Ye(k,n.ch,n.sticky),Z=k[W];if(Z.from!=n.ch&&Z.to!=n.ch)return t;var Q=W+(Z.from==n.ch==(Z.level!=1)?0:1);if(Q==0||Q==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)*(Z.level==1?-1:1);fe==Q-1||fe==Q?te=ye<0:te=ye>0}var Me=k[Q+(te?-1:0)],Re=te==(Me.level==1),We=Re?Me.from:Me.to,Xe=Re?"after":"before";return n.ch==We&&n.sticky==Xe?t:new Xt(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(Me){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ne(t);var W=e.display,Z=W.lineDiv.getBoundingClientRect();if(k>Z.bottom||!me(e,n))return ce(t);k-=Z.top-W.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=W.gutters.childNodes[Q];if(te&&te.getBoundingClientRect().right>=o){var fe=Lr(e.doc,k),ye=e.display.gutterSpecs[Q];return Be(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(ze(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return me(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(Z,Q,te){te!=si&&k(Z,Q,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,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),_r(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(Q){for(var te=0;;){var fe=Q.text.indexOf(o,te);if(fe==-1)break;te=fe+o.length,k.push(He(W,fe))}W++});for(var Z=k.length-1;Z>=0;Z--)ni(r.doc,o,k[Z],He(k[Z].line,k[Z].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",Wt,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",!y),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),Ti(r)},!0),n("keyMap","default",function(r,o,k){var W=ia(o),Z=k!=si&&ia(k);Z&&Z.detach&&Z.detach(r,W),W.attach&&W.attach(r,Z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!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"&&(Zn(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?_e:st;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 Zl(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Ca(e),_r(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 Ir(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 hl(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 q,keySeq:null,specialChars:null},t.autofocus&&!i&&k.input.focus(),H&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(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):Zn(this);for(var W in oa)oa.hasOwnProperty(W)&&oa[W](this,t[W],si);ko(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<za.length;++Z)za[Z](this);jn(this),P&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}ir.defaults=Ts,ir.optionHandlers=oa;function Ql(e){var t=e.display;_e(t.scroller,"mousedown",vr(e,bs)),H&&U<11?_e(t.scroller,"dblclick",vr(e,function(Q){if(ze(e,Q))return;var te=In(e,Q);if(!te||Ga(e,Q)||gn(e.display,Q))return;ne(Q);var fe=e.findWordAt(te);qi(e.doc,fe.anchor,fe.head)})):_e(t.scroller,"dblclick",function(Q){return ze(e,Q)||ne(Q)}),_e(t.scroller,"contextmenu",function(Q){return Cs(e,Q)}),_e(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Cs(e,Q)});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(Q){if(Q.touches.length!=1)return!1;var te=Q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function W(Q,te){if(te.left==null)return!0;var fe=te.left-Q.left,ye=te.top-Q.top;return fe*fe+ye*ye>20*20}_e(t.scroller,"touchstart",function(Q){if(!ze(e,Q)&&!k(Q)&&!Ga(e,Q)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),_e(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),_e(t.scroller,"touchend",function(Q){var te=t.activeTouch;if(te&&!gn(t,Q)&&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 Xt(fe,fe):!te.prev.prev||W(te,te.prev.prev)?ye=e.findWordAt(fe):ye=new Xt(He(fe.line,0),c(e.doc,He(fe.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),ne(Q)}o()}),_e(t.scroller,"touchcancel",o),_e(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),Be(e,"scroll",e))}),_e(t.scroller,"mousewheel",function(Q){return Po(e,Q)}),_e(t.scroller,"DOMMouseScroll",function(Q){return Po(e,Q)}),_e(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){ze(e,Q)||ve(Q)},over:function(Q){ze(e,Q)||(Dl(e,Q),ve(Q))},start:function(Q){return Ll(e,Q)},drop:vr(e,Al),leave:function(Q){ze(e,Q)||os(e)}};var Z=t.input.getField();_e(Z,"keyup",function(Q){return vs.call(e,Q)}),_e(Z,"keydown",vr(e,gs)),_e(Z,"keypress",vr(e,ys)),_e(Z,"focus",function(Q){return Ta(e,Q)}),_e(Z,"blur",function(Q){return Zn(e,Q)})}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=tt(e,t).state:n="prev");var W=e.options.tabSize,Z=gt(o,t),Q=$(Z.text,null,W);Z.stateAfter&&(Z.stateAfter=null);var te=Z.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(Z.text))fe=0,n="not";else if(n=="smart"&&(fe=o.mode.indent(k,Z.text.slice(te.length),Z.text),fe==Pe||fe>150)){if(!r)return;n="prev"}n=="prev"?t>o.first?fe=$(gt(o,t-1).text,null,W):fe=0:n=="add"?fe=Q+e.options.indentUnit:n=="subtract"?fe=Q-e.options.indentUnit:typeof n=="number"&&(fe=Q+n),fe=Math.max(0,fe);var ye="",Me=0;if(e.options.indentWithTabs)for(var Re=Math.floor(fe/W);Re;--Re)Me+=W,ye+=" ";if(Me<fe&&(ye+=he(fe-Me)),ye!=te)return ni(o,ye,He(t,0),He(t,te.length),"+input"),Z.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 Ze=He(t,te.length);Fa(o,We,new Xt(Ze,Ze));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,Z=o=="paste"||e.state.pasteIncoming>W,Q=wt(t),te=null;if(Z&&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 Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=de(Q,function(it){return[it]}));for(var ye=e.curOp.updateInput,Me=r.ranges.length-1;Me>=0;Me--){var Re=r.ranges[Me],We=Re.from(),Xe=Re.to();Re.empty()&&(n&&n>0?We=He(We.line,We.ch-n):e.state.overwrite&&!Z?Xe=He(Xe.line,Math.min(gt(k,Xe.line).text.length,Xe.ch+re(Q).length)):Z&&un&&un.lineWise&&un.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(We=Xe=He(We.line,0)));var Ze={from:We,to:Xe,text:te?te[Me%te.length]:Q,origin:o||(Z?"paste":e.state.cutIncoming>W?"cut":"+input")};ri(e.doc,Ze),Cr(e,"inputRead",e,Ze)}t&&!Z&&As(e,t),Qn(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&&Hr(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 Z=0;Z<k.electricChars.length;Z++)if(t.indexOf(k.electricChars.charAt(Z))>-1){W=Bi(e,o.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(gt(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=l("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=l("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,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),Be(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:Dr(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++,_r(this)}),removeOverlay:Dr(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++,_r(this);return}}}),indentLine:Dr(function(r,o,k){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),zr(this.doc,r)&&Bi(this,r,o,k)}),indentSelection:Dr(function(r){for(var o=this.doc.sel.ranges,k=-1,W=0;W<o.length;W++){var Z=o[W];if(Z.empty())Z.head.line>k&&(Bi(this,Z.head.line,r,!0),k=Z.head.line,W==this.doc.sel.primIndex&&Qn(this));else{var Q=Z.from(),te=Z.to(),fe=Math.max(k,Q.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 Me=this.doc.sel.ranges;Q.ch==0&&o.length==Me.length&&Me[W].from().ch>0&&Fa(this.doc,W,new Xt(Q,Me[W].to()),Se)}}}),getTokenAt:function(r,o){return er(this,r,o)},getLineTokens:function(r,o){return er(this,He(r),o,!0)},getTokenTypeAt:function(r){r=c(this.doc,r);var o=Ge(this,gt(this.doc,r.line)),k=0,W=(o.length-1)/2,Z=r.ch,Q;if(Z==0)Q=o[2];else for(;;){var te=k+W>>1;if((te?o[te*2-1]:0)>=Z)W=te;else if(o[te*2+1]<Z)k=te+1;else{Q=o[te*2+2];break}}var fe=Q?Q.indexOf("overlay "):-1;return fe<0?Q:fe==0?null:Q.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],Z=this.getModeAt(r);if(typeof Z[o]=="string")W[Z[o]]&&k.push(W[Z[o]]);else if(Z[o])for(var Q=0;Q<Z[o].length;Q++){var te=W[Z[o][Q]];te&&k.push(te)}else Z.helperType&&W[Z.helperType]?k.push(W[Z.helperType]):W[Z.name]&&k.push(W[Z.name]);for(var fe=0;fe<W._global.length;fe++){var ye=W._global[fe];ye.pred(Z,this)&&le(k,ye.val)==-1&&k.push(ye.val)}return k},getStateAfter:function(r,o){var k=this.doc;return r=K(k,r==null?k.first+k.size-1:r),tt(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=c(this.doc,r):k=r?W.from():W.to(),sn(this,k,o||"page")},charCoords:function(r,o){return ga(this,c(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,Lr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,o,k){var W=!1,Z;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,W=!0),Z=gt(this.doc,r)}else Z=r;return Gi(this,Z,{top:0,left:0},o||"page",k||W).top+(W?this.doc.height-on(Z):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,Z){var Q=this.display;r=sn(this,c(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),Q.sizer.appendChild(o),W=="over")te=r.top;else if(W=="above"||W=="near"){var ye=Math.max(Q.wrapper.clientHeight,this.doc.height),Me=Math.max(Q.sizer.clientWidth,Q.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>Me&&(fe=Me-o.offsetWidth)}o.style.top=te+"px",o.style.left=o.style.right="",Z=="right"?(fe=Q.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(Z=="left"?fe=0:Z=="middle"&&(fe=(Q.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:Dr(gs),triggerOnKeyPress:Dr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Dr(bs),execCommand:function(r){if(_i.hasOwnProperty(r))return _i[r].call(null,this)},triggerElectric:Dr(function(r){As(this,r)}),findPosH:function(r,o,k,W){var Z=1;o<0&&(Z=-1,o=-o);for(var Q=c(this.doc,r),te=0;te<o&&!(Q=Va(this.doc,Q,Z,k,W),Q.hitSide);++te);return Q},moveH:Dr(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()},Ae)}),deleteH:Dr(function(r,o){var k=this.doc.sel,W=this.doc;k.somethingSelected()?W.replaceSelection("",null,"+delete"):oi(this,function(Z){var Q=Va(W,Z.head,r,o,!1);return r<0?{from:Q,to:Z.head}:{from:Z.head,to:Q}})}),findPosV:function(r,o,k,W){var Z=1,Q=W;o<0&&(Z=-1,o=-o);for(var te=c(this.doc,r),fe=0;fe<o;++fe){var ye=sn(this,te,"div");if(Q==null?Q=ye.left:ye.left=Q,te=Rs(this,ye,Z,k),te.hitSide)break}return te},moveV:Dr(function(r,o){var k=this,W=this.doc,Z=[],Q=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(fe){if(Q)return r<0?fe.from():fe.to();var ye=sn(k,fe.head,"div");fe.goalColumn!=null&&(ye.left=fe.goalColumn),Z.push(ye.left);var Me=Rs(k,ye,r,o);return o=="page"&&fe==W.sel.primary()&&Aa(k,ga(k,Me,"div").top-ye.top),Me},Ae),Z.length)for(var te=0;te<W.sel.ranges.length;te++)W.sel.ranges[te].goalColumn=Z[te]}),findWordAt:function(r){var o=this.doc,k=gt(o,r.line).text,W=r.ch,Z=r.ch;if(k){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Z==k.length)&&W?--W:++Z;for(var te=k.charAt(W),fe=De(te,Q)?function(ye){return De(ye,Q)}:/\s/.test(te)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!De(ye)};W>0&&fe(k.charAt(W-1));)--W;for(;Z<k.length&&fe(k.charAt(Z));)++Z}return new Xt(He(r.line,W),He(r.line,Z))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),Be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Dr(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:Mn(this)}},scrollIntoView:Dr(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?Zs(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Dr(function(r,o){var k=this,W=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=W(r)),o!=null&&(this.display.wrapper.style.height=W(o)),this.options.lineWrapping&&so(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(Q){if(Q.widgets){for(var te=0;te<Q.widgets.length;te++)if(Q.widgets[te].noHScroll){Cn(k,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,Be(this,"refresh",this)}),operation:function(r){return Hr(this,r)},startOperation:function(){return Un(this)},endOperation:function(){return jn(this)},refresh:Dr(function(){var r=this.display.cachedTextHeight;_r(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),Be(this,"refresh",this)}),swapDoc:Dr(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}},Ee(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,Z=gt(e,t.line),Q=o&&e.direction=="rtl"?-n:n;function te(){var ht=t.line+Q;return ht<e.first||ht>=e.first+e.size?!1:(t=new He(ht,t.ch,t.sticky),Z=gt(e,ht))}function fe(ht){var at;if(r=="codepoint"){var mt=Z.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(mt)?at=null:at=new He(t.line,Math.max(0,Math.min(Z.text.length,t.ch+n*(mt>=55296&&mt<56320?2:1))),-n)}else o?at=_l(e.cm,Z,t,n):at=Ua(Z,t,n);if(at==null)if(!ht&&te())t=ja(o,e.cm,Z,t.line,Q);else return!1;else t=at;return!0}if(r=="char"||r=="codepoint")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var ye=null,Me=r=="group",Re=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(n<0&&!fe(!We));We=!1){var Xe=Z.text.charAt(t.ch)||`
|
|
`,Ze=De(Xe,Re)?"w":Me&&Xe==`
|
|
`?"n":!Me||/\s/.test(Xe)?null:"p";if(Me&&!We&&!Ze&&(Ze="s"),ye&&ye!=Ze){n<0&&(n=1,fe(),t.sticky="after");break}if(Ze&&(ye=Ze),n>0&&!fe(!We))break}var it=ta(e,t,k,W,!0);return Mt(k,it)&&(it.hitSide=!0),it}function Rs(e,t,n,r){var o=e.doc,k=t.left,W;if(r=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Z-.5*$n(e.display),3);W=(n>0?t.bottom:t.top)+n*Q}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 q,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(Z){for(var Q=Z.target;Q;Q=Q.parentNode){if(Q==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}_e(o,"paste",function(Z){if(!k(Z)||ze(r,Z)||ws(Z,r))return;U<=11&&setTimeout(vr(r,function(){return t.updateFromDOM()}),20)}),_e(o,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),_e(o,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),_e(o,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),_e(o,"touchstart",function(){return n.forceCompositionEnd()}),_e(o,"input",function(){t.composing||t.readFromDOMSoon()});function W(Z){if(!k(Z)||ze(r,Z))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Z.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=Ls(r);sa({lineWise:!0,text:Q.text}),Z.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Se),r.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var te=un.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",te),Z.clipboardData.getData("Text")==te){Z.preventDefault();return}}var fe=ks(),ye=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),ye.value=un.text.join(`
|
|
`);var Me=document.activeElement;z(ye),setTimeout(function(){r.display.lineSpace.removeChild(fe),Me.focus(),Me==o&&n.showPrimarySelection()},50)}_e(o,"copy",W),_e(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&&ut(qt(k,W),r)==0&&ut(Yt(k,W),o)==0)return;var Z=t.display.view,Q=r.line>=t.display.viewFrom&&Os(t,r)||{node:Z[0].measure.map[2],offset:0},te=o.line<t.display.viewTo&&Os(t,o);if(!te){var fe=Z[Z.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(!Q||!te){e.removeAllRanges();return}var Me=e.rangeCount&&e.getRangeAt(0),Re;try{Re=S(Q.node,Q.offset,te.offset,te.node)}catch(We){}Re&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),Re.collapsed||(e.removeAllRanges(),e.addRange(Re))):(e.removeAllRanges(),e.addRange(Re)),Me&&e.anchorNode==null?e.addRange(Me):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){d(this.cm.display.cursorDiv,e.cursors),d(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():Hr(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&&h&&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&&Hr(t,function(){wr(t.doc,Tn(n,r),Se),(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,gt(e.doc,r.line-1).length)),o.ch==gt(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,Z;r.line==t.viewFrom||(k=Nn(e,r.line))==0?(W=Ot(t.view[0].line),Z=t.view[0].node):(W=Ot(t.view[k].line),Z=t.view[k-1].node.nextSibling);var Q=Nn(e,o.line),te,fe;if(Q==t.view.length-1?(te=t.viewTo-1,fe=t.lineDiv.lastChild):(te=Ot(t.view[Q+1].line)-1,fe=t.view[Q+1].node.previousSibling),!Z)return!1;for(var ye=e.doc.splitLines(tu(e,Z,fe,W,te)),Me=Rr(e.doc,He(W,0),He(te,gt(e.doc,te).text.length));ye.length>1&&Me.length>1;)if(re(ye)==re(Me))ye.pop(),Me.pop(),te--;else if(ye[0]==Me[0])ye.shift(),Me.shift(),W++;else break;for(var Re=0,We=0,Xe=ye[0],Ze=Me[0],it=Math.min(Xe.length,Ze.length);Re<it&&Xe.charCodeAt(Re)==Ze.charCodeAt(Re);)++Re;for(var ht=re(ye),at=re(Me),mt=Math.min(ht.length-(ye.length==1?Re:0),at.length-(Me.length==1?Re:0));We<mt&&ht.charCodeAt(ht.length-We-1)==at.charCodeAt(at.length-We-1);)++We;if(ye.length==1&&Me.length==1&&W==r.line)for(;Re&&Re>r.ch&&ht.charCodeAt(ht.length-We-1)==at.charCodeAt(at.length-We-1);)Re--,We++;ye[ye.length-1]=ht.slice(0,ht.length-We).replace(/^\u200b+/,""),ye[0]=ye[0].slice(Re).replace(/\u200b+$/,"");var Tt=He(W,Re),Et=He(te,Me.length?re(Me).length-We:0);if(ye.length>1||ye[0]||ut(Tt,Et))return ni(e.doc,ye,Tt,Et,"+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())&&Hr(this.cm,function(){return _r(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=gt(e.doc,t.line),o=ro(n,r,t.line),k=$e(r,e.doc.direction),W="left";if(k){var Z=Ye(k,t.ch);W=Z%2?"right":"left"}var Q=ao(o.map,t.ch,W);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function li(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,o){var k="",W=!1,Z=e.doc.lineSeparator(),Q=!1;function te(Re){return function(We){return We.id==Re}}function fe(){W&&(k+=Z,Q&&(k+=Z),W=Q=!1)}function ye(Re){Re&&(fe(),k+=Re)}function Me(Re){if(Re.nodeType==1){var We=Re.getAttribute("cm-text");if(We){ye(We);return}var Xe=Re.getAttribute("cm-marker"),Ze;if(Xe){var it=e.findMarks(He(r,0),He(o+1,0),te(+Xe));it.length&&(Ze=it[0].find(0))&&ye(Rr(e.doc,Ze.from,Ze.to).join(Z));return}if(Re.getAttribute("contenteditable")=="false")return;var ht=/^(pre|div|p|li|table|br)$/i.test(Re.nodeName);if(!/^br$/i.test(Re.nodeName)&&Re.textContent.length==0)return;ht&&fe();for(var at=0;at<Re.childNodes.length;at++)Me(Re.childNodes[at]);/^(pre|p)$/i.test(Re.nodeName)&&(Q=!0),ht&&(W=!0)}else Re.nodeType==3&&ye(Re.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Me(t),t==n);)t=t.nextSibling,Q=!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(Ot(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(Ot(k),k.text.length),o)}var W=t.nodeType==3?t:null,Z=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,n&&(n=W.nodeValue.length));Z.parentNode!=r;)Z=Z.parentNode;var Q=e.measure,te=Q.maps;function fe(Ze,it,ht){for(var at=-1;at<(te?te.length:0);at++)for(var mt=at<0?Q.map:te[at],Tt=0;Tt<mt.length;Tt+=3){var Et=mt[Tt+2];if(Et==Ze||Et==it){var Pt=Ot(at<0?e.line:e.rest[at]),tr=mt[Tt]+ht;return(ht<0||Et!=Ze)&&(tr=mt[Tt+(ht?1:0)]),He(Pt,tr)}}}var ye=fe(W,Z,n);if(ye)return li(ye,o);for(var Me=Z.nextSibling,Re=W?W.nodeValue.length-n:0;Me;Me=Me.nextSibling){if(ye=fe(Me,Me.firstChild,0),ye)return li(He(ye.line,ye.ch-Re),o);Re+=Me.textContent.length}for(var We=Z.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 q,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),b&&(o.style.width="0px"),_e(o,"input",function(){H&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),_e(o,"paste",function(W){if(ze(r,W)||ws(W,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function k(W){if(ze(r,W))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Z=Ls(r);sa({lineWise:!0,text:Z.text}),W.type=="cut"?r.setSelections(Z.ranges,null,Se):(n.prevInput="",o.value=Z.text.join(`
|
|
`),z(o))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}_e(o,"cut",k),_e(o,"copy",k),_e(e.scroller,"paste",function(W){if(gn(e,W)||ze(r,W))return;if(!o.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Z=new Event("paste");Z.clipboardData=W.clipboardData,o.dispatchEvent(Z)}),_e(e.lineSpace,"selectstart",function(W){gn(e,W)||ne(W)}),_e(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"})}}),_e(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;d(n.cursorDiv,e.cursors),d(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&&z(this.textarea),H&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",H&&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||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||ft(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(H&&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,Z=Math.min(r.length,o.length);W<Z&&r.charCodeAt(W)==o.charCodeAt(W);)++W;return Hr(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(){H&&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=In(n,e),W=r.scroller.scrollTop;if(!k||f)return;var Z=n.options.resetSelectionOnContextMenu;Z&&n.doc.sel.contains(k)==-1&&vr(n,wr)(n.doc,Tn(k),Se);var Q=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: `+(H?"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=Re,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Me(){if(o.selectionStart!=null){var Xe=n.somethingSelected(),Ze="\u200B"+(Xe?o.value:"");o.value="\u21DA",o.value=Ze,t.prevInput=Xe?"":"\u200B",o.selectionStart=1,o.selectionEnd=Ze.length,r.selForContextMenu=n.doc.sel}}function Re(){if(t.contextMenuPending!=Re)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,o.style.cssText=Q,H&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),o.selectionStart!=null){(!H||H&&U<9)&&Me();var Xe=0,Ze=function(){r.selForContextMenu==n.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?vr(n,$o)(n):Xe++<10?r.detectingSelectAll=setTimeout(Ze,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ze,200)}}if(H&&U>=9&&Me(),R){ve(e);var We=function(){st(window,"mouseup",We),setTimeout(Re,20)};_e(window,"mouseup",We)}else setTimeout(Re,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=I();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Z.getValue()}var o;if(e.form&&(_e(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(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(st(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var Z=ir(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Z}function iu(e){e.off=st,e.on=_e,e.wheelEventPixels=dl,e.Doc=Ir,e.splitLines=wt,e.countColumn=$,e.findColumn=Te,e.isWordChar=be,e.Pass=Pe,e.signal=Be,e.Line=Pn,e.changeEnd=wn,e.scrollbarModel=wo,e.Pos=He,e.cmpPos=ut,e.modes=Ht,e.mimeModes=Rt,e.resolveMode=bt,e.getMode=Ct,e.modeExtensions=lt,e.extendMode=xt,e.copyState=Zt,e.startState=rr,e.innerMode=nr,e.commands=_i,e.keyMap=vn,e.keyName=ds,e.isModifierKey=us,e.lookupKey=ai,e.normalizeKeyMap=Ml,e.StringStream=kt,e.SharedTextMarker=Oi,e.TextMarker=Ln,e.LineWidget=Ri,e.e_preventDefault=ne,e.e_stopPropagation=ae,e.e_stop=ve,e.addClass=B,e.contains=D,e.rmClass=C,e.keyNames=Dn}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Ir.prototype)Ir.prototype.hasOwnProperty(ua)&&le(au,ua)<0&&(ir.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ir.prototype[ua]));return Ee(Ir),ir.inputStyles={textarea:ur,contenteditable:Qt},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),Ur.apply(this,arguments)},ir.defineMIME=Zr,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){Ir.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},Y1PL:function(vt,Le,ee){"use strict";ee.r(Le),ee.d(Le,"ResizableTextArea",function(){return le});var ue=ee("wx14"),J=ee("1OyB"),O=ee("vuIU"),X=ee("Ji7U"),F=ee("LK+K"),M=ee("q1tI"),H=ee("VTBJ"),U=ee("rePB"),P=ee("Zm9Q"),L=ee("Kwbf"),h=ee("c+Xe"),f=ee("m+aA"),T=ee("bdgK"),p=new Map;function m(Se){Se.forEach(function(ke){var Ae,Te=ke.target;(Ae=p.get(Te))===null||Ae===void 0||Ae.forEach(function(ge){return ge(Te)})})}var b=new T.default(m),a=null,i=null;function s(Se,ke){p.has(Se)||(p.set(Se,new Set),b.observe(Se)),p.get(Se).add(ke)}function u(Se,ke){p.has(Se)&&(p.get(Se).delete(ke),p.get(Se).size||(b.unobserve(Se),p.delete(Se)))}var y=function(Se){Object(X.a)(Ae,Se);var ke=Object(F.a)(Ae);function Ae(){return Object(J.a)(this,Ae),ke.apply(this,arguments)}return Object(O.a)(Ae,[{key:"render",value:function(){return this.props.children}}]),Ae}(M.Component),g=M.createContext(null);function v(Se){var ke=Se.children,Ae=Se.onBatchResize,Te=M.useRef(0),ge=M.useRef([]),he=M.useContext(g),re=M.useCallback(function(de,se,Oe){Te.current+=1;var ie=Te.current;ge.current.push({size:de,element:se,data:Oe}),Promise.resolve().then(function(){ie===Te.current&&(Ae==null||Ae(ge.current),ge.current=[])}),he==null||he(de,se,Oe)},[Ae,he]);return M.createElement(g.Provider,{value:re},ke)}function R(Se){var ke=Se.children,Ae=Se.disabled,Te=M.useRef(null),ge=M.useRef(null),he=M.useContext(g),re=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=M.isValidElement(ke)&&Object(h.c)(ke),se=de?ke.ref:null,Oe=M.useMemo(function(){return Object(h.a)(se,Te)},[se,Te]),ie=M.useRef(Se);ie.current=Se;var oe=M.useCallback(function(be){var De=ie.current,Ne=De.onResize,Fe=De.data,je=be.getBoundingClientRect(),Ue=je.width,rt=je.height,Qe=be.offsetWidth,qe=be.offsetHeight,Ye=Math.floor(Ue),nt=Math.floor(rt);if(re.current.width!==Ye||re.current.height!==nt||re.current.offsetWidth!==Qe||re.current.offsetHeight!==qe){var $e={width:Ye,height:nt,offsetWidth:Qe,offsetHeight:qe};re.current=$e;var et=Qe===Math.round(Ue)?Ue:Qe,_e=qe===Math.round(rt)?rt:qe,Je=Object(H.a)(Object(H.a)({},$e),{},{offsetWidth:et,offsetHeight:_e});he==null||he(Je,be,Fe),Ne&&Promise.resolve().then(function(){Ne(Je,be)})}},[]);return M.useEffect(function(){var be=Object(f.a)(Te.current)||Object(f.a)(ge.current);return be&&!Ae&&s(be,oe),function(){return u(be,oe)}},[Te.current,Ae]),M.createElement(y,{ref:ge},de?M.cloneElement(ke,{ref:Oe}):ke)}var w="rc-observer-key";function C(Se){var ke=Se.children,Ae=Object(P.a)(ke);return Ae.map(function(Te,ge){var he=(Te==null?void 0:Te.key)||"".concat(w,"-").concat(ge);return M.createElement(R,Object(ue.a)({},Se,{key:he}),Te)})}C.Collection=v;var x=C,d=ee("bT9E"),l=ee("TSYQ"),A=ee.n(l),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"],I={},B;function j(Se){var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ae=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(ke&&I[Ae])return I[Ae];var Te=window.getComputedStyle(Se),ge=Te.getPropertyValue("box-sizing")||Te.getPropertyValue("-moz-box-sizing")||Te.getPropertyValue("-webkit-box-sizing"),he=parseFloat(Te.getPropertyValue("padding-bottom"))+parseFloat(Te.getPropertyValue("padding-top")),re=parseFloat(Te.getPropertyValue("border-bottom-width"))+parseFloat(Te.getPropertyValue("border-top-width")),de=D.map(function(Oe){return"".concat(Oe,":").concat(Te.getPropertyValue(Oe))}).join(";"),se={sizingStyle:de,paddingSize:he,borderSize:re,boxSizing:ge};return ke&&Ae&&(I[Ae]=se),se}function z(Se){var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Te=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)),Se.getAttribute("wrap")?B.setAttribute("wrap",Se.getAttribute("wrap")):B.removeAttribute("wrap");var ge=j(Se,ke),he=ge.paddingSize,re=ge.borderSize,de=ge.boxSizing,se=ge.sizingStyle;B.setAttribute("style","".concat(se,";").concat(S)),B.value=Se.value||Se.placeholder||"";var Oe=Number.MIN_SAFE_INTEGER,ie=Number.MAX_SAFE_INTEGER,oe=B.scrollHeight,be;if(de==="border-box"?oe+=re:de==="content-box"&&(oe-=he),Ae!==null||Te!==null){B.value=" ";var De=B.scrollHeight-he;Ae!==null&&(Oe=De*Ae,de==="border-box"&&(Oe=Oe+he+re),oe=Math.max(Oe,oe)),Te!==null&&(ie=De*Te,de==="border-box"&&(ie=ie+he+re),be=oe>ie?"":"hidden",oe=Math.min(ie,oe))}return{height:oe,minHeight:Oe,maxHeight:ie,overflowY:be,resize:"none"}}var _=ee("Gytx"),N=ee.n(_),$;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})($||($={}));var q=function(Se){Object(X.a)(Ae,Se);var ke=Object(F.a)(Ae);function Ae(Te){var ge;return Object(J.a)(this,Ae),ge=ke.call(this,Te),ge.nextFrameActionId=void 0,ge.resizeFrameId=void 0,ge.textArea=void 0,ge.saveTextArea=function(he){ge.textArea=he},ge.handleResize=function(he){var re=ge.state.resizeStatus,de=ge.props,se=de.autoSize,Oe=de.onResize;if(re!==$.NONE)return;typeof Oe=="function"&&Oe(he),se&&ge.resizeOnNextFrame()},ge.resizeOnNextFrame=function(){cancelAnimationFrame(ge.nextFrameActionId),ge.nextFrameActionId=requestAnimationFrame(ge.resizeTextarea)},ge.resizeTextarea=function(){var he=ge.props.autoSize;if(!he||!ge.textArea)return;var re=he.minRows,de=he.maxRows,se=z(ge.textArea,!1,re,de);ge.setState({textareaStyles:se,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ge.resizeFrameId),ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:$.RESIZED},function(){ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:$.NONE}),ge.fixFirefoxAutoScroll()})})})})},ge.renderTextArea=function(){var he=ge.props,re=he.prefixCls,de=re===void 0?"rc-textarea":re,se=he.autoSize,Oe=he.onResize,ie=he.className,oe=he.disabled,be=ge.state,De=be.textareaStyles,Ne=be.resizeStatus,Fe=Object(d.a)(ge.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),je=A()(de,ie,Object(U.a)({},"".concat(de,"-disabled"),oe));"value"in Fe&&(Fe.value=Fe.value||"");var Ue=Object(H.a)(Object(H.a)(Object(H.a)({},ge.props.style),De),Ne===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(x,{onResize:ge.handleResize,disabled:!(se||Oe)},M.createElement("textarea",Object(ue.a)({},Fe,{className:je,style:Ue,ref:ge.saveTextArea})))},ge.state={textareaStyles:{},resizeStatus:$.NONE},ge}return Object(O.a)(Ae,[{key:"componentDidUpdate",value:function(ge){(ge.value!==this.props.value||!N()(ge.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 ge=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ge,he)}}catch(re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ae}(M.Component),le=q,pe=function(Se){Object(X.a)(Ae,Se);var ke=Object(F.a)(Ae);function Ae(Te){var ge;Object(J.a)(this,Ae),ge=ke.call(this,Te),ge.resizableTextArea=void 0,ge.focus=function(){ge.resizableTextArea.textArea.focus()},ge.saveTextArea=function(re){ge.resizableTextArea=re},ge.handleChange=function(re){var de=ge.props.onChange;ge.setValue(re.target.value,function(){ge.resizableTextArea.resizeTextarea()}),de&&de(re)},ge.handleKeyDown=function(re){var de=ge.props,se=de.onPressEnter,Oe=de.onKeyDown;re.keyCode===13&&se&&se(re),Oe&&Oe(re)};var he=typeof Te.value=="undefined"||Te.value===null?Te.defaultValue:Te.value;return ge.state={value:he},ge}return Object(O.a)(Ae,[{key:"setValue",value:function(ge,he){"value"in this.props||this.setState({value:ge},he)}},{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(ge){return"value"in ge?{value:ge.value}:null}}]),Ae}(M.Component),Pe=Le.default=pe},YiJy:function(vt,Le,ee){vt.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return x});var ue=ee("k1fw"),J=ee("oBTY"),O=ee("9og8"),X=ee("miYZ"),F=ee("tsqr"),M=ee("rAM+"),H=ee("tJVT"),U=ee("PpiC"),P=ee("WmNS"),L=ee.n(P),h=ee("q1tI"),f=ee.n(h),T=ee("bdgK");function p(d,l,A,S,D){var I=l.getWordUntilPosition(A),B={startLineNumber:A.lineNumber,endLineNumber:A.lineNumber,startColumn:I.startColumn,endColumn:I.endColumn},j=S.map(function(z){return{label:z,kind:d.languages.CompletionItemKind.Keyword,insertText:z,insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:B}});return D.map(function(z){j.push(Object(ue.a)(Object(ue.a)({},z),{},{range:B}))}),j}var m=function(d){var l={label:"ifelse",kind:d.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},A=["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"];d.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(B,j){var z=p(d,B,j,A,[l]);return{suggestions:z}}});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"];d.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(B,j){var z=[{label:"print",kind:d.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],_=p(d,B,j,S,z);return{suggestions:_}}});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"];d.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(B,j){var z=[l,{label:"main",kind:d.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:d.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],_=p(d,B,j,D,z);return{suggestions:_}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",a=ee("fjLI"),i=ee("LvDl"),s=ee("+ua5");function u(d){return/^\d+$/.test(d)?"".concat(d,"px"):d}function y(){}var g=!1,v={"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 d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=d;if(Array.isArray(d)){for(var A=0;A<d.length;A++){var S=v[d[A]];if(S)return S}return l[0]}return v[l]||l}var w=null,C=Le.b=function(d){var l=d.width,A=l===void 0?"100%":l,S=d.height,D=S===void 0?"100%":S,I=d.value,B=d.language,j=B===void 0?"javascript":B,z=d.style,_=z===void 0?{}:z,N=d.options,$=N===void 0?{}:N,q=d.overrideServices,le=q===void 0?{}:q,pe=d.theme,Pe=pe===void 0?"vs-dark":pe,Se=d.onEditBlur,ke=d.onSave,Ae=d.autoHeight,Te=Ae===void 0?!1:Ae,ge=d.forbidCopy,he=ge===void 0?!1:ge,re=d.onChange,de=re===void 0?y:re,se=d.editorDidMount,Oe=se===void 0?y:se,ie=d.onFocus,oe=ie===void 0?y:ie,be=d.onBreakPoint,De=be===void 0?y:be,Ne=d.breakPointValue,Fe=Ne===void 0?[]:Ne,je=d.filename,Ue=je===void 0?"educoder.txt":je,rt=d.errorLine,Qe=d.errorContent,qe=Qe===void 0?"":Qe,Ye=d.highlightLine,nt=d.openBreakPoint,$e=nt===void 0?!1:nt,et=Object(U.a)(d,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),_e=Object(h.useRef)(),Je=Object(h.useRef)({}),st=Object(h.useRef)(),Be=Object(h.useRef)(),ze=Object(h.useRef)([]),Ce=Object(h.useRef)(!1),me=Object(h.useRef)(),Ee=Object(h.useState)(!1),ne=Object(H.a)(Ee,2),ae=ne[0],ce=ne[1];function ve(){var Ct;return _e.current&&(Ct=new T.default(function(lt){var xt=Object(M.a)(lt),Zt;try{for(xt.s();!(Zt=xt.n()).done;){var nr=Zt.value;(nr.target.offsetHeight>0||nr.target.offsetWidth>0)&&Je.current.instance.layout()}}catch(rr){xt.e(rr)}finally{xt.f()}}),Ct.observe(_e.current)),Ct}function Ie(){F.b.warn({content:decodeURIComponent(b),key:"monaco-editor-tip"})}var we=function(){var lt=Je.current.instance;if(I!=null&<&&ae){var xt=lt.getModel();xt&&I!==xt.getValue()&&(g=!0,xt.setValue(I),lt.layout(),g=!1)}};Object(h.useEffect)(function(){try{var Ct,lt=Je.current.instance;Be.current&&clearTimeout(Be.current),Be.current=setTimeout(function(){we()},500),lt==null||((Ct=lt.updateOptions)===null||Ct===void 0)||Ct.call(lt,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(I.split(/\r\n|\r|\n/g).length))+3,5)})}catch(xt){debugger}},[I,ae,Je.current]),Object(h.useEffect)(function(){try{if(rt&&Je.current&&Je.current.instance){var Ct=Je.current.instance;Ct.changeViewZones(function(xt){var Zt=document.createElement("div");Zt.style.padding="10px 20px",Zt.style.width="calc(100% - 20px)",Zt.className="my-error-line-wrp",Zt.innerHTML=qe,xt.addZone({afterLineNumber:rt||11,heightInLines:3,domNode:Zt})});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}};Ct.addOverlayWidget(lt),Ct.revealPositionInCenter({lineNumber:20,column:1})}}catch(xt){debugger}},[rt,Je.current,ae]),Object(h.useEffect)(function(){var Ct;if((Ct=Je.current)!==null&&Ct!==void 0&&Ct.instance&&ae&&$e){var lt=Je.current.instance,xt=lt.getModel();if(!xt)return;var Zt=function(){var ut=[],Mt=[],Kt=xt.getAllDecorations(),Yt=Object(M.a)(Kt),qt;try{for(Yt.s();!(qt=Yt.n()).done;){var K=qt.value;if(K.options.className==="highlighted-line"){var c;ut.push(K==null||((c=K.range)===null||c===void 0)?void 0:c.startLineNumber),Mt.push(K==null?void 0:K.id)}}}catch(G){Yt.e(G)}finally{Yt.f()}xt.deltaDecorations(Mt,[]);var E=xt.getLineCount();!!Ye&&Ye<=E&&(lt.deltaDecorations([],[{range:new w.Range(Ye,1,Ye,xt.getLineMaxColumn(Ye)),options:{isWholeLine:!0,className:"highlighted-line"}}]),lt.revealLineInCenter(Ye))};Zt();var nr=function(){var ut=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Mt=[],Kt=[],Yt=xt.getAllDecorations(),qt=Object(M.a)(Yt),K;try{for(qt.s();!(K=qt.n()).done;){var c=K.value;if(c.options.linesDecorationsClassName==="breakpoints"){var E;Mt.push(c==null||((E=c.range)===null||E===void 0)?void 0:E.startLineNumber),Kt.push(c==null?void 0:c.id)}}}catch(G){qt.e(G)}finally{qt.f()}if(ut)return{lines:Mt,ids:Kt};De(Mt)},rr=function(){var He=Object(O.a)(L.a.mark(function ut(Mt){var Kt;return L.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return Kt={range:new w.Range(Mt,1,Mt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},qt.next=3,xt.deltaDecorations([],[Kt]);case 3:nr();case 4:case"end":return qt.stop()}},ut)}));return function(Mt){return He.apply(this,arguments)}}(),kt=function(){var He=Object(O.a)(L.a.mark(function ut(Mt){var Kt,Yt,qt,K,c;return L.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:Kt=[],Yt=lt.getLineDecorations(Mt),qt=Object(M.a)(Yt);try{for(qt.s();!(K=qt.n()).done;)c=K.value,c.options.linesDecorationsClassName==="breakpoints"&&Kt.push(c.id)}catch(Y){qt.e(Y)}finally{qt.f()}return G.next=6,xt.deltaDecorations(Kt,[]);case 6:nr();case 7:case"end":return G.stop()}},ut)}));return function(Mt){return He.apply(this,arguments)}}(),gt=function(ut){var Mt=lt.getLineDecorations(ut),Kt=Object(M.a)(Mt),Yt;try{for(Kt.s();!(Yt=Kt.n()).done;){var qt=Yt.value;if(qt.options.linesDecorationsClassName==="breakpoints")return!0}}catch(K){Kt.e(K)}finally{Kt.f()}return!1};if(!Object(i.isEqual)(Fe,nr(!0).lines)){xt.deltaDecorations(nr(!0).ids,[]);var Rr=Fe.map(function(He){return{range:new w.Range(He,1,He,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});xt.deltaDecorations([],Rr)}var tn=lt.onDidChangeModelContent(function(He){var ut=lt.getPosition();if(ut){var Mt=ut.lineNumber;xt.getLineContent(Mt).trim()===""?kt(Mt):gt(Mt)&&(kt(Mt),rr(Mt))}}),Tr=lt.onMouseDown(function(He){var ut,Mt,Kt;if(He.target.detail&&(ut=He.target)!==null&&ut!==void 0&&(Mt=ut.element)!==null&&Mt!==void 0&&(Kt=Mt.className)!==null&&Kt!==void 0&&Kt.includes("line-numbers")){var Yt=He.target.position.lineNumber;if(xt.getLineContent(Yt).trim()==="")return;gt(Yt)?kt(Yt):rr(Yt)}}),Ot=function(ut){var Mt={range:new w.Range(ut,1,ut,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ze.current=lt.deltaDecorations(ze.current,[Mt])},Lr=function(){ze.current=lt.deltaDecorations(ze.current,[])},zr=lt.onMouseMove(function(He){var ut,Mt,Kt;if(Lr(),He.target.detail&&(ut=He.target)!==null&&ut!==void 0&&(Mt=ut.element)!==null&&Mt!==void 0&&(Kt=Mt.className)!==null&&Kt!==void 0&&Kt.includes("line-numbers")){var Yt=He.target.position.lineNumber;if(xt.getLineContent(Yt).trim()==="")return;Ot(Yt)}}),rn=lt.onMouseLeave(function(){Lr()});return function(){tn.dispose(),Tr.dispose(),zr.dispose(),rn.dispose()}}},[Je.current,ae,Fe,Ye,$e]);function Ke(){var Ct=Je.current.instance;if(Ct){var lt=Ct.getSelection(),xt=Je.current.pastePos||{},Zt=new w.Range(xt.startLineNumber||lt.endLineNumber,xt.startColumn||lt.endColumn,xt.endLineNumber||lt.endLineNumber,xt.endColumn||lt.endColumn);setTimeout(function(){Ct.executeEdits("",[{range:Zt,text:""}])},300)}}function ot(Ct){(window.navigator.platform.match("Mac")?Ct.metaKey:Ct.ctrlKey)&&Ct.keyCode==83&&(Ct.preventDefault(),ke())}var ct=function(){if(Te&&Je.current.instance){var lt=Je.current.instance.getContentHeight();Zr(lt<D?D:lt)}else Zr(D)};function dt(Ct){var lt=document.createEvent("MouseEvents");lt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ct.dispatchEvent(lt)}var Lt=function(lt){var xt=lt.keyCode,Zt=lt.ctrlKey,nr=lt.metaKey,rr=lt.target,kt=lt.type;return(kt==="paste"||(xt===67||xt===86)&&(nr||Zt))&&rr.nodeName==="TEXTAREA"&&(Ie(),lt.preventDefault()),!1};function wt(Ct,lt){var xt=window.URL||window.webkitURL||window,Zt=new Blob([lt]),nr=document.createElementNS("http://www.w3.org/1999/xhtml","a");nr.href=xt.createObjectURL(Zt),nr.download=Ct,dt(nr)}Object(h.useEffect)(function(){ct()},[ct]),Object(h.useEffect)(function(){_e.current&&!ae&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(Ct){try{w=Ct,Je.current.instance=w.editor.create(_e.current,{value:I,language:R(j),theme:Pe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},le);var lt=Je.current.instance,xt=a.c._menuItems,Zt=Object(J.a)(xt).find(function(rr){return rr[0]._debugName=="EditorContext"});if(Oe(lt,w),setTimeout(function(){ct(),Je.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){wt(Ue||"educoder.txt",lt.getValue())}}),lt.getDomNode().addEventListener("input",function(){st.current.autoFormat&<.getAction("editor.action.formatDocument").run()})},500),Je.current.subscription=lt.onDidChangeModelContent(function(rr){debugger;Ce.current?clearTimeout(me.current):(ct(),de(lt.getValue(),rr)),me.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||m(w,R(j)),he&&(_e.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Lt),window.removeEventListener("paste",Lt),window.addEventListener("keydown",Lt),window.addEventListener("paste",Lt)),window.Monaco=w,Se&<.onDidBlurEditorWidget(function(){Se(lt.getValue())}),oe&<.onDidFocusEditorText(function(){oe(lt.getValue())}),he)try{window.addEventListener("paste",Ke)}catch(rr){}var nr=ve();return ce(!0),function(){var rr=Je.current.instance;rr.dispose();var kt=rr.getModel();kt&&kt.dispose(),Je.current.subscription&&Je.current.subscription.dispose(),he&&window.removeEventListener("paste",Ke),nr.unobserve(_e.current)}}catch(rr){debugger}})},[]),Object(h.useEffect)(function(){var Ct=Je.current.instance;if(Ct&&ae)return document.addEventListener("keydown",ot,!1),function(){document.removeEventListener("keydown",ot)}},[ke,ae]),Object(h.useEffect)(function(){var Ct=Je.current.instance;if(Ct&&ae){var lt=R(j);w.editor.setModelLanguage(Ct.getModel(),lt)}},[j,ae]),Object(h.useEffect)(function(){var Ct=Je.current.instance;Ct&&ae&&w.editor.setTheme(Pe)},[Pe,ae]),Object(h.useEffect)(function(){var Ct=Je.current.instance;st.current=$,Ct&&ae&&(Ct.updateOptions(Object(ue.a)({},$)),setTimeout(function(){Ct.getModel().updateOptions(Object(ue.a)({},$))},200))},[JSON.stringify($),ae]),Object(h.useEffect)(function(){var Ct=Je.current.instance;Ct&&ae&&Ct.layout()},[A,D,ae]);var ft=Object(h.useState)(u(A)),zt=Object(H.a)(ft,2),Ft=zt[0],Jt=zt[1],Ht=Object(h.useState)(u(D)),Rt=Object(H.a)(Ht,2),Ur=Rt[0],Zr=Rt[1],bt=Object(ue.a)(Object(ue.a)({},_),{},{width:Ft,height:Ur});return f.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:bt})};function x(d){var l=d.width,A=l===void 0?"100%":l,S=d.height,D=S===void 0?"100%":S,I=d.original,B=d.modified,j=d.language,z=d.options,_=z===void 0?{}:z,N=Object(h.useRef)(),$=Object(h.useState)(null),q=Object(H.a)($,2),le=q[0],pe=q[1];function Pe(Te){var ge;return N.current&&(ge=new T.default(function(he){var re=Object(M.a)(he),de;try{for(re.s();!(de=re.n()).done;){var se=de.value;(se.target.offsetHeight>0||se.target.offsetWidth>0)&&Te.layout()}}catch(Oe){re.e(Oe)}finally{re.f()}}),ge.observe(N.current)),ge}Object(h.useEffect)(function(){return N.current&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(Te){w=Te;var ge=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},_),{},{wordWrap:!0}));pe(ge);var he=Pe(ge);return function(){ge.dispose();var re=ge.getModel();re&&re.dispose(),he.unobserve(N.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(h.useEffect)(function(){le&&le.setModel({original:w.editor.createModel(I,j),modified:w.editor.createModel(B,j)})},[I,B,j,le]);var Se=u(A),ke=u(D),Ae={width:Se,height:ke};return f.a.createElement("div",{className:"my-diff-editor",ref:N,style:Ae})}},ZpRC:function(vt,Le,ee){"use strict";function ue(h){return typeof h=="object"&&h!=null&&h.nodeType===1}function J(h,f){return(!f||h!=="hidden")&&h!=="visible"&&h!=="clip"}function O(h,f){if(h.clientHeight<h.scrollHeight||h.clientWidth<h.scrollWidth){var T=getComputedStyle(h,null);return J(T.overflowY,f)||J(T.overflowX,f)||function(p){var m=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(a){return null}}(p);return!!m&&(m.clientHeight<p.scrollHeight||m.clientWidth<p.scrollWidth)}(h)}return!1}function X(h,f,T,p,m,b,a,i){return b<h&&a>f||b>h&&a<f?0:b<=h&&i<=T||a>=f&&i>=T?b-h-p:a>f&&i<T||b<h&&i>T?a-f+m:0}var F=function(h,f){var T=window,p=f.scrollMode,m=f.block,b=f.inline,a=f.boundary,i=f.skipOverflowHiddenElements,s=typeof a=="function"?a:function(De){return De!==a};if(!ue(h))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,y=[],g=h;ue(g)&&s(g);){if((g=g.parentElement)===u){y.push(g);break}g!=null&&g===document.body&&O(g)&&!O(document.documentElement)||g!=null&&O(g,i)&&y.push(g)}for(var v=T.visualViewport?T.visualViewport.width:innerWidth,R=T.visualViewport?T.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,C=window.scrollY||pageYOffset,x=h.getBoundingClientRect(),d=x.height,l=x.width,A=x.top,S=x.right,D=x.bottom,I=x.left,B=m==="start"||m==="nearest"?A:m==="end"?D:A+d/2,j=b==="center"?I+l/2:b==="end"?S:I,z=[],_=0;_<y.length;_++){var N=y[_],$=N.getBoundingClientRect(),q=$.height,le=$.width,pe=$.top,Pe=$.right,Se=$.bottom,ke=$.left;if(p==="if-needed"&&A>=0&&I>=0&&D<=R&&S<=v&&A>=pe&&D<=Se&&I>=ke&&S<=Pe)return z;var Ae=getComputedStyle(N),Te=parseInt(Ae.borderLeftWidth,10),ge=parseInt(Ae.borderTopWidth,10),he=parseInt(Ae.borderRightWidth,10),re=parseInt(Ae.borderBottomWidth,10),de=0,se=0,Oe="offsetWidth"in N?N.offsetWidth-N.clientWidth-Te-he:0,ie="offsetHeight"in N?N.offsetHeight-N.clientHeight-ge-re:0;if(u===N)de=m==="start"?B:m==="end"?B-R:m==="nearest"?X(C,C+R,R,ge,re,C+B,C+B+d,d):B-R/2,se=b==="start"?j:b==="center"?j-v/2:b==="end"?j-v:X(w,w+v,v,Te,he,w+j,w+j+l,l),de=Math.max(0,de+C),se=Math.max(0,se+w);else{de=m==="start"?B-pe-ge:m==="end"?B-Se+re+ie:m==="nearest"?X(pe,Se,q,ge,re+ie,B,B+d,d):B-(pe+q/2)+ie/2,se=b==="start"?j-ke-Te:b==="center"?j-(ke+le/2)+Oe/2:b==="end"?j-Pe+he+Oe:X(ke,Pe,le,Te,he+Oe,j,j+l,l);var oe=N.scrollLeft,be=N.scrollTop;B+=be-(de=Math.max(0,Math.min(be+de,N.scrollHeight-q+ie))),j+=oe-(se=Math.max(0,Math.min(oe+se,N.scrollWidth-le+Oe)))}z.push({el:N,top:de,left:se})}return z};function M(h){return h===Object(h)&&Object.keys(h).length!==0}function H(h,f){f===void 0&&(f="auto");var T="scrollBehavior"in document.body.style;h.forEach(function(p){var m=p.el,b=p.top,a=p.left;m.scroll&&T?m.scroll({top:b,left:a,behavior:f}):(m.scrollTop=b,m.scrollLeft=a)})}function U(h){return h===!1?{block:"end",inline:"nearest"}:M(h)?h:{block:"start",inline:"nearest"}}function P(h,f){var T=!h.ownerDocument.documentElement.contains(h);if(M(f)&&typeof f.behavior=="function")return f.behavior(T?[]:F(h,f));if(T)return;var p=U(f);return H(F(h,p),p.behavior)}var L=Le.a=P},Zss7:function(vt,Le,ee){var ue;(function(J){var O=/^\s+/,X=/\s+$/,F=0,M=J.round,H=J.min,U=J.max,P=J.random;function L(re,de){if(re=re||"",de=de||{},re instanceof L)return re;if(!(this instanceof L))return new L(re,de);var se=h(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=de.format||se.format,this._gradientType=de.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++}L.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(),de,se,Oe,ie,oe,be;return de=re.r/255,se=re.g/255,Oe=re.b/255,de<=.03928?ie=de/12.92:ie=J.pow((de+.055)/1.055,2.4),se<=.03928?oe=se/12.92:oe=J.pow((se+.055)/1.055,2.4),Oe<=.03928?be=Oe/12.92:be=J.pow((Oe+.055)/1.055,2.4),.2126*ie+.7152*oe+.0722*be},setAlpha:function(re){return this._a=z(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),de=M(re.h*360),se=M(re.s*100),Oe=M(re.v*100);return this._a==1?"hsv("+de+", "+se+"%, "+Oe+"%)":"hsva("+de+", "+se+"%, "+Oe+"%, "+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),de=M(re.h*360),se=M(re.s*100),Oe=M(re.l*100);return this._a==1?"hsl("+de+", "+se+"%, "+Oe+"%)":"hsla("+de+", "+se+"%, "+Oe+"%, "+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(_(this._r,255)*100)+"%",g:M(_(this._g,255)*100)+"%",b:M(_(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(_(this._r,255)*100)+"%, "+M(_(this._g,255)*100)+"%, "+M(_(this._b,255)*100)+"%)":"rgba("+M(_(this._r,255)*100)+"%, "+M(_(this._g,255)*100)+"%, "+M(_(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 de="#"+s(this._r,this._g,this._b,this._a),se=de,Oe=this._gradientType?"GradientType = 1, ":"";if(re){var ie=L(re);se="#"+s(ie._r,ie._g,ie._b,ie._a)}return"progid:DXImageTransform.Microsoft.gradient("+Oe+"startColorstr="+de+",endColorstr="+se+")"},toString:function(re){var de=!!re;re=re||this._format;var se=!1,Oe=this._a<1&&this._a>=0,ie=!de&&Oe&&(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 L(this.toString())},_applyModification:function(re,de){var se=re.apply(null,[this].concat([].slice.call(de)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(C,arguments)},_applyCombination:function(re,de){return re.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(D,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(l,arguments)}},L.fromRatio=function(re,de){if(typeof re=="object"){var se={};for(var Oe in re)re.hasOwnProperty(Oe)&&(Oe==="a"?se[Oe]=re[Oe]:se[Oe]=Pe(re[Oe]));re=se}return L(re,de)};function h(re){var de={r:0,g:0,b:0},se=1,Oe=null,ie=null,oe=null,be=!1,De=!1;return typeof re=="string"&&(re=ge(re)),typeof re=="object"&&(Te(re.r)&&Te(re.g)&&Te(re.b)?(de=f(re.r,re.g,re.b),be=!0,De=String(re.r).substr(-1)==="%"?"prgb":"rgb"):Te(re.h)&&Te(re.s)&&Te(re.v)?(Oe=Pe(re.s),ie=Pe(re.v),de=b(re.h,Oe,ie),be=!0,De="hsv"):Te(re.h)&&Te(re.s)&&Te(re.l)&&(Oe=Pe(re.s),oe=Pe(re.l),de=p(re.h,Oe,oe),be=!0,De="hsl"),re.hasOwnProperty("a")&&(se=re.a)),se=z(se),{ok:be,format:re.format||De,r:H(255,U(de.r,0)),g:H(255,U(de.g,0)),b:H(255,U(de.b,0)),a:se}}function f(re,de,se){return{r:_(re,255)*255,g:_(de,255)*255,b:_(se,255)*255}}function T(re,de,se){re=_(re,255),de=_(de,255),se=_(se,255);var Oe=U(re,de,se),ie=H(re,de,se),oe,be,De=(Oe+ie)/2;if(Oe==ie)oe=be=0;else{var Ne=Oe-ie;be=De>.5?Ne/(2-Oe-ie):Ne/(Oe+ie);switch(Oe){case re:oe=(de-se)/Ne+(de<se?6:0);break;case de:oe=(se-re)/Ne+2;break;case se:oe=(re-de)/Ne+4;break}oe/=6}return{h:oe,s:be,l:De}}function p(re,de,se){var Oe,ie,oe;re=_(re,360),de=_(de,100),se=_(se,100);function be(Fe,je,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?Fe+(je-Fe)*6*Ue:Ue<1/2?je:Ue<2/3?Fe+(je-Fe)*(2/3-Ue)*6:Fe}if(de===0)Oe=ie=oe=se;else{var De=se<.5?se*(1+de):se+de-se*de,Ne=2*se-De;Oe=be(Ne,De,re+1/3),ie=be(Ne,De,re),oe=be(Ne,De,re-1/3)}return{r:Oe*255,g:ie*255,b:oe*255}}function m(re,de,se){re=_(re,255),de=_(de,255),se=_(se,255);var Oe=U(re,de,se),ie=H(re,de,se),oe,be,De=Oe,Ne=Oe-ie;if(be=Oe===0?0:Ne/Oe,Oe==ie)oe=0;else{switch(Oe){case re:oe=(de-se)/Ne+(de<se?6:0);break;case de:oe=(se-re)/Ne+2;break;case se:oe=(re-de)/Ne+4;break}oe/=6}return{h:oe,s:be,v:De}}function b(re,de,se){re=_(re,360)*6,de=_(de,100),se=_(se,100);var Oe=J.floor(re),ie=re-Oe,oe=se*(1-de),be=se*(1-ie*de),De=se*(1-(1-ie)*de),Ne=Oe%6,Fe=[se,be,oe,oe,De,se][Ne],je=[De,se,se,be,oe,oe][Ne],Ue=[oe,oe,De,se,se,be][Ne];return{r:Fe*255,g:je*255,b:Ue*255}}function a(re,de,se,Oe){var ie=[pe(M(re).toString(16)),pe(M(de).toString(16)),pe(M(se).toString(16))];return Oe&&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,de,se,Oe,ie){var oe=[pe(M(re).toString(16)),pe(M(de).toString(16)),pe(M(se).toString(16)),pe(Se(Oe))];return ie&&oe[0].charAt(0)==oe[0].charAt(1)&&oe[1].charAt(0)==oe[1].charAt(1)&&oe[2].charAt(0)==oe[2].charAt(1)&&oe[3].charAt(0)==oe[3].charAt(1)?oe[0].charAt(0)+oe[1].charAt(0)+oe[2].charAt(0)+oe[3].charAt(0):oe.join("")}function s(re,de,se,Oe){var ie=[pe(Se(Oe)),pe(M(re).toString(16)),pe(M(de).toString(16)),pe(M(se).toString(16))];return ie.join("")}L.equals=function(re,de){return!re||!de?!1:L(re).toRgbString()==L(de).toRgbString()},L.random=function(){return L.fromRatio({r:P(),g:P(),b:P()})};function u(re,de){de=de===0?0:de||10;var se=L(re).toHsl();return se.s-=de/100,se.s=N(se.s),L(se)}function y(re,de){de=de===0?0:de||10;var se=L(re).toHsl();return se.s+=de/100,se.s=N(se.s),L(se)}function g(re){return L(re).desaturate(100)}function v(re,de){de=de===0?0:de||10;var se=L(re).toHsl();return se.l+=de/100,se.l=N(se.l),L(se)}function R(re,de){de=de===0?0:de||10;var se=L(re).toRgb();return se.r=U(0,H(255,se.r-M(255*-(de/100)))),se.g=U(0,H(255,se.g-M(255*-(de/100)))),se.b=U(0,H(255,se.b-M(255*-(de/100)))),L(se)}function w(re,de){de=de===0?0:de||10;var se=L(re).toHsl();return se.l-=de/100,se.l=N(se.l),L(se)}function C(re,de){var se=L(re).toHsl(),Oe=(se.h+de)%360;return se.h=Oe<0?360+Oe:Oe,L(se)}function x(re){var de=L(re).toHsl();return de.h=(de.h+180)%360,L(de)}function d(re){var de=L(re).toHsl(),se=de.h;return[L(re),L({h:(se+120)%360,s:de.s,l:de.l}),L({h:(se+240)%360,s:de.s,l:de.l})]}function l(re){var de=L(re).toHsl(),se=de.h;return[L(re),L({h:(se+90)%360,s:de.s,l:de.l}),L({h:(se+180)%360,s:de.s,l:de.l}),L({h:(se+270)%360,s:de.s,l:de.l})]}function A(re){var de=L(re).toHsl(),se=de.h;return[L(re),L({h:(se+72)%360,s:de.s,l:de.l}),L({h:(se+216)%360,s:de.s,l:de.l})]}function S(re,de,se){de=de||6,se=se||30;var Oe=L(re).toHsl(),ie=360/se,oe=[L(re)];for(Oe.h=(Oe.h-(ie*de>>1)+720)%360;--de;)Oe.h=(Oe.h+ie)%360,oe.push(L(Oe));return oe}function D(re,de){de=de||6;for(var se=L(re).toHsv(),Oe=se.h,ie=se.s,oe=se.v,be=[],De=1/de;de--;)be.push(L({h:Oe,s:ie,v:oe})),oe=(oe+De)%1;return be}L.mix=function(re,de,se){se=se===0?0:se||50;var Oe=L(re).toRgb(),ie=L(de).toRgb(),oe=se/100,be={r:(ie.r-Oe.r)*oe+Oe.r,g:(ie.g-Oe.g)*oe+Oe.g,b:(ie.b-Oe.b)*oe+Oe.b,a:(ie.a-Oe.a)*oe+Oe.a};return L(be)},L.readability=function(re,de){var se=L(re),Oe=L(de);return(J.max(se.getLuminance(),Oe.getLuminance())+.05)/(J.min(se.getLuminance(),Oe.getLuminance())+.05)},L.isReadable=function(re,de,se){var Oe=L.readability(re,de),ie,oe;oe=!1,ie=he(se);switch(ie.level+ie.size){case"AAsmall":case"AAAlarge":oe=Oe>=4.5;break;case"AAlarge":oe=Oe>=3;break;case"AAAsmall":oe=Oe>=7;break}return oe},L.mostReadable=function(re,de,se){var Oe=null,ie=0,oe,be,De,Ne;se=se||{},be=se.includeFallbackColors,De=se.level,Ne=se.size;for(var Fe=0;Fe<de.length;Fe++)oe=L.readability(re,de[Fe]),oe>ie&&(ie=oe,Oe=L(de[Fe]));return L.isReadable(re,Oe,{level:De,size:Ne})||!be?Oe:(se.includeFallbackColors=!1,L.mostReadable(re,["#fff","#000"],se))};var I=L.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=L.hexNames=j(I);function j(re){var de={};for(var se in re)re.hasOwnProperty(se)&&(de[re[se]]=se);return de}function z(re){return re=parseFloat(re),(isNaN(re)||re<0||re>1)&&(re=1),re}function _(re,de){q(re)&&(re="100%");var se=le(re);return re=H(de,U(0,parseFloat(re))),se&&(re=parseInt(re*de,10)/100),J.abs(re-de)<1e-6?1:re%de/parseFloat(de)}function N(re){return H(1,U(0,re))}function $(re){return parseInt(re,16)}function q(re){return typeof re=="string"&&re.indexOf(".")!=-1&&parseFloat(re)===1}function le(re){return typeof re=="string"&&re.indexOf("%")!=-1}function pe(re){return re.length==1?"0"+re:""+re}function Pe(re){return re<=1&&(re=re*100+"%"),re}function Se(re){return J.round(parseFloat(re)*255).toString(16)}function ke(re){return $(re)/255}var Ae=function(){var re="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",se="(?:"+de+")|(?:"+re+")",Oe="[\\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"+Oe),rgba:new RegExp("rgba"+ie),hsl:new RegExp("hsl"+Oe),hsla:new RegExp("hsla"+ie),hsv:new RegExp("hsv"+Oe),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 Te(re){return!!Ae.CSS_UNIT.exec(re)}function ge(re){re=re.replace(O,"").replace(X,"").toLowerCase();var de=!1;if(I[re])re=I[re],de=!0;else if(re=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Ae.rgb.exec(re))?{r:se[1],g:se[2],b:se[3]}:(se=Ae.rgba.exec(re))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Ae.hsl.exec(re))?{h:se[1],s:se[2],l:se[3]}:(se=Ae.hsla.exec(re))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Ae.hsv.exec(re))?{h:se[1],s:se[2],v:se[3]}:(se=Ae.hsva.exec(re))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Ae.hex8.exec(re))?{r:$(se[1]),g:$(se[2]),b:$(se[3]),a:ke(se[4]),format:de?"name":"hex8"}:(se=Ae.hex6.exec(re))?{r:$(se[1]),g:$(se[2]),b:$(se[3]),format:de?"name":"hex"}:(se=Ae.hex4.exec(re))?{r:$(se[1]+""+se[1]),g:$(se[2]+""+se[2]),b:$(se[3]+""+se[3]),a:ke(se[4]+""+se[4]),format:de?"name":"hex8"}:(se=Ae.hex3.exec(re))?{r:$(se[1]+""+se[1]),g:$(se[2]+""+se[2]),b:$(se[3]+""+se[3]),format:de?"name":"hex"}:!1}function he(re){var de,se;return re=re||{level:"AA",size:"small"},de=(re.level||"AA").toUpperCase(),se=(re.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:de,size:se}}vt.exports?vt.exports=L:!(ue=function(){return L}.call(Le,ee,Le,vt),ue!==void 0&&(vt.exports=ue))})(Math)},bT9E:function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return J});var ue=ee("VTBJ");function J(O,X){var F=Object(ue.a)({},O);return Array.isArray(X)&&X.forEach(function(M){delete F[M]}),F}},c5Ni:function(vt,Le,ee){},dejd:function(vt,Le,ee){},dmUQ:function(vt,Le,ee){"use strict";var ue=ee("Ff2n"),J=ee("rePB"),O=ee("1OyB"),X=ee("vuIU"),F=ee("Ji7U"),M=ee("md7G"),H=ee("foSv"),U=ee("q1tI"),P=ee.n(U),L=ee("TSYQ"),h=ee.n(L),f=ee("4IlW");function T(d,l){var A=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);l&&(S=S.filter(function(D){return Object.getOwnPropertyDescriptor(d,D).enumerable})),A.push.apply(A,S)}return A}function p(d){for(var l=1;l<arguments.length;l++){var A=arguments[l]!=null?arguments[l]:{};l%2?T(Object(A),!0).forEach(function(S){Object(J.a)(d,S,A[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(A)):T(Object(A)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(A,S))})}return d}function m(d){var l=b();return function(){var S=Object(H.a)(d),D;if(l){var I=Object(H.a)(this).constructor;D=Reflect.construct(S,arguments,I)}else D=S.apply(this,arguments);return Object(M.a)(this,D)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function a(){}function i(d){d.preventDefault()}var s=function(l){return l.replace(/[^\w.-]+/g,"")},u=200,y=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(l){return l!=null},R=function(l,A){return A===l||typeof A=="number"&&typeof l=="number"&&isNaN(A)&&isNaN(l)},w=function(d){Object(F.a)(A,d);var l=m(A);function A(S){var D;Object(O.a)(this,A),D=l.call(this,S),D.onKeyDown=function(j){var z=D.props,_=z.onKeyDown,N=z.onPressEnter;if(j.keyCode===f.a.UP){var $=D.getRatio(j);D.up(j,$,null),D.stop()}else if(j.keyCode===f.a.DOWN){var q=D.getRatio(j);D.down(j,q,null),D.stop()}else j.keyCode===f.a.ENTER&&N&&N(j);if(D.recordCursorPosition(),D.lastKeyCode=j.keyCode,_){for(var le=arguments.length,pe=new Array(le>1?le-1:0),Pe=1;Pe<le;Pe++)pe[Pe-1]=arguments[Pe];_.apply(void 0,[j].concat(pe))}},D.onKeyUp=function(j){var z=D.props.onKeyUp;if(D.stop(),D.recordCursorPosition(),z){for(var _=arguments.length,N=new Array(_>1?_-1:0),$=1;$<_;$++)N[$-1]=arguments[$];z.apply(void 0,[j].concat(N))}},D.onChange=function(j){var z=D.props.onChange;D.state.focused&&(D.inputting=!0),D.rawInput=D.props.parser(D.getValueFromEvent(j)),D.setState({inputValue:D.rawInput}),z(D.toNumber(D.rawInput))},D.onMouseUp=function(){var j=D.props.onMouseUp;D.recordCursorPosition(),j&&j.apply(void 0,arguments)},D.onFocus=function(){var j;D.setState({focused:!0}),(j=D.props).onFocus.apply(j,arguments)},D.onBlur=function(){var j=D.props.onBlur;D.inputting=!1,D.setState({focused:!1});var z=D.getCurrentValidValue(D.state.inputValue),_=D.setValue(z,a);if(j){var N=D.input.value,$=D.getInputDisplayValue({focus:!1,value:_});D.input.value=$&&Number($),j.apply(void 0,arguments),D.input.value=N}},D.getRatio=function(j){var z=1;return j.metaKey||j.ctrlKey?z=.1:j.shiftKey&&(z=10),z},D.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},D.getPrecision=function(j){if(v(D.props.precision))return D.props.precision;var z=String(j);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var _=0;return z.indexOf(".")>=0&&(_=z.length-z.indexOf(".")-1),_},D.getInputDisplayValue=function(j){var z=j||D.state,_=z.focused,N=z.inputValue,$=z.value,q;_?q=N:q=D.toPrecisionAsStep($),q==null&&(q="");var le=D.formatWrapper(q);return v(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(j){}},D.restoreByAfter=function(j){if(j===void 0)return!1;var z=D.input.value,_=z.lastIndexOf(j);if(_===-1)return!1;var N=D.cursorBefore.length;return D.lastKeyCode===f.a.DELETE&&D.cursorBefore.charAt(N-1)===j[0]?(D.fixCaret(N,N),!0):_+j.length===z.length?(D.fixCaret(_,_),!0):!1},D.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(z,_){var N=j.substring(_);return D.restoreByAfter(N)})},D.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},D.stop=function(){D.autoStepTimer&&clearTimeout(D.autoStepTimer)},D.down=function(j,z,_){D.pressingUpOrDown=!0,D.step("down",j,z,_)},D.up=function(j,z,_){D.pressingUpOrDown=!0,D.step("up",j,z,_)},D.saveInput=function(j){D.input=j};var I=S.value;I===void 0&&(I=S.defaultValue),D.state={focused:S.autoFocus};var B=D.getValidValue(D.toNumber(I));return D.state=p(p({},D.state),{},{inputValue:D.toPrecisionAsStep(B),value:B}),D}return Object(X.a)(A,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(D){var I=this.props,B=I.value,j=I.onChange,z=I.max,_=I.min,N=this.state.focused;if(D){if(!R(D.value,B)||!R(D.max,z)||!R(D.min,_)){var $=N?B:this.getValidValue(B),q;this.pressingUpOrDown?q=$:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep($),this.setState({value:$,inputValue:q})}var le="value"in this.props?B:this.state.value;"max"in this.props&&D.max!==z&&typeof le=="number"&&le>z&&j&&j(z),"min"in this.props&&D.min!==_&&typeof le=="number"&&le<_&&j&&j(_)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var pe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===f.a.BACKSPACE?pe=this.cursorStart-1:this.lastKeyCode===f.a.DELETE&&(pe=this.cursorStart):pe=this.input.value.length,this.fixCaret(pe,pe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case 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(Pe){}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 I=D;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(D){var I=D.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(D){var I=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,j=parseFloat(D);return isNaN(j)?D:(j<I&&(j=I),j>B&&(j=B),j)}},{key:"setValue",value:function(D,I){var B=this.props.precision,j=this.isNotCompleteNumber(parseFloat(D))?null:parseFloat(D),z=this.state.value,_=z===void 0?null:z,N=this.state.inputValue,$=N===void 0?null:N,q=typeof j=="number"?j.toFixed(B):"".concat(j),le=j!==_||q!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},I)):this.setState({value:j,inputValue:this.toPrecisionAsStep(D)},I),le&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(D){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,j=B.precision,z=B.step;if(v(j))return j;var _=this.getPrecision(I),N=this.getPrecision(z),$=this.getPrecision(D);return D?Math.max($,_+N):_+N}},{key:"getPrecisionFactor",value:function(D){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(D,I);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 I=Math.abs(this.getMaxPrecision(D));return isNaN(I)?D.toString():Number(D).toFixed(I)}},{key:"toNumber",value:function(D){var I=this.props.precision,B=this.state.focused,j=D&&D.length>16&&B;return this.isNotCompleteNumber(D)||j?D:v(I)?Math.round(D*Math.pow(10,I))/Math.pow(10,I):Number(D)}},{key:"upStep",value:function(D,I){var B=this.props.step,j=this.getPrecisionFactor(D,I),z=Math.abs(this.getMaxPrecision(D,I)),_=((j*D+j*B*I)/j).toFixed(z);return this.toNumber(_)}},{key:"downStep",value:function(D,I){var B=this.props.step,j=this.getPrecisionFactor(D,I),z=Math.abs(this.getMaxPrecision(D,I)),_=((j*D-j*B*I)/j).toFixed(z);return this.toNumber(_)}},{key:"step",value:function(D,I){var B=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var _=this.props;if(_.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var $=this["".concat(D,"Step")](N,j),q=$>_.max||$<_.min;if($>_.max?$=_.max:$<_.min&&($=_.min),this.setValue($,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){B[D](I,j,!0)},z?u:y)}},{key:"fixCaret",value:function(D,I){if(D===void 0||I===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,j=this.input.selectionEnd;(D!==B||I!==j)&&this.input.setSelectionRange(D,I)}catch(z){}}},{key:"render",value:function(){var D,I=this.props,B=I.prefixCls,j=I.disabled,z=I.readOnly,_=I.useTouch,N=I.autoComplete,$=I.upHandler,q=I.downHandler,le=I.className,pe=I.max,Pe=I.min,Se=I.style,ke=I.title,Ae=I.onMouseEnter,Te=I.onMouseLeave,ge=I.onMouseOver,he=I.onMouseOut,re=I.required,de=I.onClick,se=I.tabIndex,Oe=I.type,ie=I.placeholder,oe=I.id,be=I.inputMode,De=I.pattern,Ne=I.step,Fe=I.maxLength,je=I.autoFocus,Ue=I.name,rt=I.onPaste,Qe=I.onInput,qe=Object(ue.a)(I,["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,nt=Ye.value,$e=Ye.focused,et=h()(B,(D={},Object(J.a)(D,le,!!le),Object(J.a)(D,"".concat(B,"-disabled"),j),Object(J.a)(D,"".concat(B,"-focused"),$e),D)),_e={};Object.keys(qe).forEach(function(ve){(ve.substr(0,5)==="data-"||ve.substr(0,5)==="aria-"||ve==="role")&&(_e[ve]=qe[ve])});var Je=!z&&!j,st=this.getInputDisplayValue(null),Be=(nt||nt===0)&&(isNaN(nt)||Number(nt)>=pe),ze=(nt||nt===0)&&(isNaN(nt)||Number(nt)<=Pe),Ce=Be||j||z,me=ze||j||z,Ee=h()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(J.a)({},"".concat(B,"-handler-up-disabled"),Ce)),ne=h()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(J.a)({},"".concat(B,"-handler-down-disabled"),me)),ae=_?{onTouchStart:Ce?a:this.up,onTouchEnd:this.stop}:{onMouseDown:Ce?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ce=_?{onTouchStart:me?a:this.down,onTouchEnd:this.stop}:{onMouseDown:me?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:et,style:Se,title:ke,onMouseEnter:Ae,onMouseLeave:Te,onMouseOver:ge,onMouseOut:he,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"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":Ce,className:Ee}),$||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":me,className:ne}),q||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":Pe,"aria-valuemax":pe,"aria-valuenow":nt,required:re,type:Oe,placeholder:ie,onPaste:rt,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:se,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Je?this.onKeyDown:a,onKeyUp:Je?this.onKeyUp:a,autoFocus:je,maxLength:Fe,readOnly:z,disabled:j,max:pe,min:Pe,step:Ne,name:Ue,title:ke,id:oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(st),pattern:De,inputMode:be,onInput:Qe},_e))))}}]),A}(P.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:s,required:!1,autoComplete:"off"};var C=w,x=Le.a=C},fjLI:function(vt,Le,ee){"use strict";ee.d(Le,"e",function(){return L}),ee.d(Le,"a",function(){return h}),ee.d(Le,"c",function(){return f}),ee.d(Le,"d",function(){return p}),ee.d(Le,"b",function(){return m});var ue=ee("8HAY"),J=ee("Cg/j"),O=ee("T8No"),X=ee("nnTU"),F=ee("MI8n"),M=function(){var b=function(a,i){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var y in u)u.hasOwnProperty(y)&&(s[y]=u[y])},b(a,i)};return function(a,i){b(a,i);function s(){this.constructor=a}a.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),H=function(b,a,i,s){var u=arguments.length,y=u<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,i):s,g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(b,a,i,s);else for(var v=b.length-1;v>=0;v--)(g=b[v])&&(y=(u<3?g(y):u>3?g(a,i,y):g(a,i))||y);return u>3&&y&&Object.defineProperty(a,i,y),y},U=function(b,a){return function(i,s){a(i,s,b)}},P=function(){for(var b=0,a=0,i=arguments.length;a<i;a++)b+=arguments[a].length;for(var s=Array(b),u=0,a=0;a<i;a++)for(var y=arguments[a],g=0,v=y.length;g<v;g++,u++)s[u]=y[g];return s};function L(b){return b.command!==void 0}var h=Object(J.c)("menuService"),f=new(function(){function b(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new F.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return b.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)}}},b.prototype.getCommand=function(a){return this._commands.get(a)},b.prototype.getCommands=function(){var a=new Map;return this._commands.forEach(function(i,s){return a.set(s,i)}),a},b.prototype.appendMenuItem=function(a,i){var s=this,u=this._menuItems.get(a);return u?u.push(i):(u=[i],this._menuItems.set(a,u)),this._onDidChangeMenu.fire(a),{dispose:function(){var y=u.indexOf(i);y>=0&&(u.splice(y,1),s._onDidChangeMenu.fire(a))}}},b.prototype.getMenuItems=function(a){var i=(this._menuItems.get(a)||[]).slice(0);return a===0&&this._appendImplicitItems(i),i},b.prototype._appendImplicitItems=function(a){for(var i=new Set,s=a.filter(function(w){return L(w)}),u=0,y=s;u<y.length;u++){var g=y[u],v=g.command,R=g.alt;i.add(v.id),R&&i.add(R.id)}this._commands.forEach(function(w,C){i.has(C)||a.push({command:w})})},b}()),T=function(b){M(a,b);function a(i,s,u){var y=b.call(this,i,s)||this;return y._commandService=u,y}return a.prototype.run=function(){for(var i,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return(i=this._commandService).executeCommand.apply(i,P([this.id],s))},a=H([U(2,X.b)],a),a}(ue.a),p=function(b){M(a,b);function a(i){var s=this;return typeof i.title=="string"?s=b.call(this,"",i.title,"submenu")||this:s=b.call(this,"",i.title.value,"submenu")||this,s.item=i,s}return a}(ue.a),m=function(b){M(a,b);function a(i,s,u,y,g){var v=this;return typeof i.title=="string"?v=b.call(this,i.id,i.title,g)||this:v=b.call(this,i.id,i.title.value,g)||this,v._cssClass=void 0,v._enabled=!i.precondition||y.contextMatchesRules(i.precondition),v._checked=Boolean(i.toggled&&y.contextMatchesRules(i.toggled)),v._options=u||{},v.item=i,v.alt=s?new a(s,void 0,v._options,y,g):void 0,v}return a.prototype.dispose=function(){this.alt&&this.alt.dispose(),b.prototype.dispose.call(this)},a.prototype.run=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var u=[];return this._options.arg&&(u=P(u,[this._options.arg])),this._options.shouldForwardArgs&&(u=P(u,i)),b.prototype.run.apply(this,u)},a=H([U(3,O.c),U(4,X.b)],a),a}(T)},h78n:function(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return D});var ue=ee("q1tI"),J=ee.n(ue),O=ee("TSYQ"),X=ee.n(O),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(j){var z=j.map(function(){return Object(ue.useRef)()}),_=Object(ue.useRef)();return Object(ue.useEffect)(function(){var N=Date.now(),$=!1;Object.keys(z).forEach(function(q){var le=z[q].current;if(!le)return;$=!0;var pe=le.style;pe.transitionDuration=".3s, .3s, .3s, .06s",_.current&&N-_.current<100&&(pe.transitionDuration="0s, 0s")}),$&&(_.current=Date.now())}),[z]};function H(){return H=Object.assign||function(B){for(var j=1;j<arguments.length;j++){var z=arguments[j];for(var _ in z)Object.prototype.hasOwnProperty.call(z,_)&&(B[_]=z[_])}return B},H.apply(this,arguments)}function U(B,j){return T(B)||f(B,j)||L(B,j)||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 L(B,j){if(!B)return;if(typeof B=="string")return h(B,j);var z=Object.prototype.toString.call(B).slice(8,-1);if(z==="Object"&&B.constructor&&(z=B.constructor.name),z==="Map"||z==="Set")return Array.from(B);if(z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(z))return h(B,j)}function h(B,j){(j==null||j>B.length)&&(j=B.length);for(var z=0,_=new Array(j);z<j;z++)_[z]=B[z];return _}function f(B,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var z=[],_=!0,N=!1,$=void 0;try{for(var q=B[Symbol.iterator](),le;!(_=(le=q.next()).done)&&!(z.push(le.value),j&&z.length===j);_=!0);}catch(pe){N=!0,$=pe}finally{try{!_&&q.return!=null&&q.return()}finally{if(N)throw $}}return z}function T(B){if(Array.isArray(B))return B}function p(B,j){if(B==null)return{};var z=m(B,j),_,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(B);for(N=0;N<$.length;N++){if(_=$[N],j.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,_))continue;z[_]=B[_]}}return z}function m(B,j){if(B==null)return{};var z={},_=Object.keys(B),N,$;for($=0;$<_.length;$++){if(N=_[$],j.indexOf(N)>=0)continue;z[N]=B[N]}return z}var b=function(j){var z=j.className,_=j.percent,N=j.prefixCls,$=j.strokeColor,q=j.strokeLinecap,le=j.strokeWidth,pe=j.style,Pe=j.trailColor,Se=j.trailWidth,ke=j.transition,Ae=p(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ae.gapPosition;var Te=Array.isArray(_)?_:[_],ge=Array.isArray($)?$:[$],he=M(Te),re=U(he,1),de=re[0],se=le/2,Oe=100-le/2,ie="M ".concat(q==="round"?se:0,",").concat(se,`
|
|
L `).concat(q==="round"?Oe:100,",").concat(se),oe="0 0 100 ".concat(le),be=0;return J.a.createElement("svg",H({className:X()("".concat(N,"-line"),z),viewBox:oe,preserveAspectRatio:"none",style:pe},Ae),J.a.createElement("path",{className:"".concat(N,"-line-trail"),d:ie,strokeLinecap:q,stroke:Pe,strokeWidth:Se||le,fillOpacity:"0"}),Te.map(function(De,Ne){var Fe={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:ke||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},je=ge[Ne]||ge[ge.length-1];return be+=De,J.a.createElement("path",{key:Ne,className:"".concat(N,"-line-path"),d:ie,strokeLinecap:q,stroke:je,strokeWidth:le,fillOpacity:"0",ref:de[Ne],style:Fe})}))};b.defaultProps=F;var a=b;function i(){return i=Object.assign||function(B){for(var j=1;j<arguments.length;j++){var z=arguments[j];for(var _ in z)Object.prototype.hasOwnProperty.call(z,_)&&(B[_]=z[_])}return B},i.apply(this,arguments)}function s(B,j){return R(B)||v(B,j)||y(B,j)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(B,j){if(!B)return;if(typeof B=="string")return g(B,j);var z=Object.prototype.toString.call(B).slice(8,-1);if(z==="Object"&&B.constructor&&(z=B.constructor.name),z==="Map"||z==="Set")return Array.from(B);if(z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(z))return g(B,j)}function g(B,j){(j==null||j>B.length)&&(j=B.length);for(var z=0,_=new Array(j);z<j;z++)_[z]=B[z];return _}function v(B,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var z=[],_=!0,N=!1,$=void 0;try{for(var q=B[Symbol.iterator](),le;!(_=(le=q.next()).done)&&!(z.push(le.value),j&&z.length===j);_=!0);}catch(pe){N=!0,$=pe}finally{try{!_&&q.return!=null&&q.return()}finally{if(N)throw $}}return z}function R(B){if(Array.isArray(B))return B}function w(B,j){if(B==null)return{};var z=C(B,j),_,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(B);for(N=0;N<$.length;N++){if(_=$[N],j.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,_))continue;z[_]=B[_]}}return z}function C(B,j){if(B==null)return{};var z={},_=Object.keys(B),N,$;for($=0;$<_.length;$++){if(N=_[$],j.indexOf(N)>=0)continue;z[N]=B[N]}return z}var x=0;function d(B){return+B.replace("%","")}function l(B){return Array.isArray(B)?B:[B]}function A(B,j,z,_){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,q=50-_/2,le=0,pe=-q,Pe=0,Se=-2*q;switch($){case"left":le=-q,pe=0,Pe=2*q,Se=0;break;case"right":le=q,pe=0,Pe=-2*q,Se=0;break;case"bottom":pe=q,Se=2*q;break;default:}var ke="M 50,50 m ".concat(le,",").concat(pe,`
|
|
a `).concat(q,",").concat(q," 0 1 1 ").concat(Pe,",").concat(-Se,`
|
|
a `).concat(q,",").concat(q," 0 1 1 ").concat(-Pe,",").concat(Se),Ae=Math.PI*2*q,Te={stroke:z,strokeDasharray:"".concat(j/100*(Ae-N),"px ").concat(Ae,"px"),strokeDashoffset:"-".concat(N/2+B/100*(Ae-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ke,pathStyle:Te}}var S=function(j){var z=j.prefixCls,_=j.strokeWidth,N=j.trailWidth,$=j.gapDegree,q=j.gapPosition,le=j.trailColor,pe=j.strokeLinecap,Pe=j.style,Se=j.className,ke=j.strokeColor,Ae=j.percent,Te=w(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ge=Object(ue.useMemo)(function(){return x+=1,x},[]),he=A(0,100,le,_,$,q),re=he.pathString,de=he.pathStyle,se=l(Ae),Oe=l(ke),ie=Oe.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),oe=M(se),be=s(oe,1),De=be[0],Ne=function(){var je=0;return se.map(function(Ue,rt){var Qe=Oe[rt]||Oe[Oe.length-1],qe=Object.prototype.toString.call(Qe)==="[object Object]"?"url(#".concat(z,"-gradient-").concat(ge,")"):"",Ye=A(je,Ue,Qe,_,$,q);return je+=Ue,J.a.createElement("path",{key:rt,className:"".concat(z,"-circle-path"),d:Ye.pathString,stroke:qe,strokeLinecap:pe,strokeWidth:_,opacity:Ue===0?0:1,fillOpacity:"0",style:Ye.pathStyle,ref:De[rt]})})};return J.a.createElement("svg",i({className:X()("".concat(z,"-circle"),Se),viewBox:"0 0 100 100",style:Pe},Te),ie&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(z,"-gradient-").concat(ge),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ie).sort(function(Fe,je){return d(Fe)-d(je)}).map(function(Fe,je){return J.a.createElement("stop",{key:je,offset:Fe,stopColor:ie[Fe]})}))),J.a.createElement("path",{className:"".concat(z,"-circle-trail"),d:re,stroke:le,strokeLinecap:pe,strokeWidth:N||_,fillOpacity:"0",style:de}),Ne().reverse())};S.defaultProps=F;var D=S,I={Line:a,Circle:D}},kSUc:function(vt,Le,ee){},lZu9:function(vt,Le,ee){(function(ue){ue(ee("VrN/"),ee("1eCo"),ee("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(J,O){var X=ue.getMode(J,"text/html"),F=X.name=="null";function M(_){if(ue.findModeByName){var N=ue.findModeByName(_);N&&(_=N.mime||N.mimes[0])}var $=ue.getMode(J,_);return $.name=="null"?null:$}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 H={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 H)H.hasOwnProperty(U)&&O.tokenTypeOverrides[U]&&(H[U]=O.tokenTypeOverrides[U]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,h=/^\[(x| )\](?=\s)/i,f=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,T=/^ {0,3}(?:\={1,}|-{2,})\s*$/,p=/^[^#!\[\]*_\\<>` "'(~:]+/,m=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\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(_,N,$){return N.f=N.inline=$,$(_,N)}function u(_,N,$){return N.f=N.block=$,$(_,N)}function y(_){return!_||!/\S/.test(_.string)}function g(_){if(_.linkTitle=!1,_.linkHref=!1,_.linkText=!1,_.em=!1,_.strong=!1,_.strikethrough=!1,_.quote=0,_.indentedCode=!1,_.f==R){var N=F;if(!N){var $=ue.innerMode(X,_.htmlState);N=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}N&&(_.f=d,_.block=v,_.htmlState=null)}return _.trailingSpace=0,_.trailingSpaceNewLine=!1,_.prevLine=_.thisLine,_.thisLine={stream:null},null}function v(_,N){var $=_.column()===N.indentation,q=y(N.prevLine.stream),le=N.indentedCode,pe=N.prevLine.hr,Pe=N.list!==!1,Se=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var ke=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Pe)){for(N.list=null;ke<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=ke-N.listStack[N.listStack.length-1])}var Ae=!q&&!pe&&!N.prevLine.header&&(!Pe||!le)&&!N.prevLine.fencedCodeEnd,Te=(N.list===!1||pe||q)&&N.indentation<=Se&&_.match(P),ge=null;if(N.indentationDiff>=4&&(le||N.prevLine.fencedCodeEnd||N.prevLine.header||q))return _.skipToEnd(),N.indentedCode=!0,H.code;if(_.eatSpace())return null;if($&&N.indentation<=Se&&(ge=_.match(f))&&ge[1].length<=6)return N.quote=0,N.header=ge[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,C(N);if(N.indentation<=Se&&_.eat(">"))return N.quote=$?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),_.eatSpace(),C(N);if(!Te&&!N.setext&&$&&N.indentation<=Se&&(ge=_.match(L))){var he=ge[1]?"ol":"ul";return N.indentation=ke+_.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&&_.match(h,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+he]),C(N)}else{if($&&N.indentation<=Se&&(ge=_.match(m,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ge[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&M(ge[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,C(N);if(N.setext||(!Ae||!Pe)&&!N.quote&&N.list===!1&&!N.code&&!Te&&!b.test(_.string)&&(ge=_.lookAhead(1))&&(ge=ge.match(T)))return N.setext?(N.header=N.setext,N.setext=0,_.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=ge[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,C(N);if(Te)return _.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,H.hr;if(_.peek()==="[")return s(_,N,I)}return s(_,N,N.inline)}function R(_,N){var $=X.token(_,N.htmlState);if(!F){var q=ue.innerMode(X,N.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||N.md_inside&&_.current().indexOf(">")>-1)&&(N.f=d,N.block=v,N.htmlState=null)}return $}function w(_,N){var $=N.listStack[N.listStack.length-1]||0,q=N.indentation<$,le=$+3;if(N.fencedEndRE&&N.indentation<=le&&(q||_.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var pe;return q||(pe=C(N)),N.localMode=N.localState=null,N.block=v,N.f=d,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,q?u(_,N,N.block):pe}else return N.localMode?N.localMode.token(_,N.localState):(_.skipToEnd(),H.code)}function C(_){var N=[];if(_.formatting){N.push(H.formatting),typeof _.formatting=="string"&&(_.formatting=[_.formatting]);for(var $=0;$<_.formatting.length;$++)N.push(H.formatting+"-"+_.formatting[$]),_.formatting[$]==="header"&&N.push(H.formatting+"-"+_.formatting[$]+"-"+_.header),_.formatting[$]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=_.quote?N.push(H.formatting+"-"+_.formatting[$]+"-"+_.quote):N.push("error"))}if(_.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(_.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(_.linkHref?N.push(H.linkHref,"url"):(_.strong&&N.push(H.strong),_.em&&N.push(H.em),_.strikethrough&&N.push(H.strikethrough),_.emoji&&N.push(H.emoji),_.linkText&&N.push(H.linkText),_.code&&N.push(H.code),_.image&&N.push(H.image),_.imageAltText&&N.push(H.imageAltText,"link"),_.imageMarker&&N.push(H.imageMarker)),_.header&&N.push(H.header,H.header+"-"+_.header),_.quote&&(N.push(H.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=_.quote?N.push(H.quote+"-"+_.quote):N.push(H.quote+"-"+O.maxBlockquoteDepth)),_.list!==!1){var q=(_.listStack.length-1)%3;q?q===1?N.push(H.list2):N.push(H.list3):N.push(H.list1)}return _.trailingSpaceNewLine?N.push("trailing-space-new-line"):_.trailingSpace&&N.push("trailing-space-"+(_.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function x(_,N){return _.match(p,!0)?C(N):void 0}function d(_,N){var $=N.text(_,N);if(typeof $!="undefined")return $;if(N.list)return N.list=null,C(N);if(N.taskList){var q=_.match(h,!0)[1]===" ";return q?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,C(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&_.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),C(N);var le=_.next();if(N.linkTitle){N.linkTitle=!1;var pe=le;le==="("&&(pe=")"),pe=(pe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Pe="^\\s*(?:[^"+pe+"\\\\]+|\\\\\\\\|\\\\.)"+pe;if(_.match(new RegExp(Pe),!0))return H.linkHref}if(le==="`"){var Se=N.formatting;O.highlightFormatting&&(N.formatting="code"),_.eatWhile("`");var ke=_.current().length;if(N.code==0&&(!N.quote||ke==1))return N.code=ke,C(N);if(ke==N.code){var Ae=C(N);return N.code=0,Ae}else return N.formatting=Se,C(N)}else if(N.code)return C(N);if(le==="\\"&&(_.next(),O.highlightFormatting)){var Te=C(N),ge=H.formatting+"-escape";return Te?Te+" "+ge:ge}if(le==="!"&&_.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),C(N);if(le==="["&&N.imageMarker&&_.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),C(N);if(le==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var Te=C(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=A,Te}if(le==="["&&!N.image)return N.linkText&&_.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),C(N);if(le==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var Te=C(N);return N.linkText=!1,N.inline=N.f=_.match(/\(.*?\)| ?\[.*?\]/,!1)?A:d,Te}if(le==="<"&&_.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=l,O.highlightFormatting&&(N.formatting="link");var Te=C(N);return Te?Te+=" ":Te="",Te+H.linkInline}if(le==="<"&&_.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=l,O.highlightFormatting&&(N.formatting="link");var Te=C(N);return Te?Te+=" ":Te="",Te+H.linkEmail}if(O.xml&&le==="<"&&_.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=_.string.indexOf(">",_.pos);if(he!=-1){var re=_.string.substring(_.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(N.md_inside=!0)}return _.backUp(1),N.htmlState=ue.startState(X),u(_,N,R)}if(O.xml&&le==="<"&&_.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(le==="*"||le==="_"){for(var de=1,se=_.pos==1?" ":_.string.charAt(_.pos-2);de<3&&_.eat(le);)de++;var Oe=_.peek()||" ",ie=!/\s/.test(Oe)&&(!a.test(Oe)||/\s/.test(se)||a.test(se)),oe=!/\s/.test(se)&&(!a.test(se)||/\s/.test(Oe)||a.test(Oe)),be=null,De=null;if(de%2&&(!N.em&&ie&&(le==="*"||!oe||a.test(se))?be=!0:N.em==le&&oe&&(le==="*"||!ie||a.test(Oe))&&(be=!1)),de>1&&(!N.strong&&ie&&(le==="*"||!oe||a.test(se))?De=!0:N.strong==le&&oe&&(le==="*"||!ie||a.test(Oe))&&(De=!1)),De!=null||be!=null){O.highlightFormatting&&(N.formatting=be==null?"strong":De==null?"em":"strong em"),be===!0&&(N.em=le),De===!0&&(N.strong=le);var Ae=C(N);return be===!1&&(N.em=!1),De===!1&&(N.strong=!1),Ae}}else if(le===" "&&(_.eat("*")||_.eat("_"))){if(_.peek()===" ")return C(N);_.backUp(1)}if(O.strikethrough){if(le==="~"&&_.eatWhile(le)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var Ae=C(N);return N.strikethrough=!1,Ae}else if(_.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),C(N)}else if(le===" "&&_.match(/^~~/,!0)){if(_.peek()===" ")return C(N);_.backUp(2)}}if(O.emoji&&le===":"&&_.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var Ne=C(N);return N.emoji=!1,Ne}return le===" "&&(_.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),C(N)}function l(_,N){var $=_.next();if($===">"){N.f=N.inline=d,O.highlightFormatting&&(N.formatting="link");var q=C(N);return q?q+=" ":q="",q+H.linkInline}return _.match(/^[^>]+/,!0),H.linkInline}function A(_,N){if(_.eatSpace())return null;var $=_.next();return $==="("||$==="["?(N.f=N.inline=D($==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,C(N)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function D(_){return function(N,$){var q=N.next();if(q===_){$.f=$.inline=d,O.highlightFormatting&&($.formatting="link-string");var le=C($);return $.linkHref=!1,le}return N.match(S[_]),$.linkHref=!0,C($)}}function I(_,N){return _.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=B,_.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,C(N)):s(_,N,d)}function B(_,N){if(_.match(/^\]:/,!0)){N.f=N.inline=j,O.highlightFormatting&&(N.formatting="link");var $=C(N);return N.linkText=!1,$}return _.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function j(_,N){return _.eatSpace()?null:(_.match(/^[^\s]+/,!0),_.peek()===void 0?N.linkTitle=!0:_.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=d,H.linkHref+" url")}var z={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:d,text:x,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(_){return{f:_.f,prevLine:_.prevLine,thisLine:_.thisLine,block:_.block,htmlState:_.htmlState&&ue.copyState(X,_.htmlState),indentation:_.indentation,localMode:_.localMode,localState:_.localMode?ue.copyState(_.localMode,_.localState):null,inline:_.inline,text:_.text,formatting:!1,linkText:_.linkText,linkTitle:_.linkTitle,linkHref:_.linkHref,code:_.code,em:_.em,strong:_.strong,strikethrough:_.strikethrough,emoji:_.emoji,header:_.header,setext:_.setext,hr:_.hr,taskList:_.taskList,list:_.list,listStack:_.listStack.slice(0),quote:_.quote,indentedCode:_.indentedCode,trailingSpace:_.trailingSpace,trailingSpaceNewLine:_.trailingSpaceNewLine,md_inside:_.md_inside,fencedEndRE:_.fencedEndRE}},token:function(_,N){if(N.formatting=!1,_!=N.thisLine.stream){if(N.header=0,N.hr=!1,_.match(/^\s*$/,!0))return g(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:_},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=R)){var $=_.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(N.indentation=$,N.indentationDiff=null,$>0)return null}}return N.f(_,N)},innerMode:function(_){return _.block==R?{state:_.htmlState,mode:X}:_.localState?{state:_.localState,mode:_.localMode}:{state:_,mode:z}},indent:function(_,N,$){return _.block==R&&X.indent?X.indent(_.htmlState,N,$):_.localState&&_.localMode.indent?_.localMode.indent(_.localState,N,$):ue.Pass},blankLine:g,getType:C,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},nnTU:function(vt,Le,ee){"use strict";ee.d(Le,"b",function(){return U}),ee.d(Le,"a",function(){return P});var ue=ee("pmY6"),J=ee("746U"),O=ee("Cg/j"),X=ee("MI8n"),F=ee("24hK"),M=ee("QDVR"),H=function(){for(var L=0,h=0,f=arguments.length;h<f;h++)L+=arguments[h].length;for(var T=Array(L),p=0,h=0;h<f;h++)for(var m=arguments[h],b=0,a=m.length;b<a;b++,p++)T[p]=m[b];return T},U=Object(O.c)("commandService"),P=new(function(){function L(){this._commands=new Map,this._onDidRegisterCommand=new X.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return L.prototype.registerCommand=function(h,f){var T=this;if(!h)throw new Error("invalid command");if(typeof h=="string"){if(!f)throw new Error("invalid command");return this.registerCommand({id:h,handler:f})}if(h.description){for(var p=[],m=0,b=h.description.args;m<b.length;m++){var a=b[m];p.push(a.constraint)}var i=h.handler;h.handler=function(v){for(var R=[],w=1;w<arguments.length;w++)R[w-1]=arguments[w];return Object(J.m)(R,p),i.apply(void 0,H([v],R))}}var s=h.id,u=this._commands.get(s);u||(u=new F.a,this._commands.set(s,u));var y=u.unshift(h),g=Object(ue.h)(function(){y();var v=T._commands.get(s);(v==null?void 0:v.isEmpty())&&T._commands.delete(s)});return this._onDidRegisterCommand.fire(s),g},L.prototype.registerCommandAlias=function(h,f){return P.registerCommand(h,function(T){for(var p,m=[],b=1;b<arguments.length;b++)m[b-1]=arguments[b];return(p=T.get(U)).executeCommand.apply(p,H([f],m))})},L.prototype.getCommand=function(h){var f=this._commands.get(h);return!f||f.isEmpty()?void 0:f.iterator().next().value},L.prototype.getCommands=function(){for(var h=new Map,f=0,T=Object(M.d)(this._commands);f<T.length;f++){var p=T[f],m=this.getCommand(p);m&&h.set(p,m)}return h},L}())},osHv:function(vt,Le,ee){(function(ue){ue(ee("VrN/"))})(function(ue){"use strict";var J=ue.Pos;function O(a,i){return a.line-i.line||a.ch-i.ch}var X="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=X+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+X+"]["+F+"]*)","g");function H(a,i,s,u){this.line=i,this.ch=s,this.cm=a,this.text=a.getLine(i),this.min=u?Math.max(u.from,a.firstLine()):a.firstLine(),this.max=u?Math.min(u.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 L(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function h(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),u=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,u?"selfClose":"regular"}}function f(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(L(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(L(a))continue;return}if(!U(a,i+1)){a.ch=i;continue}var s=a.text.lastIndexOf("/",i),u=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,u?"selfClose":"regular"}}function m(a,i){for(var s=[];;){var u=T(a),y,g=a.line,v=a.ch-(u?u[0].length:0);if(!u||!(y=h(a)))return;if(y=="selfClose")continue;if(u[1]){for(var R=s.length-1;R>=0;--R)if(s[R]==u[2]){s.length=R;break}if(R<0&&(!i||i==u[2]))return{tag:u[2],from:J(g,v),to:J(a.line,a.ch)}}else s.push(u[2])}}function b(a,i){for(var s=[];;){var u=p(a);if(!u)return;if(u=="selfClose"){f(a);continue}var y=a.line,g=a.ch,v=f(a);if(!v)return;if(v[1])s.push(v[2]);else{for(var R=s.length-1;R>=0;--R)if(s[R]==v[2]){s.length=R;break}if(R<0&&(!i||i==v[2]))return{tag:v[2],from:J(a.line,a.ch),to:J(y,g)}}}}ue.registerHelper("fold","xml",function(a,i){for(var s=new H(a,i.line,0);;){var u=T(s);if(!u||s.line!=i.line)return;var y=h(s);if(!y)return;if(!u[1]&&y!="selfClose"){var g=J(s.line,s.ch),v=m(s,u[2]);return v&&O(v.from,g)>0?{from:g,to:v.from}:null}}}),ue.findMatchingTag=function(a,i,s){var u=new H(a,i.line,i.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var y=h(u),g=y&&J(u.line,u.ch),v=y&&f(u);if(!y||!v||O(u,i)>0)return;var R={from:J(u.line,u.ch),to:g,tag:v[2]};return y=="selfClose"?{open:R,close:null,at:"open"}:v[1]?{open:b(u,v[2]),close:R,at:"close"}:(u=new H(a,g.line,g.ch,s),{open:R,close:m(u,v[2]),at:"open"})},ue.findEnclosingTag=function(a,i,s,u){for(var y=new H(a,i.line,i.ch,s);;){var g=b(y,u);if(!g)break;var v=new H(a,i.line,i.ch,s),R=m(v,g.tag);if(R)return{open:g,close:R}}},ue.scanForClosingTag=function(a,i,s,u){var y=new H(a,i.line,i.ch,u?{from:0,to:u}:null);return m(y,s)}})},p5ED:function(vt,Le,ee){"use strict";var ue=ee("+L6B"),J=ee("2/Rp"),O=ee("5Dmo"),X=ee("3S7+"),F=ee("k1fw"),M=ee("9og8"),H=ee("tJVT"),U=ee("WmNS"),P=ee.n(U),L=ee("q1tI"),h=ee.n(L),f=ee("vHTk"),T=ee.n(f),p=ee("yEEn"),m=ee("ZW9T"),b=ee("1vsH"),a=ee("V0Rq"),i=ee("m3rI");Le.a=function(s){var u,y,g,v,R,w,C=s.editOffice,x=C===void 0?"view":C,d=s.name,l=s.data,A=s.theme,S=s.type,D=s.filename,I=s.monacoEditor,B=s.className,j=s.style,z=s.close,_=s.onClose,N=s.hasMask,$=s.disabledDownload,q=s.onImgDimensions,le=s.otherData,pe=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Pe=Object(H.a)(pe,2),Se=Pe[0],ke=Pe[1],Ae=Object(L.useState)(""),Te=Object(H.a)(Ae,2),ge=Te[0],he=Te[1],re=Object(L.useState)(),de=Object(H.a)(re,2),se=de[0],Oe=de[1],ie=window.ENV==="build"?"/react/build":"",oe=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,be,De=1024*1024,Ne=10*De,Fe=Object(L.useRef)();(u=l)!==null&&u!==void 0&&u.startsWith("/api")&&S!=="txt"&&(l=i.a.API_SERVER+l),S==="office"&&(be=Object(b.P)(l).filesize,be>Ne&&(S="other")),D&&(I.filename=D),Object(L.useEffect)(function(){var Qe,qe,Ye=(Qe=document.cookie)===null||Qe===void 0||((qe=Qe.replace(/\s/g,""))===null||qe===void 0)?void 0:qe.split(";");Ye==null||Ye.map(function(nt){var $e=nt.split("=");$e[0]==="_educoder_session"&&he($e[1])})},[]),Object(L.useEffect)(function(){S==="office"&&je()},[S,l]);var je=function(){var Qe=Object(M.a)(P.a.mark(function qe(){var Ye,nt,$e;return P.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return console.log("data:",l),Ye=l,l.startsWith("http")||(Ye=location.origin+Ye),nt=new URL(Ye).pathname.split("/").pop(),_e.next=6,Object(a.U)({attachment_id:nt});case 6:$e=_e.sent,Oe($e);case 8:case"end":return _e.stop()}},qe)}));return function(){return Qe.apply(this,arguments)}}(),Ue=function(){if(l.startsWith("http")||l.startsWith("blob:")){rt();return}Object(b.x)(D||"educoder",l,D)},rt=function(){Object(b.v)(D||"educoder",decodeURIComponent(l))};return h.a.createElement("div",{style:Object(F.a)({},j||{}),className:"".concat(N&&T.a.bgBlack," ").concat(S?T.a.wrp:"hide")},z&&h.a.createElement("div",{className:T.a.close,ref:Fe},!!q&&h.a.createElement(X.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return Fe.current}},h.a.createElement("span",{onClick:function(){_(),q()}},h.a.createElement("i",{className:"icon-yulanpizhu"}))),!$&&h.a.createElement(X.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Fe.current}},h.a.createElement("span",{onClick:rt},h.a.createElement("i",{className:"icon-quxiaozhiding"}))),h.a.createElement(X.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Fe.current}},h.a.createElement("span",{className:"",onClick:_},h.a.createElement("i",{className:"icon-guanbi1"})))),h.a.createElement("div",{className:"".concat(T.a[B]," ").concat(B," ").concat(T.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&h.a.createElement(m.b,I)),S==="audio"&&h.a.createElement("audio",{src:"".concat(((y=l)===null||y===void 0?void 0:y.indexOf("http://"))>-1||((g=l)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(l),autoPlay:!0}),S==="video"&&h.a.createElement(h.a.Fragment,null,((v=l)===null||v===void 0?void 0:v.indexOf("http"))>-1?h.a.createElement("video",{controls:!0,src:"".concat(l),autoPlay:!0}):h.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(l),autoPlay:!0})),S==="office"&&se&&h.a.createElement("iframe",{src:"".concat(ie,"/office.html?key=").concat(se.key,"&url=").concat(oe+se.url,"&callbackUrl=").concat(oe+se.callbackUrl,"&fileType=").concat(se.fileType,"&title=").concat(se.title,"&model=").concat(x,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&h.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"&&h.a.createElement("iframe",{src:l+"&disposition=inline"}),S==="pdf"&&h.a.createElement("embed",{className:T.a.embed,src:l}),S==="image"&&h.a.createElement("img",{src:"".concat(((R=l)===null||R===void 0?void 0:R.indexOf("http://"))>-1||((w=l)===null||w===void 0?void 0:w.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(l)}),S==="other"&&h.a.createElement("div",null,h.a.createElement(J.a,{type:"primary",size:"large",onClick:Ue},h.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&h.a.createElement(J.a,{type:"primary",size:"large",onClick:Ue},h.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(vt,Le,ee){},pmY6:function(vt,Le,ee){"use strict";ee.d(Le,"g",function(){return F}),ee.d(Le,"f",function(){return M}),ee.d(Le,"e",function(){return H}),ee.d(Le,"h",function(){return U}),ee.d(Le,"b",function(){return P}),ee.d(Le,"a",function(){return L}),ee.d(Le,"d",function(){return h}),ee.d(Le,"c",function(){return f});var ue=!1,J="__is_disposable_tracked__";function O(T){if(!ue)return;if(T&&T!==L.None)try{T[J]=!0}catch(p){}}function X(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 H(){for(var T=[],p=0;p<arguments.length;p++)T[p]=arguments[p];return T.forEach(O),X({dispose:function(){return M(T)}})}function U(T){var p=X({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}(),L=function(){function T(){this._store=new P,X(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}(),h=function(){function T(){this._isDisposed=!1,X(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(vt,Le,ee){"use strict";ee.d(Le,"a",function(){return J});var ue=ee("Qw5x");function J(O,X){var F;if(typeof Symbol=="undefined"||O[Symbol.iterator]==null){if(Array.isArray(O)||(F=Object(ue.a)(O))||X&&O&&typeof O.length=="number"){F&&(O=F);var M=0,H=function(){};return{s:H,n:function(){return M>=O.length?{done:!0}:{done:!1,value:O[M++]}},e:function(f){throw f},f:H}}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,L;return{s:function(){F=O[Symbol.iterator]()},n:function(){var f=F.next();return U=f.done,f},e:function(f){P=!0,L=f},f:function(){try{!U&&F.return!=null&&F.return()}finally{if(P)throw L}}}}},rUJ1:function(vt,Le){const ee=/[&<>"']/,ue=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,X={"&":"&","<":"<",">":">",'"':""","'":"'"},F=w=>X[w];function M(w,C){if(C){if(ee.test(w))return w.replace(ue,F)}else if(J.test(w))return w.replace(O,F);return w}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(w){return w.replace(H,(C,x)=>(x=x.toLowerCase(),x==="colon"?":":x.charAt(0)==="#"?x.charAt(1)==="x"?String.fromCharCode(parseInt(x.substring(2),16)):String.fromCharCode(+x.substring(1)):""))}const P=/(^|[^\[])\^/g;function L(w,C){w=w.source||w,C=C||"";const x={replace:(d,l)=>(l=l.source||l,l=l.replace(P,"$1"),w=w.replace(d,l),x),getRegex:()=>new RegExp(w,C)};return x}const h=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(w,C,x){if(w){let d;try{d=decodeURIComponent(U(x)).replace(h,"").toLowerCase()}catch(l){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}C&&!f.test(x)&&(x=i(C,x));try{x=encodeURI(x).replace(/%25/g,"%")}catch(d){return null}return x}const p={},m=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(w,C){p[" "+w]||(m.test(w)?p[" "+w]=w+"/":p[" "+w]=g(w,"/",!0)),w=p[" "+w];const x=w.indexOf(":")===-1;return C.substring(0,2)==="//"?x?C:w.replace(b,"$1")+C:C.charAt(0)==="/"?x?C:w.replace(a,"$1")+C:w+C}const s={exec:function(){}};function u(w){let C=1,x,d;for(;C<arguments.length;C++){x=arguments[C];for(d in x)Object.prototype.hasOwnProperty.call(x,d)&&(w[d]=x[d])}return w}function y(w,C){const x=w.replace(/\|/g,(A,S,D)=>{let I=!1,B=S;for(;--B>=0&&D[B]==="\\";)I=!I;return I?"|":" |"}),d=x.split(/ \|/);let l=0;if(d.length>C)d.splice(C);else for(;d.length<C;)d.push("");for(;l<d.length;l++)d[l]=d[l].trim().replace(/\\\|/g,"|");return d}function g(w,C,x){const d=w.length;if(d===0)return"";let l=0;for(;l<d;){const A=w.charAt(d-l-1);if(A===C&&!x)l++;else if(A!==C&&x)l++;else break}return w.substr(0,d-l)}function v(w,C){if(w.indexOf(C[1])===-1)return-1;const x=w.length;let d=0,l=0;for(;l<x;l++)if(w[l]==="\\")l++;else if(w[l]===C[0])d++;else if(w[l]===C[1]&&(d--,d<0))return l;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")}vt.exports={escape:M,unescape:U,edit:L,cleanUrl:T,resolveUrl:i,noopTest:s,merge:u,splitCells:y,rtrim:g,findClosingBracket:v,checkSanitizeDeprecation:R}},ulZh:function(vt,Le,ee){typeof window!="undefined"&&function(J,O){vt.exports=O()}(this,function(){return function(ue){var J={};function O(X){if(J[X])return J[X].exports;var F=J[X]={i:X,l:!1,exports:{}};return ue[X].call(F.exports,F,F.exports,O),F.l=!0,F.exports}return O.m=ue,O.c=J,O.d=function(X,F,M){O.o(X,F)||Object.defineProperty(X,F,{enumerable:!0,get:M})},O.r=function(X){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(X,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(X,"__esModule",{value:!0})},O.t=function(X,F){if(F&1&&(X=O(X)),F&8)return X;if(F&4&&typeof X=="object"&&X&&X.__esModule)return X;var M=Object.create(null);if(O.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:X}),F&2&&typeof X!="string")for(var H in X)O.d(M,H,function(U){return X[U]}.bind(null,H));return M},O.n=function(X){var F=X&&X.__esModule?function(){return X.default}:function(){return X};return O.d(F,"a",F),F},O.o=function(X,F){return Object.prototype.hasOwnProperty.call(X,F)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,J,O){"use strict";var X=Object.prototype.hasOwnProperty,F="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(F=!1));function H(h,f,T){this.fn=h,this.context=f,this.once=T||!1}function U(h,f,T,p,m){if(typeof T!="function")throw new TypeError("The listener must be a function");var b=new H(T,p||h,m),a=F?F+f:f;return h._events[a]?h._events[a].fn?h._events[a]=[h._events[a],b]:h._events[a].push(b):(h._events[a]=b,h._eventsCount++),h}function P(h,f){--h._eventsCount===0?h._events=new M:delete h._events[f]}function L(){this._events=new M,this._eventsCount=0}L.prototype.eventNames=function(){var f=[],T,p;if(this._eventsCount===0)return f;for(p in T=this._events)X.call(T,p)&&f.push(F?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(T)):f},L.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,b=p.length,a=new Array(b);m<b;m++)a[m]=p[m].fn;return a},L.prototype.listenerCount=function(f){var T=F?F+f:f,p=this._events[T];return p?p.fn?1:p.length:0},L.prototype.emit=function(f,T,p,m,b,a){var i=F?F+f:f;if(!this._events[i])return!1;var s=this._events[i],u=arguments.length,y,g;if(s.fn){s.once&&this.removeListener(f,s.fn,void 0,!0);switch(u){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,b),!0;case 6:return s.fn.call(s.context,T,p,m,b,a),!0}for(g=1,y=new Array(u-1);g<u;g++)y[g-1]=arguments[g];s.fn.apply(s.context,y)}else{var v=s.length,R;for(g=0;g<v;g++){s[g].once&&this.removeListener(f,s[g].fn,void 0,!0);switch(u){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,T);break;case 3:s[g].fn.call(s[g].context,T,p);break;case 4:s[g].fn.call(s[g].context,T,p,m);break;default:if(!y)for(R=1,y=new Array(u-1);R<u;R++)y[R-1]=arguments[R];s[g].fn.apply(s[g].context,y)}}}return!0},L.prototype.on=function(f,T,p){return U(this,f,T,p,!1)},L.prototype.once=function(f,T,p){return U(this,f,T,p,!0)},L.prototype.removeListener=function(f,T,p,m){var b=F?F+f:f;if(!this._events[b])return this;if(!T)return P(this,b),this;var a=this._events[b];if(a.fn)a.fn===T&&(!m||a.once)&&(!p||a.context===p)&&P(this,b);else{for(var i=0,s=[],u=a.length;i<u;i++)(a[i].fn!==T||m&&!a[i].once||p&&a[i].context!==p)&&s.push(a[i]);s.length?this._events[b]=s.length===1?s[0]:s:P(this,b)}return this},L.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},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=F,L.EventEmitter=L,ue.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,J,O){(function(X){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(L,h,f){if(f=f||{},L=L.trim(),h=h.trim(),!h){if(!f.alwaysNormalize)return L;var T=P.parseURL(L);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(h);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)):h;var m=P.parseURL(L);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var b=M.exec(m.path);m.netLoc=b[1],m.path=b[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(L){var h=F.exec(L);return h?{scheme:h[1]||"",netLoc:h[2]||"",path:h[3]||"",params:h[4]||"",query:h[5]||"",fragment:h[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(H,"");L.length!==(L=L.replace(U,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};ue.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,J,O){function X(f){var T={};function p(b){if(T[b])return T[b].exports;var a=T[b]={i:b,l:!1,exports:{}};return f[b].call(a.exports,a,a.exports,p),a.l=!0,a.exports}p.m=f,p.c=T,p.i=function(b){return b},p.d=function(b,a,i){p.o(b,a)||Object.defineProperty(b,a,{configurable:!1,enumerable:!0,get:i})},p.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},p.n=function(b){var a=b&&b.__esModule?function(){return b.default}:function(){return b};return p.d(a,"a",a),a},p.o=function(b,a){return Object.prototype.hasOwnProperty.call(b,a)},p.p="/",p.oe=function(b){throw console.error(b),b};var m=p(p.s=ENTRY_MODULE);return m.default||m}var F="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function H(f){return(f+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(f){return!isNaN(1*f)}function P(f,T,p){var m={};m[p]=[];var b=T.toString(),a=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return m;for(var i=a[1],s=new RegExp("(\\\\n|\\W)"+H(i)+M,"g"),u;u=s.exec(b);){if(u[3]==="dll-reference")continue;m[p].push(u[3])}for(s=new RegExp("\\("+H(i)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+M,"g");u=s.exec(b);)f[u[2]]||(m[p].push(u[1]),f[u[2]]=O(u[1]).m),m[u[2]]=m[u[2]]||[],m[u[2]].push(u[4]);for(var y=Object.keys(m),g=0;g<y.length;g++)for(var v=0;v<m[y[g]].length;v++)U(m[y[g]][v])&&(m[y[g]][v]=1*m[y[g]][v]);return m}function L(f){var T=Object.keys(f);return T.reduce(function(p,m){return p||f[m].length>0},!1)}function h(f,T){for(var p={main:[T]},m={main:[]},b={main:{}};L(p);)for(var a=Object.keys(p),i=0;i<a.length;i++){var s=a[i],u=p[s],y=u.pop();if(b[s]=b[s]||{},b[s][y]||!f[s][y])continue;b[s][y]=!0,m[s]=m[s]||[],m[s].push(y);for(var g=P(f,f[s][y],s),v=Object.keys(g),R=0;R<v.length;R++)p[v[R]]=p[v[R]]||[],p[v[R]]=p[v[R]].concat(g[v[R]])}return m}ue.exports=function(f,T){T=T||{};var p={main:O.m},m=T.all?{main:Object.keys(p.main)}:h(p,f),b="";Object.keys(m).filter(function(y){return y!=="main"}).forEach(function(y){for(var g=0;m[y][g];)g++;m[y].push(g),p[y][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+y+" = ("+X.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+m[y].map(function(v){return""+JSON.stringify(v)+": "+p[y][v].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+X.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+m.main.map(function(y){return""+JSON.stringify(y)+": "+p.main[y].toString()}).join(",")+"}))(self);";var a=new window.Blob([b],{type:"text/javascript"});if(T.bare)return a;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,s=i.createObjectURL(a),u=new window.Worker(s);return u.objectURL=s,u}},"./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 C}),O.d(J,"enableStreamingMode",function(){return x});var X=O("./src/controller/abr-controller.ts"),F=O("./src/controller/audio-stream-controller.ts"),M=O("./src/controller/audio-track-controller.ts"),H=O("./src/controller/subtitle-stream-controller.ts"),U=O("./src/controller/subtitle-track-controller.ts"),P=O("./src/controller/buffer-controller.ts"),L=O("./src/controller/timeline-controller.ts"),h=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"),b=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 u(){return u=Object.assign||function(d){for(var l=1;l<arguments.length;l++){var A=arguments[l];for(var S in A)Object.prototype.hasOwnProperty.call(A,S)&&(d[S]=A[S])}return d},u.apply(this,arguments)}function y(d,l){var A=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);l&&(S=S.filter(function(D){return Object.getOwnPropertyDescriptor(d,D).enumerable})),A.push.apply(A,S)}return A}function g(d){for(var l=1;l<arguments.length;l++){var A=arguments[l]!=null?arguments[l]:{};l%2?y(Object(A),!0).forEach(function(S){v(d,S,A[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(A)):y(Object(A)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(A,S))})}return d}function v(d,l,A){return l in d?Object.defineProperty(d,l,{value:A,enumerable:!0,configurable:!0,writable:!0}):d[l]=A,d}var R=g(g({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:X.default,bufferController:P.default,capLevelController:h.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:H.SubtitleStreamController,subtitleTrackController:U.default,timelineController:L.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 C(d,l){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(l.liveMaxLatencyDurationCount!==void 0&&(l.liveSyncDurationCount===void 0||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(l.liveMaxLatencyDuration!==void 0&&(l.liveSyncDuration===void 0||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},d,l)}function x(d){var l=d.loader;if(l!==b.default&&l!==m.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var A=Object(b.fetchSupported)();A&&(d.loader=b.default,d.progressive=!0,d.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 X=O("./src/polyfills/number.ts"),F=O("./src/utils/ewma-bandwidth-estimator.ts"),M=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),P=O("./src/types/loader.ts"),L=O("./src/utils/logger.ts");function h(p,m){for(var b=0;b<m.length;b++){var a=m[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function f(p,m,b){return m&&h(p.prototype,m),b&&h(p,b),p}var T=function(){function p(b){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=b;var a=b.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 u;this.fragCurrent=s,this.partCurrent=(u=i.part)!=null?u: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,u=s.autoLevelEnabled,y=s.config,g=s.media;if(!a||!g)return;var v=i?i.stats:a.stats,R=i?i.duration:a.duration;if(v.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||g.paused||!g.playbackRate||!g.readyState)return;var w=performance.now()-v.loading.start,C=Math.abs(g.playbackRate);if(w<=500*R/C)return;var x=s.levels,d=s.minAutoLevel,l=x[a.level],A=v.total||Math.max(v.loaded,Math.round(R*l.maxBitrate/8)),S=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/w),D=(A-v.loaded)/S,I=g.currentTime,B=(H.BufferHelper.bufferInfo(g,I,y.maxBufferHole).end-I)/C;if(B>=2*R/C||D<=B)return;var j=Number.POSITIVE_INFINITY,z;for(z=a.level-1;z>d;z--){var _=x[z].maxBitrate;if(j=R*_/(8*.8*S),j<B)break}if(j>=D)return;var N=this.bwEstimator.getEstimate();L.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 "+z+`
|
|
Current BW estimate: `+(Object(X.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: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=z,this.bwEstimator.sample(w,v.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:v})},m.onFragLoaded=function(a,i){var s=i.frag,u=i.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(X.isFiniteNumber)(s.sn)){var y=u?u.stats:s.stats,g=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[s.level],R=(v.loaded?v.loaded.bytes:0)+y.loaded,w=(v.loaded?v.loaded.duration:0)+g;v.loaded={bytes:R,duration:w},v.realBitrate=Math.round(8*R/w)}if(s.bitrateTest){var C={stats:y,frag:s,part:u,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,C),s.bitrateTest=!1}}},m.onFragBuffered=function(a,i){var s=i.frag,u=i.part,y=u?u.stats:s.stats;if(y.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=y.parsing.end-y.loading.start;this.bwEstimator.sample(g,y.loaded),y.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/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,u=s.maxAutoLevel,y=s.config,g=s.minAutoLevel,v=s.media,R=i?i.duration:a?a.duration:0,w=v?v.currentTime:0,C=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,x=this.bwEstimator?this.bwEstimator.getEstimate():y.abrEwmaDefaultEstimate,d=(H.BufferHelper.bufferInfo(v,w,y.maxBufferHole).end-w)/C,l=this.findBestLevel(x,g,u,d,y.abrBandWidthFactor,y.abrBandWidthUpFactor);if(l>=0)return l;L.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var A=R?Math.min(R,y.maxStarvationDelay):y.maxStarvationDelay,S=y.abrBandWidthFactor,D=y.abrBandWidthUpFactor;if(!d){var I=this.bitrateTestDelay;if(I){var B=R?Math.min(R,y.maxLoadingDelay):y.maxLoadingDelay;A=B-I,L.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*A)+" ms"),S=D=1}}return l=this.findBestLevel(x,g,u,d+A,S,D),Math.max(l,0)},m.findBestLevel=function(a,i,s,u,y,g){for(var v,R=this.fragCurrent,w=this.partCurrent,C=this.lastLoadedFragLevel,x=this.hls.levels,d=x[C],l=!!(d!=null&&(v=d.details)!==null&&v!==void 0&&v.live),A=d==null?void 0:d.codecSet,S=w?w.duration:R?R.duration:0,D=s;D>=i;D--){var I=x[D];if(!I||A&&I.codecSet!==A)continue;var B=I.details,j=(w?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||S,z=void 0;D<=C?z=y*a:z=g*a;var _=x[D].maxBitrate,N=_*j/z;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+D+"/"+Math.round(z)+"/"+_+"/"+j+"/"+u+"/"+N),z>_&&(!N||l&&!this.bitrateTestDelay||N<u))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 X=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),M=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),U=O("./src/controller/fragment-tracker.ts"),P=O("./src/types/level.ts"),L=O("./src/types/loader.ts"),h=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"),b=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 C=arguments[w];for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(R[x]=C[x])}return R},s.apply(this,arguments)}function u(R,w){R.prototype=Object.create(w.prototype),R.prototype.constructor=R,y(R,w)}function y(R,w){return y=Object.setPrototypeOf||function(x,d){return x.__proto__=d,x},y(R,w)}var g=100,v=function(R){u(w,R);function w(x,d){var l;return l=R.call(this,x,d,"[audio-stream-controller]")||this,l.videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.audioSwitch=!1,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l._registerListeners(),l}var C=w.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var d=this.hls;d.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(M.Events.ERROR,this.onError,this),d.on(M.Events.BUFFER_RESET,this.onBufferReset,this),d.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(M.Events.ERROR,this.onError,this),d.off(M.Events.BUFFER_RESET,this.onBufferReset,this),d.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onInitPtsFound=function(d,l){var A=l.frag,S=l.id,D=l.initPTS;if(S==="main"){var I=A.cc;this.initPTS[A.cc]=D,this.log("InitPTS for cc: "+I+" found from main: "+D),this.videoTrackCC=I,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},C.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=F.State.STOPPED;return}var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,l>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},C.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var d,l=this.levels,A=this.trackId,S=l==null||((d=l[A])===null||d===void 0)?void 0:d.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,I=performance.now(),B=this.retryDate;(!B||I>=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 j=this.waitingData;if(j){var z=j.frag,_=j.part,N=j.cache,$=j.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var q=N.flush(),le={frag:z,part:_,payload:q,networkDetails:null};this._handleFragmentLoadProgress(le),$&&R.prototype._handleFragmentLoadComplete.call(this,le)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var pe=this.getLoadPosition(),Pe=H.BufferHelper.bufferInfo(this.mediaBuffer,pe,this.config.maxBufferHole),Se=Object(m.fragmentWithinToleranceTest)(Pe.end,this.config.maxFragLookUpTolerance,z);Se<0&&(i.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+Pe.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},C.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},C.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var l=this.mediaBuffer?this.mediaBuffer:d,A=l.buffered;!this.loadedmetadata&&A.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},C.doTickIdle=function(){var d,l,A=this.hls,S=this.levels,D=this.media,I=this.trackId,B=A.config;if(!S||!S[I])return;if(!D&&(this.startFragRequested||!B.startFragPrefetch))return;var j=S[I],z=j.details;if(!z||z.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(z)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,h.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(_===null)return;var N=_.len,$=this.getMaxBufferLength(),q=this.audioSwitch;if(N>=$&&!q)return;if(!q&&this._streamEnded(_,z)){A.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var le=z.fragments,pe=le[0].start,Pe=_.end;if(q){var Se=this.getLoadPosition();Pe=Se,z.PTSKnown&&Se<pe&&((_.end>pe||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),D.currentTime=pe+.05))}var ke=this.getNextFragment(Pe,z);if(!ke){this.bufferFlushed=!0;return}((d=ke.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((l=ke.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ke,z):this.loadFragment(ke,z,Pe)},C.getMaxBufferLength=function(){var d=R.prototype.getMaxBufferLength.call(this),l=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return l===null?d:Math.max(d,l.len)},C.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},C.onAudioTracksUpdated=function(d,l){var A=l.audioTracks;this.resetTransmuxer(),this.levels=A.map(function(S){return new P.Level(S)})},C.onAudioTrackSwitching=function(d,l){var A=!!l.url;this.trackId=l.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),A?this.setInterval(g):this.resetTransmuxer(),A?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},C.onLevelLoaded=function(d,l){this.mainDetails=l.details},C.onAudioTrackLoaded=function(d,l){var A,S=this.levels,D=l.details,I=l.id;if(!S){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+D.startSN+","+D.endSN+"],duration:"+D.totalduration);var B=S[I],j=0;if(D.live||(A=B.details)!==null&&A!==void 0&&A.live){var z=this.mainDetails;if(D.fragments[0]||(D.deltaUpdateFailed=!0),D.deltaUpdateFailed||!z)return;!B.details&&D.hasProgramDateTime&&z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(D,z),j=D.fragments[0].start):j=this.alignPlaylists(D,B.details)}B.details=D,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!D.live)&&this.setStartPosition(B.details,j),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(D)&&(this.state=F.State.IDLE),this.tick()},C._handleFragmentLoadProgress=function(d){var l,A=d.frag,S=d.part,D=d.payload,I=this.config,B=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+A.sn+" of level "+A.level+" will not be buffered");return}var z=j[B];console.assert(z,"Audio track is defined on fragment load progress");var _=z.details;console.assert(_,"Audio track details are defined on fragment load progress");var N=I.defaultAudioCodec||z.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new T.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[A.cc],le=(l=A.initSegment)===null||l===void 0?void 0:l.data;if(q!==void 0){var pe=!1,Pe=S?S.index:-1,Se=Pe!==-1,ke=new p.ChunkMetadata(A.level,A.sn,A.stats.chunkCount,D.byteLength,Pe,Se);$.push(D,le,N,"",A,S,_.totalduration,pe,ke,q)}else{i.logger.log("Unknown video PTS for cc "+A.cc+", waiting for video PTS before demuxing audio frag "+A.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+B);var Ae=this.waitingData=this.waitingData||{frag:A,part:S,cache:new f.default,complete:!1},Te=Ae.cache;Te.push(new Uint8Array(D)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},C._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,d)},C.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},C.onBufferCreated=function(d,l){var A=l.tracks.audio;A&&(this.mediaBuffer=A.buffer),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer)},C.onFragBuffered=function(d,l){var A=l.frag,S=l.part;if(A.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(A)){this.warn("Fragment "+A.sn+(S?" p: "+S.index:"")+" of level "+A.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}A.sn!=="initSegment"&&(this.fragPrevious=A,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(A,S)},C.onError=function(d,l){switch(l.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(L.PlaylistLevelType.AUDIO,l);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=l.fatal?F.State.ERROR:F.State.IDLE,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var A=!0,S=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);S&&S.len>.5&&(A=!this.reduceMaxBufferLength(S.len)),A&&(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}},C.onBufferFlushed=function(d,l){var A=l.type;A===h.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},C._handleTransmuxComplete=function(d){var l,A="audio",S=this.hls,D=d.remuxResult,I=d.chunkMeta,B=this.getCurrentContext(I);if(!B){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var j=B.frag,z=B.part,_=D.audio,N=D.text,$=D.id3,q=D.initSegment;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,this.audioSwitch&&_&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,j,I),S.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:A,tracks:q.tracks})),_){var le=_.startPTS,pe=_.endPTS,Pe=_.startDTS,Se=_.endDTS;z&&(z.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:pe,startDTS:Pe,endDTS:Se}),j.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,le,pe,Pe,Se),this.bufferFragmentData(_,j,z,I)}if($!=null&&(l=$.samples)!==null&&l!==void 0&&l.length){var ke=s({frag:j,id:A},$);S.trigger(M.Events.FRAG_PARSING_METADATA,ke)}if(N){var Ae=s({frag:j,id:A},N);S.trigger(M.Events.FRAG_PARSING_USERDATA,Ae)}},C._bufferInitSegment=function(d,l,A){if(this.state!==F.State.PARSING)return;d.video&&delete d.video;var S=d.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,d);var D=S.initSegment;if(D!=null&&D.byteLength){var I={type:"audio",frag:l,part:null,chunkMeta:A,parent:l.type,data:D};this.hls.trigger(M.Events.BUFFER_APPENDING,I)}this.tick()},C.loadFragment=function(d,l,A){var S=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||S===U.FragmentState.NOT_LOADED||S===U.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):l.live&&!Object(X.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,d,l,A)))},C.completeAudioSwitch=function(){var d=this.hls,l=this.media,A=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:A})},w}(F.default);J.default=v},"./src/controller/audio-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/controller/base-playlist-controller.ts"),H=O("./src/types/loader.ts");function U(T,p){for(var m=0;m<p.length;m++){var b=p[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function P(T,p,m){return p&&U(T.prototype,p),m&&U(T,m),T}function L(T,p){T.prototype=Object.create(p.prototype),T.prototype.constructor=T,h(T,p)}function h(T,p){return h=Object.setPrototypeOf||function(b,a){return b.__proto__=a,b},h(T,p)}var f=function(T){L(p,T);function p(b){var a;return a=T.call(this,b,"[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(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(X.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var a=this.hls;a.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(X.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,u=i.details,y=this.tracksInGroup[s];if(!y){this.warn("Invalid audio track id "+s);return}var g=y.details;y.details=i.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,i,g))},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 u=this.tracks.filter(function(g){return!s||g.groupId===s});this.selectDefaultTrack&&!u.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var y={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(X.Events.AUDIO_TRACKS_UPDATED,y),this.selectInitialTrack()}},m.onError=function(a,i){if(T.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===H.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 u=i[a],y=u.id,g=u.groupId,v=g===void 0?"":g,R=u.name,w=u.type,C=u.url;if(this.trackId=a,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger(X.Events.AUDIO_TRACK_SWITCHING,{id:y,groupId:v,name:R,type:w,url:C}),u.details&&!u.details.live)return;var x=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(x)},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(X.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 u=i[s];if((!this.selectDefaultTrack||u.default)&&(!a||a===u.name))return u.id}return-1},m.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var s=i.id,u=i.groupId,y=i.url;if(a)try{y=a.addDirectives(y)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(X.Events.AUDIO_TRACK_LOADING,{url:y,id:s,groupId:u,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 X=O("./src/polyfills/number.ts"),F=O("./src/types/level.ts"),M=O("./src/controller/level-helper.ts"),H=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),P=function(){function L(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=H.logger.log.bind(H.logger,T+":"),this.warn=H.logger.warn.bind(H.logger,T+":"),this.hls=f}var h=L.prototype;return h.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},h.onError=function(T,p){p.fatal&&p.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},h.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},h.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},h.stopLoad=function(){this.canLoad=!1,this.clearTimer()},h.switchParams=function(T,p){var m=p==null?void 0:p.renditionReports;if(m)for(var b=0;b<m.length;b++){var a=m[b],i=""+a.URI;if(i===T.substr(-i.length)){var s=parseInt(a["LAST-MSN"]),u=parseInt(a["LAST-PART"]);if(p&&this.hls.config.lowLatencyMode){var y=Math.min(p.age-p.partTarget,p.targetduration);u!==void 0&&y>p.partTarget&&(u+=1)}if(Object(X.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object(X.isFiniteNumber)(u)?u:void 0,F.HlsSkip.No)}}},h.loadPlaylist=function(T){},h.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},h.playlistLoaded=function(T,p,m){var b=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 u,y=void 0,g=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var v=this.hls.config.lowLatencyMode,R=a.lastPartSn,w=a.endSN,C=a.lastPartIndex,x=C!==-1,d=R===w,l=v?0:C;x?(y=d?w+1:R,g=d?l:C+1):y=w+1;var A=a.age,S=A+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 I=Math.floor(D/a.targetduration);if(y+=I,g!==void 0){var B=Math.round(D%a.targetduration/a.partTarget);g+=B}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+A.toFixed(2)+"s goal: "+D+" skip sn "+I+" to part "+g)}a.tuneInGoal=D}if(u=this.getDeliveryDirectives(a,p.deliveryDirectives,y,g),v||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(a,p.deliveryDirectives,y,g);var j=Object(M.computeReloadInterval)(a,i);y!==void 0&&a.canBlockReload&&(j-=a.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(u)},j)}else this.clearTimer()},h.getDeliveryDirectives=function(T,p,m,b){var a=Object(F.getSkipValue)(T,m);return p!=null&&p.skip&&T.deltaUpdateFailed&&(m=p.msn,b=p.part,a=F.HlsSkip.No),new F.HlsUrlParameters(m,b,a)},h.retryLoadingOrFail=function(T){var p=this,m=this.hls.config,b=this.retryCount<m.levelLoadingMaxRetry;if(b){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 b},L}()},"./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 C});var X=O("./src/polyfills/number.ts"),F=O("./src/task-loop.ts"),M=O("./src/controller/fragment-tracker.ts"),H=O("./src/utils/buffer-helper.ts"),U=O("./src/utils/logger.ts"),P=O("./src/events.ts"),L=O("./src/errors.ts"),h=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"),b=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 u(x,d){for(var l=0;l<d.length;l++){var A=d[l];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(x,A.key,A)}}function y(x,d,l){return d&&u(x.prototype,d),l&&u(x,l),x}function g(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function v(x,d){x.prototype=Object.create(d.prototype),x.prototype.constructor=x,R(x,d)}function R(x,d){return R=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},R(x,d)}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"},C=function(x){v(d,x);function d(A,S,D){var I;return I=x.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=w.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=D,I.log=U.logger.log.bind(U.logger,D+":"),I.warn=U.logger.warn.bind(U.logger,D+":"),I.hls=A,I.fragmentLoader=new b.default(A.config),I.fragmentTracker=S,I.config=A.config,I.decrypter=new a.default(A,A.config),A.on(P.Events.KEY_LOADED,I.onKeyLoaded,g(I)),I}var l=d.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(S){},l.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},l._streamEnded=function(S,D){var I=this.fragCurrent,B=this.fragmentTracker;if(!D.live&&I&&I.sn===D.endSN&&!S.nextStart){var j=B.getState(I);return j===M.FragmentState.PARTIAL||j===M.FragmentState.OK}return!1},l.onMediaAttached=function(S,D){var I=this.media=this.mediaBuffer=D.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(B.startPosition)},l.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()},l.onMediaSeeking=function(){var S=this.config,D=this.fragCurrent,I=this.media,B=this.mediaBuffer,j=this.state,z=I?I.currentTime:0,_=H.BufferHelper.bufferInfo(B||I,z,S.maxBufferHole);if(this.log("media seeking to "+(Object(X.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+j),j===w.ENDED)this.resetLoadingState();else if(D&&!_.len){var N=S.maxFragLookUpTolerance,$=D.start-N,q=D.start+D.duration+N,le=z>q;(z<$||le)&&(le&&D.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),D.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=z),!this.loadedmetadata&&!_.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onKeyLoaded=function(S,D){if(this.state!==w.KEY_LOADING||D.frag!==this.fragCurrent||!this.levels)return;this.state=w.IDLE;var I=this.levels[D.frag.level].details;I&&this.loadFragment(D.frag,I,D.frag.start)},l.onHandlerDestroying=function(){this.stopLoad(),x.prototype.onHandlerDestroying.call(this)},l.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,x.prototype.onHandlerDestroyed.call(this)},l.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})},l.loadFragment=function(S,D,I){this._loadFragForPlayback(S,D,I)},l._loadFragForPlayback=function(S,D,I){var B=this,j=function(_){if(B.fragContextChanged(S)){B.warn("Fragment "+S.sn+(_.part?" p: "+_.part.index:"")+" of level "+S.level+" was dropped during download."),B.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,B._handleFragmentLoadProgress(_)};this._doFragLoad(S,D,I,j).then(function(z){if(!z)return;B.fragLoadError=0;var _=B.state;if(B.fragContextChanged(S)){(_===w.FRAG_LOADING||_===w.BACKTRACKING||!B.fragCurrent&&_===w.PARSING)&&(B.fragmentTracker.removeFragment(S),B.state=w.IDLE);return}if("payload"in z&&(B.log("Loaded fragment "+S.sn+" of level "+S.level),B.hls.trigger(P.Events.FRAG_LOADED,z),B.state===w.BACKTRACKING)){B.fragmentTracker.backtrack(S,z),B.resetFragmentLoading(S);return}B._handleFragmentLoadComplete(z)}).catch(function(z){B.warn(z),B.resetFragmentLoading(S)})},l.flushMainBuffer=function(S,D,I){if(I===void 0&&(I=null),!(S-D))return;var B={startOffset:S,endOffset:D,type:I};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,B)},l._loadInitSegment=function(S){var D=this;this._doFragLoad(S).then(function(I){if(!I||D.fragContextChanged(S)||!D.levels)throw new Error("init load aborted");return I}).then(function(I){var B=D.hls,j=I.payload,z=S.decryptdata;if(j&&j.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var _=self.performance.now();return D.decrypter.webCryptoDecrypt(new Uint8Array(j),z.key.buffer,z.iv.buffer).then(function(N){var $=self.performance.now();return B.trigger(P.Events.FRAG_DECRYPTED,{frag:S,payload:N,stats:{tstart:_,tdecrypt:$}}),I.payload=N,I})}return I}).then(function(I){var B=D.fragCurrent,j=D.hls,z=D.levels;if(!z)throw new Error("init load aborted, missing levels");var _=z[S.level].details;console.assert(_,"Level details are defined when init segment is loaded");var N=S.stats;D.state=w.IDLE,D.fragLoadError=0,S.data=new Uint8Array(I.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),I.frag===B&&j.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:B,part:null,id:S.type}),D.tick()}).catch(function(I){D.warn(I),D.resetFragmentLoading(S)})},l.fragContextChanged=function(S){var D=this.fragCurrent;return!S||!D||S.level!==D.level||S.sn!==D.sn||S.urlId!==D.urlId},l.fragBufferedComplete=function(S,D){var I=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(H.BufferHelper.getBuffered(I))),this.state=w.IDLE,this.tick()},l._handleFragmentLoadComplete=function(S){var D=this.transmuxer;if(!D)return;var I=S.frag,B=S.part,j=S.partsLoaded,z=!j||j.length===0||j.some(function(N){return!N}),_=new h.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,B?B.index:-1,!z);D.flush(_)},l._handleFragmentLoadProgress=function(S){},l._doFragLoad=function(S,D,I,B){var j=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(S.start,I||0),this.config.lowLatencyMode&&D){var z=D.partList;if(z&&B){I>S.end&&D.fragmentHint&&(S=D.fragmentHint);var _=this.getNextPart(z,S,I);if(_>-1){var N=z[_];return this.log("Loading part sn: "+S.sn+" p: "+N.index+" cc: "+S.cc+" of playlist ["+D.startSN+"-"+D.endSN+"] parts [0-"+_+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=w.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,part:z[_],targetBufferTime:I}),this.doFragPartsLoad(S,z,_,B).catch(function($){return j.handleFragLoadError($)})}else if(!S.url||this.loadedEndOfParts(z,I))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(I.toFixed(3))),Object(X.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:I}),this.fragmentLoader.load(S,B).catch(function($){return j.handleFragLoadError($)})},l.doFragPartsLoad=function(S,D,I,B){var j=this;return new Promise(function(z,_){var N=[],$=function q(le){var pe=D[le];j.fragmentLoader.loadPart(S,pe,B).then(function(Pe){N[pe.index]=Pe;var Se=Pe.part;j.hls.trigger(P.Events.FRAG_LOADED,Pe);var ke=D[le+1];if(ke&&ke.fragment===S)q(le+1);else return z({frag:S,part:Se,partsLoaded:N})}).catch(_)};$(I)})},l.handleFragLoadError=function(S){var D=S.data;return D&&D.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(D.frag,D.part):this.hls.trigger(P.Events.ERROR,D),null},l._handleTransmuxerFlush=function(S){var D=this.getCurrentContext(S);if(!D||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var I=D.frag,B=D.part,j=D.level,z=self.performance.now();I.stats.parsing.end=z,B&&(B.stats.parsing.end=z),this.updateLevelTiming(I,B,j,S.partial)},l.getCurrentContext=function(S){var D=this.levels,I=S.level,B=S.sn,j=S.part;if(!D||!D[I])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+I+". The current chunk will not be buffered."),null;var z=D[I],_=j>-1?Object(m.getPartWith)(z,B,j):null,N=_?_.fragment:Object(m.getFragmentWithSN)(z,B,this.fragCurrent);return N?{frag:N,part:_,level:z}:null},l.bufferFragmentData=function(S,D,I,B){if(!S||this.state!==w.PARSING)return;var j=S.data1,z=S.data2,_=j;if(j&&z&&(_=Object(f.appendUint8Array)(j,z)),!_||!_.length)return;var N={type:S.type,frag:D,part:I,chunkMeta:B,parent:D.type,data:_};this.hls.trigger(P.Events.BUFFER_APPENDING,N),S.dropped&&S.independent&&!I&&this.flushBufferGap(D)},l.flushBufferGap=function(S){var D=this.media;if(!D)return;if(!H.BufferHelper.isBuffered(D,D.currentTime)){this.flushMainBuffer(0,S.start);return}var I=D.currentTime,B=H.BufferHelper.bufferInfo(D,I,0),j=S.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),_=Math.max(Math.min(S.start-z,B.end-z),I+z);S.start-_>z&&this.flushMainBuffer(_,S.start)},l.getFwdBufferInfo=function(S,D){var I=this.config,B=this.getLoadPosition();if(!Object(X.isFiniteNumber)(B))return null;var j=H.BufferHelper.bufferInfo(S,B,I.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(B,D);if(z&&j.nextStart<z.end)return H.BufferHelper.bufferInfo(S,B,Math.max(j.nextStart,I.maxBufferHole))}return j},l.getMaxBufferLength=function(S){var D=this.config,I;return S?I=Math.max(8*D.maxBufferSize/S,D.maxBufferLength):I=D.maxBufferLength,Math.min(I,D.maxMaxBufferLength)},l.reduceMaxBufferLength=function(S){var D=this.config,I=S||D.maxBufferLength;return D.maxMaxBufferLength>=I?(D.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+D.maxMaxBufferLength+"s"),!0):!1},l.getNextFragment=function(S,D){var I,B,j=D.fragments,z=j.length;if(!z)return null;var _=this.config,N=j[0].start,$;if(D.live){var q=_.initialLiveManifestSize;if(z<q)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+q+")"),null;!D.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(D,j),this.startPosition=$?this.hls.liveSyncPosition||$.start:S)}else S<=N&&($=j[0]);if(!$){var le=_.lowLatencyMode?D.partEnd:D.fragmentEnd;$=this.getFragmentAtPosition(S,le,D)}return(I=$)!==null&&I!==void 0&&I.initSegment&&!((B=$)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},l.getNextPart=function(S,D,I){for(var B=-1,j=!1,z=!0,_=0,N=S.length;_<N;_++){var $=S[_];if(z=z&&!$.independent,B>-1&&I<$.start)break;var q=$.loaded;!q&&(j||$.independent||z)&&$.fragment===D&&(B=_),j=q}return B},l.loadedEndOfParts=function(S,D){var I=S[S.length-1];return I&&D>I.start&&I.loaded},l.getInitialLiveFragment=function(S,D){var I=this.fragPrevious,B=null;if(I){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),B=Object(p.findFragmentByPDT)(D,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var j=I.sn+1;if(j>=S.startSN&&j<=S.endSN){var z=D[j-S.startSN];I.cc===z.cc&&(B=z,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(p.findFragWithCC)(D,I.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var _=this.hls.liveSyncPosition;_!==null&&(B=this.getFragmentAtPosition(_,this.bitrateTest?S.fragmentEnd:S.edge,S))}return B},l.getFragmentAtPosition=function(S,D,I){var B=this.config,j=this.fragPrevious,z=I.fragments,_=I.endSN,N=I.fragmentHint,$=B.maxFragLookUpTolerance,q=!!(B.lowLatencyMode&&I.partList&&N);q&&N&&!this.bitrateTest&&(z=z.concat(N),_=N.sn);var le;if(S<D){var pe=S>D-$?0:$;le=Object(p.findFragmentByPTS)(j,z,S,pe)}else le=z[z.length-1];if(le){var Pe=le.sn-I.startSN,Se=j&&le.level===j.level,ke=z[Pe+1],Ae=this.fragmentTracker.getState(le);if(Ae===M.FragmentState.BACKTRACKED){le=null;for(var Te=Pe;z[Te]&&this.fragmentTracker.getState(z[Te])===M.FragmentState.BACKTRACKED;)j?le=z[Te--]:le=z[--Te];le||(le=ke)}else j&&le.sn===j.sn&&!q&&(Se&&(le.sn<_&&this.fragmentTracker.getState(ke)!==M.FragmentState.OK?(this.log("SN "+le.sn+" just loaded, load next one: "+ke.sn),le=ke):le=null))}return le},l.synchronizeToLiveEdge=function(S){var D=this.config,I=this.media;if(!I)return;var B=this.hls.liveSyncPosition,j=I.currentTime,z=S.fragments[0].start,_=S.edge,N=j>=z-D.maxFragLookUpTolerance&&j<=_;if(B!==null&&I.duration>B&&(j<B||!N)){var $=D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:D.liveMaxLatencyDurationCount*S.targetduration;(!N&&I.readyState<4||j<_-$)&&(this.loadedmetadata||(this.nextLoadPosition=B),I.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+_+", reset currentTime to : "+B.toFixed(3)),I.currentTime=B))}},l.alignPlaylists=function(S,D){var I=this.levels,B=this.levelLastLoaded,j=this.fragPrevious,z=B!==null?I[B]:null,_=S.fragments.length;if(!_)return this.warn("No fragments in live playlist"),0;var N=S.fragments[0].start,$=!D,q=S.alignedSliding&&Object(X.isFiniteNumber)(N);if($||!q&&!N){Object(T.alignStream)(j,z,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: "+(j?j.sn:"na")+" fragments: "+_),le}return N},l.waitForCdnTuneIn=function(S){var D=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*D)},l.setStartPosition=function(S,D){var I=this.startPosition;if(I<D&&(I=-1),I===-1||this.lastCurrentTime===-1){var B=S.startTimeOffset;Object(X.isFiniteNumber)(B)?(I=D+B,B<0&&(I+=S.totalduration),I=Math.min(Math.max(D,I),D+S.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+I),this.startPosition=I):S.live?I=this.hls.liveSyncPosition||D:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},l.getLoadPosition=function(){var S=this.media,D=0;return this.loadedmetadata&&S?D=S.currentTime:this.nextLoadPosition&&(D=this.nextLoadPosition),D},l.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))},l.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=w.IDLE)},l.onFragmentOrKeyLoadError=function(S,D){if(D.fatal)return;var I=D.frag;if(!I||I.type!==S)return;var B=this.fragCurrent;console.assert(B&&I.sn===B.sn&&I.level===B.level&&I.urlId===B.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+S+" "+I.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,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)},l.afterBufferFlushed=function(S,D,I){if(!S)return;var B=H.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(D,B,I),this.state===w.ENDED&&this.resetLoadingState()},l.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=w.IDLE},l.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},l.updateLevelTiming=function(S,D,I,B){var j=this,z=I.details;console.assert(!!z,"level.details must be defined");var _=Object.keys(S.elementaryStreams).reduce(function(N,$){var q=S.elementaryStreams[$];if(q){var le=q.endPTS-q.startPTS;if(le<=0)return j.warn("Could not parse fragment "+S.sn+" "+$+" duration reliably ("+le+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var pe=B?0:Object(m.updateFragPTSDTS)(z,S,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return j.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:z,level:I,drift:pe,type:$,frag:S,start:q.startPTS,end:q.endPTS}),!0}return N},!1);_?(this.state=w.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:S,part:D})):this.resetLoadingState()},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},y(d,[{key:"state",get:function(){return this._state},set:function(S){var D=this._state;D!==S&&(this._state=S,this.log(D+"->"+S))}}]),d}(F.default)},"./src/controller/buffer-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return p});var X=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),M=O("./src/utils/logger.ts"),H=O("./src/errors.ts"),U=O("./src/utils/buffer-helper.ts"),P=O("./src/utils/mediasource-helper.ts"),L=O("./src/loader/fragment.ts"),h=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,u=i.media,y=i.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),u&&(i.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:u})),y&&y.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 b=m.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var 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)},b.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)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new h.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(i,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(i,s){var u=this.media=s.media;if(u&&f){var y=this.mediaSource=new f;y.addEventListener("sourceopen",this._onMediaSourceOpen),y.addEventListener("sourceended",this._onMediaSourceEnded),y.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(y),this._objectUrl=u.src}},b.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(y){M.logger.warn("[buffer-controller]: onMediaDetaching: "+y.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(u&&self.URL.revokeObjectURL(u),i.src===u?(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)},b.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(s){var u=i.sourceBuffer[s];try{u&&(i.removeBufferListeners(s),i.mediaSource&&i.mediaSource.removeSourceBuffer(u),i.sourceBuffer[s]=void 0)}catch(y){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",y)}}),this._initSourceBuffer()},b.onBufferCodecs=function(i,s){var u=this,y=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(y){var v=u.tracks[g];if(v&&typeof v.buffer.changeType=="function"){var R=s[g],w=R.codec,C=R.levelCodec,x=R.container,d=(v.levelCodec||v.codec).replace(T,"$1"),l=(C||w).replace(T,"$1");if(d!==l){var A=x+";codecs="+(C||w);u.appendChangeType(g,A)}}}else u.pendingTracks[g]=s[g]}),y)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(i,s){var u=this,y=this.operationQueue,g={execute:function(){var R=u.sourceBuffer[i];R&&(M.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),R.changeType(s)),y.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(R){M.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",R)}};y.append(g,i)},b.onBufferAppending=function(i,s){var u=this,y=this.hls,g=this.operationQueue,v=this.tracks,R=s.data,w=s.type,C=s.frag,x=s.part,d=s.chunkMeta,l=d.buffering[w],A=self.performance.now();l.start=A;var S=C.stats.buffering,D=x?x.stats.buffering:null;S.start===0&&(S.start=A),D&&D.start===0&&(D.start=A);var I=v.audio,B=w==="audio"&&d.id===1&&(I==null?void 0:I.container)==="audio/mpeg",j={execute:function(){if(l.executeStart=self.performance.now(),B){var _=u.sourceBuffer[w];if(_){var N=C.start-_.timestampOffset;Math.abs(N)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+C.start+" (delta: "+N+") sn: "+C.sn+")"),_.timestampOffset=C.start)}}u.appendExecutor(R,w)},onStart:function(){},onComplete:function(){var _=self.performance.now();l.executeEnd=l.end=_,S.first===0&&(S.first=_),D&&D.first===0&&(D.first=_);var N=u.sourceBuffer,$={};for(var q in N)$[q]=U.BufferHelper.getBuffered(N[q]);u.appendError=0,u.hls.trigger(F.Events.BUFFER_APPENDED,{type:w,frag:C,part:x,chunkMeta:d,parent:C.type,timeRanges:$})},onError:function(_){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",_);var N={type:H.ErrorTypes.MEDIA_ERROR,parent:C.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:_,fatal:!1};_.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=H.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,N.details=H.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>y.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+y.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),y.trigger(F.Events.ERROR,N)}};g.append(j,w)},b.onBufferFlushing=function(i,s){var u=this,y=this.operationQueue,g=function(R){return{execute:u.removeExecutor.bind(u,R,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(F.Events.BUFFER_FLUSHED,{type:R})},onError:function(C){M.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",C)}}};s.type?y.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){y.append(g(v),v)})},b.onFragParsed=function(i,s){var u=this,y=s.frag,g=s.part,v=[],R=g?g.elementaryStreams:y.elementaryStreams;R[L.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(R[L.ElementaryStreamTypes.AUDIO]&&v.push("audio"),R[L.ElementaryStreamTypes.VIDEO]&&v.push("video"));var w=function(){var x=self.performance.now();y.stats.buffering.end=x,g&&(g.stats.buffering.end=x);var d=g?g.stats:y.stats;u.hls.trigger(F.Events.FRAG_BUFFERED,{frag:y,part:g,stats:d,id:y.type})};v.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+y.type+" level: "+y.level+" sn: "+y.sn),this.blockBuffers(w,v)},b.onFragChanged=function(i,s){this.flushBackBuffer()},b.onBufferEos=function(i,s){var u=this,y=this.getSourceBufferTypes().reduce(function(g,v){var R=u.sourceBuffer[v];return(!s.type||s.type===v)&&(R&&!R.ended&&(R.ended=!0,M.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),g&&!!(!R||R.ended)},!0);y&&this.blockBuffers(function(){var g=u.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},b.onLevelUpdated=function(i,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var i=this.hls,s=this.details,u=this.media,y=this.sourceBuffer;if(!u||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var v=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(X.isFiniteNumber)(v)||v<0)return;var R=u.currentTime,w=s.levelTargetDuration,C=Math.max(v,w),x=Math.floor(R/w)*w-C;g.forEach(function(d){var l=y[d];if(l){var A=U.BufferHelper.getBuffered(l);A.length>0&&x>A.start(0)&&(i.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:x}),s.live&&i.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:x}),i.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:x,type:d}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,s=this.hls,u=this.media,y=this.mediaSource,g=i.fragments[0].start+i.totalduration,v=u.duration,R=Object(X.isFiniteNumber)(y.duration)?y.duration:0;i.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),y.duration=Infinity,this.updateSeekableRange(i)):(g>R&&g>v||!Object(X.isFiniteNumber)(v))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),y.duration=g)},b.updateSeekableRange=function(i){var s=this.mediaSource,u=i.fragments,y=u.length;if(y&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,u[0].start),v=Math.max(g,g+i.totalduration);s.setLiveSeekableRange(g,v)}},b.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,y=Object.keys(u).length;if(y&&!i||y===2){this.createSourceBuffers(u),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(v){s.executeNext(v)})}},b.createSourceBuffers=function(i){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var y=0;for(var g in i)if(!s[g]){var v=i[g];if(!v)throw Error("source buffer exists for track "+g+", however track does not");var R=v.levelCodec||v.codec,w=v.container+";codecs="+R;M.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var C=s[g]=u.addSourceBuffer(w),x=g;this.addBufferListener(x,"updatestart",this._onSBUpdateStart),this.addBufferListener(x,"updateend",this._onSBUpdateEnd),this.addBufferListener(x,"error",this._onSBUpdateError),this.tracks[g]={buffer:C,codec:R,container:v.container,levelCodec:v.levelCodec,id:v.id},y++}catch(d){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:w})}}y&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(i){var s=this.operationQueue,u=s.current(i);u.onStart()},b._onSBUpdateEnd=function(i){var s=this.operationQueue,u=s.current(i);u.onComplete(),s.shiftAndExecuteNext(i)},b._onSBUpdateError=function(i,s){M.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(i);u&&u.onError(s)},b.removeExecutor=function(i,s,u){var y=this.media,g=this.mediaSource,v=this.operationQueue,R=this.sourceBuffer,w=R[i];if(!y||!g||!w){M.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(i);return}var C=Object(X.isFiniteNumber)(y.duration)?y.duration:Infinity,x=Object(X.isFiniteNumber)(g.duration)?g.duration:Infinity,d=Math.max(0,s),l=Math.min(u,C,x);l>d?(M.logger.log("[buffer-controller]: Removing ["+d+","+l+"] from the "+i+" SourceBuffer"),console.assert(!w.updating,i+" sourceBuffer must not be updating"),w.remove(d,l)):v.shiftAndExecuteNext(i)},b.appendExecutor=function(i,s){var u=this.operationQueue,y=this.sourceBuffer,g=y[s];if(!g){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(i)},b.blockBuffers=function(i,s){var u=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 y=this.operationQueue,g=s.map(function(v){return y.appendBlocker(v)});Promise.all(g).then(function(){i(),s.forEach(function(v){var R=u.sourceBuffer[v];(!R||!R.updating)&&y.shiftAndExecuteNext(v)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(i,s,u){var y=this.sourceBuffer[i];if(!y)return;var g=u.bind(this,i);this.listeners[i].push({event:s,listener:g}),y.addEventListener(s,g)},b.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(u){s.removeEventListener(u.event,u.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 X=O("./src/utils/logger.ts"),F=function(){function M(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var H=M.prototype;return H.append=function(P,L){var h=this.queues[L];h.push(P),h.length===1&&this.buffers[L]&&this.executeNext(L)},H.insertAbort=function(P,L){var h=this.queues[L];h.unshift(P),this.executeNext(L)},H.appendBlocker=function(P){var L,h=new Promise(function(T){L=T}),f={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(f,P),h},H.executeNext=function(P){var L=this.buffers,h=this.queues,f=L[P],T=h[P];if(T.length){var p=T[0];try{p.execute()}catch(m){X.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),p.onError(m),(!f||!f.updating)&&(T.shift(),this.executeNext(P))}}},H.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},H.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 X=O("./src/events.ts");function F(U,P){for(var L=0;L<P.length;L++){var h=P[L];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(U,h.key,h)}}function M(U,P,L){return P&&F(U.prototype,P),L&&F(U,L),U}var H=function(){function U(L){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=L,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(h){this.streamController=h},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 h=this.hls;h.on(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var h=this.hls;h.off(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(h,f){U.isLevelAllowed(f.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(f.droppedLevel)},P.onMediaAttaching=function(h,f){this.media=f.media instanceof HTMLVideoElement?f.media:null},P.onManifestParsed=function(h,f){var T=this.hls;this.restrictedLevels=[],this.firstLevel=f.firstLevel,T.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onBufferCodecs=function(h,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 h=this.hls.levels;if(h.length){var f=this.hls;f.autoLevelCapping=this.getMaxLevel(h.length-1),f.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=f.autoLevelCapping}}},P.getMaxLevel=function(h){var f=this,T=this.hls.levels;if(!T.length)return-1;var p=T.filter(function(m,b){return U.isLevelAllowed(b,f.restrictedLevels)&&b<=h});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 h=this.media,f={width:0,height:0};if(h){var T=h.getBoundingClientRect();f.width=T.width,f.height=T.height,!f.width&&!f.height&&(f.width=T.right-T.left||h.width||0,f.height=T.bottom-T.top||h.height||0)}return this.clientRect=f,f},U.isLevelAllowed=function(h,f){return f===void 0&&(f=[]),f.indexOf(h)===-1},U.getMaxLevelByMediaSize=function(h,f,T){if(!h||!h.length)return-1;for(var p=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},m=h.length-1,b=0;b<h.length;b+=1){var a=h[b];if((a.width>=f||a.height>=T)&&p(a,h[b+1])){m=b;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 h=1;try{h=self.devicePixelRatio}catch(f){}return h}}]),U}();J.default=H},"./src/controller/cmcd-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return p});var X=O("./src/events.ts"),F=O("./src/types/cmcd.ts"),M=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts");function U(m,b){for(var a=0;a<b.length;a++){var i=b[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,i.key,i)}}function P(m,b,a){return b&&U(m.prototype,b),a&&U(m,a),m}function L(m,b){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=h(m))||b&&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 h(m,b){if(!m)return;if(typeof m=="string")return f(m,b);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,b)}function f(m,b){(b==null||b>m.length)&&(b=m.length);for(var a=0,i=new Array(b);a<b;a++)i[a]=m[a];return i}function T(){return T=Object.assign||function(m){for(var b=1;b<arguments.length;b++){var a=arguments[b];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(y){try{i.apply(y,{ot:F.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(g){H.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(y){try{var g=y.frag,v=i.hls.levels[g.level],R=i.getObjectType(g),w={d:g.duration*1e3,ot:R};(R===F.CMCDObjectType.VIDEO||R===F.CMCDObjectType.AUDIO||R==F.CMCDObjectType.MUXED)&&(w.br=v.bitrate/1e3,w.tb=i.getTopBandwidth(R),w.bl=i.getBufferLength(R)),i.apply(y,w)}catch(C){H.logger.warn("Could not generate segment CMCD data.",C)}},this.hls=a;var s=this.config=a.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||m.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var b=m.prototype;return b.registerListeners=function(){var i=this.hls;i.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(X.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var i=this.hls;i.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(X.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(i,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(i,s){var u,y;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(y=s.tracks.video)===null||y===void 0?void 0:y.buffer},b.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}},b.apply=function(i,s){s===void 0&&(s={}),T(s,this.createData());var u=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var y=m.toHeaders(s);if(!Object.keys(y).length)return;i.headers||(i.headers={}),T(i.headers,y)}else{var g=m.toQuery(s);if(!g)return;i.url=m.appendQueryToUri(i.url,g)}},b.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},b.getTopBandwidth=function(i){for(var s=0,u=i===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,y=L(u),g;!(g=y()).done;){var v=g.value;v.bitrate>s&&(s=v.bitrate)}return s>0?s:NaN},b.getBufferLength=function(i){var s=this.hls.media,u=i===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var y=M.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return y.len*1e3},b.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,u=i||this.config.loader;return function(){function y(v){this.loader=void 0,this.loader=new u(v)}var g=y.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(R,w,C){s(R),this.loader.load(R,w,C)},P(y,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),y}()},b.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,u=i||this.config.loader;return function(){function y(v){this.loader=void 0,this.loader=new u(v)}var g=y.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(R,w,C){s(R),this.loader.load(R,w,C)},P(y,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),y}()},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=[],u=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},y=function(B){return Math.round(B)},g=function(B){return y(B/100)*100},v=function(B){return encodeURIComponent(B)},R={br:y,d:y,bl:g,dl:g,mtp:g,nor:v,rtp:g,tb:y},w=Object.keys(i||{}).sort(),C=L(w),x;!(x=C()).done;){var d=x.value,l=i[d];if(!u(l))continue;if(d==="v"&&l===1)continue;if(d=="pr"&&l===1)continue;var A=R[d];A&&(l=A(l));var S=typeof l,D=void 0;d==="ot"||d==="sf"||d==="st"?D=d+"="+l:S==="boolean"?D=d:S==="number"?D=d+"="+l:D=d+"="+JSON.stringify(l),s.push(D)}return s.join(",")},m.toHeaders=function(i){for(var s=Object.keys(i),u={},y=["Object","Request","Session","Status"],g=[{},{},{},{}],v={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 C=w[R],x=v[C]!=null?v[C]:1;g[x][C]=i[C]}for(var d=0;d<g.length;d++){var l=m.serialize(g[d]);l&&(u["CMCD-"+y[d]]=l)}return u},m.toQuery=function(i){return"CMCD="+encodeURIComponent(m.serialize(i))},m.appendQueryToUri=function(i,s){if(!s)return i;var u=i.includes("?")?"&":"?";return""+i+u+s},m}()},"./src/controller/eme-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),H=O("./src/utils/mediakeys-helper.ts");function U(p,m){for(var b=0;b<m.length;b++){var a=m[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function P(p,m,b){return m&&U(p.prototype,m),b&&U(p,b),p}var L=3,h=function(m,b,a){var i={audioCapabilities:[],videoCapabilities:[]};return m.forEach(function(s){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:a.audioRobustness||""})}),b.forEach(function(s){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:a.videoRobustness||""})}),[i]},f=function(m,b,a,i){switch(m){case H.KeySystems.WIDEVINE:return h(b,a,i);default:throw new Error("Unknown key-system: "+m)}},T=function(){function p(b){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=b,this._config=b.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var m=p.prototype;return m.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},m._registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},m._unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},m.getLicenseServerUrl=function(a){switch(a){case H.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 u=this,y=f(a,i,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(a,y);this.mediaKeysPromise=g.then(function(v){return u._onMediaKeySystemAccessObtained(a,v)}),g.catch(function(v){M.logger.error('Failed to obtain key-system "'+a+'" access:',v)})},m._onMediaKeySystemAccessObtained=function(a,i){var s=this;M.logger.log('Access for key-system "'+a+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:a};this._mediaKeysList.push(u);var y=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(g){return u.mediaKeys=g,M.logger.log('Media-keys created for key-system "'+a+'"'),s._onMediaKeysCreated(),g});return y.catch(function(g){M.logger.error("Failed to create media-keys:",g)}),y},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(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(y){if(!i._media)return;i._attemptSetMediaKeys(y),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(X.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,u=this._mediaKeysList[0];if(!u){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var y=u.mediaKeysSession;if(!y){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(X.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(X.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'),u.mediaKeysSessionInitialized=!0,y.generateRequest(a,i).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(g){M.logger.error("Error generating key-session request:",g),s.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},m._createLicenseXhr=function(a,i,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,a,i,s);var y=this._licenseXhrSetup;if(y)try{y.call(this.hls,u,a),y=void 0}catch(g){M.logger.error(g)}try{u.readyState||u.open("POST",a,!0),y&&y.call(this.hls,u,a)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return u},m._onLicenseRequestReadyStageChange=function(a,i,s,u){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var y=a.response,g=this._licenseResponseCallback;if(g)try{y=g.call(this.hls,a,i)}catch(R){M.logger.error(R)}u(y)}else{if(M.logger.error("License Request XHR failed ("+i+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=L-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,u)}break}},m._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case H.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(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),y=this._createLicenseXhr(u,a,i);M.logger.log("Sending license request to URL: "+u);var g=this._generateLicenseRequestChallenge(s,a);y.send(g)}catch(v){M.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(X.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(y){return y.audioCodec}).filter(function(y){return!!y}),u=i.levels.map(function(y){return y.videoCodec}).filter(function(y){return!!y});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,s,u)},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 X=O("./src/events.ts"),F=O("./src/utils/logger.ts"),M=function(){function H(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=H.prototype;return U.setStreamController=function(L){this.streamController=L},U.registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(L,h){var f=this.hls.config;if(f.capLevelOnFPSDrop){var T=h.media instanceof self.HTMLVideoElement?h.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(L,h,f){var T=performance.now();if(h){if(this.lastTime){var p=T-this.lastTime,m=f-this.lastDroppedFrames,b=h-this.lastDecodedFrames,a=1e3*m/p,i=this.hls;if(i.trigger(X.Events.FPS_DROP,{currentDropped:m,currentDecoded:b,totalDroppedFrames:f}),a>0&&m>i.config.fpsDroppedMonitoringThreshold*b){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(X.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=f,this.lastDecodedFrames=h}},U.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var h=L.getVideoPlaybackQuality();this.checkFPS(L,h.totalVideoFrames,h.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},H}();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 H}),O.d(J,"fragmentWithinToleranceTest",function(){return U}),O.d(J,"pdtWithinToleranceTest",function(){return P}),O.d(J,"findFragWithCC",function(){return L});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/binary-search.ts");function M(h,f,T){if(f===null||!Array.isArray(h)||!h.length||!Object(X.isFiniteNumber)(f))return null;var p=h[0].programDateTime;if(f<(p||0))return null;var m=h[h.length-1].endProgramDateTime;if(f>=(m||0))return null;T=T||0;for(var b=0;b<h.length;++b){var a=h[b];if(P(f,T,a))return a}return null}function H(h,f,T,p){T===void 0&&(T=0),p===void 0&&(p=0);var m=null;if(h?m=f[h.sn-f[0].sn+1]||null:T===0&&f[0].start===0&&(m=f[0]),m&&U(T,p,m)===0)return m;var b=F.default.search(f,U.bind(null,T,p));return b||m}function U(h,f,T){h===void 0&&(h=0),f===void 0&&(f=0);var p=Math.min(f,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-p<=h?1:T.start-p>h&&T.start?-1:0}function P(h,f,T){var p=Math.min(f,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,m=T.endProgramDateTime||0;return m-p>h}function L(h,f){return F.default.search(h,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 H});var X=O("./src/events.ts"),F=O("./src/types/loader.ts"),M;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(M||(M={}));var H=function(){function L(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 h=L.prototype;return h._registerListeners=function(){var T=this.hls;T.on(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on(X.Events.FRAG_LOADED,this.onFragLoaded,this)},h._unregisterListeners=function(){var T=this.hls;T.off(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off(X.Events.FRAG_LOADED,this.onFragLoaded,this)},h.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},h.getAppendedFrag=function(T,p){if(p===F.PlaylistLevelType.MAIN){var m=this.activeFragment,b=this.activeParts;if(!m)return null;if(b)for(var a=b.length;a--;){var i=b[a],s=i?i.end:m.appendedPTS;if(i.start<=T&&s!==void 0&&T<=s)return a>9&&(this.activeParts=b.slice(a-9)),i}else if(m.start<=T&&m.appendedPTS!==void 0&&T<=m.appendedPTS)return m}return this.getBufferedFrag(T,p)},h.getBufferedFrag=function(T,p){for(var m=this.fragments,b=Object.keys(m),a=b.length;a--;){var i=m[b[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},h.detectEvictedFragments=function(T,p,m){var b=this;Object.keys(this.fragments).forEach(function(a){var i=b.fragments[a];if(!i)return;if(!i.buffered){i.body.type===m&&b.removeFragment(i.body);return}var s=i.range[T];if(!s)return;s.time.some(function(u){var y=!b.isTimeBuffered(u.startPTS,u.endPTS,p);return y&&b.removeFragment(i.body),y})})},h.detectPartialFragments=function(T){var p=this,m=this.timeRanges,b=T.frag,a=T.part;if(!m||b.sn==="initSegment")return;var i=P(b),s=this.fragments[i];if(!s)return;Object.keys(m).forEach(function(u){var y=b.elementaryStreams[u];if(!y)return;var g=m[u],v=a!==null||y.partial===!0;s.range[u]=p.getBufferedTimes(b,a,v,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},h.fragBuffered=function(T){var p=P(T),m=this.fragments[p];m&&(m.backtrack=m.loaded=null,m.buffered=!0)},h.getBufferedTimes=function(T,p,m,b){for(var a={time:[],partial:m},i=p?p.start:T.start,s=p?p.end:T.end,u=T.minEndPTS||s,y=T.maxStartPTS||i,g=0;g<b.length;g++){var v=b.start(g)-this.bufferPadding,R=b.end(g)+this.bufferPadding;if(y>=v&&u<=R){a.time.push({startPTS:Math.max(i,b.start(g)),endPTS:Math.min(s,b.end(g))});break}else if(i<R&&s>v)a.partial=!0,a.time.push({startPTS:Math.max(i,b.start(g)),endPTS:Math.min(s,b.end(g))});else if(s<=v)break}return a},h.getPartialFragment=function(T){var p=null,m,b,a,i=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(y){var g=u[y];if(!g)return;U(g)&&(b=g.body.start-s,a=g.body.end+s,T>=b&&T<=a&&(m=Math.min(T-b,a-T),i<=m&&(p=g.body,i=m)))}),p},h.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},h.backtrack=function(T,p){var m=P(T),b=this.fragments[m];if(!b||b.backtrack)return null;var a=b.backtrack=p||b.loaded;return b.loaded=null,a},h.getBacktrackData=function(T){var p=P(T),m=this.fragments[p];if(m){var b,a=m.backtrack;if(a!=null&&(b=a.payload)!==null&&b!==void 0&&b.byteLength)return a;this.removeFragment(T)}return null},h.isTimeBuffered=function(T,p,m){for(var b,a,i=0;i<m.length;i++){if(b=m.start(i)-this.bufferPadding,a=m.end(i)+this.bufferPadding,T>=b&&p<=a)return!0;if(p<=b)return!1}return!1},h.onFragLoaded=function(T,p){var m=p.frag,b=p.part;if(m.sn==="initSegment"||m.bitrateTest||b)return;var a=P(m);this.fragments[a]={body:m,loaded:p,backtrack:null,buffered:!1,range:Object.create(null)}},h.onBufferAppended=function(T,p){var m=this,b=p.frag,a=p.part,i=p.timeRanges;if(b.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=b,a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(u){var y=i[u];if(m.detectEvictedFragments(u,y),!a)for(var g=0;g<y.length;g++)b.appendedPTS=Math.max(y.end(g),b.appendedPTS||0)})},h.onFragBuffered=function(T,p){this.detectPartialFragments(p)},h.hasFragment=function(T){var p=P(T);return!!this.fragments[p]},h.removeFragmentsInRange=function(T,p,m){var b=this;Object.keys(this.fragments).forEach(function(a){var i=b.fragments[a];if(!i)return;if(i.buffered){var s=i.body;s.type===m&&s.start<p&&s.end>T&&b.removeFragment(s)}})},h.removeFragment=function(T){var p=P(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[p]},h.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function U(L){var h,f;return L.buffered&&(((h=L.range.video)===null||h===void 0?void 0:h.partial)||((f=L.range.audio)===null||f===void 0?void 0:f.partial))}function P(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.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 L}),O.d(J,"SKIP_BUFFER_RANGE_START",function(){return h}),O.d(J,"default",function(){return f});var X=O("./src/utils/buffer-helper.ts"),F=O("./src/errors.ts"),M=O("./src/events.ts"),H=O("./src/utils/logger.ts"),U=250,P=2,L=.1,h=.05,f=function(){function T(m,b,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=b,this.fragmentTracker=a,this.hls=i}var p=T.prototype;return p.destroy=function(){this.hls=this.fragmentTracker=this.media=null},p.poll=function(b){var a=this.config,i=this.media,s=this.stalled,u=i.currentTime,y=i.seeking,g=this.seeking&&!y,v=!this.seeking&&y;if(this.seeking=y,u!==b){if(this.moved=!0,s!==null){if(this.stallReported){var R=self.performance.now()-s;H.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||g)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!X.BufferHelper.getBuffered(i).length)return;var w=X.BufferHelper.bufferInfo(i,u,0),C=w.len>0,x=w.nextStart||0;if(!C&&!x)return;if(y){var d=w.len>P,l=!x||x-u>P&&!this.fragmentTracker.getPartialFragment(u);if(d||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var A,S=Math.max(x,w.start||0)-u,D=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=D==null||((A=D.details)===null||A===void 0)?void 0:A.live,B=I?D.details.targetduration*2:P;if(S>0&&S<=B){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var z=j-s;!y&&z>=U&&this._reportStall(w.len);var _=X.BufferHelper.bufferInfo(i,u,a.maxBufferHole);this._tryFixBufferStall(_,z)},p._tryFixBufferStall=function(b,a){var i=this.config,s=this.fragmentTracker,u=this.media,y=u.currentTime,g=s.getPartialFragment(y);if(g){var v=this._trySkipBufferHole(g);if(v)return}b.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},p._reportStall=function(b){var a=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+b+")"),a.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},p._trySkipBufferHole=function(b){for(var a=this.config,i=this.hls,s=this.media,u=s.currentTime,y=0,g=X.BufferHelper.getBuffered(s),v=0;v<g.length;v++){var R=g.start(v);if(u+a.maxBufferHole>=y&&u<R){var w=Math.max(R+h,s.currentTime+L);return H.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+w),this.moved=!0,this.stalled=null,s.currentTime=w,b&&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 "+u+" to "+w,frag:b}),w}y=g.end(v)}return 0},p._tryNudgeBuffer=function(){var b=this.config,a=this.hls,i=this.media,s=i.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<b.nudgeMaxRetry){var y=s+u*b.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+s+" to "+y),i.currentTime=y,a.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.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 X=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),M=O("./src/demux/id3.ts"),H=.25,U=function(){function P(h){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=h,this._registerListeners()}var L=P.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var f=this.hls;f.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var f=this.hls;f.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(f,T){this.media=T.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.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")},L.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 b=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,u=a<m.length-1?m[a+1].pts:p.end,y=u-s;y<=0&&(u=s+H);for(var g=0;g<i.length;g++){var v=i[g];if(!M.isTimeStampFrame(v)){var R=new b(s,u,"");R.value=v,this.id3Track.addCue(R)}}}}},L.onBufferFlushing=function(f,T){var p=T.startOffset,m=T.endOffset,b=T.type;if(!b||b==="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 X=O("./src/errors.ts"),F=O("./src/events.ts"),M=O("./src/utils/logger.ts");function H(L,h){for(var f=0;f<h.length;f++){var T=h[f];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(L,T.key,T)}}function U(L,h,f){return h&&H(L.prototype,h),f&&H(L,f),L}var P=function(){function L(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 h=L.prototype;return h.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},h.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)},h.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)},h.onMediaAttached=function(T,p){this.media=p.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},h.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},h.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},h.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)},h.onError=function(T,p){if(p.details!==X.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},h.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 b=this.config,a=b.lowLatencyMode,i=b.maxLiveSyncPlaybackRate;if(!a||i===1)return;var s=this.targetLatency;if(s===null)return;var u=m-s,y=Math.min(this.maxLatency,s+p.targetduration),g=u<y;if(p.live&&g&&u>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,i)),R=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;T.playbackRate=Math.min(v,Math.max(1,R))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)},h.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},h.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},U(L,[{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,b=T.targetduration,a=this.config,i=a.liveSyncDuration,s=a.liveSyncDurationCount,u=a.lowLatencyMode,y=this.hls.userConfig,g=u&&m||p;(y.liveSyncDuration||y.liveSyncDurationCount||g===0)&&(g=i!==void 0?i:s*b);var v=b,R=1;return g+Math.min(this.stallCount*R,v)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),p=this.targetLatency,m=this.levelDetails;if(T===null||p===null||m===null)return null;var b=m.edge,a=T-p-this.edgeStalled,i=b-m.totalduration,s=b-(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}}]),L}()},"./src/controller/level-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return a});var X=O("./src/types/level.ts"),F=O("./src/events.ts"),M=O("./src/errors.ts"),H=O("./src/utils/codecs.ts"),U=O("./src/controller/level-helper.ts"),P=O("./src/controller/base-playlist-controller.ts"),L=O("./src/types/loader.ts");function h(){return h=Object.assign||function(i){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var y in u)Object.prototype.hasOwnProperty.call(u,y)&&(i[y]=u[y])}return i},h.apply(this,arguments)}function f(i,s){for(var u=0;u<s.length;u++){var y=s[u];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(i,y.key,y)}}function T(i,s,u){return s&&f(i.prototype,s),u&&f(i,u),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(y,g){return y.__proto__=g,y},m(i,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(i){p(s,i);function s(y){var g;return g=i.call(this,y,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var u=s.prototype;return u._registerListeners=function(){var g=this.hls;g.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(F.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var g=this.hls;g.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(F.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},u.startLoad=function(){var g=this._levels;g.forEach(function(v){v.loadError=0}),i.prototype.startLoad.call(this)},u.onManifestLoaded=function(g,v){var R=[],w=[],C=[],x,d={},l,A=!1,S=!1,D=!1;if(v.levels.forEach(function(z){var _=z.attrs;A=A||!!(z.width&&z.height),S=S||!!z.videoCodec,D=D||!!z.audioCodec,b&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var N=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;l=d[N],l?l.url.push(z.url):(l=new X.Level(z),d[N]=l,R.push(l)),_&&(_.AUDIO&&Object(U.addGroupId)(l,"audio",_.AUDIO),_.SUBTITLES&&Object(U.addGroupId)(l,"text",_.SUBTITLES))}),(A||S)&&D&&(R=R.filter(function(z){var _=z.videoCodec,N=z.width,$=z.height;return!!_||!!(N&&$)})),R=R.filter(function(z){var _=z.audioCodec,N=z.videoCodec;return(!_||Object(H.isCodecSupportedInMp4)(_,"audio"))&&(!N||Object(H.isCodecSupportedInMp4)(N,"video"))}),v.audioTracks&&(w=v.audioTracks.filter(function(z){return!z.audioCodec||Object(H.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(w)),v.subtitles&&(C=v.subtitles,Object(U.assignTrackIdsByGroup)(C)),R.length>0){x=R[0].bitrate,R.sort(function(z,_){return z.bitrate-_.bitrate}),this._levels=R;for(var I=0;I<R.length;I++)if(R[I].bitrate===x){this._firstLevel=I,this.log("manifest loaded, "+R.length+" level(s) found, first bitrate: "+x);break}var B=D&&!S,j={levels:R,audioTracks:w,subtitleTracks:C,firstLevel:this._firstLevel,stats:v.stats,audio:D,video:S,altAudio:!B&&w.some(function(z){return!!z.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,j),(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:v.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(g,v){if(i.prototype.onError.call(this,g,v),v.fatal)return;var R=v.context,w=this._levels[this.currentLevelIndex];if(R&&(R.type===L.PlaylistContextType.AUDIO_TRACK&&w.audioGroupIds&&R.groupId===w.audioGroupIds[w.urlId]||R.type===L.PlaylistContextType.SUBTITLE_TRACK&&w.textGroupIds&&R.groupId===w.textGroupIds[w.urlId])){this.redundantFailover(this.currentLevelIndex);return}var C=!1,x=!0,d;switch(v.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(v.frag){var l=this._levels[v.frag.level];l?(l.fragmentError++,l.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=v.frag.level)):d=v.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(x=!1),d=R.level),C=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:d=v.level,C=!0;break}d!==void 0&&this.recoverLevel(v,d,C,x)},u.recoverLevel=function(g,v,R,w){var C=g.details,x=this._levels[v];if(x.loadError++,R){var d=this.retryLoadingOrFail(g);if(d)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var l=x.url.length;if(l>1&&x.loadError<l)g.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var A=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==A&&this._levels[A].loadError===0&&(this.warn(C+": switch to "+A),g.levelRetry=!0,this.hls.nextAutoLevel=A)}}},u.redundantFailover=function(g){var v=this._levels[g],R=v.url.length;if(R>1){var w=(v.urlId+1)%R;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(C){C.urlId=w}),this.level=g}},u.onFragLoaded=function(g,v){var R=v.frag;if(R!==void 0&&R.type===L.PlaylistLevelType.MAIN){var w=this._levels[R.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},u.onLevelLoaded=function(g,v){var R,w=v.level,C=v.details,x=this._levels[w];if(!x){var d;this.warn("Invalid level index "+w),(d=v.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(C.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(x.fragmentError===0&&(x.loadError=0,this.retryCount=0),this.playlistLoaded(w,v,x.details)):(R=v.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(C.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(g,v){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var w=-1,C=this.hls.audioTracks[v.id].groupId,x=0;x<R.audioGroupIds.length;x++)if(R.audioGroupIds[x]===C){w=x;break}w!==R.urlId&&(R.urlId=w,this.startLoad())}},u.loadPlaylist=function(g){var v=this.currentLevelIndex,R=this._levels[v];if(this.canLoad&&R&&R.url.length>0){var w=R.urlId,C=R.url[w];if(g)try{C=g.addDirectives(C)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Attempt loading level index "+v+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+w+" "+C),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:C,level:v,id:w,deliveryDirectives:g||null})}},u.removeLevel=function(g,v){var R=function(x,d){return d!==v},w=this._levels.filter(function(C,x){return x!==g?!0:C.url.length>1&&v!==void 0?(C.url=C.url.filter(R),C.audioGroupIds&&(C.audioGroupIds=C.audioGroupIds.filter(R)),C.textGroupIds&&(C.textGroupIds=C.textGroupIds.filter(R)),C.urlId=0,!0):!1}).map(function(C,x){var d=C.details;return d!=null&&d.fragments&&d.fragments.forEach(function(l){l.level=x}),C});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(g){var v,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===g&&(v=R[g])!==null&&v!==void 0&&v.details)return;if(g<0||g>=R.length){var w=g<0;if(this.hls.trigger(F.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:w,reason:"invalid level idx"}),w)return;g=Math.min(g,R.length-1)}this.clearTimer();var C=this.currentLevelIndex,x=R[C],d=R[g];this.log("switching to level "+g+" from "+C),this.currentLevelIndex=g;var l=h({},d,{level:g,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete l._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,l);var A=d.details;if(!A||A.live){var S=this.switchParams(d.uri,x==null?void 0:x.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),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 H}),O.d(J,"updatePTS",function(){return U}),O.d(J,"updateFragPTSDTS",function(){return L}),O.d(J,"mergeDetails",function(){return h}),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 b}),O.d(J,"getFragmentWithSN",function(){return a}),O.d(J,"getPartWith",function(){return i});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts");function M(s,u,y){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(y);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(y);break}}function H(s){var u={};s.forEach(function(y){var g=y.groupId||"";y.id=u[g]=u[g]||0,u[g]++})}function U(s,u,y){var g=s[u],v=s[y];P(g,v)}function P(s,u){var y=u.startPTS;if(Object(X.isFiniteNumber)(y)){var g=0,v;u.sn>s.sn?(g=y-s.start,v=s):(g=s.start-y,v=u),v.duration!==g&&(v.duration=g)}else if(u.sn>s.sn){var R=s.cc===u.cc;R&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function L(s,u,y,g,v,R){var w=g-y;w<=0&&(F.logger.warn("Fragment should have a positive duration",u),g=y+u.duration,R=v+u.duration);var C=y,x=g,d=u.startPTS,l=u.endPTS;if(Object(X.isFiniteNumber)(d)){var A=Math.abs(d-y);Object(X.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(A,u.deltaPTS):u.deltaPTS=A,C=Math.max(y,d),y=Math.min(y,d),v=Math.min(v,u.startDTS),x=Math.min(g,l),g=Math.max(g,l),R=Math.max(R,u.endDTS)}u.duration=g-y;var S=y-u.start;u.appendedPTS=g,u.start=u.startPTS=y,u.maxStartPTS=C,u.startDTS=v,u.endPTS=g,u.minEndPTS=x,u.endDTS=R;var D=u.sn;if(!s||D<s.startSN||D>s.endSN)return 0;var I,B=D-s.startSN,j=s.fragments;for(j[B]=u,I=B;I>0;I--)P(j[I],j[I-1]);for(I=B;I<j.length-1;I++)P(j[I],j[I+1]);return s.fragmentHint&&P(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function h(s,u){for(var y=null,g=s.fragments,v=g.length-1;v>=0;v--){var R=g[v].initSegment;if(R){y=R;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var w=0,C;if(T(s,u,function(I,B){I.relurl&&(w=I.cc-B.cc),Object(X.isFiniteNumber)(I.startPTS)&&Object(X.isFiniteNumber)(I.endPTS)&&(B.start=B.startPTS=I.startPTS,B.startDTS=I.startDTS,B.appendedPTS=I.appendedPTS,B.maxStartPTS=I.maxStartPTS,B.endPTS=I.endPTS,B.endDTS=I.endDTS,B.minEndPTS=I.minEndPTS,B.duration=I.endPTS-I.startPTS,B.duration&&(C=B),u.PTSKnown=u.alignedSliding=!0),B.elementaryStreams=I.elementaryStreams,B.loader=I.loader,B.stats=I.stats,B.urlId=I.urlId,I.initSegment&&(B.initSegment=I.initSegment,y=I.initSegment)}),y){var x=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;x.forEach(function(I){var B;(!I.initSegment||I.initSegment.relurl===((B=y)===null||B===void 0?void 0:B.relurl))&&(I.initSegment=y)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(I){return!I}),u.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var l=u.fragments;if(w){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var A=0;A<l.length;A++)l[A].cc+=w}u.skippedSegments&&(u.startCC=u.fragments[0].cc),f(s.partList,u.partList,function(I,B){B.elementaryStreams=I.elementaryStreams,B.stats=I.stats}),C?L(u,C,C.startPTS,C.endPTS,C.startDTS,C.endDTS):p(s,u),l.length&&(u.totalduration=u.edge-l[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var S=u.advancedDateTime;if(u.advanced&&S){var D=u.edge;u.driftStart||(u.driftStartTime=S,u.driftStart=D),u.driftEndTime=S,u.driftEnd=D}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function f(s,u,y){if(s&&u)for(var g=0,v=0,R=s.length;v<=R;v++){var w=s[v],C=u[v+g];w&&C&&w.index===C.index&&w.fragment.sn===C.fragment.sn?y(w,C):g--}}function T(s,u,y){for(var g=u.skippedSegments,v=Math.max(s.startSN,u.startSN)-u.startSN,R=(s.fragmentHint?1:0)+(g?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,w=u.startSN-s.startSN,C=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,x=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=v;d<=R;d++){var l=x[w+d],A=C[d];g&&!A&&d<g&&(A=u.fragments[d]=l),l&&A&&y(l,A)}}function p(s,u){var y=u.startSN+u.skippedSegments-s.startSN,g=s.fragments;if(y<0||y>=g.length)return;m(u,g[y].start)}function m(s,u){if(u){for(var y=s.fragments,g=s.skippedSegments;g<y.length;g++)y[g].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function b(s,u){var y=1e3*s.levelTargetDuration,g=y/2,v=s.age,R=v>0&&v<y*3,w=u.loading.end-u.loading.start,C,x=s.availabilityDelay;if(s.updated===!1)if(R){var d=333*s.misses;C=Math.max(Math.min(g,w*2),d),s.availabilityDelay=(s.availabilityDelay||0)+C}else C=g;else R?(x=Math.min(x||y/2,v),s.availabilityDelay=x,C=x+y-v):C=y-w;return Math.round(C)}function a(s,u,y){if(!s||!s.details)return null;var g=s.details,v=g.fragments[u-g.startSN];return v||(v=g.fragmentHint,v&&v.sn===u?v:u<g.startSN&&y&&y.sn===u?y:null)}function i(s,u,y){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var v=g.length;v--;){var R=g[v];if(R.index===y&&R.fragment.sn===u)return R}return null}},"./src/controller/stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return g});var X=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),M=O("./src/is-supported.ts"),H=O("./src/events.ts"),U=O("./src/utils/buffer-helper.ts"),P=O("./src/controller/fragment-tracker.ts"),L=O("./src/types/loader.ts"),h=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"),b=O("./src/utils/logger.ts");function a(v,R){for(var w=0;w<R.length;w++){var C=R[w];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}function i(v,R,w){return R&&a(v.prototype,R),w&&a(v,w),v}function s(v,R){v.prototype=Object.create(R.prototype),v.prototype.constructor=v,u(v,R)}function u(v,R){return u=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},u(v,R)}var y=100,g=function(v){s(R,v);function R(C,x){var d;return d=v.call(this,C,x,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var w=R.prototype;return w._registerListeners=function(){var x=this.hls;x.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),x.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.on(H.Events.ERROR,this.onError,this),x.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),x.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var x=this.hls;x.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.off(H.Events.ERROR,this.onError,this),x.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),x.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},w.startLoad=function(x){if(this.levels){var d=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(y),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var A=l.startLevel;A===-1&&(l.config.testBandwidth?(A=0,this.bitrateTest=!0):A=l.nextAutoLevel),this.level=l.nextLoadLevel=A,this.loadedmetadata=!1}d>0&&x===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),x=d),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=x,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},w.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},w.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var x,d=this.levels,l=this.level,A=d==null||((x=d[l])===null||x===void 0)?void 0:x.details;if(A&&(!A.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(A))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var S,D=self.performance.now(),I=this.retryDate;(!I||D>=I||(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(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var x,d,l=this.hls,A=this.levelLastLoaded,S=this.levels,D=this.media,I=l.config,B=l.nextLoadLevel;if(A===null||!D&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[B])return;var j=S[B];this.level=l.nextLoadLevel=B;var z=j.details;if(!z||this.state===F.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==B){this.state=F.State.WAITING_LEVEL;return}var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:D,L.PlaylistLevelType.MAIN);if(_===null)return;var N=_.len,$=this.getMaxBufferLength(j.maxBitrate);if(N>=$)return;if(this._streamEnded(_,z)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,q),this.state=F.State.ENDED;return}var le=_.end,pe=this.getNextFragment(le,z);if(this.couldBacktrack&&!this.fragPrevious&&pe&&pe.sn!=="initSegment"){var Pe=pe.sn-z.startSN;Pe>1&&(pe=z.fragments[Pe-1],this.fragmentTracker.removeFragment(pe))}if(pe&&this.fragmentTracker.getState(pe)===P.FragmentState.OK&&this.nextLoadPosition>le){var Se=this.audioOnly&&!this.altAudio?h.ElementaryStreamTypes.AUDIO:h.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(D,Se,L.PlaylistLevelType.MAIN),pe=this.getNextFragment(this.nextLoadPosition,z)}if(!pe)return;pe.initSegment&&!pe.initSegment.data&&!this.bitrateTest&&(pe=pe.initSegment),((x=pe.decryptdata)===null||x===void 0?void 0:x.keyFormat)==="identity"&&!((d=pe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(pe,z):this.loadFragment(pe,z,le)},w.loadFragment=function(x,d,l){var A,S=this.fragmentTracker.getState(x);if(this.fragCurrent=x,S===P.FragmentState.BACKTRACKED){var D=this.fragmentTracker.getBacktrackData(x);if(D){this._handleFragmentLoadProgress(D),this._handleFragmentLoadComplete(D);return}else S=P.FragmentState.NOT_LOADED}S===P.FragmentState.NOT_LOADED||S===P.FragmentState.PARTIAL?x.sn==="initSegment"?this._loadInitSegment(x):this.bitrateTest?(x.bitrateTest=!0,this.log("Fragment "+x.sn+" of level "+x.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(x)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,x,d,l)):S===P.FragmentState.APPENDING?this.reduceMaxBufferLength(x.duration)&&this.fragmentTracker.removeFragment(x):((A=this.media)===null||A===void 0?void 0:A.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(x){var d=this.fragmentTracker.getAppendedFrag(x,L.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},w.getBufferedFrag=function(x){return this.fragmentTracker.getBufferedFrag(x,L.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(x){return x?this.getBufferedFrag(x.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var x=this.levels,d=this.media;if(d!=null&&d.readyState){var l,A=this.getAppendedFrag(d.currentTime);if(A&&A.start>1&&this.flushMainBuffer(0,A.start-1),!d.paused&&x){var S=this.hls.nextLoadLevel,D=x[S],I=this.fragLastKbps;I&&this.fragCurrent?l=this.fragCurrent.duration*D.maxBitrate/(1e3*I)+1:l=0}else l=0;var B=this.getBufferedFrag(d.currentTime+l);if(B){var j=this.followingBufferedFrag(B);if(j){this.abortCurrentFrag();var z=j.maxStartPTS?j.maxStartPTS:j.start,_=j.duration,N=Math.max(B.end,z+Math.min(Math.max(_-this.config.maxFragLookUpTolerance,_*.5),_*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},w.abortCurrentFrag=function(){var x=this.fragCurrent;this.fragCurrent=null,x!=null&&x.loader&&x.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},w.flushMainBuffer=function(x,d){v.prototype.flushMainBuffer.call(this,x,d,this.altAudio?"video":null)},w.onMediaAttached=function(x,d){v.prototype.onMediaAttached.call(this,x,d);var l=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new p.default(this.config,l,this.fragmentTracker,this.hls)},w.onMediaDetaching=function(){var x=this.media;x&&(x.removeEventListener("playing",this.onvplaying),x.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},w.onMediaPlaying=function(){this.tick()},w.onMediaSeeked=function(){var x=this.media,d=x?x.currentTime:null;Object(X.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},w.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},w.onManifestParsed=function(x,d){var l=!1,A=!1,S;d.levels.forEach(function(D){S=D.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(l=!0),S.indexOf("mp4a.40.5")!==-1&&(A=!0))}),this.audioCodecSwitch=l&&A&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},w.onLevelLoading=function(x,d){var l=this.levels;if(!l||this.state!==F.State.IDLE)return;var A=l[d.level];(!A.details||A.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(A.details))&&(this.state=F.State.WAITING_LEVEL)},w.onLevelLoaded=function(x,d){var l,A=this.levels,S=d.level,D=d.details,I=D.totalduration;if(!A){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:"+I);var B=this.fragCurrent;B&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==d.level&&B.loader&&(this.state=F.State.IDLE,B.loader.abort()));var j=A[S],z=0;if(D.live||(l=j.details)!==null&&l!==void 0&&l.live){if(D.fragments[0]||(D.deltaUpdateFailed=!0),D.deltaUpdateFailed)return;z=this.alignPlaylists(D,j.details)}if(j.details=D,this.levelLastLoaded=S,this.hls.trigger(H.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,z),this.tick()},w._handleFragmentLoadProgress=function(x){var d,l=x.frag,A=x.part,S=x.payload,D=this.levels;if(!D){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var I=D[l.level],B=I.details;if(!B){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var j=I.videoCodec,z=B.PTSKnown||!B.live,_=(d=l.initSegment)===null||d===void 0?void 0:d.data,N=this._getAudioCodec(I),$=this.transmuxer=this.transmuxer||new f.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=A?A.index:-1,le=q!==-1,pe=new T.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,S.byteLength,q,le),Pe=this.initPTS[l.cc];$.push(S,_,N,j,l,A,B.totalduration,z,pe,Pe)},w.onAudioTrackSwitching=function(x,d){var l=this.altAudio,A=!!d.url,S=d.id;if(!A){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 I=this.hls;l&&I.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:S})}},w.onAudioTrackSwitched=function(x,d){var l=d.id,A=!!this.hls.audioTracks[l].url;if(A){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=A,this.tick()},w.onBufferCreated=function(x,d){var l=d.tracks,A,S,D=!1;for(var I in l){var B=l[I];if(B.id==="main"){if(S=I,A=B,I==="video"){var j=l[I];j&&(this.videoBuffer=j.buffer)}}else D=!0}D&&A?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=A.buffer):this.mediaBuffer=this.media},w.onFragBuffered=function(x,d){var l=d.frag,A=d.part;if(l&&l.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(A?" p: "+A.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var S=A?A.stats:l.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,A)},w.onError=function(x,d){switch(d.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(L.PlaylistLevelType.MAIN,d);break;case m.ErrorDetails.LEVEL_LOAD_ERROR:case m.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=F.State.ERROR):!d.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var l=!0,A=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);A&&A.len>.5&&(l=!this.reduceMaxBufferLength(A.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.checkBuffer=function(){var x=this.media,d=this.gapController;if(!x||!d||!x.readyState)return;var l=U.BufferHelper.getBuffered(x);!this.loadedmetadata&&l.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=x.currentTime},w.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(x,d){var l=d.type;if(l!==h.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var A=(l===h.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(A,l,L.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(x,d){this.levels=d.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.seekToStartPos=function(){var x=this.media,d=x.currentTime,l=this.startPosition;if(l>=0&&d<l){if(x.seeking){b.logger.log("could not seek to "+l+", already seeking at "+d);return}var A=U.BufferHelper.getBuffered(x),S=A.length?A.start(0):0,D=S-l;D>0&&(D<this.config.maxBufferHole||D<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+D+" to match buffer start"),l+=D,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+d),x.currentTime=l}},w._getAudioCodec=function(x){var d=this.config.defaultAudioCodec||x.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},w._loadBitrateTestFrag=function(x){var d=this;this._doFragLoad(x).then(function(l){var A=d.hls;if(!l||A.nextLoadLevel||d.fragContextChanged(x))return;d.fragLoadError=0,d.state=F.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var S=x.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),A.trigger(H.Events.FRAG_LOADED,l)})},w._handleTransmuxComplete=function(x){var d,l="main",A=this.hls,S=x.remuxResult,D=x.chunkMeta,I=this.getCurrentContext(D);if(!I){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=I.frag,j=I.part,z=I.level,_=S.video,N=S.text,$=S.id3,q=S.initSegment,le=this.altAudio?void 0:S.audio;if(this.fragContextChanged(B))return;if(this.state=F.State.PARSING,q){q.tracks&&(this._bufferInitSegment(z,q.tracks,B,D),A.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:l,tracks:q.tracks}));var pe=q.initPTS,Pe=q.timescale;Object(X.isFiniteNumber)(pe)&&(this.initPTS[B.cc]=pe,A.trigger(H.Events.INIT_PTS_FOUND,{frag:B,id:l,initPTS:pe,timescale:Pe}))}if(_&&S.independent!==!1){if(z.details){var Se=_.startPTS,ke=_.endPTS,Ae=_.startDTS,Te=_.endDTS;if(j)j.elementaryStreams[_.type]={startPTS:Se,endPTS:ke,startDTS:Ae,endDTS:Te};else if(_.firstKeyFrame&&_.independent&&(this.couldBacktrack=!0),_.dropped&&_.independent){var ge=this.getLoadPosition()+this.config.maxBufferHole;if(ge<Se){this.backtrack(B);return}B.setElementaryStreamInfo(_.type,B.start,ke,B.start,Te,!0)}B.setElementaryStreamInfo(_.type,Se,ke,Ae,Te),this.bufferFragmentData(_,B,j,D)}}else if(S.independent===!1){this.backtrack(B);return}if(le){var he=le.startPTS,re=le.endPTS,de=le.startDTS,se=le.endDTS;j&&(j.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:re,startDTS:de,endDTS:se}),B.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,he,re,de,se),this.bufferFragmentData(le,B,j,D)}if($!=null&&(d=$.samples)!==null&&d!==void 0&&d.length){var Oe={frag:B,id:l,samples:$.samples};A.trigger(H.Events.FRAG_PARSING_METADATA,Oe)}if(N){var ie={frag:B,id:l,samples:N.samples};A.trigger(H.Events.FRAG_PARSING_USERDATA,ie)}},w._bufferInitSegment=function(x,d,l,A){var S=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var D=d.audio,I=d.video,B=d.audiovideo;if(D){var j=x.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),D.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(j="mp4a.40.5")),z.indexOf("android")!==-1&&D.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),x.audioCodec&&x.audioCodec!==j&&this.log('Swapping manifest audio codec "'+x.audioCodec+'" for "'+j+'"'),D.levelCodec=j,D.id="main",this.log("Init audio buffer, container:"+D.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(x.audioCodec||"")+"/"+D.codec+"]")}I&&(I.levelCodec=x.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(x.videoCodec||"")+"/"+I.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(x.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(_){var N=d[_],$=N.initSegment;$!=null&&$.byteLength&&S.hls.trigger(H.Events.BUFFER_APPENDING,{type:_,data:$,frag:l,part:null,chunkMeta:A,parent:l.type})}),this.tick()},w.backtrack=function(x){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(x);var d=this.fragmentTracker.backtrack(x);this.fragPrevious=null,this.nextLoadPosition=x.start,d?this.resetFragmentLoading(x):this.state=F.State.BACKTRACKING},w.checkFragmentChanged=function(){var x=this.media,d=null;if(x&&x.readyState>1&&x.seeking===!1){var l=x.currentTime;if(U.BufferHelper.isBuffered(x,l)?d=this.getAppendedFrag(l):U.BufferHelper.isBuffered(x,l+.1)&&(d=this.getAppendedFrag(l+.1)),d){var A=this.fragPlaying,S=d.level;(!A||d.sn!==A.sn||A.level!==S||d.urlId!==A.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:d}),(!A||A.level!==S)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=d)}}},i(R,[{key:"nextLevel",get:function(){var x=this.nextBufferedFrag;return x?x.level:-1}},{key:"currentLevel",get:function(){var x=this.media;if(x){var d=this.getAppendedFrag(x.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var x=this.media;if(x){var d=this.getAppendedFrag(x.currentTime);return this.followingBufferedFrag(d)}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 X=O("./src/events.ts"),F=O("./src/utils/logger.ts"),M=O("./src/utils/buffer-helper.ts"),H=O("./src/controller/fragment-finders.ts"),U=O("./src/utils/discontinuities.ts"),P=O("./src/controller/level-helper.ts"),L=O("./src/controller/fragment-tracker.ts"),h=O("./src/controller/base-stream-controller.ts"),f=O("./src/types/loader.ts"),T=O("./src/types/level.ts");function p(u,y){for(var g=0;g<y.length;g++){var v=y[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(u,v.key,v)}}function m(u,y,g){return y&&p(u.prototype,y),g&&p(u,g),u}function b(u,y){u.prototype=Object.create(y.prototype),u.prototype.constructor=u,a(u,y)}function a(u,y){return a=Object.setPrototypeOf||function(v,R){return v.__proto__=R,v},a(u,y)}var i=500,s=function(u){b(y,u);function y(v,R){var w;return w=u.call(this,v,R,"[subtitle-stream-controller]")||this,w.levels=[],w.currentTrackId=-1,w.tracksBuffered=[],w.mainDetails=null,w._registerListeners(),w}var g=y.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var R=this.hls;R.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.on(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on(X.Events.ERROR,this.onError,this),R.on(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.on(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.on(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var R=this.hls;R.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.off(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off(X.Events.ERROR,this.onError,this),R.off(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.off(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.off(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=h.State.IDLE,this.setInterval(i),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(R,w){this.mainDetails=w.details},g.onSubtitleFragProcessed=function(R,w){var C=w.frag,x=w.success;if(this.fragPrevious=C,this.state=h.State.IDLE,!x)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var l,A=C.start,S=0;S<d.length;S++)if(A>=d[S].start&&A<=d[S].end){l=d[S];break}var D=C.start+C.duration;l?l.end=D:(l={start:A,end:D},d.push(l)),this.fragmentTracker.fragBuffered(C)},g.onBufferFlushing=function(R,w){var C=w.startOffset,x=w.endOffset;if(C===0&&x!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,l=this.levels;if(!l.length||!l[d]||!l[d].details)return;var A=l[d].details,S=A.targetduration,D=x-S;if(D<=0)return;w.endOffsetSubtitles=Math.max(0,D),this.tracksBuffered.forEach(function(I){for(var B=0;B<I.length;){if(I[B].end<=D){I.shift();continue}else if(I[B].start<D)I[B].start=D;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(C,D,f.PlaylistLevelType.SUBTITLE)}},g.onError=function(R,w){var C,x=w.frag;if(!x||x.type!==f.PlaylistLevelType.SUBTITLE)return;(C=this.fragCurrent)!==null&&C!==void 0&&C.loader&&this.fragCurrent.loader.abort(),this.state=h.State.IDLE},g.onSubtitleTracksUpdated=function(R,w){var C=this,x=w.subtitleTracks;this.tracksBuffered=[],this.levels=x.map(function(d){return new T.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){C.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(R,w){if(this.currentTrackId=w.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var C=this.levels[this.currentTrackId];C!=null&&C.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,C&&this.setInterval(i)},g.onSubtitleTrackLoaded=function(R,w){var C,x=w.details,d=w.id,l=this.currentTrackId,A=this.levels;if(!A.length)return;var S=A[l];if(d>=A.length||d!==l||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,x.live||(C=S.details)!==null&&C!==void 0&&C.live){var D=this.mainDetails;if(x.deltaUpdateFailed||!D)return;var I=D.fragments[0];if(!S.details)x.hasProgramDateTime&&D.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(x,D):I&&Object(P.addSliding)(x,I.start);else{var B=this.alignPlaylists(x,S.details);B===0&&I&&Object(P.addSliding)(x,I.start)}}if(S.details=x,this.levelLastLoaded=d,this.tick(),x.live&&!this.fragCurrent&&this.media&&this.state===h.State.IDLE){var j=Object(H.findFragmentByPTS)(null,x.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},g._handleFragmentLoadComplete=function(R){var w=R.frag,C=R.payload,x=w.decryptdata,d=this.hls;if(this.fragContextChanged(w))return;if(C&&C.byteLength>0&&x&&x.key&&x.iv&&x.method==="AES-128"){var l=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(C),x.key.buffer,x.iv.buffer).then(function(A){var S=performance.now();d.trigger(X.Events.FRAG_DECRYPTED,{frag:w,payload:A,stats:{tstart:l,tdecrypt:S}})})}},g.doTick=function(){if(!this.media){this.state=h.State.IDLE;return}if(this.state===h.State.IDLE){var R,w=this.currentTrackId,C=this.levels;if(!C.length||!C[w]||!C[w].details)return;var x=C[w].details,d=x.targetduration,l=this.config,A=this.media,S=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,A.currentTime-d,l.maxBufferHole),D=S.end,I=S.len,B=this.getMaxBufferLength()+d;if(I>B)return;console.assert(x,"Subtitle track details are defined on idle subtitle stream controller tick");var j=x.fragments,z=j.length,_=x.edge,N,$=this.fragPrevious;if(D<_){var q=l.maxFragLookUpTolerance;$&&x.hasProgramDateTime&&(N=Object(H.findFragmentByPDT)(j,$.endProgramDateTime,q)),N||(N=Object(H.findFragmentByPTS)($,j,D,q),!N&&$&&$.start<j[0].start&&(N=j[0]))}else N=j[z-1];(R=N)!==null&&R!==void 0&&R.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=h.State.KEY_LOADING,this.hls.trigger(X.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===L.FragmentState.NOT_LOADED&&this.loadFragment(N,x,D)}},g.loadFragment=function(R,w,C){this.fragCurrent=R,u.prototype.loadFragment.call(this,R,w,C)},m(y,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),y}(h.default)},"./src/controller/subtitle-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),M=O("./src/controller/base-playlist-controller.ts"),H=O("./src/types/loader.ts");function U(p,m){for(var b=0;b<m.length;b++){var a=m[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function P(p,m,b){return m&&U(p.prototype,m),b&&U(p,b),p}function L(p,m){p.prototype=Object.create(m.prototype),p.prototype.constructor=p,h(p,m)}function h(p,m){return h=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},h(p,m)}var f=function(p){L(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 b=m.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,p.prototype.destroy.call(this)},b.registerListeners=function(){var i=this.hls;i.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(X.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var i=this.hls;i.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(X.Events.ERROR,this.onError,this)},b.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)},b.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var i=T(this.media.textTracks);i.forEach(function(s){Object(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(i,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(i,s){var u=s.id,y=s.details,g=this.trackId,v=this.tracksInGroup[g];if(!v){this.warn("Invalid subtitle track id "+u);return}var R=v.details;v.details=s.details,this.log("subtitle track "+u+" loaded ["+y.startSN+"-"+y.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,R))},b.onLevelLoading=function(i,s){this.switchLevel(s.level)},b.onLevelSwitching=function(i,s){this.switchLevel(s.level)},b.switchLevel=function(i){var s=this.hls.levels[i];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var y=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(w){return!u||w.groupId===u});this.tracksInGroup=g;var v=this.findTrackId(y==null?void 0:y.name)||this.findTrackId();this.groupId=u;var R={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(X.Events.SUBTITLE_TRACKS_UPDATED,R),v!==-1&&this.setSubtitleTrack(v,y)}},b.findTrackId=function(i){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var y=s[u];if((!this.selectDefaultTrack||y.default)&&(!i||i===y.name))return y.id}return-1},b.onError=function(i,s){if(p.prototype.onError.call(this,i,s),s.fatal||!s.context)return;s.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(i){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,y=s.groupId,g=s.url;if(i)try{g=i.addDirectives(g)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(X.Events.SUBTITLE_TRACK_LOADING,{url:g,id:u,groupId:y,deliveryDirectives:i||null})}},b.toggleTrackModes=function(i){var s=this,u=this.media,y=this.subtitleDisplay,g=this.trackId;if(!u)return;var v=T(u.textTracks),R=v.filter(function(x){return x.groupId===s.groupId});if(i===-1)[].slice.call(v).forEach(function(x){x.mode="disabled"});else{var w=R[g];w&&(w.mode="disabled")}var C=R[i];C&&(C.mode=y?"showing":"hidden")},b.setSubtitleTrack=function(i,s){var u,y=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(u=y[i])!==null&&u!==void 0&&u.details)||i<-1||i>=y.length)return;this.clearTimer();var g=y[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,g){var v=g.id,R=g.groupId,w=R===void 0?"":R,C=g.name,x=g.type,d=g.url;this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:w,name:C,type:x,url:d});var l=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(l)}else this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:i})},b.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),u=0;u<s.length;u++)if(s[u].mode==="hidden")i=u;else if(s[u].mode==="showing"){i=u;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=[],b=0;b<p.length;b++){var a=p[b];a.kind==="subtitles"&&a.label&&m.push(p[b])}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 X=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),M=O("./src/utils/cea-608-parser.ts"),H=O("./src/utils/output-filter.ts"),U=O("./src/utils/webvtt-parser.ts"),P=O("./src/utils/texttrack-utils.ts"),L=O("./src/utils/imsc1-ttml-parser.ts"),h=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=b(),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 u=new H.default(this,"textTrack1"),y=new H.default(this,"textTrack2"),g=new H.default(this,"textTrack3"),v=new H.default(this,"textTrack4");this.cea608Parser1=new M.default(1,u,y),this.cea608Parser2=new M.default(3,g,v)}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 u=this.hls;u.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(F.Events.FRAG_LOADING,this.onFragLoading,this),u.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(u,y,g,v,R){for(var w=!1,C=R.length;C--;){var x=R[C],d=m(x[0],x[1],y,g);if(d>=0&&(x[0]=Math.min(x[0],y),x[1]=Math.max(x[1],g),w=!0,d/(g-y)>.5))return}if(w||R.push([y,g]),this.config.renderTextTracksNatively){var l=this.captionsTracks[u];this.Cues.newCue(l,y,g,v)}else{var A=this.Cues.newCue(null,y,g,v);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:A,track:u})}},i.onInitPtsFound=function(u,y){var g=this,v=y.frag,R=y.id,w=y.initPTS,C=y.timescale,x=this.unparsedVttFrags;R==="main"&&(this.initPTS[v.cc]=w,this.timescale[v.cc]=C),x.length&&(this.unparsedVttFrags=[],x.forEach(function(d){g.onFragLoaded(F.Events.FRAG_LOADED,d)}))},i.getExistingTrack=function(u){var y=this.media;if(y)for(var g=0;g<y.textTracks.length;g++){var v=y.textTracks[g];if(v[u])return v}return null},i.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},i.createNativeTrack=function(u){if(this.captionsTracks[u])return;var y=this.captionsProperties,g=this.captionsTracks,v=this.media,R=y[u],w=R.label,C=R.languageCode,x=this.getExistingTrack(u);if(x)g[u]=x,Object(P.clearCurrentCues)(g[u]),Object(P.sendAddTrackEvent)(g[u],v);else{var d=this.createTextTrack("captions",w,C);d&&(d[u]=!0,g[u]=d)}},i.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var y=this.captionsProperties[u];if(!y)return;var g=y.label,v={_id:u,label:g,kind:"captions",default:y.media?!!y.media.default:!1,closedCaptions:y.media};this.nonNativeCaptionsTracks[u]=v,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},i.createTextTrack=function(u,y,g){var v=this.media;return v?v.addTextTrack(u,y,g):void 0},i.onMediaAttaching=function(u,y){this.media=y.media,this._cleanTracks()},i.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(y){Object(P.clearCurrentCues)(u[y]),delete u[y]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},i._cleanTracks=function(){var u=this.media;if(!u)return;var y=u.textTracks;if(y)for(var g=0;g<y.length;g++)Object(P.clearCurrentCues)(y[g])},i.onSubtitleTracksUpdated=function(u,y){var g=this;this.textTracks=[];var v=y.subtitleTracks||[],R=v.some(function(d){return d.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||R&&this.config.enableIMSC1){var w=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var C=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,l){var A;if(l<C.length){for(var S=null,D=0;D<C.length;D++)if(p(C[D],d)){S=C[D];break}S&&(A=S)}A?Object(P.clearCurrentCues)(A):(A=g.createTextTrack("subtitles",d.name,d.lang),A&&(A.mode="disabled")),A&&(A.groupId=d.groupId,g.textTracks.push(A))})}else if(!w&&this.tracks&&this.tracks.length){var x=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:x})}}},i.onManifestLoaded=function(u,y){var g=this;this.config.enableCEA708Captions&&y.captions&&y.captions.forEach(function(v){var R=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!R)return;var w="textTrack"+R[1],C=g.captionsProperties[w];if(!C)return;C.label=v.name,v.lang&&(C.languageCode=v.lang),C.media=v})},i.onFragLoading=function(u,y){var g=this.cea608Parser1,v=this.cea608Parser2,R=this.lastSn,w=this.lastPartIndex;if(!this.enabled||!(g&&v))return;if(y.frag.type===h.PlaylistLevelType.MAIN){var C,x,d=y.frag.sn,l=(C=y==null||((x=y.part)===null||x===void 0)?void 0:x.index)!=null?C:-1;d===R+1||d===R&&l===w+1||(g.reset(),v.reset()),this.lastSn=d,this.lastPartIndex=l}},i.onFragLoaded=function(u,y){var g=y.frag,v=y.payload,R=this.initPTS,w=this.unparsedVttFrags;if(g.type===h.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(X.isFiniteNumber)(R[g.cc])){w.push(y),R.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var C=g.decryptdata;if(C==null||C.key==null||C.method!=="AES-128"){var x=this.tracks[g.level],d=this.vttCCs;d[g.cc]||(d[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),x&&x.textCodec===L.IMSC1_CODEC?this._parseIMSC1(g,v):this._parseVTTs(g,v,d)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(u,y){var g=this,v=this.hls;Object(L.parseIMSC1)(y,this.initPTS[u.cc],this.timescale[u.cc],function(R){g._appendCues(R,u.level),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(R){f.logger.log("Failed to parse IMSC1: "+R),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:R})})},i._parseVTTs=function(u,y,g){var v=this,R=this.hls;Object(U.parseWebVTT)(y,this.initPTS[u.cc],this.timescale[u.cc],g,u.cc,u.start,function(w){v._appendCues(w,u.level),R.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(w){v._fallbackToIMSC1(u,y),f.logger.log("Failed to parse VTT cue: "+w),R.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:w})})},i._fallbackToIMSC1=function(u,y){var g=this,v=this.tracks[u.level];v.textCodec||Object(L.parseIMSC1)(y,this.initPTS[u.cc],this.timescale[u.cc],function(){v.textCodec=L.IMSC1_CODEC,g._parseIMSC1(u,y)},function(){v.textCodec="wvtt"})},i._appendCues=function(u,y){var g=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[y];if(v.mode==="disabled")return;u.forEach(function(C){return Object(P.addCueToTrack)(v,C)})}else{var R=this.tracks[y],w=R.default?"default":"subtitles"+y;g.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:u,track:w})}},i.onFragDecrypted=function(u,y){var g=y.frag;if(g.type===h.PlaylistLevelType.SUBTITLE){if(!Object(X.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(y);return}this.onFragLoaded(F.Events.FRAG_LOADED,y)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(u,y){var g=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(g&&v))return;for(var R=0;R<y.samples.length;R++){var w=y.samples[R].bytes;if(w){var C=this.extractCea608Data(w);g.addData(y.samples[R].pts,C[0]),v.addData(y.samples[R].pts,C[1])}}},i.onBufferFlushing=function(u,y){var g=y.startOffset,v=y.endOffset,R=y.endOffsetSubtitles,w=y.type,C=this.media;if(!C||C.currentTime<v)return;if(!w||w==="video"){var x=this.captionsTracks;Object.keys(x).forEach(function(l){return Object(P.removeCuesInRange)(x[l],g,v)})}if(this.config.renderTextTracksNatively&&(g===0&&R!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(l){return Object(P.removeCuesInRange)(d[l],g,R)})}},i.extractCea608Data=function(u){for(var y=u[0]&31,g=2,v=[[],[]],R=0;R<y;R++){var w=u[g++],C=127&u[g++],x=127&u[g++],d=(4&w)!==0,l=3&w;if(C===0&&x===0)continue;d&&((l===0||l===1)&&(v[l].push(C),v[l].push(x)))}return v},a}();function p(a,i){return a&&a.label===i.name&&!(a.textTrack1||a.textTrack2)}function m(a,i,s,u){return Math.min(i,u)-Math.max(a,s)}function b(){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 X});var X=function(){function F(H,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,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 X=O("./src/utils/typed-array.ts");function F(H){var U=H.byteLength,P=U&&new DataView(H.buffer).getUint8(U-1);return P?Object(X.sliceUint8)(H,0,U-P):H}var M=function(){function H(){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=H.prototype;return U.uint8ArrayToUint32Array_=function(L){for(var h=new DataView(L),f=new Uint32Array(4),T=0;T<4;T++)f[T]=h.getUint32(T*4);return f},U.initTable=function(){var L=this.sBox,h=this.invSBox,f=this.subMix,T=f[0],p=f[1],m=f[2],b=f[3],a=this.invSubMix,i=a[0],s=a[1],u=a[2],y=a[3],g=new Uint32Array(256),v=0,R=0,w=0;for(w=0;w<256;w++)w<128?g[w]=w<<1:g[w]=w<<1^283;for(w=0;w<256;w++){var C=R^R<<1^R<<2^R<<3^R<<4;C=C>>>8^C&255^99,L[v]=C,h[C]=v;var x=g[v],d=g[x],l=g[d],A=g[C]*257^C*16843008;T[v]=A<<24|A>>>8,p[v]=A<<16|A>>>16,m[v]=A<<8|A>>>24,b[v]=A,A=l*16843009^d*65537^x*257^v*16843008,i[C]=A<<24|A>>>8,s[C]=A<<16|A>>>16,u[C]=A<<8|A>>>24,y[C]=A,v?(v=x^g[g[g[l^x]]],R^=g[g[R]]):v=R=1}},U.expandKey=function(L){for(var h=this.uint8ArrayToUint32Array_(L),f=!0,T=0;T<h.length&&f;)f=h[T]===this.key[T],T++;if(f)return;this.key=h;var p=this.keySize=h.length;if(p!==4&&p!==6&&p!==8)throw new Error("Invalid aes key size="+p);var m=this.ksRows=(p+6+1)*4,b,a,i=this.keySchedule=new Uint32Array(m),s=this.invKeySchedule=new Uint32Array(m),u=this.sBox,y=this.rcon,g=this.invSubMix,v=g[0],R=g[1],w=g[2],C=g[3],x,d;for(b=0;b<m;b++){if(b<p){x=i[b]=h[b];continue}d=x,b%p===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=y[b/p|0]<<24):p>6&&b%p===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),i[b]=x=(i[b-p]^d)>>>0}for(a=0;a<m;a++)b=m-a,a&3?d=i[b]:d=i[b-4],a<4||b<=4?s[a]=d:s[a]=v[u[d>>>24]]^R[u[d>>>16&255]]^w[u[d>>>8&255]]^C[u[d&255]],s[a]=s[a]>>>0},U.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},U.decrypt=function(L,h,f){for(var T=this.keySize+6,p=this.invKeySchedule,m=this.invSBox,b=this.invSubMix,a=b[0],i=b[1],s=b[2],u=b[3],y=this.uint8ArrayToUint32Array_(f),g=y[0],v=y[1],R=y[2],w=y[3],C=new Int32Array(L),x=new Int32Array(C.length),d,l,A,S,D,I,B,j,z,_,N,$,q,le,pe=this.networkToHostOrderSwap;h<C.length;){for(z=pe(C[h]),_=pe(C[h+1]),N=pe(C[h+2]),$=pe(C[h+3]),D=z^p[0],I=$^p[1],B=N^p[2],j=_^p[3],q=4,le=1;le<T;le++)d=a[D>>>24]^i[I>>16&255]^s[B>>8&255]^u[j&255]^p[q],l=a[I>>>24]^i[B>>16&255]^s[j>>8&255]^u[D&255]^p[q+1],A=a[B>>>24]^i[j>>16&255]^s[D>>8&255]^u[I&255]^p[q+2],S=a[j>>>24]^i[D>>16&255]^s[I>>8&255]^u[B&255]^p[q+3],D=d,I=l,B=A,j=S,q=q+4;d=m[D>>>24]<<24^m[I>>16&255]<<16^m[B>>8&255]<<8^m[j&255]^p[q],l=m[I>>>24]<<24^m[B>>16&255]<<16^m[j>>8&255]<<8^m[D&255]^p[q+1],A=m[B>>>24]<<24^m[j>>16&255]<<16^m[D>>8&255]<<8^m[I&255]^p[q+2],S=m[j>>>24]<<24^m[D>>16&255]<<16^m[I>>8&255]<<8^m[B&255]^p[q+3],x[h]=pe(d^g),x[h+1]=pe(S^v),x[h+2]=pe(A^R),x[h+3]=pe(l^w),g=z,v=_,R=N,w=$,h=h+4}return x.buffer},H}()},"./src/crypt/decrypter.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return h});var X=O("./src/crypt/aes-crypto.ts"),F=O("./src/crypt/fast-aes-key.ts"),M=O("./src/crypt/aes-decryptor.ts"),H=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),P=O("./src/utils/typed-array.ts"),L=16,h=function(){function f(p,m,b){var a=b===void 0?{}:b,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 u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(y){}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 b=new Uint8Array(m);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(b):b},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(m,b,a,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(m),b,a);var s=this.flush();s&&i(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(m),b,a).then(i)},T.softwareDecrypt=function(m,b,a){var i=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(m=Object(U.appendUint8Array)(u,m),this.remainderData=null);var y=this.getValidChunk(m);if(!y.length)return null;i&&(a=i);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new M.default),g.expandKey(b);var v=s;return this.currentResult=g.decrypt(y.buffer,0,a),this.currentIV=Object(P.sliceUint8)(y,-16).buffer,v||null},T.webCryptoDecrypt=function(m,b,a){var i=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new F.default(s,b)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var y=new X.default(s,a);return y.decrypt(m.buffer,u)}).catch(function(u){return i.onWebCryptoError(u,m,b,a)})},T.onWebCryptoError=function(m,b,a,i){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",m),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,a,i)},T.getValidChunk=function(m){var b=m,a=m.length-m.length%L;return a!==m.length&&(b=Object(P.sliceUint8)(m,0,a),this.remainderData=Object(P.sliceUint8)(m,a)),b},T.logOnce=function(m){if(!this.logEnabled)return;H.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 X});var X=function(){function F(H,U){this.subtle=void 0,this.key=void 0,this.subtle=H,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 X=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/adts.ts"),M=O("./src/utils/logger.ts"),H=O("./src/demux/id3.ts");function U(h,f){h.prototype=Object.create(f.prototype),h.prototype.constructor=h,P(h,f)}function P(h,f){return P=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},P(h,f)}var L=function(h){U(f,h);function f(p,m){var b;return b=h.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=p,b.config=m,b}var T=f.prototype;return T.resetInitSegment=function(m,b,a){h.prototype.resetInitSegment.call(this,m,b,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 b=H.getID3Data(m,0)||[],a=b.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,b){return F.canParse(m,b)},T.appendFrame=function(m,b,a){F.initTrackConfig(m,this.observer,b,a,m.manifestCodec);var i=F.appendFrame(m,b,a,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},f}(X.default);L.minProbeByteLength=9,J.default=L},"./src/demux/adts.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"getAudioConfig",function(){return H}),O.d(J,"isHeaderPattern",function(){return U}),O.d(J,"getHeaderLength",function(){return P}),O.d(J,"getFullFrameLength",function(){return L}),O.d(J,"canGetFrameLength",function(){return h}),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 b}),O.d(J,"parseFrameHeader",function(){return a}),O.d(J,"appendFrame",function(){return i});var X=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),M=O("./src/events.ts");function H(s,u,y,g){var v,R,w,C,x=navigator.userAgent.toLowerCase(),d=g,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((u[y+2]&192)>>>6)+1;var A=(u[y+2]&60)>>>2;if(A>l.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:"+A});return}return w=(u[y+2]&1)<<2,w|=(u[y+3]&192)>>>6,X.logger.log("manifest codec:"+g+", ADTS type:"+v+", samplingIndex:"+A),/firefox/i.test(x)?A>=6?(v=5,C=new Array(4),R=A-3):(v=2,C=new Array(2),R=A):x.indexOf("android")!==-1?(v=2,C=new Array(2),R=A):(v=5,C=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&A>=6?R=A-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(A>=6&&w===1||/vivaldi/i.test(x))||!g&&w===1)&&(v=2,C=new Array(2)),R=A)),C[0]=v<<3,C[0]|=(A&14)>>1,C[1]|=(A&1)<<7,C[1]|=w<<3,v===5&&(C[1]|=(R&14)>>1,C[2]=(R&1)<<7,C[2]|=2<<2,C[3]=0),{config:C,samplerate:l[A],channelCount:w,codec:"mp4a.40."+v,manifestCodec:d}}function U(s,u){return s[u]===255&&(s[u+1]&246)===240}function P(s,u){return s[u+1]&1?7:9}function L(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function h(s,u){return u+5<s.length}function f(s,u){return u+1<s.length&&U(s,u)}function T(s,u){return h(s,u)&&U(s,u)&&L(s,u)<=s.length-u}function p(s,u){if(f(s,u)){var y=P(s,u);if(u+y>=s.length)return!1;var g=L(s,u);if(g<=y)return!1;var v=u+g;return v===s.length||f(s,v)}return!1}function m(s,u,y,g,v){if(!s.samplerate){var R=H(u,y,g,v);if(!R)return;s.config=R.config,s.samplerate=R.samplerate,s.channelCount=R.channelCount,s.codec=R.codec,s.manifestCodec=R.manifestCodec,X.logger.log("parsed codec:"+s.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function b(s){return 1024*9e4/s}function a(s,u,y,g,v){var R=P(s,u),w=L(s,u);if(w-=R,w>0){var C=y+g*v;return{headerLength:R,frameLength:w,stamp:C}}}function i(s,u,y,g,v){var R=b(s.samplerate),w=a(u,y,g,v,R);if(w){var C=w.frameLength,x=w.headerLength,d=w.stamp,l=x+C,A=Math.max(0,y+l-u.length),S;A?(S=new Uint8Array(l-x),S.set(u.subarray(y+x,u.length),0)):S=u.subarray(y+x,y+l);var D={unit:S,pts:d};return A||s.samples.push(D),{sample:D,length:l,missing:A}}}},"./src/demux/base-audio-demuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"initPTSFn",function(){return L});var X=O("./src/polyfills/number.ts"),F=O("./src/demux/id3.ts"),M=O("./src/demux/dummy-demuxed-track.ts"),H=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/typed-array.ts"),P=function(){function h(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var f=h.prototype;return f.resetInitSegment=function(p,m,b){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,b){},f.demux=function(p,m){this.cachedData&&(p=Object(H.appendUint8Array)(this.cachedData,p),this.cachedData=null);var b=F.getID3Data(p,0),a=b?b.length:0,i,s,u=this._audioTrack,y=this._id3Track,g=b?F.getTimeStamp(b):void 0,v=p.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(g,m)),b&&b.length>0&&y.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;a<v;){if(this.canParse(p,a)){var R=this.appendFrame(u,p,a);R?(this.frameIndex++,s=R.sample.pts,a+=R.length,i=a):a=v}else F.canParse(p,a)?(b=F.getID3Data(p,a),y.samples.push({pts:s,dts:s,data:b}),a+=b.length,i=a):a++;if(a===v&&i!==v){var w=Object(U.sliceUint8)(p,i);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,w):this.cachedData=w}}return{audioTrack:u,avcTrack:Object(M.dummyTrack)(),id3Track:y,textTrack:Object(M.dummyTrack)()}},f.demuxSampleAes=function(p,m,b){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(){},h}(),L=function(f,T){return Object(X.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 X});var X=function(){function M(){this.chunks=[],this.dataLength=0}var H=M.prototype;return H.push=function(P){this.chunks.push(P),this.dataLength+=P.length},H.flush=function(){var P=this.chunks,L=this.dataLength,h;if(P.length)P.length===1?h=P[0]:h=F(P,L);else return new Uint8Array(0);return this.reset(),h},H.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function F(M,H){for(var U=new Uint8Array(H),P=0,L=0;L<M.length;L++){var h=M[L];U.set(h,P),P+=h.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"dummyTrack",function(){return X});function X(){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 X=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 H=M.prototype;return H.loadWord=function(){var P=this.data,L=this.bytesAvailable,h=P.byteLength-L,f=new Uint8Array(4),T=Math.min(4,L);if(T===0)throw new Error("no bytes available");f.set(P.subarray(h,h+T)),this.word=new DataView(f.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},H.skipBits=function(P){var L;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,L=P>>3,P-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},H.readBits=function(P){var L=Math.min(this.bitsAvailable,P),h=this.word>>>32-L;return P>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=P-L,L>0&&this.bitsAvailable?h<<L|this.readBits(L):h},H.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()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},H.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(P){for(var L=8,h=8,f,T=0;T<P;T++)h!==0&&(f=this.readEG(),h=(L+f+256)%256),L=h===0?L:h},H.readSPS=function(){var P=0,L=0,h=0,f=0,T,p,m,b=this.readUByte.bind(this),a=this.readBits.bind(this),i=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),y=this.skipEG.bind(this),g=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);b();var R=b();if(a(5),u(3),b(),g(),R===100||R===110||R===122||R===244||R===44||R===83||R===86||R===118||R===128){var w=i();if(w===3&&u(1),g(),g(),u(1),s())for(p=w!==3?8:12,m=0;m<p;m++)s()&&(m<6?v(16):v(64))}g();var C=i();if(C===0)i();else if(C===1)for(u(1),y(),y(),T=i(),m=0;m<T;m++)y();g(),u(1);var x=i(),d=i(),l=a(1);l===0&&u(1),u(1),s()&&(P=i(),L=i(),h=i(),f=i());var A=[1,1];if(s()&&s()){var S=b();switch(S){case 1:A=[1,1];break;case 2:A=[12,11];break;case 3:A=[10,11];break;case 4:A=[16,11];break;case 5:A=[40,33];break;case 6:A=[24,11];break;case 7:A=[20,11];break;case 8:A=[32,11];break;case 9:A=[80,33];break;case 10:A=[18,11];break;case 11:A=[15,11];break;case 12:A=[64,33];break;case 13:A=[160,99];break;case 14:A=[4,3];break;case 15:A=[3,2];break;case 16:A=[2,1];break;case 255:{A=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((x+1)*16-P*2-L*2),height:(2-l)*(d+1)*16-(l?2:4)*(h+f),pixelRatio:A}},H.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 X}),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 L}),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 X=function(v,R){return R+10<=v.length&&(v[R]===73&&v[R+1]===68&&v[R+2]===51&&(v[R+3]<255&&v[R+4]<255&&(v[R+6]<128&&v[R+7]<128&&v[R+8]<128&&v[R+9]<128)))},F=function(v,R){return R+10<=v.length&&(v[R]===51&&v[R+1]===68&&v[R+2]===73&&(v[R+3]<255&&v[R+4]<255&&(v[R+6]<128&&v[R+7]<128&&v[R+8]<128&&v[R+9]<128)))},M=function(v,R){for(var w=R,C=0;X(v,R);){C+=10;var x=H(v,R+6);C+=x,F(v,R+10)&&(C+=10),R+=C}return C>0?v.subarray(w,w+C):void 0},H=function(v,R){var w=0;return w=(v[R]&127)<<21,w|=(v[R+1]&127)<<14,w|=(v[R+2]&127)<<7,w|=v[R+3]&127,w},U=function(v,R){return X(v,R)&&H(v,R+6)+10<=v.length-R},P=function(v){for(var R=f(v),w=0;w<R.length;w++){var C=R[w];if(L(C))return a(C)}return},L=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},h=function(v){var R=String.fromCharCode(v[0],v[1],v[2],v[3]),w=H(v,4),C=10;return{type:R,size:w,data:v.subarray(C,C+w)}},f=function(v){for(var R=0,w=[];X(v,R);){var C=H(v,R+6);R+=10;for(var x=R+C;R+8<x;){var d=h(v.subarray(R)),l=T(d);l&&w.push(l),R+=d.size+10}F(v,R)&&(R+=10)}return w},T=function(v){return v.type==="PRIV"?p(v):v.type[0]==="W"?b(v):m(v)},p=function(v){if(v.size<2)return;var R=i(v.data,!0),w=new Uint8Array(v.data.subarray(R.length+1));return{key:v.type,info:R,data:w.buffer}},m=function(v){if(v.size<2)return;if(v.type==="TXXX"){var R=1,w=i(v.data.subarray(R),!0);R+=w.length+1;var C=i(v.data.subarray(R));return{key:v.type,info:w,data:C}}var x=i(v.data.subarray(1));return{key:v.type,data:x}},b=function(v){if(v.type==="WXXX"){if(v.size<2)return;var R=1,w=i(v.data.subarray(R),!0);R+=w.length+1;var C=i(v.data.subarray(R));return{key:v.type,info:w,data:C}}var x=i(v.data);return{key:v.type,data:x}},a=function(v){if(v.data.byteLength===8){var R=new Uint8Array(v.data),w=R[3]&1,C=(R[4]<<23)+(R[5]<<15)+(R[6]<<7)+R[7];return C/=45,w&&(C+=4772185884e-2),Math.round(C)}return},i=function(v,R){R===void 0&&(R=!1);var w=y();if(w){var C=w.decode(v);if(R){var x=C.indexOf("\0");return x!==-1?C.substring(0,x):C}return C.replace(/\0/g,"")}for(var d=v.length,l,A,S,D="",I=0;I<d;){if(l=v[I++],l===0&&R)return D;if(l===0||l===3)continue;switch(l>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:D+=String.fromCharCode(l);break;case 12:case 13:A=v[I++],D+=String.fromCharCode((l&31)<<6|A&63);break;case 14:A=v[I++],S=v[I++],D+=String.fromCharCode((l&15)<<12|(A&63)<<6|(S&63)<<0);break;default:}}return D},s={decodeTextFrame:m},u;function y(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/id3.ts"),M=O("./src/utils/logger.ts"),H=O("./src/demux/mpegaudio.ts");function U(h,f){h.prototype=Object.create(f.prototype),h.prototype.constructor=h,P(h,f)}function P(h,f){return P=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},P(h,f)}var L=function(h){U(f,h);function f(){return h.apply(this,arguments)||this}var T=f.prototype;return T.resetInitSegment=function(m,b,a){h.prototype.resetInitSegment.call(this,m,b,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 b=F.getID3Data(m,0)||[],a=b.length,i=m.length;a<i;a++)if(H.probe(m,a))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(m,b){return H.canParse(m,b)},T.appendFrame=function(m,b,a){return this.initPTS===null?void 0:H.appendFrame(m,b,a,this.initPTS,this.frameIndex)},f}(X.default);L.minProbeByteLength=4,J.default=L},"./src/demux/mp4demuxer.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/mp4-tools.ts"),F=O("./src/demux/dummy-demuxed-track.ts"),M=function(){function H(P,L){this.remainderData=null,this.config=void 0,this.config=L}var U=H.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},H.probe=function(L){return Object(X.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},U.demux=function(L){var h=L,f=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(h=Object(X.appendUint8Array)(this.remainderData,L));var T=Object(X.segmentValidRange)(h);this.remainderData=T.remainder,f.samples=T.valid||new Uint8Array}else f.samples=h;return{audioTrack:Object(F.dummyTrack)(),avcTrack:f,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},U.flush=function(){var L=Object(F.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:L,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},U.demuxSampleAes=function(L,h,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},H}();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 L}),O.d(J,"isHeaderPattern",function(){return h}),O.d(J,"isHeader",function(){return f}),O.d(J,"canParse",function(){return T}),O.d(J,"probe",function(){return p});var X=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],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function P(m,b,a,i,s){if(a+24>b.length)return;var u=L(b,a);if(u&&a+u.frameLength<=b.length){var y=u.samplesPerFrame*9e4/u.sampleRate,g=i+s*y,v={unit:b.subarray(a,a+u.frameLength),pts:g,dts:g};return m.config=[],m.channelCount=u.channelCount,m.samplerate=u.sampleRate,m.samples.push(v),{sample:v,length:u.frameLength,missing:0}}}function L(m,b){var a=m[b+1]>>3&3,i=m[b+1]>>1&3,s=m[b+2]>>4&15,u=m[b+2]>>2&3;if(a!==1&&s!==0&&s!==15&&u!==3){var y=m[b+2]>>1&1,g=m[b+3]>>6,v=a===3?3-i:i===3?3:4,R=F[v*14+s-1]*1e3,w=a===3?0:a===2?1:2,C=M[w*3+u],x=g===3?1:2,d=H[a][i],l=U[i],A=d*8*l,S=Math.floor(d*R/C+y)*l;if(X===null){var D=navigator.userAgent||"",I=D.match(/Chrome\/(\d+)/i);X=I?parseInt(I[1]):0}var B=!!X&&X<=87;return B&&i===2&&R>=224e3&&g===0&&(m[b+3]=m[b+3]|128),{sampleRate:C,channelCount:x,frameLength:S,samplesPerFrame:A}}}function h(m,b){return m[b]===255&&(m[b+1]&224)===224&&(m[b+1]&6)!==0}function f(m,b){return b+1<m.length&&h(m,b)}function T(m,b){var a=4;return h(m,b)&&a<=m.length-b}function p(m,b){if(b+1<m.length&&h(m,b)){var a=4,i=L(m,b),s=a;i!=null&&i.frameLength&&(s=i.frameLength);var u=b+s;return u===m.length||f(m,u)}return!1}},"./src/demux/sample-aes.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/crypt/decrypter.ts"),F=O("./src/demux/tsdemuxer.ts"),M=function(){function H(P,L,h){this.keyData=void 0,this.decrypter=void 0,this.keyData=h,this.decrypter=new X.default(P,L,{removePKCS7Padding:!1})}var U=H.prototype;return U.decryptBuffer=function(L,h){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,h)},U.decryptAacSample=function(L,h,f,T){var p=L[h].unit,m=p.subarray(16,p.length-p.length%16),b=m.buffer.slice(m.byteOffset,m.byteOffset+m.length),a=this;this.decryptBuffer(b,function(i){var s=new Uint8Array(i);p.set(s,16),T||a.decryptAacSamples(L,h+1,f)})},U.decryptAacSamples=function(L,h,f){for(;;h++){if(h>=L.length){f();return}if(L[h].unit.length<32)continue;var T=this.decrypter.isSync();if(this.decryptAacSample(L,h,f,T),!T)return}},U.getAvcEncryptedData=function(L){for(var h=Math.floor((L.length-48)/160)*16+16,f=new Int8Array(h),T=0,p=32;p<=L.length-16;p+=160,T+=16)f.set(L.subarray(p,p+16),T);return f},U.getAvcDecryptedUnit=function(L,h){for(var f=new Uint8Array(h),T=0,p=32;p<=L.length-16;p+=160,T+=16)L.set(f.subarray(T,T+16),p);return L},U.decryptAvcSample=function(L,h,f,T,p,m){var b=Object(F.discardEPB)(p.data),a=this.getAvcEncryptedData(b),i=this;this.decryptBuffer(a.buffer,function(s){p.data=i.getAvcDecryptedUnit(b,s),m||i.decryptAvcSamples(L,h,f+1,T)})},U.decryptAvcSamples=function(L,h,f,T){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;h++,f=0){if(h>=L.length){T();return}for(var p=L[h].units;!(f>=p.length);f++){var m=p[f];if(m.data.length<=48||m.type!==1&&m.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(L,h,f,T,m,b),!b)return}}},H}();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 X=O("./node_modules/webworkify-webpack/index.js"),F=O.n(X),M=O("./src/events.ts"),H=O("./src/demux/transmuxer.ts"),U=O("./src/utils/logger.ts"),P=O("./src/errors.ts"),L=O("./src/utils/mediasource-helper.ts"),h=O("./node_modules/eventemitter3/index.js"),f=O.n(h),T=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},p=function(){function m(a,i,s,u){var y=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=u;var g=a.config,v=function(d,l){l=l||{},l.frag=y.frag,l.id=y.id,a.trigger(d,l)};this.observer=new h.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,v),this.observer.on(M.Events.ERROR,v);var R={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var C;try{C=this.worker=X("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),C.addEventListener("message",this.onwmsg),C.onerror=function(x){a.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(x.message+" ("+x.filename+":"+x.lineno+")")})},C.postMessage({cmd:"init",typeSupported:R,vendor:w,id:i,config:JSON.stringify(g)})}catch(x){U.logger.warn("Error in worker:",x),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),C&&self.URL.revokeObjectURL(C.objectURL),this.transmuxer=new H.default(this.observer,R,g,w,i),this.worker=null}}else this.transmuxer=new H.default(this.observer,R,g,w,i)}var b=m.prototype;return b.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 u=this.observer;u&&u.removeAllListeners(),this.observer=null},b.push=function(i,s,u,y,g,v,R,w,C,x){var d=this;C.transmuxing.start=self.performance.now();var l=this.transmuxer,A=this.worker,S=v?v.start:g.start,D=g.decryptdata,I=this.frag,B=!(I&&g.cc===I.cc),j=!(I&&C.level===I.level),z=I?C.sn-I.sn:-1,_=this.part?C.part-this.part.index:1,N=!j&&(z===1||z===0&&_===1),$=self.performance.now();(j||z||g.stats.parsing.start===0)&&(g.stats.parsing.start=$),v&&(_||!N)&&(v.stats.parsing.start=$);var q=new H.TransmuxState(B,N,w,j,S);if(!N||B){U.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+C.sn+" p: "+C.part+" level: "+C.level+" id: "+C.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+w+`
|
|
timeOffset: `+S);var le=new H.TransmuxConfig(u,y,s,R,x);this.configureTransmuxer(le)}if(this.frag=g,this.part=v,A)A.postMessage({cmd:"demux",data:i,decryptdata:D,chunkMeta:C,state:q},i instanceof ArrayBuffer?[i]:[]);else if(l){var pe=l.push(i,D,C,q);Object(H.isPromise)(pe)?pe.then(function(Pe){d.handleTransmuxComplete(Pe)}):this.handleTransmuxComplete(pe)}},b.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var u=this.transmuxer,y=this.worker;if(y)y.postMessage({cmd:"flush",chunkMeta:i});else if(u){var g=u.flush(i);Object(H.isPromise)(g)?g.then(function(v){s.handleFlushResult(v,i)}):this.handleFlushResult(g,i)}},b.handleFlushResult=function(i,s){var u=this;i.forEach(function(y){u.handleTransmuxComplete(y)}),this.onFlush(s)},b.onWorkerMessage=function(i){var s=i.data,u=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,u.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(i){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:i}):u&&u.configure(i)},b.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 X=O("./src/demux/transmuxer.ts"),F=O("./src/events.ts"),M=O("./src/utils/logger.ts"),H=O("./node_modules/eventemitter3/index.js"),U=O.n(H);function P(p){var m=new H.EventEmitter,b=function(i,s){p.postMessage({event:i,data:s})};m.on(F.Events.FRAG_DECRYPTED,b),m.on(F.Events.ERROR,b),p.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);p.transmuxer=new X.default(m,i.typeSupported,s,i.vendor,i.id),Object(M.enableLogs)(s.debug),b("init",null);break}case"configure":{p.transmuxer.configure(i.config);break}case"demux":{var u=p.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(X.isPromise)(u)?u.then(function(v){L(p,v)}):L(p,u);break}case"flush":{var y=i.chunkMeta,g=p.transmuxer.flush(y);Object(X.isPromise)(g)?g.then(function(v){f(p,v,y)}):f(p,g,y);break}default:break}})}function L(p,m){if(T(m.remuxResult))return;var b=[],a=m.remuxResult,i=a.audio,s=a.video;i&&h(b,i),s&&h(b,s),p.postMessage({event:"transmuxComplete",data:m},b)}function h(p,m){m.data1&&p.push(m.data1.buffer),m.data2&&p.push(m.data2.buffer)}function f(p,m,b){m.forEach(function(a){L(p,a)}),p.postMessage({event:"flush",data:b})}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 g}),O.d(J,"TransmuxConfig",function(){return v}),O.d(J,"TransmuxState",function(){return R});var X=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/crypt/decrypter.ts"),H=O("./src/demux/aacdemuxer.ts"),U=O("./src/demux/mp4demuxer.ts"),P=O("./src/demux/tsdemuxer.ts"),L=O("./src/demux/mp3demuxer.ts"),h=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"),b;try{b=self.performance.now.bind(self.performance)}catch(w){m.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var a=[{demux:P.default,remux:h.default},{demux:U.default,remux:f.default},{demux:H.default,remux:h.default},{demux:L.default,remux:h.default}],i=1024;a.forEach(function(w){var C=w.demux;i=Math.max(i,C.minProbeByteLength)});var s=function(){function w(x,d,l,A,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=x,this.typeSupported=d,this.config=l,this.vendor=A,this.id=S}var C=w.prototype;return C.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},C.push=function(d,l,A,S){var D=this,I=A.transmuxing;I.executeStart=b();var B=new Uint8Array(d),j=this.cache,z=this.config,_=this.currentTransmuxState,N=this.transmuxConfig;S&&(this.currentTransmuxState=S);var $=u(B,l);if($&&$.method==="AES-128"){var q=this.getDecrypter();if(z.enableSoftwareAES){var le=q.softwareDecrypt(B,$.key.buffer,$.iv.buffer);if(!le)return I.executeEnd=b(),y(A);B=new Uint8Array(le)}else return this.decryptionPromise=q.webCryptoDecrypt(B,$.key.buffer,$.iv.buffer).then(function(be){var De=D.push(be,null,A);return D.decryptionPromise=null,De}),this.decryptionPromise}var pe=S||_,Pe=pe.contiguous,Se=pe.discontinuity,ke=pe.trackSwitch,Ae=pe.accurateTimeOffset,Te=pe.timeOffset,ge=N.audioCodec,he=N.videoCodec,re=N.defaultInitPts,de=N.duration,se=N.initSegmentData;if((Se||ke)&&this.resetInitSegment(se,ge,he,de),Se&&this.resetInitialTimestamp(re),Pe||this.resetContiguity(),this.needsProbing(B,Se,ke)){if(j.dataLength){var Oe=j.flush();B=Object(p.appendUint8Array)(Oe,B)}this.configureTransmuxer(B,N)}var ie=this.transmux(B,$,Te,Ae,A),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,I.executeEnd=b(),ie},C.flush=function(d){var l=this,A=d.transmuxing;A.executeStart=b();var S=this.decrypter,D=this.cache,I=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return l.flush(d)});var j=[],z=I.timeOffset;if(S){var _=S.flush();_&&j.push(this.push(_,null,d))}var N=D.dataLength;D.reset();var $=this.demuxer,q=this.remuxer;if(!$||!q)return N>=i&&this.observer.emit(X.Events.ERROR,X.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),A.executeEnd=b(),[y(d)];var le=$.flush(z);return g(le)?le.then(function(pe){return l.flushRemux(j,pe,d),j}):(this.flushRemux(j,le,d),j)},C.flushRemux=function(d,l,A){var S=l.audioTrack,D=l.avcTrack,I=l.id3Track,B=l.textTrack,j=this.currentTransmuxState,z=j.accurateTimeOffset,_=j.timeOffset;m.logger.log("[transmuxer.ts]: Flushed fragment "+A.sn+(A.part>-1?" p: "+A.part:"")+" of level "+A.level);var N=this.remuxer.remux(S,D,I,B,_,z,!0,this.id);d.push({remuxResult:N,chunkMeta:A}),A.transmuxing.executeEnd=b()},C.resetInitialTimestamp=function(d){var l=this.demuxer,A=this.remuxer;if(!l||!A)return;l.resetTimeStamp(d),A.resetTimeStamp(d)},C.resetContiguity=function(){var d=this.demuxer,l=this.remuxer;if(!d||!l)return;d.resetContiguity(),l.resetNextTimestamp()},C.resetInitSegment=function(d,l,A,S){var D=this.demuxer,I=this.remuxer;if(!D||!I)return;D.resetInitSegment(l,A,S),I.resetInitSegment(d,l,A)},C.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},C.transmux=function(d,l,A,S,D){var I;return l&&l.method==="SAMPLE-AES"?I=this.transmuxSampleAes(d,l,A,S,D):I=this.transmuxUnencrypted(d,A,S,D),I},C.transmuxUnencrypted=function(d,l,A,S){var D=this.demuxer.demux(d,l,!1,!this.config.progressive),I=D.audioTrack,B=D.avcTrack,j=D.id3Track,z=D.textTrack,_=this.remuxer.remux(I,B,j,z,l,A,!1,this.id);return{remuxResult:_,chunkMeta:S}},C.transmuxSampleAes=function(d,l,A,S,D){var I=this;return this.demuxer.demuxSampleAes(d,l,A).then(function(B){var j=I.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,A,S,!1,I.id);return{remuxResult:j,chunkMeta:D}})},C.configureTransmuxer=function(d,l){for(var A=this.config,S=this.observer,D=this.typeSupported,I=this.vendor,B=l.audioCodec,j=l.defaultInitPts,z=l.duration,_=l.initSegmentData,N=l.videoCodec,$,q=0,le=a.length;q<le;q++)if(a[q].demux.probe(d)){$=a[q];break}$||(m.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:U.default,remux:f.default});var pe=this.demuxer,Pe=this.remuxer,Se=$.remux,ke=$.demux;(!Pe||!(Pe instanceof Se))&&(this.remuxer=new Se(S,A,D,I)),(!pe||!(pe instanceof ke))&&(this.demuxer=new ke(S,A,D),this.probe=ke.probe),this.resetInitSegment(_,B,N,z),this.resetInitialTimestamp(j)},C.needsProbing=function(d,l,A){return!this.demuxer||!this.remuxer||l||A},C.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new M.default(this.observer,this.config)),d},w}();function u(w,C){var x=null;return w.byteLength>0&&C!=null&&C.key!=null&&C.iv!==null&&C.method!=null&&(x=C),x}var y=function(C){return{remuxResult:{},chunkMeta:C}};function g(w){return"then"in w&&w.then instanceof Function}var v=function(C,x,d,l,A){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=C,this.videoCodec=x,this.initSegmentData=d,this.duration=l,this.defaultInitPts=A},R=function(C,x,d,l,A){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=C,this.contiguous=x,this.accurateTimeOffset=d,this.trackSwitch=l,this.timeOffset=A}},"./src/demux/tsdemuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"discardEPB",function(){return y});var X=O("./src/demux/adts.ts"),F=O("./src/demux/mpegaudio.ts"),M=O("./src/demux/exp-golomb.ts"),H=O("./src/demux/id3.ts"),U=O("./src/demux/sample-aes.ts"),P=O("./src/events.ts"),L=O("./src/utils/mp4-tools.ts"),h=O("./src/utils/logger.ts"),f=O("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},p=function(){function g(R,w,C){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=R,this.config=w,this.typeSupported=C}g.probe=function(w){var C=g.syncOffset(w);return C<0?!1:(C&&h.logger.warn("MPEG2-TS detected but first sync word found @ offset "+C+", junk ahead ?"),!0)},g.syncOffset=function(w){for(var C=Math.min(1e3,w.length-3*188),x=0;x<C;){if(w[x]===71&&w[x+188]===71&&w[x+2*188]===71)return x;x++}return-1},g.createTrack=function(w,C){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"?C:void 0}};var v=g.prototype;return v.resetInitSegment=function(w,C,x){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",x),this._audioTrack=g.createTrack("audio",x),this._id3Track=g.createTrack("id3",x),this._txtTrack=g.createTrack("text",x),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=w,this.videoCodec=C,this._duration=x},v.resetTimeStamp=function(){},v.resetContiguity=function(){var w=this._audioTrack,C=this._avcTrack,x=this._id3Track;w&&(w.pesData=null),C&&(C.pesData=null),x&&(x.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(w,C,x,d){x===void 0&&(x=!1),d===void 0&&(d=!1),x||(this.sampleAes=null);var l,A=this._avcTrack,S=this._audioTrack,D=this._id3Track,I=A.pid,B=A.pesData,j=S.pid,z=D.pid,_=S.pesData,N=D.pesData,$=!1,q=this.pmtParsed,le=this._pmtId,pe=w.length;if(this.remainderData&&(w=Object(L.appendUint8Array)(this.remainderData,w),pe=w.length,this.remainderData=null),pe<188&&!d)return this.remainderData=w,{audioTrack:S,avcTrack:A,id3Track:D,textTrack:this._txtTrack};var Pe=Math.max(0,g.syncOffset(w));pe-=(pe+Pe)%188,pe<w.byteLength&&!d&&(this.remainderData=new Uint8Array(w.buffer,pe,w.buffer.byteLength-pe));for(var Se=Pe;Se<pe;Se+=188)if(w[Se]===71){var ke=!!(w[Se+1]&64),Ae=((w[Se+1]&31)<<8)+w[Se+2],Te=(w[Se+3]&48)>>4,ge=void 0;if(Te>1){if(ge=Se+5+w[Se+4],ge===Se+188)continue}else ge=Se+4;switch(Ae){case I:ke&&(B&&(l=i(B))&&this.parseAVCPES(l,!1),B={data:[],size:0}),B&&(B.data.push(w.subarray(ge,Se+188)),B.size+=Se+188-ge);break;case j:ke&&(_&&(l=i(_))&&(S.isAAC?this.parseAACPES(l):this.parseMPEGPES(l)),_={data:[],size:0}),_&&(_.data.push(w.subarray(ge,Se+188)),_.size+=Se+188-ge);break;case z:ke&&(N&&(l=i(N))&&this.parseID3PES(l),N={data:[],size:0}),N&&(N.data.push(w.subarray(ge,Se+188)),N.size+=Se+188-ge);break;case 0:ke&&(ge+=w[ge]+1),le=this._pmtId=b(w,ge);break;case le:{ke&&(ge+=w[ge]+1);var he=a(w,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,x);I=he.avc,I>0&&(A.pid=I),j=he.audio,j>0&&(S.pid=j,S.isAAC=he.isAAC),z=he.id3,z>0&&(D.pid=z),$&&!q&&(h.logger.log("reparse from beginning"),$=!1,Se=Pe-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!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"});A.pesData=B,S.pesData=_,D.pesData=N;var re={audioTrack:S,avcTrack:A,id3Track:D,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(re),re},v.flush=function(){var w=this.remainderData;this.remainderData=null;var C;return w?C=this.demux(w,-1,!1,!0):C={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(C),this.sampleAes?this.decrypt(C,this.sampleAes):C},v.extractRemainingSamples=function(w){var C=w.audioTrack,x=w.avcTrack,d=w.id3Track,l=x.pesData,A=C.pesData,S=d.pesData,D;l&&(D=i(l))?(this.parseAVCPES(D,!0),x.pesData=null):x.pesData=l,A&&(D=i(A))?(C.isAAC?this.parseAACPES(D):this.parseMPEGPES(D),C.pesData=null):(A!=null&&A.size&&h.logger.log("last AAC PES packet truncated,might overlap between fragments"),C.pesData=A),S&&(D=i(S))?(this.parseID3PES(D),d.pesData=null):d.pesData=S},v.demuxSampleAes=function(w,C,x){var d=this.demux(w,x,!0,!this.config.progressive),l=this.sampleAes=new U.default(this.observer,this.config,C);return this.decrypt(d,l)},v.decrypt=function(w,C){return new Promise(function(x){var d=w.audioTrack,l=w.avcTrack;d.samples&&d.isAAC?C.decryptAacSamples(d.samples,0,function(){l.samples?C.decryptAvcSamples(l.samples,0,0,function(){x(w)}):x(w)}):l.samples&&C.decryptAvcSamples(l.samples,0,0,function(){x(w)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(w,C){var x=this,d=this._avcTrack,l=this.parseAVCNALu(w.data),A=!1,S=this.avcSample,D,I=!1;w.data=null,S&&l.length&&!d.audFound&&(s(S,d),S=this.avcSample=m(!1,w.pts,w.dts,"")),l.forEach(function(B){switch(B.type){case 1:{D=!0,S||(S=x.avcSample=m(!0,w.pts,w.dts,"")),A&&(S.debug+="NDR "),S.frame=!0;var j=B.data;if(I&&j.length>4){var z=new M.default(j).readSliceType();(z===2||z===4||z===7||z===9)&&(S.key=!0)}break}case 5:D=!0,S||(S=x.avcSample=m(!0,w.pts,w.dts,"")),A&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{D=!0,A&&S&&(S.debug+="SEI ");var _=new M.default(y(B.data));_.readUByte();for(var N=0,$=0,q=!1,le=0;!q&&_.bytesAvailable>1;){N=0;do le=_.readUByte(),N+=le;while(le===255);$=0;do le=_.readUByte(),$+=le;while(le===255);if(N===4&&_.bytesAvailable!==0){q=!0;var pe=_.readUByte();if(pe===181){var Pe=_.readUShort();if(Pe===49){var Se=_.readUInt();if(Se===1195456820){var ke=_.readUByte();if(ke===3){for(var Ae=_.readUByte(),Te=_.readUByte(),ge=31&Ae,he=[Ae,Te],re=0;re<ge;re++)he.push(_.readUByte()),he.push(_.readUByte()),he.push(_.readUByte());u(x._txtTrack.samples,{type:3,pts:w.pts,bytes:he})}}}}}else if(N===5&&_.bytesAvailable!==0){if(q=!0,$>16){for(var de=[],se=0;se<16;se++)de.push(_.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&de.push("-");for(var Oe=$-16,ie=new Uint8Array(Oe),oe=0;oe<Oe;oe++)ie[oe]=_.readUByte();u(x._txtTrack.samples,{pts:w.pts,payloadType:N,uuid:de.join(""),userData:Object(H.utf8ArrayToStr)(ie),userDataBytes:ie})}}else if($<_.bytesAvailable)for(var be=0;be<$;be++)_.readUByte()}break}case 7:if(D=!0,I=!0,A&&S&&(S.debug+="SPS "),!d.sps){var De=new M.default(B.data),Ne=De.readSPS();d.width=Ne.width,d.height=Ne.height,d.pixelRatio=Ne.pixelRatio,d.sps=[B.data],d.duration=x._duration;for(var Fe=B.data.subarray(1,4),je="avc1.",Ue=0;Ue<3;Ue++){var rt=Fe[Ue].toString(16);rt.length<2&&(rt="0"+rt),je+=rt}d.codec=je}break;case 8:D=!0,A&&S&&(S.debug+="PPS "),d.pps||(d.pps=[B.data]);break;case 9:D=!1,d.audFound=!0,S&&s(S,d),S=x.avcSample=m(!1,w.pts,w.dts,A?"AUD ":"");break;case 12:D=!1;break;default:D=!1,S&&(S.debug+="unknown NAL "+B.type+" ");break}if(S&&D){var Qe=S.units;Qe.push(B)}}),C&&S&&(s(S,d),this.avcSample=null)},v.getLastNalUnit=function(){var w,C=this.avcSample,x;if(!C||C.units.length===0){var d=this._avcTrack.samples;C=d[d.length-1]}if((w=C)!==null&&w!==void 0&&w.units){var l=C.units;x=l[l.length-1]}return x},v.parseAVCNALu=function(w){var C=w.byteLength,x=this._avcTrack,d=x.naluState||0,l=d,A=[],S=0,D,I,B,j=-1,z=0;for(d===-1&&(j=0,z=w[0]&31,d=0,S=1);S<C;){if(D=w[S++],!d){d=D?0:1;continue}if(d===1){d=D?0:2;continue}if(!D)d=3;else if(D===1){if(j>=0){var _={data:w.subarray(j,S-d-1),type:z};A.push(_)}else{var N=this.getLastNalUnit();if(N&&(l&&S<=4-l&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-l))),I=S-d-1,I>0)){var $=new Uint8Array(N.data.byteLength+I);$.set(N.data,0),$.set(w.subarray(0,I),N.data.byteLength),N.data=$,N.state=0}}S<C?(B=w[S]&31,j=S,z=B,d=0):d=-1}else d=0}if(j>=0&&d>=0){var q={data:w.subarray(j,C),type:z,state:d};A.push(q)}if(A.length===0){var le=this.getLastNalUnit();if(le){var pe=new Uint8Array(le.data.byteLength+w.byteLength);pe.set(le.data,0),pe.set(w,le.data.byteLength),le.data=pe}}return x.naluState=d,A},v.parseAACPES=function(w){var C=0,x=this._audioTrack,d=this.aacOverFlow,l=w.data;if(d){this.aacOverFlow=null;var A=d.sample.unit.byteLength,S=Math.min(d.missing,A),D=A-S;d.sample.unit.set(l.subarray(0,S),D),x.samples.push(d.sample),C=d.missing}var I,B;for(I=C,B=l.length;I<B-1&&!X.isHeader(l,I);I++);if(I!==C){var j,z;if(I<B-1?(j="AAC PES did not start with ADTS header,offset:"+I,z=!1):(j="no ADTS header found in AAC PES",z=!0),h.logger.warn("parsing error:"+j),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:j}),z)return}X.initTrackConfig(x,this.observer,l,I,this.audioCodec);var _;if(w.pts!==void 0)_=w.pts;else if(d){var N=X.getFrameDuration(x.samplerate);_=d.sample.pts+N}else{h.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;I<B;)if(X.isHeader(l,I)){if(I+5<B){var q=X.appendFrame(x,l,I,_,$);if(q)if(q.missing)this.aacOverFlow=q;else{I+=q.length,$++;continue}}break}else I++},v.parseMPEGPES=function(w){var C=w.data,x=C.length,d=0,l=0,A=w.pts;if(A===void 0){h.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;l<x;)if(F.isHeader(C,l)){var S=F.appendFrame(this._audioTrack,C,l,A,d);if(S)l+=S.length,d++;else break}else l++},v.parseID3PES=function(w){if(w.pts===void 0){h.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(w)},g}();p.minProbeByteLength=188;function m(g,v,R,w){return{key:g,frame:!1,pts:v,dts:R,units:[],debug:w,length:0}}function b(g,v){return(g[v+10]&31)<<8|g[v+11]}function a(g,v,R,w){var C={audio:-1,avc:-1,id3:-1,isAAC:!0},x=(g[v+1]&15)<<8|g[v+2],d=v+3+x-4,l=(g[v+10]&15)<<8|g[v+11];for(v+=12+l;v<d;){var A=(g[v+1]&31)<<8|g[v+2];switch(g[v]){case 207:if(!w){h.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:C.audio===-1&&(C.audio=A);break;case 21:C.id3===-1&&(C.id3=A);break;case 219:if(!w){h.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:C.avc===-1&&(C.avc=A);break;case 3:case 4:R?C.audio===-1&&(C.audio=A,C.isAAC=!1):h.logger.log("MPEG audio found, not supported in this browser");break;case 36:h.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((g[v+3]&15)<<8|g[v+4])+5}return C}function i(g){var v=0,R,w,C,x,d,l=g.data;if(!g||g.size===0)return null;for(;l[0].length<19&&l.length>1;){var A=new Uint8Array(l[0].length+l[1].length);A.set(l[0]),A.set(l[1],l[0].length),l[0]=A,l.splice(1,1)}R=l[0];var S=(R[0]<<16)+(R[1]<<8)+R[2];if(S===1){if(w=(R[4]<<8)+R[5],w&&w>g.size-6)return null;var D=R[7];D&192&&(x=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,D&64?(d=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,x-d>60*9e4&&(h.logger.warn(Math.round((x-d)/9e4)+"s delta between PTS and DTS, align them"),x=d)):d=x),C=R[8];var I=C+9;if(g.size<=I)return null;g.size-=I;for(var B=new Uint8Array(g.size),j=0,z=l.length;j<z;j++){R=l[j];var _=R.byteLength;if(I)if(I>_){I-=_;continue}else R=R.subarray(I),_-=I,I=0;B.set(R,v),v+=_}return w&&(w-=C+3),{data:B,pts:x,dts:d,len:w}}return null}function s(g,v){if(g.units.length&&g.frame){if(g.pts===void 0){var R=v.samples,w=R.length;if(w){var C=R[w-1];g.pts=C.pts,g.dts=C.dts}else{v.dropped++;return}}v.samples.push(g)}g.debug.length&&h.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function u(g,v){var R=g.length;if(R>0){if(v.pts>=g[R-1].pts)g.push(v);else for(var w=R-1;w>=0;w--)if(v.pts<g[w].pts){g.splice(w,0,v);break}}else g.push(v)}function y(g){for(var v=g.byteLength,R=[],w=1;w<v-2;)g[w]===0&&g[w+1]===0&&g[w+2]===3?(R.push(w+2),w+=2):w++;if(R.length===0)return g;var C=v-R.length,x=new Uint8Array(C),d=0;for(w=0;w<C;d++,w++)d===R[0]&&(d++,R.shift()),x[w]=g[d];return x}J.default=p},"./src/errors.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ErrorTypes",function(){return X}),O.d(J,"ErrorDetails",function(){return F});var X;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(X||(X={}));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 X});var X;(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"})(X||(X={}))},"./src/hls.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return g});var X=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(X),M=O("./src/loader/playlist-loader.ts"),H=O("./src/loader/key-loader.ts"),U=O("./src/controller/id3-track-controller.ts"),P=O("./src/controller/latency-controller.ts"),L=O("./src/controller/level-controller.ts"),h=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"),b=O("./node_modules/eventemitter3/index.js"),a=O.n(b),i=O("./src/events.ts"),s=O("./src/errors.ts");function u(v,R){for(var w=0;w<R.length;w++){var C=R[w];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}function y(v,R,w){return R&&u(v.prototype,R),w&&u(v,w),v}var g=function(){v.isSupported=function(){return Object(T.isSupported)()};function v(w){w===void 0&&(w={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var C=this.config=Object(m.mergeConfig)(v.DefaultConfig,w);this.userConfig=w,Object(p.enableLogs)(C.debug),this._autoLevelCapping=-1,C.progressive&&Object(m.enableStreamingMode)(C);var x=C.abrController,d=C.bufferController,l=C.capLevelController,A=C.fpsController,S=this.abrController=new x(this),D=this.bufferController=new d(this),I=this.capLevelController=new l(this),B=new A(this),j=new M.default(this),z=new H.default(this),_=new U.default(this),N=this.levelController=new L.default(this),$=new h.FragmentTracker(this),q=this.streamController=new f.default(this,$);I.setStreamController(q),B.setStreamController(q);var le=[N,q];this.networkControllers=le;var pe=[j,z,S,D,I,B,_,$];this.audioTrackController=this.createController(C.audioTrackController,null,le),this.createController(C.audioStreamController,$,le),this.subtitleTrackController=this.createController(C.subtitleTrackController,null,le),this.createController(C.subtitleStreamController,$,le),this.createController(C.timelineController,null,pe),this.emeController=this.createController(C.emeController,null,pe),this.cmcdController=this.createController(C.cmcdController,null,pe),this.latencyController=this.createController(P.default,null,pe),this.coreComponents=pe}var R=v.prototype;return R.createController=function(C,x,d){if(C){var l=x?new C(this,x):new C(this);return d&&d.push(l),l}return null},R.on=function(C,x,d){d===void 0&&(d=this),this._emitter.on(C,x,d)},R.once=function(C,x,d){d===void 0&&(d=this),this._emitter.once(C,x,d)},R.removeAllListeners=function(C){this._emitter.removeAllListeners(C)},R.off=function(C,x,d,l){d===void 0&&(d=this),this._emitter.off(C,x,d,l)},R.listeners=function(C){return this._emitter.listeners(C)},R.emit=function(C,x,d){return this._emitter.emit(C,x,d)},R.trigger=function(C,x){if(this.config.debug)return this.emit(C,C,x);try{return this.emit(C,C,x)}catch(d){p.logger.error("An internal error happened while handling event "+C+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:C,error:d})}return!1},R.listenerCount=function(C){return this._emitter.listenerCount(C)},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(C){return C.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(C){return C.destroy()}),this.coreComponents.length=0},R.attachMedia=function(C){p.logger.log("attachMedia"),this._media=C,this.trigger(i.Events.MEDIA_ATTACHING,{media:C})},R.detachMedia=function(){p.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},R.loadSource=function(C){this.stopLoad();var x=this.media,d=this.url,l=this.url=X.buildAbsoluteURL(self.location.href,C,{alwaysNormalize:!0});p.logger.log("loadSource:"+l),x&&d&&d!==l&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(x)),this.trigger(i.Events.MANIFEST_LOADING,{url:C})},R.startLoad=function(C){C===void 0&&(C=-1),p.logger.log("startLoad("+C+")"),this.networkControllers.forEach(function(x){x.startLoad(C)})},R.stopLoad=function(){p.logger.log("stopLoad"),this.networkControllers.forEach(function(C){C.stopLoad()})},R.swapAudioCodec=function(){p.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},R.recoverMediaError=function(){p.logger.log("recoverMediaError");var C=this._media;this.detachMedia(),C&&this.attachMedia(C)},R.removeLevel=function(C,x){x===void 0&&(x=0),this.levelController.removeLevel(C,x)},y(v,[{key:"levels",get:function(){var C=this.levelController.levels;return C||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(C){p.logger.log("set currentLevel:"+C),this.loadLevel=C,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(C){p.logger.log("set nextLevel:"+C),this.levelController.manualLevel=C,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(C){p.logger.log("set loadLevel:"+C),this.levelController.manualLevel=C}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(C){this.levelController.nextLoadLevel=C}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(C){p.logger.log("set firstLevel:"+C),this.levelController.firstLevel=C}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(C){p.logger.log("set startLevel:"+C),C!==-1&&(C=Math.max(C,this.minAutoLevel)),this.levelController.startLevel=C}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(C){var x=!!C;x!==this.config.capLevelToPlayerSize&&(x?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=x)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(C){this._autoLevelCapping!==C&&(p.logger.log("set autoLevelCapping:"+C),this._autoLevelCapping=C)}},{key:"bandwidthEstimate",get:function(){var C=this.abrController.bwEstimator;return C?C.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var C=this.levels,x=this.config.minAutoBitrate;if(!C)return 0;for(var d=C.length,l=0;l<d;l++)if(C[l].maxBitrate>x)return l;return 0}},{key:"maxAutoLevel",get:function(){var C=this.levels,x=this.autoLevelCapping,d;return x===-1&&C&&C.length?d=C.length-1:d=x,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(C){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,C)}},{key:"audioTracks",get:function(){var C=this.audioTrackController;return C?C.audioTracks:[]}},{key:"audioTrack",get:function(){var C=this.audioTrackController;return C?C.audioTrack:-1},set:function(C){var x=this.audioTrackController;x&&(x.audioTrack=C)}},{key:"subtitleTracks",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTrack:-1},set:function(C){var x=this.subtitleTrackController;x&&(x.subtitleTrack=C)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var C=this.subtitleTrackController;return C?C.subtitleDisplay:!1},set:function(C){var x=this.subtitleTrackController;x&&(x.subtitleDisplay=C)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(C){this.config.lowLatencyMode=C}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return i.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:m.hlsDefaultConfig},set:function(C){v.defaultConfig=C}}]),v}();g.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 H});var X=O("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var U=Object(X.getMediaSource)();if(!U)return!1;var P=F(),L=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),h=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!L&&!!h}function H(){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 b});var X=O("./src/polyfills/number.ts"),F=O("./src/errors.ts");function M(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,h(a,i)}function H(a){var i=typeof Map=="function"?new Map:void 0;return H=function(u){if(u===null||!L(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(u))return i.get(u);i.set(u,y)}function y(){return U(u,arguments,f(this).constructor)}return y.prototype=Object.create(u.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),h(y,u)},H(a)}function U(a,i,s){return P()?U=Reflect.construct:U=function(y,g,v){var R=[null];R.push.apply(R,g);var w=Function.bind.apply(y,R),C=new w;return v&&h(C,v.prototype),C},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 L(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function h(a,i){return h=Object.setPrototypeOf||function(u,y){return u.__proto__=y,u},h(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(u,y){var g=this,v=u.url;if(!v)return Promise.reject(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var R=this.config,w=R.fLoader,C=R.loader;return new Promise(function(x,d){g.loader&&g.loader.destroy();var l=g.loader=u.loader=w?new w(R):new C(R),A=m(u),S={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:T};u.stats=l.stats,l.load(A,S,{onSuccess:function(I,B,j,z){g.resetLoader(u,l),x({frag:u,part:null,payload:I.data,networkDetails:z})},onError:function(I,B,j){g.resetLoader(u,l),d(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:I,networkDetails:j}))},onAbort:function(I,B,j){g.resetLoader(u,l),d(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(I,B,j){g.resetLoader(u,l),d(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(I,B,j,z){y&&y({frag:u,part:null,payload:j,networkDetails:z})}})})},i.loadPart=function(u,y,g){var v=this;this.abort();var R=this.config,w=R.fLoader,C=R.loader;return new Promise(function(x,d){v.loader&&v.loader.destroy();var l=v.loader=u.loader=w?new w(R):new C(R),A=m(u,y),S={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:T};y.stats=l.stats,l.load(A,S,{onSuccess:function(I,B,j,z){v.resetLoader(u,l),v.updateStatsFromPart(u,y);var _={frag:u,part:y,payload:I.data,networkDetails:z};g(_),x(_)},onError:function(I,B,j){v.resetLoader(u,l),d(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:y,response:I,networkDetails:j}))},onAbort:function(I,B,j){u.stats.aborted=y.stats.aborted,v.resetLoader(u,l),d(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:y,networkDetails:j}))},onTimeout:function(I,B,j){v.resetLoader(u,l),d(new b({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:y,networkDetails:j}))}})})},i.updateStatsFromPart=function(u,y){var g=u.stats,v=y.stats,R=v.total;if(g.loaded+=v.loaded,R){var w=Math.round(u.duration/y.duration),C=Math.min(Math.round(g.loaded/R),w),x=w-C,d=x*Math.round(g.loaded/C);g.total=g.loaded+d}else g.total=Math.max(g.loaded,g.total);var l=g.loading,A=v.loading;l.start?l.first+=A.first-A.start:(l.start=A.start,l.first=A.first),l.end=A.end},i.resetLoader=function(u,y){u.loader=null,this.loader===y&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),y.destroy()},a}();function m(a,i){i===void 0&&(i=null);var s=i||a,u={frag:a,part:i,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},y=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(X.isFiniteNumber)(y)&&Object(X.isFiniteNumber)(g)&&(u.rangeStart=y,u.rangeEnd=g),u}var b=function(a){M(i,a);function i(s){for(var u,y=arguments.length,g=new Array(y>1?y-1:0),v=1;v<y;v++)g[v-1]=arguments[v];return u=a.call.apply(a,[this].concat(g))||this,u.data=void 0,u.data=s,u}return i}(H(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 b}),O.d(J,"Part",function(){return a});var X=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),M=O.n(F),H=O("./src/utils/logger.ts"),U=O("./src/loader/level-key.ts"),P=O("./src/loader/load-stats.ts");function L(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,h(i,s)}function h(i,s){return h=Object.setPrototypeOf||function(y,g){return y.__proto__=g,y},h(i,s)}function f(i,s){for(var u=0;u<s.length;u++){var y=s[u];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(i,y.key,y)}}function T(i,s,u){return s&&f(i.prototype,s),u&&f(i,u),i}var p;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(p||(p={}));var m=function(){function i(u){var y;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(y={},y[p.AUDIO]=null,y[p.VIDEO]=null,y[p.AUDIOVIDEO]=null,y),this.baseurl=u}var s=i.prototype;return s.setByteRange=function(y,g){var v=y.split("@",2),R=[];v.length===1?R[0]=g?g.byteRangeEndOffset:0:R[0]=parseInt(v[1]),R[1]=parseInt(v[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(y){this._url=y}}]),i}(),b=function(i){L(s,i);function s(y,g){var v;return v=i.call(this,g)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new P.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=y,v}var u=s.prototype;return u.createInitializationVector=function(g){for(var v=new Uint8Array(16),R=12;R<16;R++)v[R]=g>>8*(15-R)&255;return v},u.setDecryptDataFromLevelKey=function(g,v){var R=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(R=U.LevelKey.fromURI(g.uri),R.method=g.method,R.iv=this.createInitializationVector(v),R.keyFormat="identity"),R},u.setElementaryStreamInfo=function(g,v,R,w,C,x){x===void 0&&(x=!1);var d=this.elementaryStreams,l=d[g];if(!l){d[g]={startPTS:v,endPTS:R,startDTS:w,endDTS:C,partial:x};return}l.startPTS=Math.min(l.startPTS,v),l.endPTS=Math.max(l.endPTS,R),l.startDTS=Math.min(l.startDTS,w),l.endDTS=Math.max(l.endDTS,C)},u.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[p.AUDIO]=null,g[p.VIDEO]=null,g[p.AUDIOVIDEO]=null},T(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&H.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(X.isFiniteNumber)(this.programDateTime))return null;var g=Object(X.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(m),a=function(i){L(s,i);function s(u,y,g,v,R){var w;w=i.call(this,g)||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=u.decimalFloatingPoint("DURATION"),w.gap=u.bool("GAP"),w.independent=u.bool("INDEPENDENT"),w.relurl=u.enumeratedString("URI"),w.fragment=y,w.index=v;var C=u.enumeratedString("BYTERANGE");return C&&w.setByteRange(C,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 y=this.elementaryStreams;return!!(y.audio||y.video||y.audiovideo)}}]),s}(m)},"./src/loader/key-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return H});var X=O("./src/events.ts"),F=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),H=function(){function U(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var P=U.prototype;return P._registerListeners=function(){this.hls.on(X.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(X.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var h in this.loaders){var f=this.loaders[h];f&&f.destroy()}this.loaders={}},P.onKeyLoading=function(h,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 b=T.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(m&&(M.logger.warn("abort previous key loader for type:"+p),m.abort()),!b){M.logger.warn("key uri is falsy");return}var i=a.loader,s=T.loader=this.loaders[p]=new i(a);this.decrypturl=b,this.decryptkey=null;var u={url:b,frag:T,responseType:"arraybuffer"},y={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,y,g)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger(X.Events.KEY_LOADED,{frag:T}))},P.loadsuccess=function(h,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(h.data),p.loader=null,delete this.loaders[p.type],this.hls.trigger(X.Events.KEY_LOADED,{frag:p})},P.loaderror=function(h,f){var T=f.frag,p=T.loader;p&&p.abort(),delete this.loaders[T.type],this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:h})},P.loadtimeout=function(h,f){var T=f.frag,p=T.loader;p&&p.abort(),delete this.loaders[T.type],this.hls.trigger(X.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 X=O("./src/polyfills/number.ts");function F(P,L){for(var h=0;h<L.length;h++){var f=L[h];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function M(P,L,h){return L&&F(P.prototype,L),h&&F(P,h),P}var H=10,U=function(){function P(h){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=h}var L=P.prototype;return L.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(X.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{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 X=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(X);function M(P,L){for(var h=0;h<L.length;h++){var f=L[h];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function H(P,L,h){return L&&M(P.prototype,L),h&&M(P,h),P}var U=function(){P.fromURL=function(h,f){return new P(h,f)},P.fromURI=function(h){return new P(h)};function P(L,h){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,h?this._uri=Object(X.buildAbsoluteURL)(L,h,{alwaysNormalize:!0}):this._uri=L}return H(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 X});var X=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 X=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),M=O.n(F),H=O("./src/loader/fragment.ts"),U=O("./src/loader/level-details.ts"),P=O("./src/loader/level-key.ts"),L=O("./src/utils/attr-list.ts"),h=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"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function i(R){var w,C;return a.test((w=(C=F.parseURL(R))===null||C===void 0?void 0:C.path)!=null?w:"")}var s=function(){function R(){}return R.findGroup=function(C,x){for(var d=0;d<C.length;d++){var l=C[d];if(l.id===x)return l}},R.convertAVC1ToAVCOTI=function(C){var x=C.split(".");if(x.length>2){var d=x.shift()+".";return d+=parseInt(x.shift()).toString(16),d+=("000"+parseInt(x.shift()).toString(16)).substr(-4),d}return C},R.resolve=function(C,x){return F.buildAbsoluteURL(x,C,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(C,x){var d=[],l={},A=!1;T.lastIndex=0;for(var S;(S=T.exec(C))!=null;)if(S[1]){var D=new L.AttrList(S[1]),I={attrs:D,bitrate:D.decimalInteger("AVERAGE-BANDWIDTH")||D.decimalInteger("BANDWIDTH"),name:D.NAME,url:R.resolve(S[2],x)},B=D.decimalResolution("RESOLUTION");B&&(I.width=B.width,I.height=B.height),u((D.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=R.convertAVC1ToAVCOTI(I.videoCodec)),d.push(I)}else if(S[3]){var j=new L.AttrList(S[3]);j["DATA-ID"]&&(A=!0,l[j["DATA-ID"]]=j)}return{levels:d,sessionData:A?l:null}},R.parseMasterPlaylistMedia=function(C,x,d,l){l===void 0&&(l=[]);var A,S=[],D=0;for(p.lastIndex=0;(A=p.exec(C))!==null;){var I=new L.AttrList(A[1]);if(I.TYPE===d){var B={attrs:I,bitrate:0,id:D++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:d,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?R.resolve(I.URI,x):""};if(l.length){var j=R.findGroup(l,B.groupId)||l[0];y(B,j,"audioCodec"),y(B,j,"textCodec")}S.push(B)}}return S},R.parseLevelPlaylist=function(C,x,d,l,A){var S=new U.LevelDetails(x),D=S.fragments,I=null,B=0,j=0,z=0,_=0,N=null,$=new H.Fragment(l,x),q,le,pe,Pe=-1,Se=!1;for(m.lastIndex=0,S.m3u8=C;(q=m.exec(C))!==null;){Se&&(Se=!1,$=new H.Fragment(l,x),$.start=z,$.sn=B,$.cc=_,$.level=d,I&&($.initSegment=I,$.rawProgramDateTime=I.rawProgramDateTime));var ke=q[1];if(ke){$.duration=parseFloat(ke);var Ae=(" "+q[2]).slice(1);$.title=Ae||null,$.tagList.push(Ae?["INF",ke,Ae]:["INF",ke])}else if(q[3])Object(X.isFiniteNumber)($.duration)&&($.start=z,pe&&($.levelkey=pe),$.sn=B,$.level=d,$.cc=_,$.urlId=A,D.push($),$.relurl=(" "+q[3]).slice(1),v($,N),N=$,z+=$.duration,B++,j=0,Se=!0);else if(q[4]){var Te=(" "+q[4]).slice(1);N?$.setByteRange(Te,N):$.setByteRange(Te)}else if(q[5])$.rawProgramDateTime=(" "+q[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Pe===-1&&(Pe=D.length);else{if(q=q[0].match(b),!q){h.logger.warn("No matches on slow regex match for level playlist!");continue}for(le=1;le<q.length&&!(typeof q[le]!="undefined");le++);var ge=(" "+q[le]).slice(1),he=(" "+q[le+1]).slice(1),re=q[le+2]?(" "+q[le+2]).slice(1):"";switch(ge){case"PLAYLIST-TYPE":S.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":B=S.startSN=parseInt(he);break;case"SKIP":{var de=new L.AttrList(he),se=de.decimalInteger("SKIPPED-SEGMENTS");if(Object(X.isFiniteNumber)(se)){S.skippedSegments=se;for(var Oe=se;Oe--;)D.unshift(null);B+=se}var ie=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");ie&&(S.recentlyRemovedDateranges=ie.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(he);break;case"VERSION":S.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(he||re)&&$.tagList.push(re?[he,re]:[he]);break;case"DIS":_++;case"GAP":$.tagList.push([ge]);break;case"BITRATE":$.tagList.push([ge,he]);break;case"DISCONTINUITY-SEQ":_=parseInt(he);break;case"KEY":{var oe,be=new L.AttrList(he),De=be.enumeratedString("METHOD"),Ne=be.URI,Fe=be.hexadecimalInteger("IV"),je=be.enumeratedString("KEYFORMATVERSIONS"),Ue=be.enumeratedString("KEYID"),rt=(oe=be.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(rt)>-1){h.logger.warn("Keyformat "+rt+" is not supported from the manifest");continue}else if(rt!=="identity")continue;De&&(pe=P.LevelKey.fromURL(x,Ne),Ne&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(pe.method=De,pe.keyFormat=rt,Ue&&(pe.keyID=Ue),je&&(pe.keyFormatVersions=je),pe.iv=Fe));break}case"START":{var qe=new L.AttrList(he),Ye=qe.decimalFloatingPoint("TIME-OFFSET");Object(X.isFiniteNumber)(Ye)&&(S.startTimeOffset=Ye);break}case"MAP":{var nt=new L.AttrList(he);$.relurl=nt.URI,nt.BYTERANGE&&$.setByteRange(nt.BYTERANGE),$.level=d,$.sn="initSegment",pe&&($.levelkey=pe),$.initSegment=null,I=$,Se=!0;break}case"SERVER-CONTROL":{var $e=new L.AttrList(he);S.canBlockReload=$e.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=$e.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&$e.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=$e.optionalFloat("PART-HOLD-BACK",0),S.holdBack=$e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var et=new L.AttrList(he);S.partTarget=et.decimalFloatingPoint("PART-TARGET");break}case"PART":{var _e=S.partList;_e||(_e=S.partList=[]);var Je=j>0?_e[_e.length-1]:void 0,st=j++,Be=new H.Part(new L.AttrList(he),$,x,st,Je);_e.push(Be),$.duration+=Be.duration;break}case"PRELOAD-HINT":{var ze=new L.AttrList(he);S.preloadHint=ze;break}case"RENDITION-REPORT":{var Ce=new L.AttrList(he);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Ce);break}default:h.logger.warn("line parsed but not handled: "+q);break}}}N&&!N.relurl?(D.pop(),z-=N.duration,S.partList&&(S.fragmentHint=N)):S.partList&&(v($,N),$.cc=_,S.fragmentHint=$);var me=D.length,Ee=D[0],ne=D[me-1];if(z+=S.skippedSegments*S.targetduration,z>0&&me&&ne){S.averagetargetduration=z/me;var ae=ne.sn;S.endSN=ae!=="initSegment"?ae:0,Ee&&(S.startCC=Ee.cc,Ee.initSegment||S.fragments.every(function(ce){return ce.relurl&&i(ce.relurl)})&&(h.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new H.Fragment(l,x),$.relurl=ne.relurl,$.level=d,$.sn="initSegment",Ee.initSegment=$,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(z+=S.fragmentHint.duration),S.totalduration=z,S.endCC=_,Pe>0&&g(D,Pe),S},R}();function u(R,w){["video","audio","text"].forEach(function(C){var x=R.filter(function(l){return Object(f.isCodecType)(l,C)});if(x.length){var d=x.filter(function(l){return l.lastIndexOf("avc1",0)===0||l.lastIndexOf("mp4a",0)===0});w[C+"Codec"]=d.length>0?d[0]:x[0],R=R.filter(function(l){return x.indexOf(l)===-1})}}),w.unknownCodecs=R}function y(R,w,C){var x=w[C];x&&(R[C]=x)}function g(R,w){for(var C=R[w],x=w;x--;){var d=R[x];if(!d)return;d.programDateTime=C.programDateTime-d.duration*1e3,C=d}}function v(R,w){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):w!=null&&w.programDateTime&&(R.programDateTime=w.endProgramDateTime),Object(X.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),M=O("./src/errors.ts"),H=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),P=O("./src/loader/m3u8-parser.ts"),L=O("./src/types/loader.ts"),h=O("./src/utils/attr-list.ts");function f(m){var b=m.type;switch(b){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function T(m,b){var a=m.url;return(a===void 0||a.indexOf("data:")===0)&&(a=b.url),a}var p=function(){function m(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var b=m.prototype;return b.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)},b.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)},b.createInternalLoader=function(i){var s=this.hls.config,u=s.pLoader,y=s.loader,g=u||y,v=new g(s);return i.loader=v,this.loaders[i.type]=v,v},b.getInternalLoader=function(i){return this.loaders[i.type]},b.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},b.destroyInternalLoaders=function(){for(var i in this.loaders){var s=this.loaders[i];s&&s.destroy(),this.resetInternalLoader(i)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(i,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},b.onLevelLoading=function(i,s){var u=s.id,y=s.level,g=s.url,v=s.deliveryDirectives;this.load({id:u,groupId:null,level:y,responseType:"text",type:L.PlaylistContextType.LEVEL,url:g,deliveryDirectives:v})},b.onAudioTrackLoading=function(i,s){var u=s.id,y=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:u,groupId:y,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:v})},b.onSubtitleTrackLoading=function(i,s){var u=s.id,y=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:u,groupId:y,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:v})},b.load=function(i){var s,u=this.hls.config,y=this.getInternalLoader(i);if(y){var g=y.context;if(g&&g.url===i.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),y.abort()}var v,R,w,C;switch(i.type){case L.PlaylistContextType.MANIFEST:v=u.manifestLoadingMaxRetry,R=u.manifestLoadingTimeOut,w=u.manifestLoadingRetryDelay,C=u.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:v=0,R=u.levelLoadingTimeOut;break;default:v=u.levelLoadingMaxRetry,R=u.levelLoadingTimeOut,w=u.levelLoadingRetryDelay,C=u.levelLoadingMaxRetryTimeout;break}if(y=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var x;if(i.type===L.PlaylistContextType.LEVEL&&i.level!==null?x=this.hls.levels[i.level].details:i.type===L.PlaylistContextType.AUDIO_TRACK&&i.id!==null?x=this.hls.audioTracks[i.id].details:i.type===L.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(x=this.hls.subtitleTracks[i.id].details),x){var d=x.partTarget,l=x.targetduration;d&&l&&(R=Math.min(Math.max(d*3,l*.8)*1e3,R))}}var A={timeout:R,maxRetry:v,retryDelay:w,maxRetryDelay:C,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};y.load(i,A,S)},b.loadsuccess=function(i,s,u,y){if(y===void 0&&(y=null),u.isSidxRequest){this.handleSidxRequest(i,u),this.handlePlaylistLoaded(i,s,u,y);return}this.resetInternalLoader(u.type);var g=i.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,u,"no EXTM3U delimiter",y);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,u,y):this.handleMasterPlaylist(i,s,u,y)},b.loaderror=function(i,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,i)},b.loadtimeout=function(i,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},b.handleMasterPlaylist=function(i,s,u,y){var g=this.hls,v=i.data,R=T(i,u),w=P.default.parseMasterPlaylist(v,R),C=w.levels,x=w.sessionData;if(!C.length){this.handleManifestParsingError(i,u,"no level found in manifest",y);return}var d=C.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),l=C.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),A=P.default.parseMasterPlaylistMedia(v,R,"AUDIO",d),S=P.default.parseMasterPlaylistMedia(v,R,"SUBTITLES",l),D=P.default.parseMasterPlaylistMedia(v,R,"CLOSED-CAPTIONS");if(A.length){var I=A.some(function(B){return!B.url});!I&&C[0].audioCodec&&!C[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),A.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new h.AttrList({}),bitrate:0,url:""}))}g.trigger(F.Events.MANIFEST_LOADED,{levels:C,audioTracks:A,subtitles:S,captions:D,url:R,stats:s,networkDetails:y,sessionData:x})},b.handleTrackOrLevelPlaylist=function(i,s,u,y){var g=this.hls,v=u.id,R=u.level,w=u.type,C=T(i,u),x=Object(X.isFiniteNumber)(v)?v:0,d=Object(X.isFiniteNumber)(R)?R:x,l=f(u),A=P.default.parseLevelPlaylist(i.data,C,d,l,x);if(!A.fragments.length){g.trigger(F.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:C,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(w===L.PlaylistContextType.MANIFEST){var S={attrs:new h.AttrList({}),bitrate:0,details:A,name:"",url:C};g.trigger(F.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:C,stats:s,networkDetails:y,sessionData:null})}if(s.parsing.end=performance.now(),A.needSidxRanges){var D,I=(D=A.fragments[0].initSegment)===null||D===void 0?void 0:D.url;this.load({url:I,isSidxRequest:!0,type:w,level:R,levelDetails:A,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=A,this.handlePlaylistLoaded(i,s,u,y)},b.handleSidxRequest=function(i,s){var u=Object(U.parseSegmentIndex)(new Uint8Array(i.data));if(!u)return;var y=u.references,g=s.levelDetails;y.forEach(function(v,R){var w=v.info,C=g.fragments[R];C.byteRange.length===0&&C.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),C.initSegment&&C.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(i,s,u,y){this.hls.trigger(F.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:i.url,reason:u,response:i,context:s,networkDetails:y})},b.handleNetworkError=function(i,s,u,y){u===void 0&&(u=!1),H.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var g=M.ErrorDetails.UNKNOWN,v=!1,R=this.getInternalLoader(i);switch(i.type){case L.PlaylistContextType.MANIFEST:g=u?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case L.PlaylistContextType.LEVEL:g=u?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case L.PlaylistContextType.AUDIO_TRACK:g=u?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:g=u?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}R&&this.resetInternalLoader(i.type);var w={type:M.ErrorTypes.NETWORK_ERROR,details:g,fatal:v,url:i.url,loader:R,context:i,networkDetails:s};y&&(w.response=y),this.hls.trigger(F.Events.ERROR,w)},b.handlePlaylistLoaded=function(i,s,u,y){var g=u.type,v=u.level,R=u.id,w=u.groupId,C=u.loader,x=u.levelDetails,d=u.deliveryDirectives;if(!(x!=null&&x.targetduration)){this.handleManifestParsingError(i,u,"invalid target duration",y);return}if(!C)return;x.live&&(C.getCacheAge&&(x.ageHeader=C.getCacheAge()||0),(!C.getCacheAge||isNaN(x.ageHeader))&&(x.ageHeader=0));switch(g){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:x,level:v||0,id:R||0,stats:s,networkDetails:y,deliveryDirectives:d});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:x,id:R||0,groupId:w||"",stats:s,networkDetails:y,deliveryDirectives:d});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:x,id:R||0,groupId:w||"",stats:s,networkDetails:y,deliveryDirectives:d});break}},m}();J.default=p},"./src/polyfills/number.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isFiniteNumber",function(){return X}),O.d(J,"MAX_SAFE_INTEGER",function(){return F});var X=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 X=function(){function F(){}return F.getSilentFrame=function(H,U){switch(H){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=X},"./src/remux/mp4-generator.ts":function(ue,J,O){"use strict";O.r(J);var X=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]),L=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:L};var h=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,h))},M.box=function(U){for(var P=8,L=arguments.length,h=new Array(L>1?L-1:0),f=1;f<L;f++)h[f-1]=arguments[f];for(var T=h.length,p=T;T--;)P+=h[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(h[T],P),P+=h[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 L=Math.floor(P/(X+1)),h=Math.floor(P%(X+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,L>>24,L>>16&255,L>>8&255,L&255,h>>24,h>>16&255,h>>8&255,h&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,L){return M.box(M.types.moof,M.mfhd(U),M.traf(L,P))},M.moov=function(U){for(var P=U.length,L=[];P--;)L[P]=M.trak(U[P]);return M.box.apply(null,[M.types.moov,M.mvhd(U[0].timescale,U[0].duration)].concat(L).concat(M.mvex(U)))},M.mvex=function(U){for(var P=U.length,L=[];P--;)L[P]=M.trex(U[P]);return M.box.apply(null,[M.types.mvex].concat(L))},M.mvhd=function(U,P){P*=U;var L=Math.floor(P/(X+1)),h=Math.floor(P%(X+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,L>>24,L>>16&255,L>>8&255,L&255,h>>24,h>>16&255,h>>8&255,h&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||[],L=new Uint8Array(4+P.length),h,f;for(h=0;h<P.length;h++)f=P[h].flags,L[h+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return M.box(M.types.sdtp,L)},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=[],L=[],h,f,T;for(h=0;h<U.sps.length;h++)f=U.sps[h],T=f.byteLength,P.push(T>>>8&255),P.push(T&255),P=P.concat(Array.prototype.slice.call(f));for(h=0;h<U.pps.length;h++)f=U.pps[h],T=f.byteLength,L.push(T>>>8&255),L.push(T&255),L=L.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(L))),m=U.width,b=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,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),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,L=U.duration*U.timescale,h=U.width,f=U.height,T=Math.floor(L/(X+1)),p=Math.floor(L%(X+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,h>>8&255,h&255,0,0,f>>8&255,f&255,0,0]))},M.traf=function(U,P){var L=M.sdtp(U),h=U.id,f=Math.floor(P/(X+1)),T=Math.floor(P%(X+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,h>>24,h>>16&255,h>>8&255,h&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,L.length+16+20+8+16+8+8),L)},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 L=U.samples||[],h=L.length,f=12+16*h,T=new Uint8Array(f),p,m,b,a,i,s;for(P+=8+f,T.set([0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,h&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),p=0;p<h;p++)m=L[p],b=m.duration,a=m.size,i=m.flags,s=m.cts,T.set([b>>>24&255,b>>>16&255,b>>>8&255,b&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),L=new Uint8Array(M.FTYP.byteLength+P.byteLength);return L.set(M.FTYP),L.set(P,M.FTYP.byteLength),L},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 u});var X=O("./src/polyfills/number.ts"),F=O("./src/remux/aac-helper.ts"),M=O("./src/remux/mp4-generator.ts"),H=O("./src/events.ts"),U=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),L=O("./src/types/loader.ts"),h=O("./src/utils/timescale-conversion.ts");function f(){return f=Object.assign||function(R){for(var w=1;w<arguments.length;w++){var C=arguments[w];for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(R[x]=C[x])}return R},f.apply(this,arguments)}var T=10*1e3,p=1024,m=1152,b=null,a=null,i=!1,s=function(){function R(C,x,d,l){if(l===void 0&&(l=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=C,this.config=x,this.typeSupported=d,this.ISGenerated=!1,b===null){var A=navigator.userAgent||"",S=A.match(/Chrome\/(\d+)/i);b=S?parseInt(S[1]):0}if(a===null){var D=navigator.userAgent.match(/Safari\/(\d+)/i);a=D?parseInt(D[1]):0}i=!!b&&b<75||!!a&&a<600}var w=R.prototype;return w.destroy=function(){},w.resetTimeStamp=function(x){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=x},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(x){var d=!1,l=x.reduce(function(A,S){var D=S.pts-A;return D<-4294967296?(d=!0,u(A,S.pts)):D>0?A:S.pts},x[0].pts);return d&&P.logger.debug("PTS rollover detected"),l},w.remux=function(x,d,l,A,S,D,I,B){var j,z,_,N,$,q,le=S,pe=S,Pe=x.pid>-1,Se=d.pid>-1,ke=d.samples.length,Ae=x.samples.length>0,Te=ke>1,ge=(!Pe||Ae)&&(!Se||Te)||this.ISGenerated||I;if(ge){this.ISGenerated||(_=this.generateIS(x,d,S));var he=this.isVideoContiguous,re=-1;if(Te&&(re=y(d.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,re>0){P.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+ke+" video samples due to a missing keyframe");var de=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(re),d.dropped+=re,pe+=(d.samples[0].pts-de)/(d.timescale||9e4)}else re===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+ke+" video samples"),q=!1);if(this.ISGenerated){if(Ae&&Te){var se=this.getVideoStartPts(d.samples),Oe=u(x.samples[0].pts,se)-se,ie=Oe/d.inputTimeScale;le+=Math.max(0,ie),pe+=Math.max(0,-ie)}if(Ae){if(x.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),_=this.generateIS(x,d,S)),z=this.remuxAudio(x,le,this.isAudioContiguous,D,Se||Te||B===L.PlaylistLevelType.AUDIO?pe:void 0),Te){var oe=z?z.endPTS-z.startPTS:0;d.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),_=this.generateIS(x,d,S)),j=this.remuxVideo(d,pe,he,oe)}}else Te&&(j=this.remuxVideo(d,pe,he,0));j&&(j.firstKeyFrame=re,j.independent=re!==-1)}}return this.ISGenerated&&(l.samples.length&&($=this.remuxID3(l,S)),A.samples.length&&(N=this.remuxText(A,S))),{audio:z,video:j,initSegment:_,independent:q,text:N,id3:$}},w.generateIS=function(x,d,l){var A=x.samples,S=d.samples,D=this.typeSupported,I={},B=!Object(X.isFiniteNumber)(this._initPTS),j="audio/mp4",z,_,N;if(B&&(z=_=Infinity),x.config&&A.length&&(x.timescale=x.samplerate,x.isAAC||(D.mpeg?(j="audio/mpeg",x.codec=""):D.mp3&&(x.codec="mp3")),I.audio={id:"audio",container:j,codec:x.codec,initSegment:!x.isAAC&&D.mpeg?new Uint8Array(0):M.default.initSegment([x]),metadata:{channelCount:x.channelCount}},B&&(N=x.inputTimeScale,z=_=A[0].pts-Math.round(N*l))),d.sps&&d.pps&&S.length&&(d.timescale=d.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:M.default.initSegment([d]),metadata:{width:d.width,height:d.height}},B)){N=d.inputTimeScale;var $=this.getVideoStartPts(S),q=Math.round(N*l);_=Math.min(_,u(S[0].dts,$)-q),z=Math.min(z,$-q)}if(Object.keys(I).length)return this.ISGenerated=!0,B&&(this._initPTS=z,this._initDTS=_),{tracks:I,initPTS:z,timescale:N}},w.remuxVideo=function(x,d,l,A){var S=x.inputTimeScale,D=x.samples,I=[],B=D.length,j=this._initPTS,z=this.nextAvcDts,_=8,N,$,q,le=Number.POSITIVE_INFINITY,pe=Number.NEGATIVE_INFINITY,Pe=0,Se=!1;if(!l||z===null){var ke=d*S,Ae=D[0].pts-u(D[0].dts,D[0].pts);z=ke-Ae}for(var Te=0;Te<B;Te++){var ge=D[Te];if(ge.pts=u(ge.pts-j,z),ge.dts=u(ge.dts-j,z),ge.dts>ge.pts){var he=9e4*.2;Pe=Math.max(Math.min(Pe,ge.pts-ge.dts),-1*he)}ge.dts<D[Te>0?Te-1:Te].dts&&(Se=!0)}Se&&D.sort(function(Lt,wt){var ft=Lt.dts-wt.dts,zt=Lt.pts-wt.pts;return ft||zt}),$=D[0].dts,q=D[D.length-1].dts;var re=Math.round((q-$)/(B-1));if(Pe<0){if(Pe<re*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(h.toMsFromMpegTsClock)(-re,!0)+" ms");for(var de=Pe,se=0;se<B;se++)D[se].dts=de=Math.max(de,D[se].pts-re),D[se].pts=Math.max(de,D[se].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(h.toMsFromMpegTsClock)(Pe,!0)+" ms to overcome this issue");for(var Oe=0;Oe<B;Oe++)D[Oe].dts=D[Oe].dts+Pe}$=D[0].dts}if(l){var ie=$-z,oe=ie>re,be=ie<-1;if(oe||be){oe?P.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(ie,!0)+" ms ("+ie+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(-ie,!0)+" ms ("+ie+"dts) overlapping between fragments detected"),$=z;var De=D[0].pts-ie;D[0].dts=$,D[0].pts=De,P.logger.log("Video: First PTS/DTS adjusted: "+Object(h.toMsFromMpegTsClock)(De,!0)+"/"+Object(h.toMsFromMpegTsClock)($,!0)+", delta: "+Object(h.toMsFromMpegTsClock)(ie,!0)+" ms")}}i&&($=Math.max(0,$));for(var Ne=0,Fe=0,je=0;je<B;je++){for(var Ue=D[je],rt=Ue.units,Qe=rt.length,qe=0,Ye=0;Ye<Qe;Ye++)qe+=rt[Ye].data.length;Fe+=qe,Ne+=Qe,Ue.length=qe,Ue.dts=Math.max(Ue.dts,$),Ue.pts=Math.max(Ue.pts,Ue.dts,0),le=Math.min(Ue.pts,le),pe=Math.max(Ue.pts,pe)}q=D[B-1].dts;var nt=Fe+4*Ne+8,$e;try{$e=new Uint8Array(nt)}catch(Lt){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:nt,reason:"fail allocating video mdat "+nt});return}var et=new DataView($e.buffer);et.setUint32(0,nt),$e.set(M.default.types.mdat,4);for(var _e=0;_e<B;_e++){for(var Je=D[_e],st=Je.units,Be=0,ze=0,Ce=st.length;ze<Ce;ze++){var me=st[ze],Ee=me.data,ne=me.data.byteLength;et.setUint32(_,ne),_+=4,$e.set(Ee,_),_+=ne,Be+=4+ne}if(_e<B-1)N=D[_e+1].dts-Je.dts;else{var ae=this.config,ce=Je.dts-D[_e>0?_e-1:_e].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(ae.maxBufferHole*S),Ie=(A?le+A*S:this.nextAudioPts)-Je.pts;Ie>ve?(N=Ie-ce,N<0&&(N=ce),P.logger.log("[mp4-remuxer]: It is approximately "+Ie/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=ce}else N=ce}var we=Math.round(Je.pts-Je.dts);I.push(new g(Je.key,N,Be,we))}if(I.length&&b&&b<70){var Ke=I[0].flags;Ke.dependsOn=2,Ke.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=q+N,this.isVideoContiguous=!0;var ot=M.default.moof(x.sequenceNumber++,$,f({},x,{samples:I})),ct="video",dt={data1:ot,data2:$e,startPTS:le/S,endPTS:(pe+N)/S,startDTS:$/S,endDTS:z/S,type:ct,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:x.dropped};return x.samples=[],x.dropped=0,console.assert($e.length,"MDAT length must not be zero"),dt},w.remuxAudio=function(x,d,l,A,S){var D=x.inputTimeScale,I=x.samplerate?x.samplerate:D,B=D/I,j=x.isAAC?p:m,z=j*B,_=this._initPTS,N=!x.isAAC&&this.typeSupported.mpeg,$=[],q=x.samples,le=N?0:8,pe=this.nextAudioPts||-1,Pe=d*D;if(this.isAudioContiguous=l=l||q.length&&pe>0&&(A&&Math.abs(Pe-pe)<9e3||Math.abs(u(q[0].pts-_,Pe)-pe)<20*z),q.forEach(function(Ee){Ee.pts=u(Ee.pts-_,Pe)}),!l||pe<0){if(q=q.filter(function(Ee){return Ee.pts>=0}),!q.length)return;S===0?pe=0:A?pe=Math.max(0,Pe):pe=q[0].pts}if(x.isAAC)for(var Se=S!==void 0,ke=this.config.maxAudioFramesDrift,Ae=0,Te=pe;Ae<q.length;Ae++){var ge=q[Ae],he=ge.pts,re=he-Te,de=Math.abs(1e3*re/D);if(re<=-ke*z&&Se)Ae===0&&(P.logger.warn("Audio frame @ "+(he/D).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/D)+" ms."),this.nextAudioPts=pe=Te=he);else if(re>=ke*z&&de<T&&Se){var se=Math.round(re/z);Te=he-se*z,Te<0&&(se--,Te+=z),Ae===0&&(this.nextAudioPts=pe=Te),P.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(Te/D).toFixed(3)+"s due to "+Math.round(1e3*re/D)+" ms gap.");for(var Oe=0;Oe<se;Oe++){var ie=Math.max(Te,0),oe=F.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);oe||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=ge.unit.subarray()),q.splice(Ae,0,{unit:oe,pts:ie}),Te+=z,Ae++}}ge.pts=Te,Te+=z}for(var be=null,De=null,Ne,Fe=0,je=q.length;je--;)Fe+=q[je].unit.byteLength;for(var Ue=0,rt=q.length;Ue<rt;Ue++){var Qe=q[Ue],qe=Qe.unit,Ye=Qe.pts;if(De!==null){var nt=$[Ue-1];nt.duration=Math.round((Ye-De)/B)}else if(l&&x.isAAC&&(Ye=pe),be=Ye,Fe>0){Fe+=le;try{Ne=new Uint8Array(Fe)}catch(Ee){this.observer.emit(H.Events.ERROR,H.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 $e=new DataView(Ne.buffer);$e.setUint32(0,Fe),Ne.set(M.default.types.mdat,4)}}else return;Ne.set(qe,le);var et=qe.byteLength;le+=et,$.push(new g(!0,j,et,0)),De=Ye}var _e=$.length;if(!_e)return;var Je=$[$.length-1];this.nextAudioPts=pe=De+B*Je.duration;var st=N?new Uint8Array(0):M.default.moof(x.sequenceNumber++,be/B,f({},x,{samples:$}));x.samples=[];var Be=be/D,ze=pe/D,Ce="audio",me={data1:st,data2:Ne,startPTS:Be,endPTS:ze,startDTS:Be,endDTS:ze,type:Ce,hasAudio:!0,hasVideo:!1,nb:_e};return this.isAudioContiguous=!0,console.assert(Ne.length,"MDAT length must not be zero"),me},w.remuxEmptyAudio=function(x,d,l,A){var S=x.inputTimeScale,D=x.samplerate?x.samplerate:S,I=S/D,B=this.nextAudioPts,j=(B!==null?B:A.startDTS*S)+this._initDTS,z=A.endDTS*S+this._initDTS,_=I*p,N=Math.ceil((z-j)/_),$=F.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],le=0;le<N;le++){var pe=j+le*_;q.push({unit:$,pts:pe,dts:pe})}return x.samples=q,this.remuxAudio(x,d,l,!1)},w.remuxID3=function(x,d){var l=x.samples.length;if(!l)return;for(var A=x.inputTimeScale,S=this._initPTS,D=this._initDTS,I=0;I<l;I++){var B=x.samples[I];B.pts=u(B.pts-S,d*A)/A,B.dts=u(B.dts-D,d*A)/A}var j=x.samples;return x.samples=[],{samples:j}},w.remuxText=function(x,d){var l=x.samples.length;if(!l)return;for(var A=x.inputTimeScale,S=this._initPTS,D=0;D<l;D++){var I=x.samples[D];I.pts=u(I.pts-S,d*A)/A}x.samples.sort(function(j,z){return j.pts-z.pts});var B=x.samples;return x.samples=[],{samples:B}},R}();function u(R,w){var C;if(w===null)return R;for(w<R?C=-8589934592:C=8589934592;Math.abs(R-w)>4294967296;)R+=C;return R}function y(R){for(var w=0;w<R.length;w++)if(R[w].key)return w;return-1}var g=function(w,C,x,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=C,this.size=x,this.cts=d,this.flags=new v(w)},v=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 X=O("./src/polyfills/number.ts"),F=O("./src/utils/mp4-tools.ts"),M=O("./src/loader/fragment.ts"),H=O("./src/utils/logger.ts"),U=function(){function h(){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=h.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,b){this.audioCodec=m,this.videoCodec=b,this.generateInitSegment(p),this.emitInitSegment=!0},f.generateInitSegment=function(p){var m=this.audioCodec,b=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=L(a.audio,M.ElementaryStreamTypes.AUDIO)),b||(b=L(a.video,M.ElementaryStreamTypes.VIDEO));var i={};a.audio&&a.video?i.audiovideo={container:"video/mp4",codec:m+","+b,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:b,initSegment:p,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},f.remux=function(p,m,b,a,i){var s=this.initPTS,u=this.lastEndDTS,y={audio:void 0,video:void 0,text:a,id3:b,initSegment:void 0};Object(X.isFiniteNumber)(u)||(u=this.lastEndDTS=i||0);var g=m.samples;if(!g||!g.length)return y;var v={initPTS:void 0,timescale:1},R=this.initData;if((!R||!R.length)&&(this.generateInitSegment(g),R=this.initData),!R||!R.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),y;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(X.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=P(R,g,u));var w=Object(F.getDuration)(g,R),C=u,x=w+C;Object(F.offsetStartDTS)(R,g,s),w>0?this.lastEndDTS=x:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!R.audio,l=!!R.video,A="";d&&(A+="audio"),l&&(A+="video");var S={data1:g,startPTS:C,startDTS:C,endPTS:x,endDTS:x,type:A,hasAudio:d,hasVideo:l,nb:1,dropped:0};return y.audio=S.type==="audio"?S:void 0,y.video=S.type!=="audio"?S:void 0,y.text=a,y.id3=b,y.initSegment=v,y},h}(),P=function(f,T,p){return Object(F.getStartDTS)(f,T)-p};function L(h,f){var T=h==null?void 0:h.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 X});var X=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 X}),O.d(J,"CMCDObjectType",function(){return F}),O.d(J,"CMCDStreamingFormat",function(){return M}),O.d(J,"CMCDStreamType",function(){return H});var X=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 H;(function(U){U.VOD="v",U.LIVE="l"})(H||(H={}))},"./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 H}),O.d(J,"HlsUrlParameters",function(){return U}),O.d(J,"Level",function(){return P});function X(L,h){for(var f=0;f<h.length;f++){var T=h[f];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(L,T.key,T)}}function F(L,h,f){return h&&X(L.prototype,h),f&&X(L,f),L}var M;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(M||(M={}));function H(L,h){var f=L.canSkipUntil,T=L.canSkipDateRanges,p=L.endSN,m=h!==void 0?h-p:0;return f&&m<f?T?M.v2:M.Yes:M.No}var U=function(){function L(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 h=L.prototype;return h.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()},L}(),P=function(){function L(h){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=[h.url],this.attrs=h.attrs,this.bitrate=h.bitrate,h.details&&(this.details=h.details),this.id=h.id||0,this.name=h.name,this.width=h.width||0,this.height=h.height||0,this.audioCodec=h.audioCodec,this.videoCodec=h.videoCodec,this.unknownCodecs=h.unknownCodecs,this.codecSet=[h.videoCodec,h.audioCodec].filter(function(f){return f}).join(",").replace(/\.[^.,]+/g,"")}return F(L,[{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)}}]),L}()},"./src/types/loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"PlaylistContextType",function(){return X}),O.d(J,"PlaylistLevelType",function(){return F});var X;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(X||(X={}));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 X});var X=function(H,U,P,L,h,f){L===void 0&&(L=0),h===void 0&&(h=-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=H,this.sn=U,this.id=P,this.size=L,this.part=h,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 X=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function H(P){typeof P=="string"&&(P=H.parseAttrList(P));for(var L in P)P.hasOwnProperty(L)&&(this[L]=P[L])}var U=H.prototype;return U.decimalInteger=function(L){var h=parseInt(this[L],10);return h>Number.MAX_SAFE_INTEGER?Infinity:h},U.hexadecimalInteger=function(L){if(this[L]){var h=(this[L]||"0x").slice(2);h=(h.length&1?"0":"")+h;for(var f=new Uint8Array(h.length/2),T=0;T<h.length/2;T++)f[T]=parseInt(h.slice(T*2,T*2+2),16);return f}else return null},U.hexadecimalIntegerAsNumber=function(L){var h=parseInt(this[L],16);return h>Number.MAX_SAFE_INTEGER?Infinity:h},U.decimalFloatingPoint=function(L){return parseFloat(this[L])},U.optionalFloat=function(L,h){var f=this[L];return f?parseFloat(f):h},U.enumeratedString=function(L){return this[L]},U.bool=function(L){return this[L]==="YES"},U.decimalResolution=function(L){var h=X.exec(this[L]);return h===null?void 0:{width:parseInt(h[1],10),height:parseInt(h[2],10)}},H.parseAttrList=function(L){var h,f={},T='"';for(F.lastIndex=0;(h=F.exec(L))!==null;){var p=h[2];p.indexOf(T)===0&&p.lastIndexOf(T)===p.length-1&&(p=p.slice(1,-1)),f[h[1]]=p}return f},H}()},"./src/utils/binary-search.ts":function(ue,J,O){"use strict";O.r(J);var X={search:function(M,H){for(var U=0,P=M.length-1,L=null,h=null;U<=P;){L=(U+P)/2|0,h=M[L];var f=H(h);if(f>0)U=L+1;else if(f<0)P=L-1;else return h}return null}};J.default=X},"./src/utils/buffer-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"BufferHelper",function(){return M});var X=O("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function H(){}return H.isBuffered=function(P,L){try{if(P){for(var h=H.getBuffered(P),f=0;f<h.length;f++)if(L>=h.start(f)&&L<=h.end(f))return!0}}catch(T){}return!1},H.bufferInfo=function(P,L,h){try{if(P){var f=H.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,L,h)}}catch(m){}return{len:0,start:L,end:L,nextStart:void 0}},H.bufferedInfo=function(P,L,h){L=Math.max(0,L),P.sort(function(v,R){var w=v.start-R.start;return w||R.end-v.end});var f=[];if(h)for(var T=0;T<P.length;T++){var p=f.length;if(p){var m=f[p-1].end;P[T].start-m<h?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 b=0,a,i=L,s=L,u=0;u<f.length;u++){var y=f[u].start,g=f[u].end;if(L+h>=y&&L<g)i=y,s=g,b=s-L;else if(L+h<y){a=y;break}}return{len:b,start:i||0,end:s||0,nextStart:a}},H.getBuffered=function(P){try{return P.buffered}catch(L){return X.logger.log("failed to get media.buffered",L),F}},H}()},"./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 u});var X=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(x){var d=x;return F.hasOwnProperty(x)&&(d=F[x]),String.fromCharCode(d)},H=15,U=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={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(C){C[C.ERROR=0]="ERROR",C[C.TEXT=1]="TEXT",C[C.WARNING=2]="WARNING",C[C.INFO=2]="INFO",C[C.DEBUG=3]="DEBUG",C[C.DATA=3]="DATA"})(p||(p={}));var m=function(){function C(){this.time=null,this.verboseLevel=p.ERROR}var x=C.prototype;return x.log=function(l,A){this.verboseLevel>=l&&X.logger.log(this.time+" ["+l+"] "+A)},C}(),b=function(x){for(var d=[],l=0;l<x.length;l++)d.push(x[l].toString(16));return d},a=function(){function C(d,l,A,S,D){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=l||!1,this.italics=A||!1,this.background=S||"black",this.flash=D||!1}var x=C.prototype;return x.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},x.setStyles=function(l){for(var A=["foreground","underline","italics","background","flash"],S=0;S<A.length;S++){var D=A[S];l.hasOwnProperty(D)&&(this[D]=l[D])}},x.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},x.equals=function(l){return this.foreground===l.foreground&&this.underline===l.underline&&this.italics===l.italics&&this.background===l.background&&this.flash===l.flash},x.copy=function(l){this.foreground=l.foreground,this.underline=l.underline,this.italics=l.italics,this.background=l.background,this.flash=l.flash},x.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},C}(),i=function(){function C(d,l,A,S,D,I){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new a(l,A,S,D,I)}var x=C.prototype;return x.reset=function(){this.uchar=" ",this.penState.reset()},x.setChar=function(l,A){this.uchar=l,this.penState.copy(A)},x.setPenState=function(l){this.penState.copy(l)},x.equals=function(l){return this.uchar===l.uchar&&this.penState.equals(l.penState)},x.copy=function(l){this.uchar=l.uchar,this.penState.copy(l.penState)},x.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},C}(),s=function(){function C(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var l=0;l<U;l++)this.chars.push(new i);this.logger=d,this.pos=0,this.currPenState=new a}var x=C.prototype;return x.equals=function(l){for(var A=!0,S=0;S<U;S++)if(!this.chars[S].equals(l.chars[S])){A=!1;break}return A},x.copy=function(l){for(var A=0;A<U;A++)this.chars[A].copy(l.chars[A])},x.isEmpty=function(){for(var l=!0,A=0;A<U;A++)if(!this.chars[A].isEmpty()){l=!1;break}return l},x.setCursor=function(l){this.pos!==l&&(this.pos=l),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)},x.moveCursor=function(l){var A=this.pos+l;if(l>1)for(var S=this.pos+1;S<A+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(A)},x.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},x.insertChar=function(l){l>=144&&this.backSpace();var A=M(l);if(this.pos>=U){this.logger.log(p.ERROR,"Cannot insert "+l.toString(16)+" ("+A+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(A,this.currPenState),this.moveCursor(1)},x.clearFromPos=function(l){var A;for(A=l;A<U;A++)this.chars[A].reset()},x.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},x.clearToEndOfRow=function(){this.clearFromPos(this.pos)},x.getTextString=function(){for(var l=[],A=!0,S=0;S<U;S++){var D=this.chars[S].uchar;D!==" "&&(A=!1),l.push(D)}return A?"":l.join("")},x.setPenStyles=function(l){this.currPenState.setStyles(l);var A=this.chars[this.pos];A.setPenState(this.currPenState)},C}(),u=function(){function C(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var l=0;l<H;l++)this.rows.push(new s(d));this.logger=d,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var x=C.prototype;return x.reset=function(){for(var l=0;l<H;l++)this.rows[l].clear();this.currRow=H-1},x.equals=function(l){for(var A=!0,S=0;S<H;S++)if(!this.rows[S].equals(l.rows[S])){A=!1;break}return A},x.copy=function(l){for(var A=0;A<H;A++)this.rows[A].copy(l.rows[A])},x.isEmpty=function(){for(var l=!0,A=0;A<H;A++)if(!this.rows[A].isEmpty()){l=!1;break}return l},x.backSpace=function(){var l=this.rows[this.currRow];l.backSpace()},x.clearToEndOfRow=function(){var l=this.rows[this.currRow];l.clearToEndOfRow()},x.insertChar=function(l){var A=this.rows[this.currRow];A.insertChar(l)},x.setPen=function(l){var A=this.rows[this.currRow];A.setPenStyles(l)},x.moveCursor=function(l){var A=this.rows[this.currRow];A.moveCursor(l)},x.setCursor=function(l){this.logger.log(p.INFO,"setCursor: "+l);var A=this.rows[this.currRow];A.setCursor(l)},x.setPAC=function(l){this.logger.log(p.INFO,"pacData = "+JSON.stringify(l));var A=l.row-1;if(this.nrRollUpRows&&A<this.nrRollUpRows-1&&(A=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==A){for(var S=0;S<H;S++)this.rows[S].clear();var D=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var B=I.rows[D].cueStartTime,j=this.logger.time;if(B&&j!==null&&B<j)for(var z=0;z<this.nrRollUpRows;z++)this.rows[A-this.nrRollUpRows+z+1].copy(I.rows[D+z])}}this.currRow=A;var _=this.rows[this.currRow];if(l.indent!==null){var N=l.indent,$=Math.max(N-1,0);_.setCursor(l.indent),l.color=_.chars[$].penState.foreground}var q={foreground:l.color,underline:l.underline,italics:l.italics,background:"black",flash:!1};this.setPen(q)},x.setBkgData=function(l){this.logger.log(p.INFO,"bkgData = "+JSON.stringify(l)),this.backSpace(),this.setPen(l),this.insertChar(32)},x.setRollUpRows=function(l){this.nrRollUpRows=l},x.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 l=this.currRow+1-this.nrRollUpRows,A=this.rows.splice(l,1)[0];A.clear(),this.rows.splice(this.currRow,0,A),this.logger.log(p.INFO,"Rolling up")},x.getDisplayText=function(l){l=l||!1;for(var A=[],S="",D=-1,I=0;I<H;I++){var B=this.rows[I].getTextString();B&&(D=I+1,l?A.push("Row "+D+": '"+B+"'"):A.push(B.trim()))}return A.length>0&&(l?S="["+A.join(" | ")+"]":S=A.join(`
|
|
`)),S},x.getTextAndFormat=function(){return this.rows},C}(),y=function(){function C(d,l,A){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=l,this.mode=null,this.verbose=0,this.displayedMemory=new u(A),this.nonDisplayedMemory=new u(A),this.lastOutputScreen=new u(A),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=A}var x=C.prototype;return x.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},x.getHandler=function(){return this.outputFilter},x.setHandler=function(l){this.outputFilter=l},x.setPAC=function(l){this.writeScreen.setPAC(l)},x.setBkgData=function(l){this.writeScreen.setBkgData(l)},x.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(p.INFO,"MODE="+l),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=l},x.insertChars=function(l){for(var A=0;A<l.length;A++)this.writeScreen.insertChar(l[A]);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())},x.ccRCL=function(){this.logger.log(p.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},x.ccBS=function(){if(this.logger.log(p.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},x.ccAOF=function(){},x.ccAON=function(){},x.ccDER=function(){this.logger.log(p.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},x.ccRU=function(l){this.logger.log(p.INFO,"RU("+l+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(l)},x.ccFON=function(){this.logger.log(p.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},x.ccRDC=function(){this.logger.log(p.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},x.ccTR=function(){this.logger.log(p.INFO,"TR"),this.setMode("MODE_TEXT")},x.ccRTD=function(){this.logger.log(p.INFO,"RTD"),this.setMode("MODE_TEXT")},x.ccEDM=function(){this.logger.log(p.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},x.ccCR=function(){this.logger.log(p.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},x.ccENM=function(){this.logger.log(p.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},x.ccEOC=function(){if(this.logger.log(p.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var l=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=l,this.writeScreen=this.nonDisplayedMemory,this.logger.log(p.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},x.ccTO=function(l){this.logger.log(p.INFO,"TO("+l+") - Tab Offset"),this.writeScreen.moveCursor(l)},x.ccMIDROW=function(l){var A={flash:!1};if(A.underline=l%2===1,A.italics=l>=46,A.italics)A.foreground="white";else{var S=Math.floor(l/2)-16,D=["white","green","blue","cyan","red","yellow","magenta"];A.foreground=D[S]}this.logger.log(p.INFO,"MIDROW: "+JSON.stringify(A)),this.writeScreen.setPen(A)},x.outputDataUpdate=function(l){l===void 0&&(l=!1);var A=this.logger.time;if(A===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=A:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,A,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:A),this.lastOutputScreen.copy(this.displayedMemory))},x.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},C}(),g=function(){function C(d,l,A){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new m;this.channels=[null,new y(d,l,S),new y(d+1,A,S)],this.cmdHistory=w(),this.logger=S}var x=C.prototype;return x.getHandler=function(l){return this.channels[l].getHandler()},x.setHandler=function(l,A){this.channels[l].setHandler(A)},x.addData=function(l,A){var S,D,I,B=!1;this.logger.time=l;for(var j=0;j<A.length;j+=2){if(D=A[j]&127,I=A[j+1]&127,D===0&&I===0)continue;if(this.logger.log(p.DATA,"["+b([A[j],A[j+1]])+"] -> ("+b([D,I])+")"),S=this.parseCmd(D,I),S||(S=this.parseMidrow(D,I)),S||(S=this.parsePAC(D,I)),S||(S=this.parseBackgroundAttributes(D,I)),!S&&(B=this.parseChars(D,I),B)){var z=this.currentChannel;if(z&&z>0){var _=this.channels[z];_.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 "+b([D,I])+" orig: "+b([A[j],A[j+1]]))}},x.parseCmd=function(l,A){var S=this.cmdHistory,D=(l===20||l===28||l===21||l===29)&&A>=32&&A<=47,I=(l===23||l===31)&&A>=33&&A<=35;if(!(D||I))return!1;if(R(l,A,S))return v(null,null,S),this.logger.log(p.DEBUG,"Repeated command ("+b([l,A])+") is dropped"),!0;var B=l===20||l===21||l===23?1:2,j=this.channels[B];return l===20||l===21||l===28||l===29?A===32?j.ccRCL():A===33?j.ccBS():A===34?j.ccAOF():A===35?j.ccAON():A===36?j.ccDER():A===37?j.ccRU(2):A===38?j.ccRU(3):A===39?j.ccRU(4):A===40?j.ccFON():A===41?j.ccRDC():A===42?j.ccTR():A===43?j.ccRTD():A===44?j.ccEDM():A===45?j.ccCR():A===46?j.ccENM():A===47&&j.ccEOC():j.ccTO(A-32),v(l,A,S),this.currentChannel=B,!0},x.parseMidrow=function(l,A){var S=0;if((l===17||l===25)&&A>=32&&A<=47){if(l===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(A),this.logger.log(p.DEBUG,"MIDROW ("+b([l,A])+")"),!0):!1}return!1},x.parsePAC=function(l,A){var S,D=this.cmdHistory,I=(l>=17&&l<=23||l>=25&&l<=31)&&A>=64&&A<=127,B=(l===16||l===24)&&A>=64&&A<=95;if(!(I||B))return!1;if(R(l,A,D))return v(null,null,D),!0;var j=l<=23?1:2;A>=64&&A<=95?S=j===1?P[l]:h[l]:S=j===1?L[l]:f[l];var z=this.channels[j];return z?(z.setPAC(this.interpretPAC(S,A)),v(l,A,D),this.currentChannel=j,!0):!1},x.interpretPAC=function(l,A){var S,D={color:null,italics:!1,indent:null,underline:!1,row:l};return A>95?S=A-96:S=A-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},x.parseChars=function(l,A){var S,D=null,I=null;if(l>=25?(S=2,I=l-8):(S=1,I=l),I>=17&&I<=19){var B;I===17?B=A+80:I===18?B=A+112:B=A+144,this.logger.log(p.INFO,"Special char '"+M(B)+"' in channel "+S),D=[B]}else l>=32&&l<=127&&(D=A===0?[l]:[l,A]);if(D){var j=b(D);this.logger.log(p.DEBUG,"Char codes = "+j.join(",")),v(l,A,this.cmdHistory)}return D},x.parseBackgroundAttributes=function(l,A){var S=(l===16||l===24)&&A>=32&&A<=47,D=(l===23||l===31)&&A>=45&&A<=47;if(!(S||D))return!1;var I,B={};l===16||l===24?(I=Math.floor((A-32)/2),B.background=T[I],A%2===1&&(B.background=B.background+"_semi")):A===45?B.background="transparent":(B.foreground="black",A===47&&(B.underline=!0));var j=l<=23?1:2,z=this.channels[j];return z.setBkgData(B),v(l,A,this.cmdHistory),!0},x.reset=function(){for(var l=0;l<Object.keys(this.channels).length;l++){var A=this.channels[l];A&&A.reset()}this.cmdHistory=w()},x.cueSplitAtTime=function(l){for(var A=0;A<this.channels.length;A++){var S=this.channels[A];S&&S.cueSplitAtTime(l)}},C}();function v(C,x,d){d.a=C,d.b=x}function R(C,x,d){return d.a===C&&d.b===x}function w(){return{a:null,b:null}}J.default=g},"./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 X={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(H,U){var P=X[U];return!!P&&P[H.slice(0,4)]===!0}function M(H,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/vttparser.ts"),F=O("./src/utils/webvtt-parser.ts"),M=O("./src/utils/texttrack-utils.ts"),H=/\s/,U={newCue:function(L,h,f,T){for(var p=[],m,b,a,i,s,u=self.VTTCue||self.TextTrackCue,y=0;y<T.rows.length;y++)if(m=T.rows[y],a=!0,i=0,s="",!m.isEmpty()){for(var g=0;g<m.chars.length;g++)H.test(m.chars[g].uchar)&&a?i++:(s+=m.chars[g].uchar,a=!1);m.cueStartTime=h,h===f&&(f+=1e-4),i>=16?i--:i++;var v=Object(X.fixLineBreaks)(s.trim()),R=Object(F.generateCueId)(h,f,v);(!L||!L.cues||!L.cues.getCueById(R))&&(b=new u(h,f,v),b.id=R,b.line=y+1,b.align="left",b.position=10+Math.min(80,Math.floor(i*8/32)*10),p.push(b))}return L&&p.length&&(p.sort(function(w,C){return w.line==="auto"||C.line==="auto"?0:w.line>8&&C.line>8?C.line-w.line:w.line-C.line}),p.forEach(function(w){return Object(M.addCueToTrack)(L,w)})),p}};J.default=U},"./src/utils/discontinuities.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"findFirstFragWithCC",function(){return H}),O.d(J,"shouldAlignOnDiscontinuities",function(){return U}),O.d(J,"findDiscontinuousReferenceFrag",function(){return P}),O.d(J,"adjustSlidingStart",function(){return h}),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 b});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts"),M=O("./src/controller/level-helper.ts");function H(a,i){for(var s=null,u=0,y=a.length;u<y;u++){var g=a[u];if(g&&g.cc===i){s=g;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,u=i.fragments;if(!u.length||!s.length){F.logger.log("No fragments to align");return}var y=H(s,u[0].cc);if(!y||y&&!y.startPTS){F.logger.log("No frag in previous level to align on");return}return y}function L(a,i){if(a){var s=a.start+i;a.start=a.startPTS=s,a.endPTS=s+a.duration}}function h(a,i){for(var s=i.fragments,u=0,y=s.length;u<y;u++)L(s[u],a);i.fragmentHint&&L(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 u=P(s.details,i);u&&Object(X.isFiniteNumber)(u.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),h(u.start,i))}}function p(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,u=a.fragments[0].programDateTime,y=(u-s)/1e3+i.fragments[0].start;y&&Object(X.isFiniteNumber)(y)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+y.toFixed(3)+" "+a.url+" "),h(y,a))}function m(a,i){var s=a.programDateTime;if(!s)return;var u=(s-i)/1e3;a.start=a.startPTS=u,a.endPTS=u+a.duration}function b(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,u=i.fragments[0].start,y=s-u*1e3;a.fragments.forEach(function(g){m(g,y)}),a.fragmentHint&&m(a.fragmentHint,y),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/ewma.ts"),F=function(){function M(U,P,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new X.default(U),this.fast_=new X.default(P)}var H=M.prototype;return H.update=function(P,L){var h=this.slow_,f=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new X.default(P,h.getEstimate(),h.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new X.default(L,f.getEstimate(),f.getTotalWeight()))},H.sample=function(P,L){P=Math.max(P,this.minDelayMs_);var h=8*L,f=P/1e3,T=h/f;this.fast_.sample(f,T),this.slow_.sample(f,T)},H.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},M}();J.default=F},"./src/utils/ewma.ts":function(ue,J,O){"use strict";O.r(J);var X=function(){function F(H,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=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=U,this.totalWeight_=P}var M=F.prototype;return M.sample=function(U,P){var L=Math.pow(this.alpha_,U);this.estimate_=P*(1-L)+L*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=X},"./src/utils/fetch-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"fetchSupported",function(){return m});var X=O("./src/polyfills/number.ts"),F=O("./src/loader/load-stats.ts"),M=O("./src/demux/chunk-cache.ts");function H(u,y){u.prototype=Object.create(y.prototype),u.prototype.constructor=u,f(u,y)}function U(u){var y=typeof Map=="function"?new Map:void 0;return U=function(v){if(v===null||!h(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof y!="undefined"){if(y.has(v))return y.get(v);y.set(v,R)}function R(){return P(v,arguments,T(this).constructor)}return R.prototype=Object.create(v.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),f(R,v)},U(u)}function P(u,y,g){return L()?P=Reflect.construct:P=function(R,w,C){var x=[null];x.push.apply(x,w);var d=Function.bind.apply(R,x),l=new d;return C&&f(l,C.prototype),l},P.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function h(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function f(u,y){return f=Object.setPrototypeOf||function(v,R){return v.__proto__=R,v},f(u,y)}function T(u){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},T(u)}function p(){return p=Object.assign||function(u){for(var y=1;y<arguments.length;y++){var g=arguments[y];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(u[v]=g[v])}return u},p.apply(this,arguments)}function m(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var b=function(){function u(g){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=g.fetchSetup||i,this.controller=new self.AbortController,this.stats=new F.LoadStats}var y=u.prototype;return y.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},y.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},y.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},y.load=function(v,R,w){var C=this,x=this.stats;if(x.loading.start)throw new Error("Loader can only be used once.");x.loading.start=self.performance.now();var d=a(v,this.controller.signal),l=w.onProgress,A=v.responseType==="arraybuffer",S=A?"byteLength":"length";this.context=v,this.config=R,this.callbacks=w,this.request=this.fetchSetup(v,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){C.abortInternal(),w.onTimeout(x,v,C.response)},R.timeout),self.fetch(this.request).then(function(D){if(C.response=C.loader=D,!D.ok){var I=D.status,B=D.statusText;throw new s(B||"fetch, bad network response",I,D)}return x.loading.first=Math.max(self.performance.now(),x.loading.start),x.total=parseInt(D.headers.get("Content-Length")||"0"),l&&Object(X.isFiniteNumber)(R.highWaterMark)?C.loadProgressively(D,x,v,R.highWaterMark,l):A?D.arrayBuffer():D.text()}).then(function(D){var I=C.response;self.clearTimeout(C.requestTimeout),x.loading.end=Math.max(self.performance.now(),x.loading.first),x.loaded=x.total=D[S];var B={url:I.url,data:D};l&&!Object(X.isFiniteNumber)(R.highWaterMark)&&l(x,v,D,I),w.onSuccess(B,x,v,I)}).catch(function(D){if(self.clearTimeout(C.requestTimeout),x.aborted)return;var I=D.code||0;w.onError({code:I,text:D.message},v,D.details)})},y.getCacheAge=function(){var v=null;if(this.response){var R=this.response.headers.get("age");v=R?parseFloat(R):null}return v},y.loadProgressively=function(v,R,w,C,x){C===void 0&&(C=0);var d=new M.default,l=v.body.getReader(),A=function S(){return l.read().then(function(D){if(D.done)return d.dataLength&&x(R,w,d.flush(),v),Promise.resolve(new ArrayBuffer(0));var I=D.value,B=I.length;return R.loaded+=B,B<C||d.dataLength?(d.push(I),d.dataLength>=C&&x(R,w,d.flush(),v)):x(R,w,I,v),S()}).catch(function(){return Promise.reject()})};return A()},u}();function a(u,y){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:y,headers:new self.Headers(p({},u.headers))};return u.rangeEnd&&g.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),g}function i(u,y){return new self.Request(u.url,y)}var s=function(u){H(y,u);function y(g,v,R){var w;return w=u.call(this,g)||this,w.code=void 0,w.details=void 0,w.code=v,w.details=R,w}return y}(U(Error));J.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"IMSC1_CODEC",function(){return h}),O.d(J,"parseIMSC1",function(){return m});var X=O("./src/utils/mp4-tools.ts"),F=O("./src/utils/vttparser.ts"),M=O("./src/utils/vttcue.ts"),H=O("./src/demux/id3.ts"),U=O("./src/utils/timescale-conversion.ts"),P=O("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(C){for(var x=1;x<arguments.length;x++){var d=arguments[x];for(var l in d)Object.prototype.hasOwnProperty.call(d,l)&&(C[l]=d[l])}return C},L.apply(this,arguments)}var h="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(C,x,d,l,A){var S=Object(X.findBox)(new Uint8Array(C),["mdat"]);if(S.length===0){A(new Error("Could not parse IMSC1 mdat"));return}var D=S[0],I=Object(H.utf8ArrayToStr)(new Uint8Array(C,D.start,D.end-D.start)),B=Object(U.toTimescaleFromScale)(x,1,d);try{l(b(I,B))}catch(j){A(j)}}function b(C,x){var d=new DOMParser,l=d.parseFromString(C,"text/xml"),A=l.getElementsByTagName("tt")[0];if(!A)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(S).reduce(function(_,N){return _[N]=A.getAttribute("ttp:"+N)||S[N],_},{}),I=A.getAttribute("xml:space")!=="preserve",B=i(a(A,"styling","style")),j=i(a(A,"layout","region")),z=a(A,"body","[begin]");return[].map.call(z,function(_){var N=s(_,I);if(!N||!_.hasAttribute("begin"))return null;var $=v(_.getAttribute("begin"),D),q=v(_.getAttribute("dur"),D),le=v(_.getAttribute("end"),D);if($===null)throw g(_);if(le===null){if(q===null)throw g(_);le=$+q}var pe=new M.default($-x,le-x,N);pe.id=Object(P.generateCueId)(pe.startTime,pe.endTime,pe.text);var Pe=j[_.getAttribute("region")],Se=B[_.getAttribute("style")];pe.position=10,pe.size=80;var ke=u(Pe,Se),Ae=ke.textAlign;if(Ae){var Te=p[Ae];Te&&(pe.lineAlign=Te),pe.align=Ae}return L(pe,ke),pe}).filter(function(_){return _!==null})}function a(C,x,d){var l=C.getElementsByTagName(x)[0];return l?[].slice.call(l.querySelectorAll(d)):[]}function i(C){return C.reduce(function(x,d){var l=d.getAttribute("xml:id");return l&&(x[l]=d),x},{})}function s(C,x){return[].slice.call(C.childNodes).reduce(function(d,l,A){var S;return l.nodeName==="br"&&A?d+`
|
|
`:(S=l.childNodes)!==null&&S!==void 0&&S.length?s(l,x):x?d+l.textContent.trim().replace(/\s+/g," "):d+l.textContent},"")}function u(C,x){var d="http://www.w3.org/ns/ttml#styling",l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return l.reduce(function(A,S){var D=y(x,d,S)||y(C,d,S);return D&&(A[S]=D),A},{})}function y(C,x,d){return C.hasAttributeNS(x,d)?C.getAttributeNS(x,d):null}function g(C){return new Error("Could not parse ttml timestamp "+C)}function v(C,x){if(!C)return null;var d=Object(F.parseTimeStamp)(C);return d===null&&(f.test(C)?d=R(C,x):T.test(C)&&(d=w(C,x))),d}function R(C,x){var d=f.exec(C),l=(d[4]|0)+(d[5]|0)/x.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+l/x.frameRate}function w(C,x){var d=T.exec(C),l=Number(d[1]),A=d[2];switch(A){case"h":return l*3600;case"m":return l*60;case"ms":return l*1e3;case"f":return l/x.frameRate;case"t":return l/x.tickRate}return l}},"./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 L});var X=function(){},F={trace:X,debug:X,log:X,warn:X,info:X,error:X},M=F;function H(h){var f=self.console[h];return f?f.bind(self.console,"["+h+"] >"):X}function U(h){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]=h[m]?h[m].bind(h):H(m)})}function P(h){if(self.console&&h===!0||typeof h=="object"){U(h,"debug","log","info","warn","error");try{M.log()}catch(f){M=F}}else M=F}var L=M},"./src/utils/mediakeys-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"KeySystems",function(){return X}),O.d(J,"requestMediaKeySystemAccess",function(){return F});var X;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(X||(X={}));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 X});function X(){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 L}),O.d(J,"writeUint32",function(){return h}),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 b}),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 u});var X=O("./src/utils/typed-array.ts"),F=O("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,H=[].push;function U(y){return String.fromCharCode.apply(null,y)}function P(y,g){"data"in y&&(g+=y.start,y=y.data);var v=y[g]<<8|y[g+1];return v<0?65536+v:v}function L(y,g){"data"in y&&(g+=y.start,y=y.data);var v=y[g]<<24|y[g+1]<<16|y[g+2]<<8|y[g+3];return v<0?4294967296+v:v}function h(y,g,v){"data"in y&&(g+=y.start,y=y.data),y[g]=v>>24,y[g+1]=v>>16&255,y[g+2]=v>>8&255,y[g+3]=v&255}function f(y,g){var v=[];if(!g.length)return v;var R,w,C;"data"in y?(R=y.data,w=y.start,C=y.end):(R=y,w=0,C=R.byteLength);for(var x=w;x<C;){var d=L(R,x),l=U(R.subarray(x+4,x+8)),A=d>1?x+d:C;if(l===g[0])if(g.length===1)v.push({data:R,start:x+8,end:A});else{var S=f({data:R,start:x+8,end:A},g.slice(1));S.length&&H.apply(v,S)}x=A}return v}function T(y){var g=f(y,["moov"]),v=g[0],R=v?v.end:null,w=f(y,["sidx"]);if(!w||!w[0])return null;var C=[],x=w[0],d=x.data[0],l=d===0?8:16,A=L(x,l);l+=4;var S=0,D=0;d===0?l+=8:l+=16,l+=2;var I=x.end+D,B=P(x,l);l+=2;for(var j=0;j<B;j++){var z=l,_=L(x,z);z+=4;var N=_&2147483647,$=(_&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=L(x,z);z+=4,C.push({referenceSize:N,subsegmentDuration:q,info:{duration:q/A,start:I,end:I+N-1}}),I+=N,z+=4,l=z}return{earliestPresentationTime:S,timescale:A,version:d,referencesCount:B,references:C,moovEndOffset:R}}function p(y){for(var g=[],v=f(y,["moov","trak"]),R=0;R<v.length;R++){var w=v[R],C=f(w,["tkhd"])[0];if(C){var x=C.data[C.start],d=x===0?12:20,l=L(C,d),A=f(w,["mdia","mdhd"])[0];if(A){x=A.data[A.start],d=x===0?12:20;var S=L(A,d),D=f(w,["mdia","hdlr"])[0];if(D){var I=U(D.data.subarray(D.start+8,D.start+12)),B={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[I];if(B){var j=f(w,["mdia","minf","stbl","stsd"])[0],z=void 0;j&&(z=U(j.data.subarray(j.start+12,j.start+16))),g[l]={timescale:S,type:B},g[B]={timescale:S,id:l,codec:z}}}}}}var _=f(y,["moov","mvex","trex"]);return _.forEach(function(N){var $=L(N,4),q=g[$];q&&(q.default={duration:L(N,12),flags:L(N,20)})}),g}function m(y,g){return f(g,["moof","traf"]).reduce(function(v,R){var w=f(R,["tfdt"])[0],C=w.data[w.start],x=f(R,["tfhd"]).reduce(function(d,l){var A=L(l,4),S=y[A];if(S){var D=L(w,4);C===1&&(D*=Math.pow(2,32),D+=L(w,8));var I=S.timescale||9e4,B=D/I;if(isFinite(B)&&(d===null||B<d))return B}return d},null);return x!==null&&isFinite(x)&&(v===null||x<v)?x:v},null)||0}function b(y,g){for(var v=0,R=0,w=0,C=f(y,["moof","traf"]),x=0;x<C.length;x++){var d=C[x],l=f(d,["tfhd"])[0],A=L(l,4),S=g[A];if(!S)continue;var D=S.default,I=L(l,0)|(D==null?void 0:D.flags),B=D==null?void 0:D.duration;I&8&&(I&2?B=L(l,12):B=L(l,8));for(var j=S.timescale||9e4,z=f(d,["trun"]),_=0;_<z.length;_++){if(B){var N=L(z[_],4);v=B*N}else v=a(z[_]);S.type===F.ElementaryStreamTypes.VIDEO?R+=v/j:S.type===F.ElementaryStreamTypes.AUDIO&&(w+=v/j)}}if(R===0&&w===0){var $=T(y);if($!=null&&$.references)return $.references.reduce(function(q,le){return q+le.info.duration||0},0)}return R||w}function a(y){var g=L(y,0),v=8;g&1&&(v+=4),g&4&&(v+=4);for(var R=0,w=L(y,4),C=0;C<w;C++){if(g&256){var x=L(y,v);R+=x,v+=4}g&512&&(v+=4),g&1024&&(v+=4),g&2048&&(v+=4)}return R}function i(y,g,v){f(g,["moof","traf"]).forEach(function(R){f(R,["tfhd"]).forEach(function(w){var C=L(w,4),x=y[C];if(!x)return;var d=x.timescale||9e4;f(R,["tfdt"]).forEach(function(l){var A=l.data[l.start],S=L(l,4);if(A===0)h(l,4,S-v*d);else{S*=Math.pow(2,32),S+=L(l,8),S-=v*d,S=Math.max(S,0);var D=Math.floor(S/(M+1)),I=Math.floor(S%(M+1));h(l,4,D),h(l,8,I)}})})})}function s(y){var g={valid:null,remainder:null},v=f(y,["moof"]);if(v){if(v.length<2)return g.remainder=y,g}else return g;var R=v[v.length-1];return g.valid=Object(X.sliceUint8)(y,0,R.start-8),g.remainder=Object(X.sliceUint8)(y,R.start-8),g}function u(y,g){var v=new Uint8Array(y.length+g.length);return v.set(y),v.set(g,y.length),v}},"./src/utils/output-filter.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return X});var X=function(){function F(H,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,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,L){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=P,this.screen=L,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 H}),O.d(J,"removeCuesInRange",function(){return U}),O.d(J,"getCuesInRange",function(){return L});var X=O("./src/utils/logger.ts");function F(h,f){var T;try{T=new Event("addtrack")}catch(p){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=h,f.dispatchEvent(T)}function M(h,f){var T=h.mode;if(T==="disabled"&&(h.mode="hidden"),h.cues&&!h.cues.getCueById(f.id))try{if(h.addCue(f),!h.cues.getCueById(f.id))throw new Error("addCue is failed for: "+f)}catch(m){X.logger.debug("[texttrack-utils]: "+m);var p=new self.TextTrackCue(f.startTime,f.endTime,f.text);p.id=f.id,h.addCue(p)}T==="disabled"&&(h.mode=T)}function H(h){var f=h.mode;if(f==="disabled"&&(h.mode="hidden"),h.cues)for(var T=h.cues.length;T--;)h.removeCue(h.cues[T]);f==="disabled"&&(h.mode=f)}function U(h,f,T){var p=h.mode;if(p==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0)for(var m=L(h.cues,f,T),b=0;b<m.length;b++)h.removeCue(m[b]);p==="disabled"&&(h.mode=p)}function P(h,f){if(f<h[0].startTime)return 0;var T=h.length-1;if(f>h[T].endTime)return-1;for(var p=0,m=T;p<=m;){var b=Math.floor((m+p)/2);if(f<h[b].startTime)m=b-1;else if(f>h[b].startTime&&p<T)p=b+1;else return b}return h[p].startTime-f<f-h[m].startTime?p:m}function L(h,f,T){var p=[],m=P(h,f);if(m>-1)for(var b=m,a=h.length;b<a;b++){var i=h[b];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 X={toString:function(M){for(var H="",U=M.length,P=0;P<U;P++)H+="["+M.start(P).toFixed(3)+","+M.end(P).toFixed(3)+"]";return H}};J.default=X},"./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 H}),O.d(J,"toMpegTsClockFromTimescale",function(){return U});var X=9e4;function F(P,L,h,f){h===void 0&&(h=1),f===void 0&&(f=!1);var T=P*L*h;return f?Math.round(T):T}function M(P,L,h,f){return h===void 0&&(h=1),f===void 0&&(f=!1),F(P,L,1/h,f)}function H(P,L){return L===void 0&&(L=!1),F(P,1e3,1/X,L)}function U(P,L){return L===void 0&&(L=1),F(P,X,1/L)}},"./src/utils/typed-array.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"sliceUint8",function(){return X});function X(F,M,H){return Uint8Array.prototype.slice?F.slice(M,H):new Uint8Array(Array.prototype.slice.call(F,M,H))}},"./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 X=["","lr","rl"],F=["start","middle","end","left","right"];function M(h,f){if(typeof f!="string")return!1;if(!Array.isArray(h))return!1;var T=f.toLowerCase();return~h.indexOf(T)?T:!1}function H(h){return M(X,h)}function U(h){return M(F,h)}function P(h){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 b=arguments[m];for(var a in b)h[a]=b[a]}return h}function L(h,f,T){var p=this,m={enumerable:!0};p.hasBeenReset=!1;var b="",a=!1,i=h,s=f,u=T,y=null,g="",v=!0,R="auto",w="start",C=50,x="middle",d=50,l="middle";Object.defineProperty(p,"id",P({},m,{get:function(){return b},set:function(S){b=""+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 u},set:function(S){u=""+S,this.hasBeenReset=!0}})),Object.defineProperty(p,"region",P({},m,{get:function(){return y},set:function(S){y=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"vertical",P({},m,{get:function(){return g},set:function(S){var D=H(S);if(D===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=D,this.hasBeenReset=!0}})),Object.defineProperty(p,"snapToLines",P({},m,{get:function(){return v},set:function(S){v=!!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 C},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");C=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"positionAlign",P({},m,{get:function(){return x},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");x=D,this.hasBeenReset=!0}})),Object.defineProperty(p,"size",P({},m,{get:function(){return d},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");d=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"align",P({},m,{get:function(){return l},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");l=D,this.hasBeenReset=!0}})),p.displayState=void 0}return L.prototype.getCueAsHTML=function(){var h=self.WebVTT;return h.convertCueToDOMTree(self,this.text)},L}()},"./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 X=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,u){return(a|0)*3600+(i|0)*60+(s|0)+parseFloat(u||0)}var b=p.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?m(b[2],b[3],0,b[4]):m(b[1],b[2],b[3],b[4]):null}var H=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 u=0;u<s.length;++u)if(i===s[u]){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,b,a){var i=a?p.split(a):[p];for(var s in i){if(typeof i[s]!="string")continue;var u=i[s].split(b);if(u.length!==2)continue;var y=u[0],g=u[1];m(y,g)}}var P=new X.default(0,0,""),L=P.align==="middle"?"middle":"center";function h(p,m,b){var a=p;function i(){var y=M(p);if(y===null)throw new Error("Malformed timestamp: "+a);return p=p.replace(/^[^\sa-zA-Z-]+/,""),y}function s(y,g){var v=new H;U(y,function(C,x){var d;switch(C){case"region":for(var l=b.length-1;l>=0;l--)if(b[l].id===x){v.set(C,b[l].region);break}break;case"vertical":v.alt(C,x,["rl","lr"]);break;case"line":d=x.split(","),v.integer(C,d[0]),v.percent(C,d[0])&&v.set("snapToLines",!1),v.alt(C,d[0],["auto"]),d.length===2&&v.alt("lineAlign",d[1],["start",L,"end"]);break;case"position":d=x.split(","),v.percent(C,d[0]),d.length===2&&v.alt("positionAlign",d[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":v.percent(C,x);break;case"align":v.alt(C,x,["start",L,"end","left","right"]);break}},/:/,/\s/),g.region=v.get("region",null),g.vertical=v.get("vertical","");var R=v.get("line","auto");R==="auto"&&P.line===-1&&(R=-1),g.line=R,g.lineAlign=v.get("lineAlign","start"),g.snapToLines=v.get("snapToLines",!0),g.size=v.get("size",100),g.align=v.get("align",L);var w=v.get("position","auto");w==="auto"&&P.position===50&&(w=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=w}function u(){p=p.replace(/^\s+/,"")}if(u(),m.startTime=i(),u(),p.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);p=p.substr(3),u(),m.endTime=i(),u(),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,C=0;for(w=f(w);C<w.length&&w[C]!=="\r"&&w[C]!==`
|
|
`;)++C;var x=w.substr(0,C);return w[C]==="\r"&&++C,w[C]===`
|
|
`&&++C,i.buffer=w.substr(C),x}function u(w){U(w,function(C,x){},/:/)}try{var y="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;y=s();var g=y.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var v=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;v?v=!1:y=s();switch(i.state){case"HEADER":/:/.test(y)?u(y):y||(i.state="ID");continue;case"NOTE":y||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(y)){i.state="NOTE";break}if(!y)continue;if(i.cue=new X.default(0,0,""),i.state="CUE",y.indexOf("-->")===-1){i.cue.id=y;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{h(y,i.cue,i.regionList)}catch(w){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var R=y.indexOf("-->")!==-1;if(!y||R&&(v=!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+=y}continue;case"BADCUE":y||(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 X=O("./src/polyfills/number.ts"),F=O("./src/utils/vttparser.ts"),M=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),U=O("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,L=function(a,i,s){return s===void 0&&(s=0),a.substr(s,i.length)===i},h=function(a){var i=parseInt(a.substr(-3)),s=parseInt(a.substr(-6,2)),u=parseInt(a.substr(-9,2)),y=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(X.isFiniteNumber)(i)||!Object(X.isFiniteNumber)(s)||!Object(X.isFiniteNumber)(u)||!Object(X.isFiniteNumber)(y))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*s,i+=60*1e3*u,i+=60*60*1e3*y,i},f=function(a){for(var i=5381,s=a.length;s;)i=i*33^a.charCodeAt(--s);return(i>>>0).toString()};function T(b,a,i){return f(b.toString())+f(a.toString())+f(i)}var p=function(a,i,s){var u=a[i],y=a[u.prevCC];if(!y||!y.new&&u.new){a.ccOffset=a.presentationOffset=u.start,u.new=!1;return}for(;(g=y)!==null&&g!==void 0&&g.new;){var g;a.ccOffset+=u.start-y.start,u.new=!1,u=y,y=a[u.prevCC]}a.presentationOffset=s};function m(b,a,i,s,u,y,g,v){var R=new F.VTTParser,w=Object(M.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(P,`
|
|
`).split(`
|
|
`),C=[],x=Object(H.toMpegTsClockFromTimescale)(a,i),d="00:00.000",l=0,A=0,S,D=!0,I=!1;R.oncue=function(B){var j=s[u],z=s.ccOffset,_=(l-x)/9e4;if(j!=null&&j.new&&(A!==void 0?z=s.ccOffset=j.start:p(s,u,_)),_&&(z=_-s.presentationOffset),I){var N=B.endTime-B.startTime,$=Object(U.normalizePts)((B.startTime+z-A)*9e4,y*9e4)/9e4;B.startTime=$,B.endTime=$+N}var q=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(q)),B.id||(B.id=T(B.startTime,B.endTime,q)),B.endTime>0&&C.push(B)},R.onparsingerror=function(B){S=B},R.onflush=function(){if(S){v(S);return}g(C)},w.forEach(function(B){if(D)if(L(B,"X-TIMESTAMP-MAP=")){D=!1,I=!0,B.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?d=j.substr(6):L(j,"MPEGTS:")&&(l=parseInt(j.substr(7)))});try{A=h(d)/1e3}catch(j){I=!1,S=j}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 X=O("./src/utils/logger.ts"),F=O("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,H=function(){function U(L){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=L?L.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 h=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),h&&(h.onreadystatechange=null,h.onprogress=null,h.readyState!==4&&(this.stats.aborted=!0,h.abort()))},P.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(h,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=h,this.config=f,this.callbacks=T,this.retryDelay=f.retryDelay,this.loadInternal()},P.loadInternal=function(){var h=this.config,f=this.context;if(!h)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 b=this.context.headers;if(b)for(var a in b)T.setRequestHeader(a,b[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),h.timeout),T.send()},P.readystatechange=function(){var h=this.context,f=this.loader,T=this.stats;if(!h||!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 b=f.status;if(b>=200&&b<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var a,i;if(h.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,h,a,f),!this.callbacks)return;var u={url:f.responseURL,data:a};this.callbacks.onSuccess(u,T,h,f)}else T.retry>=m.maxRetry||b>=400&&b<499?(X.logger.error(b+" while loading "+h.url),this.callbacks.onError({code:b,text:f.statusText},h,f)):(X.logger.warn(b+" while loading "+h.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(){X.logger.warn("timeout while loading "+this.context.url);var h=this.callbacks;h&&(this.abortInternal(),h.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(h){var f=this.stats;f.loaded=h.loaded,h.lengthComputable&&(f.total=h.total)},P.getCacheAge=function(){var h=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var f=this.loader.getResponseHeader("age");h=f?parseFloat(f):null}return h},U}();J.default=H}}).default})},vHTk:function(vt,Le,ee){vt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|