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.
440 lines
1.1 MiB
440 lines
1.1 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[202,5,7,9],{"+NIl":function(et,Ee,J){(function(oe){oe(J("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function(Y,D){"use strict";function z(u,o){u.cmdState.push(o)}function N(u){return u.cmdState.length>0?u.cmdState[u.cmdState.length-1]:null}function M(u){var o=u.cmdState.pop();o&&o.closeBracket()}function W(u){for(var o=u.cmdState,p=o.length-1;p>=0;p--){var l=o[p];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function H(u,o,p){return function(){this.name=u,this.bracketNo=0,this.style=o,this.styles=p,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var i={};i.importmodule=H("importmodule","tag",["string","builtin"]),i.documentclass=H("documentclass","tag",["","atom"]),i.usepackage=H("usepackage","tag",["atom"]),i.begin=H("begin","tag",["atom"]),i.end=H("end","tag",["atom"]),i.label=H("label","tag",["atom"]),i.ref=H("ref","tag",["atom"]),i.eqref=H("eqref","tag",["atom"]),i.cite=H("cite","tag",["atom"]),i.bibitem=H("bibitem","tag",["atom"]),i.Bibitem=H("Bibitem","tag",["atom"]),i.RBibitem=H("RBibitem","tag",["atom"]),i.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(u,o){u.f=o}function g(u,o){var p;if(u.match(/^\\[a-zA-Z@]+/)){var l=u.current().slice(1);return p=i.hasOwnProperty(l)?i[l]:i.DEFAULT,p=new p,z(o,p),L(o,m),p.style}if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/\\]/))return"tag";if(u.match("\\["))return L(o,function(s,a){return c(s,a,"\\]")}),"keyword";if(u.match("\\("))return L(o,function(s,a){return c(s,a,"\\)")}),"keyword";if(u.match("$$"))return L(o,function(s,a){return c(s,a,"$$")}),"keyword";if(u.match("$"))return L(o,function(s,a){return c(s,a,"$")}),"keyword";var h=u.next();if(h=="%")return u.skipToEnd(),"comment";if(h=="}"||h=="]"){if(p=N(o),p)p.closeBracket(h),L(o,m);else return"error";return"bracket"}else return h=="{"||h=="["?(p=i.DEFAULT,p=new p,z(o,p),"bracket"):/\d/.test(h)?(u.eatWhile(/[\w.%]/),"atom"):(u.eatWhile(/[\w\-_]/),p=W(o),p.name=="begin"&&(p.argument=u.current()),p.styleIdentifier())}function c(u,o,p){if(u.eatSpace())return null;if(p&&u.match(p))return L(o,g),"keyword";if(u.match(/^\\[a-zA-Z@]+/))return"tag";if(u.match(/^[a-zA-Z]+/))return"variable-2";if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/]/))return"tag";if(u.match(/^[\^_&]/))return"tag";if(u.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(u.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=u.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(u.skipToEnd(),"comment"):"error"}function m(u,o){var p=u.peek(),l;return p=="{"||p=="["?(l=N(o),l.openBracket(p),u.eat(p),L(o,g),"bracket"):/[ \t\r]/.test(p)?(u.eat(p),null):(L(o,g),M(o),g(u,o))}return{startState:function(){var u=D.inMathMode?function(o,p){return c(o,p)}:g;return{cmdState:[],f:u}},copyState:function(u){return{cmdState:u.cmdState.slice(),f:u.f}},token:function(u,o){return o.f(u,o)},blankLine:function(u){u.f=g,u.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+ua5":function(et,Ee,J){},"/cxE":function(et,Ee,J){"use strict";J.d(Ee,"f",function(){return D}),J.d(Ee,"g",function(){return z}),J.d(Ee,"h",function(){return N}),J.d(Ee,"e",function(){return W}),J.d(Ee,"b",function(){return H}),J.d(Ee,"c",function(){return i}),J.d(Ee,"d",function(){return L}),J.d(Ee,"a",function(){return g});class oe{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(c){setTimeout(()=>{throw c.stack?new Error(c.message+`
|
|
|
|
`+c.stack):c},0)}}emit(c){this.listeners.forEach(m=>{m(c)})}onUnexpectedError(c){this.unexpectedErrorHandler(c),this.emit(c)}onUnexpectedExternalError(c){this.unexpectedErrorHandler(c)}}const Y=new oe;function D(c){W(c)||Y.onUnexpectedError(c);return}function z(c){W(c)||Y.onUnexpectedExternalError(c);return}function N(c){if(c instanceof Error){let{name:m,message:u}=c;const o=c.stacktrace||c.stack;return{$isError:!0,name:m,message:u,stack:o}}return c}const M="Canceled";function W(c){return c instanceof Error&&c.name===M&&c.message===M}function H(){const c=new Error(M);return c.name=c.message,c}function i(c){return c?new Error(`Illegal argument: ${c}`):new Error("Illegal argument")}function L(c){return c?new Error(`Illegal state: ${c}`):new Error("Illegal state")}class g extends Error{constructor(c){super("NotSupported");c&&(this.message=c)}}},"19Vz":function(et,Ee,J){(function(oe){oe(J("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(H,i,L){var g=L&&L!=oe.Init;if(i&&!g)H.on("blur",N),H.on("change",M),H.on("swapDoc",M),oe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){z(H)}),M(H);else if(!i&&g){H.off("blur",N),H.off("change",M),H.off("swapDoc",M),oe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Y(H);var c=H.getWrapperElement();c.className=c.className.replace(" CodeMirror-empty","")}i&&!H.hasFocus()&&N(H)});function Y(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function D(H){Y(H);var i=H.state.placeholder=document.createElement("pre");i.style.cssText="height: 0; overflow: visible",i.style.direction=H.getOption("direction"),i.className="CodeMirror-placeholder CodeMirror-line-like";var L=H.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),i.appendChild(L),H.display.lineSpace.insertBefore(i,H.display.lineSpace.firstChild)}function z(H){setTimeout(function(){var i=!1,L=H.getInputField();L.nodeName=="TEXTAREA"?i=!L.value:H.lineCount()==1&&(i=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),i?D(H):Y(H)},20)}function N(H){W(H)&&D(H)}function M(H){var i=H.getWrapperElement(),L=W(H);i.className=i.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(H):Y(H)}function W(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(et,Ee,J){(function(oe){oe(J("VrN/"))})(function(oe){"use strict";var Y={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function(z,N){var M=z.indentUnit,W={},H=N.htmlMode?Y:D;for(var i in H)W[i]=H[i];for(var i in N)W[i]=N[i];var L,g;function c(f,x){function v(B){return x.tokenize=B,B(f,x)}var y=f.next();if(y=="<")return f.eat("!")?f.eat("[")?f.match("CDATA[")?v(o("atom","]]>")):null:f.match("--")?v(o("comment","-->")):f.match("DOCTYPE",!0,!0)?(f.eatWhile(/[\w\._\-]/),v(p(1))):null:f.eat("?")?(f.eatWhile(/[\w\._\-]/),x.tokenize=o("meta","?>"),"meta"):(L=f.eat("/")?"closeTag":"openTag",x.tokenize=m,"tag bracket");if(y=="&"){var U;return f.eat("#")?f.eat("x")?U=f.eatWhile(/[a-fA-F\d]/)&&f.eat(";"):U=f.eatWhile(/[\d]/)&&f.eat(";"):U=f.eatWhile(/[\w\.\-:]/)&&f.eat(";"),U?"atom":"error"}else return f.eatWhile(/[^&<]/),null}c.isInText=!0;function m(f,x){var v=f.next();if(v==">"||v=="/"&&f.eat(">"))return x.tokenize=c,L=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return L="equals",null;if(v=="<"){x.tokenize=c,x.state=a,x.tagName=x.tagStart=null;var y=x.tokenize(f,x);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(v)?(x.tokenize=u(v),x.stringStartCol=f.column(),x.tokenize(f,x)):(f.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function u(f){var x=function(v,y){for(;!v.eol();)if(v.next()==f){y.tokenize=m;break}return"string"};return x.isInAttribute=!0,x}function o(f,x){return function(v,y){for(;!v.eol();){if(v.match(x)){y.tokenize=c;break}v.next()}return f}}function p(f){return function(x,v){for(var y;(y=x.next())!=null;){if(y=="<")return v.tokenize=p(f+1),v.tokenize(x,v);if(y==">")if(f==1){v.tokenize=c;break}else return v.tokenize=p(f-1),v.tokenize(x,v)}return"meta"}}function l(f,x,v){this.prev=f.context,this.tagName=x,this.indent=f.indented,this.startOfLine=v,(W.doNotIndent.hasOwnProperty(x)||f.context&&f.context.noIndent)&&(this.noIndent=!0)}function h(f){f.context&&(f.context=f.context.prev)}function s(f,x){for(var v;;){if(!f.context)return;if(v=f.context.tagName,!W.contextGrabbers.hasOwnProperty(v)||!W.contextGrabbers[v].hasOwnProperty(x))return;h(f)}}function a(f,x,v){return f=="openTag"?(v.tagStart=x.column(),C):f=="closeTag"?_:a}function C(f,x,v){return f=="word"?(v.tagName=x.current(),g="tag",R):W.allowMissingTagName&&f=="endTag"?(g="tag bracket",R(f,x,v)):(g="error",C)}function _(f,x,v){if(f=="word"){var y=x.current();return v.context&&v.context.tagName!=y&&W.implicitlyClosed.hasOwnProperty(v.context.tagName)&&h(v),v.context&&v.context.tagName==y||W.matchClosing===!1?(g="tag",T):(g="tag error",O)}else return W.allowMissingTagName&&f=="endTag"?(g="tag bracket",T(f,x,v)):(g="error",O)}function T(f,x,v){return f!="endTag"?(g="error",T):(h(v),a)}function O(f,x,v){return g="error",T(f,x,v)}function R(f,x,v){if(f=="word")return g="attribute",S;if(f=="endTag"||f=="selfcloseTag"){var y=v.tagName,U=v.tagStart;return v.tagName=v.tagStart=null,f=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(y)?s(v,y):(s(v,y),v.context=new l(v,y,U==v.indented)),a}return g="error",R}function S(f,x,v){return f=="equals"?w:(W.allowMissing||(g="error"),R(f,x,v))}function w(f,x,v){return f=="string"?E:f=="word"&&W.allowUnquoted?(g="string",R):(g="error",R(f,x,v))}function E(f,x,v){return f=="string"?E:R(f,x,v)}return{startState:function(f){var x={tokenize:c,state:a,indented:f||0,tagName:null,tagStart:null,context:null};return f!=null&&(x.baseIndent=f),x},token:function(f,x){if(!x.tagName&&f.sol()&&(x.indented=f.indentation()),f.eatSpace())return null;L=null;var v=x.tokenize(f,x);return(v||L)&&v!="comment"&&(g=null,x.state=x.state(L||v,f,x),g&&(v=g=="error"?v+" error":g)),v},indent:function(f,x,v){var y=f.context;if(f.tokenize.isInAttribute)return f.tagStart==f.indented?f.stringStartCol+1:f.indented+M;if(y&&y.noIndent)return oe.Pass;if(f.tokenize!=m&&f.tokenize!=c)return v?v.match(/^(\s*)/)[0].length:0;if(f.tagName)return W.multilineTagIndentPastTag!==!1?f.tagStart+f.tagName.length+2:f.tagStart+M*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var U=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(U&&U[1])for(;y;)if(y.tagName==U[2]){y=y.prev;break}else if(W.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(U)for(;y;){var B=W.contextGrabbers[y.tagName];if(B&&B.hasOwnProperty(U[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+M:f.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(f){f.state==w&&(f.state=R)},xmlCurrentTag:function(f){return f.tagName?{name:f.tagName,close:f.type=="closeTag"}:null},xmlCurrentContext:function(f){for(var x=[],v=f.context;v;v=v.prev)v.tagName&&x.push(v.tagName);return x.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return Y});class oe{constructor(D){this.element=D,this.next=oe.Undefined,this.prev=oe.Undefined}}oe.Undefined=new oe(void 0);class Y{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let D=this._first;for(;D!==oe.Undefined;){const z=D.next;D.prev=oe.Undefined,D.next=oe.Undefined,D=z}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(D){return this._insert(D,!1)}push(D){return this._insert(D,!0)}_insert(D,z){const N=new oe(D);if(this._first===oe.Undefined)this._first=N,this._last=N;else if(z){const W=this._last;this._last=N,N.prev=W,W.next=N}else{const W=this._first;this._first=N,N.next=W,W.prev=N}this._size+=1;let M=!1;return()=>{M||(M=!0,this._remove(N))}}shift(){if(this._first===oe.Undefined)return;{const D=this._first.element;return this._remove(this._first),D}}pop(){if(this._last===oe.Undefined)return;{const D=this._last.element;return this._remove(this._last),D}}_remove(D){if(D.prev!==oe.Undefined&&D.next!==oe.Undefined){const z=D.prev;z.next=D.next,D.next.prev=z}else D.prev===oe.Undefined&&D.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):D.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):D.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let D=this._first;for(;D!==oe.Undefined;)yield D.element,D=D.next}}},"3/fG":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return Y});function oe(D,z){let N;return z.length===0?N=D:N=D.replace(/\{(\d+)\}/g,function(M,W){const H=W[0];return typeof z[H]!="undefined"?z[H]:M}),N}function Y(D,z,...N){return oe(z,N)}},"30zm":function(et,Ee,J){"use strict";var oe=J("jCWc"),Y=J("kPKH"),D=J("k1fw"),z=J("tJVT"),N=J("PpiC"),M=J("B9cy"),W=J("Ol7k"),H=J("lUTK"),i=J("BvKs"),L=J("q1tI"),g=J.n(L),c=J("Ty5D"),m=J("55Ip"),u=J("9kvl"),o=J("m3rI"),p=J("kzJb"),l=J.n(p),h=i.a.SubMenu,s=W.a.Sider,a=W.a.Content,C=function(T){var O=T.messages,R=T.globalSetting,S=T.loading,w=T.user,E=T.dispatch,f=Object(N.a)(T,["messages","globalSetting","loading","user","dispatch"]),x=Object(c.i)(),v=w.userInfo,y=Object(c.h)(),U=O.tidingsList,B=O.privateMessage,A=O.unreadInfo,j=Object(L.useState)({per_page:10,page:1}),P=Object(z.a)(j,2),b=P[0],V=P[1];Object(L.useEffect)(function(){ne()},[x.userId]);var ne=function(){E({type:"messages/unreadMessageInfo",payload:Object(D.a)(Object(D.a)({},b),x)})};return g.a.createElement(Y.a,{flex:"264px"},g.a.createElement("aside",{className:l.a.userInfo},g.a.createElement("img",{className:"mt40",src:o.a.IMG_SERVER+"/images/"+(v==null?void 0:v.image_url)}),g.a.createElement("p",{className:"font24 mt10"},v==null?void 0:v.username),g.a.createElement("p",{className:"mt20"},v==null?void 0:v.user_identity)),g.a.createElement("ul",{className:l.a.navInfo},g.a.createElement(m.a,{to:"/messages/".concat(v==null?void 0:v.login,"/user_tidings")},g.a.createElement("li",{className:y.pathname.indexOf("user_tidings")>-1&&l.a.actived},"\u6D88\u606F",!!(A!=null&&A.unread_tiding_count)&&g.a.createElement("span",{className:l.a.newTip},A==null?void 0:A.unread_tiding_count))),g.a.createElement(m.a,{to:"/messages/".concat(v==null?void 0:v.login,"/private_messages")},g.a.createElement("li",{className:(y.pathname.indexOf("private_messages")>-1||y.pathname.indexOf("message_detail")>-1)&&l.a.actived},"\u79C1\u4FE1",!!(A!=null&&A.unread_message_count)&&g.a.createElement("span",{className:l.a.newTip},A==null?void 0:A.unread_message_count)))))};Ee.a=Object(u.a)(function(_){var T=_.messages,O=_.loading,R=_.user,S=_.globalSetting;return{messages:T,globalSetting:S,user:R,loading:O.effects}})(C)},"55Ip":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return s});var oe=J("Ty5D"),Y=J("dI71"),D=J("q1tI"),z=J.n(D),N=J("YS25"),M=J("17x9"),W=J.n(M),H=J("wx14"),i=J("zLVn"),L=J("9R94"),g=function(w){Object(Y.a)(E,w);function E(){for(var x,v=arguments.length,y=new Array(v),U=0;U<v;U++)y[U]=arguments[U];return x=w.call.apply(w,[this].concat(y))||this,x.history=Object(N.a)(x.props),x}var f=E.prototype;return f.render=function(){return z.a.createElement(oe.c,{history:this.history,children:this.props.children})},E}(z.a.Component),c=function(w){Object(Y.a)(E,w);function E(){for(var x,v=arguments.length,y=new Array(v),U=0;U<v;U++)y[U]=arguments[U];return x=w.call.apply(w,[this].concat(y))||this,x.history=Object(N.b)(x.props),x}var f=E.prototype;return f.render=function(){return z.a.createElement(oe.c,{history:this.history,children:this.props.children})},E}(z.a.Component),m=function(E,f){return typeof E=="function"?E(f):E},u=function(E,f){return typeof E=="string"?Object(N.c)(E,null,null,f):E},o=function(E){return E},p=z.a.forwardRef;typeof p=="undefined"&&(p=o);function l(w){return!!(w.metaKey||w.altKey||w.ctrlKey||w.shiftKey)}var h=p(function(w,E){var f=w.innerRef,x=w.navigate,v=w.onClick,y=Object(i.a)(w,["innerRef","navigate","onClick"]),U=y.target,B=Object(H.a)({},y,{onClick:function(j){try{v&&v(j)}catch(P){throw j.preventDefault(),P}!j.defaultPrevented&&j.button===0&&(!U||U==="_self")&&!l(j)&&(j.preventDefault(),x())}});return o!==p?B.ref=E||f:B.ref=f,z.a.createElement("a",B)}),s=p(function(w,E){var f=w.component,x=f===void 0?h:f,v=w.replace,y=w.to,U=w.innerRef,B=Object(i.a)(w,["component","replace","to","innerRef"]);return z.a.createElement(oe.e.Consumer,null,function(A){A||Object(L.a)(!1);var j=A.history,P=u(m(y,A.location),A.location),b=P?j.createHref(P):"",V=Object(H.a)({},B,{href:b,navigate:function(){var ce=m(y,A.location),me=v?j.replace:j.push;me(ce)}});return o!==p?V.ref=E||U:V.innerRef=U,z.a.createElement(x,V)})});if(!1)var a,C;var _=function(E){return E},T=z.a.forwardRef;typeof T=="undefined"&&(T=_);function O(){for(var w=arguments.length,E=new Array(w),f=0;f<w;f++)E[f]=arguments[f];return E.filter(function(x){return x}).join(" ")}var R=T(function(w,E){var f=w["aria-current"],x=f===void 0?"page":f,v=w.activeClassName,y=v===void 0?"active":v,U=w.activeStyle,B=w.className,A=w.exact,j=w.isActive,P=w.location,b=w.sensitive,V=w.strict,ne=w.style,ce=w.to,me=w.innerRef,Ie=Object(i.a)(w,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return z.a.createElement(oe.e.Consumer,null,function(we){we||Object(L.a)(!1);var Le=P||we.location,Re=u(m(ce,Le),Le),De=Re.pathname,ye=De&&De.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),X=ye?Object(oe.f)(Le.pathname,{path:ye,exact:A,sensitive:b,strict:V}):null,k=!!(j?j(X,Le):X),F=k?O(B,y):B,$=k?Object(H.a)({},ne,{},U):ne,te=Object(H.a)({"aria-current":k&&x||null,className:F,style:$,to:Re},Ie);return _!==T?te.ref=E||me:te.innerRef=me,z.a.createElement(s,te)})});if(!1)var S},"5VLF":function(et,Ee,J){"use strict";var oe,Y;function D(z,N,M){var W=function(H,i){return z.js_beautify(H,i)};return W.js=z.js_beautify,W.css=N.css_beautify,W.html=M.html_beautify,W.js_beautify=z.js_beautify,W.css_beautify=N.css_beautify,W.html_beautify=M.html_beautify,W}!(oe=[J("6UM0"),J("TXwP"),J("psGv")],Y=function(z,N,M){return D(z,N,M)}.apply(Ee,oe),Y!==void 0&&(et.exports=Y))},"5Y4S":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return D});var oe=J("MNsG");const Y=oe.b.performance&&typeof oe.b.performance.now=="function";class D{constructor(z){this._highResolution=Y&&z,this._startTime=this._now(),this._stopTime=-1}static create(z=!0){return new D(z)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?oe.b.performance.now():Date.now()}}},"6UM0":function(et,Ee,J){var oe,Y;(function(){var D;(function(){"use strict";var N=[function(i,L,g){var c=g(1).Beautifier,m=g(5).Options;function u(o,p){var l=new c(o,p);return l.beautify()}i.exports=u,i.exports.defaultOptions=function(){return new m}},function(i,L,g){var c=g(2).Output,m=g(3).Token,u=g(4),o=g(5).Options,p=g(7).Tokenizer,l=g(7).line_starters,h=g(7).positionable_operators,s=g(7).TOKEN;function a(b,V){return V.indexOf(b)!==-1}function C(b){return b.replace(/^\s+/g,"")}function _(b){for(var V={},ne=0;ne<b.length;ne++)V[b[ne].replace(/-/g,"_")]=b[ne];return V}function T(b,V){return b&&b.type===s.RESERVED&&b.text===V}function O(b,V){return b&&b.type===s.RESERVED&&a(b.text,V)}var R=["case","return","do","if","throw","else","await","break","continue","async"],S=["before-newline","after-newline","preserve-newline"],w=_(S),E=[w.before_newline,w.preserve_newline],f={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function x(b,V){if(V.multiline_frame||V.mode===f.ForInitializer||V.mode===f.Conditional)return;b.remove_indent(V.start_line_index)}function v(b){b=b.replace(u.allLineBreaks,`
|
|
`);for(var V=[],ne=b.indexOf(`
|
|
`);ne!==-1;)V.push(b.substring(0,ne)),b=b.substring(ne+1),ne=b.indexOf(`
|
|
`);return b.length&&V.push(b),V}function y(b){return b===f.ArrayLiteral}function U(b){return a(b,[f.Expression,f.ForInitializer,f.Conditional])}function B(b,V){for(var ne=0;ne<b.length;ne++){var ce=b[ne].trim();if(ce.charAt(0)!==V)return!1}return!0}function A(b,V){for(var ne=0,ce=b.length,me;ne<ce;ne++)if(me=b[ne],me&&me.indexOf(V)!==0)return!1;return!0}function j(b,V){V=V||{},this._source_text=b||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new o(V)}j.prototype.create_flags=function(b,V){var ne=0;b&&(ne=b.indentation_level,!this._output.just_added_newline()&&b.line_indent_level>ne&&(ne=b.line_indent_level));var ce={mode:V,parent:b,last_token:b?b.last_token:new m(s.START_BLOCK,""),last_word:b?b.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:ne,alignment:0,line_indent_level:b?b.line_indent_level:ne,start_line_index:this._output.get_line_number(),ternary_depth:0};return ce},j.prototype._reset=function(b){var V=b.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new c(this._options,V),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(f.BlockStatement);var ne=new p(b,this._options);return this._tokens=ne.tokenize(),b},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b,V=this._reset(this._source_text),ne=this._options.eol;this._options.eol==="auto"&&(ne=`
|
|
`,V&&u.lineBreak.test(V||"")&&(ne=V.match(u.lineBreak)[0]));for(var ce=this._tokens.next();ce;)this.handle_token(ce),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ce,ce=this._tokens.next();return b=this._output.get_code(ne),b},j.prototype.handle_token=function(b,V){b.type===s.START_EXPR?this.handle_start_expr(b):b.type===s.END_EXPR?this.handle_end_expr(b):b.type===s.START_BLOCK?this.handle_start_block(b):b.type===s.END_BLOCK?this.handle_end_block(b):b.type===s.WORD?this.handle_word(b):b.type===s.RESERVED?this.handle_word(b):b.type===s.SEMICOLON?this.handle_semicolon(b):b.type===s.STRING?this.handle_string(b):b.type===s.EQUALS?this.handle_equals(b):b.type===s.OPERATOR?this.handle_operator(b):b.type===s.COMMA?this.handle_comma(b):b.type===s.BLOCK_COMMENT?this.handle_block_comment(b,V):b.type===s.COMMENT?this.handle_comment(b,V):b.type===s.DOT?this.handle_dot(b):b.type===s.EOF?this.handle_eof(b):b.type===s.UNKNOWN?this.handle_unknown(b,V):this.handle_unknown(b,V)},j.prototype.handle_whitespace_and_comments=function(b,V){var ne=b.newlines,ce=this._options.keep_array_indentation&&y(this._flags.mode);if(b.comments_before)for(var me=b.comments_before.next();me;)this.handle_whitespace_and_comments(me,V),this.handle_token(me,V),me=b.comments_before.next();if(ce)for(var Ie=0;Ie<ne;Ie+=1)this.print_newline(Ie>0,V);else if(this._options.max_preserve_newlines&&ne>this._options.max_preserve_newlines&&(ne=this._options.max_preserve_newlines),this._options.preserve_newlines&&ne>1){this.print_newline(!1,V);for(var we=1;we<ne;we+=1)this.print_newline(!0,V)}};var P=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(b,V){if(V=V===void 0?!1:V,this._output.just_added_newline())return;var ne=this._options.preserve_newlines&&b.newlines||V,ce=a(this._flags.last_token.text,h)||a(b.text,h);if(ce){var me=a(this._flags.last_token.text,h)&&a(this._options.operator_position,E)||a(b.text,h);ne=ne&&me}if(ne)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,P))return;this._output.set_wrap_point()}},j.prototype.print_newline=function(b,V){if(!V&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==s.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var ne=this._tokens.peek();this._flags.mode===f.Statement&&!(this._flags.if_block&&T(ne,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(b)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(b){this._output.just_added_newline()&&(this._options.keep_array_indentation&&b.newlines&&(b.text==="["||y(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(b.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},j.prototype.print_token=function(b){if(this._output.raw){this._output.add_raw_token(b);return}if(this._options.comma_first&&b.previous&&b.previous.type===s.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var V=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(V),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(b),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(b),this._output.non_breaking_space=!0,this._output.add_token(b.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.set_mode=function(b){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,b),this._flags=this.create_flags(this._previous_flags,b),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===f.Statement&&x(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===f.ObjectLiteral&&this._flags.mode===f.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(b){var V=!1;return V=V||O(this._flags.last_token,["var","let","const"])&&b.type===s.WORD,V=V||T(this._flags.last_token,"do"),V=V||!(this._flags.parent.mode===f.ObjectLiteral&&this._flags.mode===f.Statement)&&O(this._flags.last_token,P)&&!b.newlines,V=V||T(this._flags.last_token,"else")&&!(T(b,"if")&&!b.comments_before),V=V||this._flags.last_token.type===s.END_EXPR&&(this._previous_flags.mode===f.ForInitializer||this._previous_flags.mode===f.Conditional),V=V||this._flags.last_token.type===s.WORD&&this._flags.mode===f.BlockStatement&&!this._flags.in_case&&!(b.text==="--"||b.text==="++")&&this._last_last_text!=="function"&&b.type!==s.WORD&&b.type!==s.RESERVED,V=V||this._flags.mode===f.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),V?(this.set_mode(f.Statement),this.indent(),this.handle_whitespace_and_comments(b,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b,O(b,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b);var V=f.Expression;if(b.text==="["){if(this._flags.last_token.type===s.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(b),this.set_mode(V),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}V=f.ArrayLiteral,y(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),a(this._flags.last_token.type,[s.START_EXPR,s.END_EXPR,s.WORD,s.OPERATOR,s.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===s.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,V=f.ForInitializer):a(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,V=f.Conditional):a(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&b.whitespace_before===""?this._output.space_before_token=!1:(a(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b);else if(this._flags.last_token.type===s.WORD){this._output.space_before_token=!1;var ne=this._tokens.peek(-3);if(this._options.space_after_named_function&&ne){var ce=this._tokens.peek(-4);O(ne,["async","function"])||ne.text==="*"&&O(ce,["async","function"])?this._output.space_before_token=!0:this._flags.mode===f.ObjectLiteral?(ne.text==="{"||ne.text===","||ne.text==="*"&&(ce.text==="{"||ce.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(b);(this._flags.last_token.type===s.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(a(this._last_last_text,["function","yield"])||this._flags.mode===f.ObjectLiteral&&a(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===s.START_BLOCK?this.print_newline():(this._flags.last_token.type===s.END_EXPR||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===s.COMMA)&&this.allow_wrap_or_preserved_newline(b,b.newlines),this.print_token(b),this.set_mode(V),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(b){for(;this._flags.mode===f.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(b,b.text==="]"&&y(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===s.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(b),this.restore_mode(),x(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===f.Conditional&&(this._previous_flags.mode=f.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(b){this.handle_whitespace_and_comments(b);var V=this._tokens.peek(),ne=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===s.END_EXPR?(this.set_mode(f.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(f.BlockStatement):ne&&(a(ne.text,[":",","])&&a(V.type,[s.STRING,s.WORD,s.RESERVED])||a(V.text,["get","set","..."])&&a(ne.type,[s.WORD,s.RESERVED]))?a(this._last_last_text,["class","interface"])&&!a(ne.text,[":",","])?this.set_mode(f.BlockStatement):this.set_mode(f.ObjectLiteral):this._flags.last_token.type===s.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(f.BlockStatement):a(this._flags.last_token.type,[s.EQUALS,s.START_EXPR,s.COMMA,s.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(f.ObjectLiteral):this.set_mode(f.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ce=!V.comments_before&&V.text==="}",me=ce&&this._flags.last_word==="function"&&this._flags.last_token.type===s.END_EXPR;if(this._options.brace_preserve_inline){var Ie=0,we=null;this._flags.inline_frame=!0;do if(Ie+=1,we=this._tokens.peek(Ie-1),we.newlines){this._flags.inline_frame=!1;break}while(we.type!==s.EOF&&!(we.type===s.END_BLOCK&&we.opened===b))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==s.OPERATOR&&(me||this._flags.last_token.type===s.EQUALS||O(this._flags.last_token,R)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(y(this._previous_flags.mode)&&(this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.COMMA)&&((this._flags.last_token.type===s.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(b),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==s.OPERATOR&&this._flags.last_token.type!==s.START_EXPR&&(this._flags.last_token.type===s.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(b),this.indent(),!ce&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(b){for(this.handle_whitespace_and_comments(b);this._flags.mode===f.Statement;)this.restore_mode();var V=this._flags.last_token.type===s.START_BLOCK;this._flags.inline_frame&&!V?this._output.space_before_token=!0:this._options.brace_style==="expand"?V||this.print_newline():V||(y(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(b)},j.prototype.handle_word=function(b){if(b.type===s.RESERVED){if(a(b.text,["set","get"])&&this._flags.mode!==f.ObjectLiteral)b.type=s.WORD;else if(b.text==="import"&&a(this._tokens.peek().text,["(","."]))b.type=s.WORD;else if(a(b.text,["as","from"])&&!this._flags.import_block)b.type=s.WORD;else if(this._flags.mode===f.ObjectLiteral){var V=this._tokens.peek();V.text===":"&&(b.type=s.WORD)}}if(this.start_of_statement(b)?O(this._flags.last_token,["var","let","const"])&&b.type===s.WORD&&(this._flags.declaration_statement=!0):b.newlines&&!U(this._flags.mode)&&(this._flags.last_token.type!==s.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==s.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(b),this.print_newline()):this.handle_whitespace_and_comments(b),this._flags.do_block&&!this._flags.do_while)if(T(b,"while")){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&T(b,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===f.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(b,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(b),this._flags.in_case=!0;return}if((this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b)),T(b,"function")){(a(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(a(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===s.OPERATOR))&&(!this._output.just_added_blankline()&&!b.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,P)?this._output.space_before_token=!0:T(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===s.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(U(this._flags.mode)||y(this._flags.mode))||this.print_newline(),this.print_token(b),this._flags.last_word=b.text;return}var ne="NONE";if(this._flags.last_token.type===s.END_BLOCK?this._previous_flags.inline_frame?ne="SPACE":O(b,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines?ne="NEWLINE":(ne="SPACE",this._output.space_before_token=!0):ne="NEWLINE":this._flags.last_token.type===s.SEMICOLON&&this._flags.mode===f.BlockStatement?ne="NEWLINE":this._flags.last_token.type===s.SEMICOLON&&U(this._flags.mode)?ne="SPACE":this._flags.last_token.type===s.STRING?ne="NEWLINE":this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD||this._flags.last_token.text==="*"&&(a(this._last_last_text,["function","yield"])||this._flags.mode===f.ObjectLiteral&&a(this._last_last_text,["{",","]))?ne="SPACE":this._flags.last_token.type===s.START_BLOCK?this._flags.inline_frame?ne="SPACE":ne="NEWLINE":this._flags.last_token.type===s.END_EXPR&&(this._output.space_before_token=!0,ne="NEWLINE"),O(b,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ne="SPACE":ne="NEWLINE"),O(b,["else","catch","finally"]))if((!(this._flags.last_token.type===s.END_BLOCK&&this._previous_flags.mode===f.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ce=this._output.current_line;ce.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ne==="NEWLINE"?O(this._flags.last_token,R)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(b,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==s.END_EXPR?(this._flags.last_token.type!==s.START_EXPR||!O(b,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(b,"if")&&T(b.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(b,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&y(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ne==="SPACE"&&(this._output.space_before_token=!0);b.previous&&(b.previous.type===s.WORD||b.previous.type===s.RESERVED)&&(this._output.space_before_token=!0),this.print_token(b),this._flags.last_word=b.text,b.type===s.RESERVED&&(b.text==="do"?this._flags.do_block=!0:b.text==="if"?this._flags.if_block=!0:b.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(b,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(b){this.start_of_statement(b)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(b);for(var V=this._tokens.peek();this._flags.mode===f.Statement&&!(this._flags.if_block&&T(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(b)},j.prototype.handle_string=function(b){b.text.startsWith("`")&&b.newlines===0&&b.whitespace_before===""&&(b.previous.text===")"||this._flags.last_token.type===s.WORD)||(this.start_of_statement(b)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(b),this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b):b.text.startsWith("`")&&this._flags.last_token.type===s.END_EXPR&&(b.previous.text==="]"||b.previous.text===")")&&b.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(b)},j.prototype.handle_equals=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0},j.prototype.handle_comma=function(b){this.handle_whitespace_and_comments(b,!0),this.print_token(b),this._output.space_before_token=!0,this._flags.declaration_statement?(U(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)):this._flags.mode===f.ObjectLiteral||this._flags.mode===f.Statement&&this._flags.parent.mode===f.ObjectLiteral?(this._flags.mode===f.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)},j.prototype.handle_operator=function(b){var V=b.text==="*"&&(O(this._flags.last_token,["function","yield"])||a(this._flags.last_token.type,[s.START_BLOCK,s.COMMA,s.END_BLOCK,s.SEMICOLON])),ne=a(b.text,["-","+"])&&(a(this._flags.last_token.type,[s.START_BLOCK,s.START_EXPR,s.EQUALS,s.OPERATOR])||a(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(b)){var ce=!V;this.handle_whitespace_and_comments(b,ce)}if(b.text==="*"&&this._flags.last_token.type===s.DOT){this.print_token(b);return}if(b.text==="::"){this.print_token(b);return}if(this._flags.last_token.type===s.OPERATOR&&a(this._options.operator_position,E)&&this.allow_wrap_or_preserved_newline(b),b.text===":"&&this._flags.in_case){this.print_token(b),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==s.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var me=!0,Ie=!0,we=!1;if(b.text===":"?this._flags.ternary_depth===0?me=!1:(this._flags.ternary_depth-=1,we=!0):b.text==="?"&&(this._flags.ternary_depth+=1),!ne&&!V&&this._options.preserve_newlines&&a(b.text,h)){var Le=b.text===":",Re=Le&&we,De=Le&&!we;switch(this._options.operator_position){case w.before_newline:this._output.space_before_token=!De,this.print_token(b),(!Le||Re)&&this.allow_wrap_or_preserved_newline(b),this._output.space_before_token=!0;return;case w.after_newline:this._output.space_before_token=!0,!Le||Re?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(b):this._output.space_before_token=!1,this.print_token(b),this._output.space_before_token=!0;return;case w.preserve_newline:De||this.allow_wrap_or_preserved_newline(b),me=!(this._output.just_added_newline()||De),this._output.space_before_token=me,this.print_token(b),this._output.space_before_token=!0;return}}if(V){this.allow_wrap_or_preserved_newline(b),me=!1;var ye=this._tokens.peek();Ie=ye&&a(ye.type,[s.WORD,s.RESERVED])}else if(b.text==="...")this.allow_wrap_or_preserved_newline(b),me=this._flags.last_token.type===s.START_BLOCK,Ie=!1;else if(a(b.text,["--","++","!","~"])||ne){if((this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR)&&this.allow_wrap_or_preserved_newline(b),me=!1,Ie=!1,b.newlines&&(b.text==="--"||b.text==="++"||b.text==="~")){var X=O(this._flags.last_token,R)&&b.newlines;X&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(X,!0)}this._flags.last_token.text===";"&&U(this._flags.mode)&&(me=!0),this._flags.last_token.type===s.RESERVED?me=!0:this._flags.last_token.type===s.END_EXPR?me=!(this._flags.last_token.text==="]"&&(b.text==="--"||b.text==="++")):this._flags.last_token.type===s.OPERATOR&&(me=a(b.text,["--","-","++","+"])&&a(this._flags.last_token.text,["--","-","++","+"]),a(b.text,["+","-"])&&a(this._flags.last_token.text,["--","++"])&&(Ie=!0)),(this._flags.mode===f.BlockStatement&&!this._flags.inline_frame||this._flags.mode===f.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||me,this.print_token(b),this._output.space_before_token=Ie},j.prototype.handle_block_comment=function(b,V){if(this._output.raw){this._output.add_raw_token(b),b.directives&&b.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(b.directives){this.print_newline(!1,V),this.print_token(b),b.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!u.newline.test(b.text)&&!b.newlines){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0;return}else this.print_block_commment(b,V)},j.prototype.print_block_commment=function(b,V){var ne=v(b.text),ce,me=!1,Ie=!1,we=b.whitespace_before,Le=we.length;if(this.print_newline(!1,V),this.print_token_line_indentation(b),this._output.add_token(ne[0]),this.print_newline(!1,V),ne.length>1){for(ne=ne.slice(1),me=B(ne,"*"),Ie=A(ne,we),me&&(this._flags.alignment=1),ce=0;ce<ne.length;ce++)me?(this.print_token_line_indentation(b),this._output.add_token(C(ne[ce]))):Ie&&ne[ce]?(this.print_token_line_indentation(b),this._output.add_token(ne[ce].substring(Le))):(this._output.current_line.set_indent(-1),this._output.add_token(ne[ce])),this.print_newline(!1,V);this._flags.alignment=0}},j.prototype.handle_comment=function(b,V){b.newlines?this.print_newline(!1,V):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(b),this.print_newline(!1,V)},j.prototype.handle_dot=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,R)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(b,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(b)},j.prototype.handle_unknown=function(b,V){this.print_token(b),b.text[b.text.length-1]===`
|
|
`&&this.print_newline(!1,V)},j.prototype.handle_eof=function(b){for(;this._flags.mode===f.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b)},i.exports.Beautifier=j},function(i){function L(m){this.__parent=m,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var m=new L(this.__parent);return m.set_indent(this.__indent_count,this.__alignment_count),m},L.prototype.item=function(m){return m<0?this.__items[this.__items.length+m]:this.__items[m]},L.prototype.has_match=function(m){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(m))return!0;return!1},L.prototype.set_indent=function(m,u){this.is_empty()&&(this.__indent_count=m||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var m=this.__parent.current_line;return m.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),m.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),m.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,m.__items[0]===" "&&(m.__items.splice(0,1),m.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(m){this.__items.push(m);var u=m.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=m.length-u:this.__character_count+=m.length},L.prototype.pop=function(){var m=null;return this.is_empty()||(m=this.__items.pop(),this.__character_count-=m.length),m},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var m="";return this.is_empty()?this.__parent.indent_empty_lines&&(m=this.__parent.get_indent_string(this.__indent_count)):(m=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),m+=this.__items.join("")),m};function g(m,u){this.__cache=[""],this.__indent_size=m.indent_size,this.__indent_string=m.indent_char,m.indent_with_tabs||(this.__indent_string=new Array(m.indent_size+1).join(m.indent_char)),u=u||"",m.indent_level>0&&(u=new Array(m.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}g.prototype.get_indent_size=function(m,u){var o=this.__base_string_length;return u=u||0,m<0&&(o=0),o+=m*this.__indent_size,o+=u,o},g.prototype.get_indent_string=function(m,u){var o=this.__base_string;return u=u||0,m<0&&(m=0,o=""),u+=m*this.__indent_size,this.__ensure_cache(u),o+=this.__cache[u],o},g.prototype.__ensure_cache=function(m){for(;m>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var m=this.__cache.length,u=0,o="";this.__indent_size&&m>=this.__indent_size&&(u=Math.floor(m/this.__indent_size),m-=u*this.__indent_size,o=new Array(u+1).join(this.__indent_string)),m&&(o+=new Array(m+1).join(" ")),this.__cache.push(o)};function c(m,u){this.__indent_cache=new g(m,u),this.raw=!1,this._end_with_newline=m.end_with_newline,this.indent_size=m.indent_size,this.wrap_line_length=m.wrap_line_length,this.indent_empty_lines=m.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(m,u){return this.__indent_cache.get_indent_string(m,u)},c.prototype.get_indent_size=function(m,u){return this.__indent_cache.get_indent_size(m,u)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(m){return this.is_empty()||!m&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(m){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
|
|
`);return m!==`
|
|
`&&(o=o.replace(/[\n]/g,m)),o},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(m,u){return m=m||0,u=u||0,this.next_line.set_indent(m,u),this.__lines.length>1?(this.current_line.set_indent(m,u),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(m){for(var u=0;u<m.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(m.whitespace_before),this.current_line.push(m.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},c.prototype.add_token=function(m){this.__add_space_before_token(),this.current_line.push(m),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},c.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},c.prototype.remove_indent=function(m){for(var u=this.__lines.length;m<u;)this.__lines[m]._remove_indent(),m++;this.current_line._remove_wrap_indent()},c.prototype.trim=function(m){for(m=m===void 0?!1:m,this.current_line.trim();m&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(m,u){for(var o=this.__lines.length-2;o>=0;){var p=this.__lines[o];if(p.is_empty())break;if(p.item(0).indexOf(m)!==0&&p.item(-1)!==u){this.__lines.splice(o+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},i.exports.Output=c},function(i){function L(g,c,m,u){this.type=g,this.text=c,this.comments_before=null,this.newlines=m||0,this.whitespace_before=u||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}i.exports.Token=L},function(i,L){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",c="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",m="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",u="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",o="(?:\\\\u[0-9a-fA-F]{4}|["+g+m+"])",p="(?:\\\\u[0-9a-fA-F]{4}|["+c+m+u+"])*";L.identifier=new RegExp(o+p,"g"),L.identifierStart=new RegExp(o),L.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+c+m+u+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;L.newline=/[\n\r\u2028\u2029]/,L.lineBreak=new RegExp(`\r
|
|
|`+L.newline.source),L.allLineBreaks=new RegExp(L.lineBreak.source,"g")},function(i,L,g){var c=g(6).Options,m=["before-newline","after-newline","preserve-newline"];function u(o){c.call(this,o,"js");var p=this.raw_options.brace_style||null;p==="expand-strict"?this.raw_options.brace_style="expand":p==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var h=0;h<l.length;h++)l[h]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[h];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",m),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}u.prototype=new c,i.exports.Options=u},function(i){function L(m,u){this.raw_options=g(m,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(m,u){var o=this.raw_options[m],p=u||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(p=o.concat()):typeof o=="string"&&(p=o.split(/[^a-zA-Z0-9_\/\-]+/)),p},L.prototype._get_boolean=function(m,u){var o=this.raw_options[m],p=o===void 0?!!u:!!o;return p},L.prototype._get_characters=function(m,u){var o=this.raw_options[m],p=u||"";return typeof o=="string"&&(p=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),p},L.prototype._get_number=function(m,u){var o=this.raw_options[m];u=parseInt(u,10),isNaN(u)&&(u=0);var p=parseInt(o,10);return isNaN(p)&&(p=u),p},L.prototype._get_selection=function(m,u,o){var p=this._get_selection_list(m,u,o);if(p.length!==1)throw new Error("Invalid Option Value: The option '"+m+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return p[0]},L.prototype._get_selection_list=function(m,u,o){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[u[0]],!this._is_valid_selection(o,u))throw new Error("Invalid Default Value!");var p=this._get_array(m,o);if(!this._is_valid_selection(p,u))throw new Error("Invalid Option Value: The option '"+m+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return p},L.prototype._is_valid_selection=function(m,u){return m.length&&u.length&&!m.some(function(o){return u.indexOf(o)===-1})};function g(m,u){var o={};m=c(m);var p;for(p in m)p!==u&&(o[p]=m[p]);if(u&&m[u])for(p in m[u])o[p]=m[u][p];return o}function c(m){var u={},o;for(o in m){var p=o.replace(/-/g,"_");u[p]=m[o]}return u}i.exports.Options=L,i.exports.normalizeOpts=c,i.exports.mergeOpts=g},function(i,L,g){var c=g(8).InputScanner,m=g(9).Tokenizer,u=g(9).TOKEN,o=g(13).Directives,p=g(4),l=g(12).Pattern,h=g(14).TemplatablePattern;function s(B,A){return A.indexOf(B)!==-1}var a={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:u.START,RAW:u.RAW,EOF:u.EOF},C=new o(/\/\*/,/\*\//),_=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,T=/[0-9]/,O=/[^\d\.]/,R=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),S=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";S=S.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),S="\\?\\.(?!\\d) "+S,S=S.replace(/ /g,"|");var w=new RegExp(S),E="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),f=E.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),x=new RegExp("^(?:"+f.join("|")+")$"),v,y=function(B,A){m.call(this,B,A),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new l(this._input),P=new h(this._input).read_options(this._options);this.__patterns={template:P,identifier:P.starting_with(p.identifier).matching(p.identifierMatch),number:j.matching(_),punct:j.matching(w),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(p.lineBreak),shebang:j.starting_with(/#!/).until_after(p.lineBreak),xml:j.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:P.until(/['\\\n\r\u2028\u2029]/),double_quote:P.until(/["\\\n\r\u2028\u2029]/),template_text:P.until(/[`\\$]/),template_expression:P.until(/[`}\\]/)}};y.prototype=new m,y.prototype._is_comment=function(B){return B.type===a.COMMENT||B.type===a.BLOCK_COMMENT||B.type===a.UNKNOWN},y.prototype._is_opening=function(B){return B.type===a.START_BLOCK||B.type===a.START_EXPR},y.prototype._is_closing=function(B,A){return(B.type===a.END_BLOCK||B.type===a.END_EXPR)&&A&&(B.text==="]"&&A.text==="["||B.text===")"&&A.text==="("||B.text==="}"&&A.text==="{")},y.prototype._reset=function(){v=!1},y.prototype._get_next_token=function(B,A){var j=null;this._readWhitespace();var P=this._input.peek();return P===null?this._create_token(a.EOF,""):(j=j||this._read_non_javascript(P),j=j||this._read_string(P),j=j||this._read_word(B),j=j||this._read_singles(P),j=j||this._read_comment(P),j=j||this._read_regexp(P,B),j=j||this._read_xml(P,B),j=j||this._read_punctuation(),j=j||this._create_token(a.UNKNOWN,this._input.next()),j)},y.prototype._read_word=function(B){var A;if(A=this.__patterns.identifier.read(),A!=="")return A=A.replace(p.allLineBreaks,`
|
|
`),!(B.type===a.DOT||B.type===a.RESERVED&&(B.text==="set"||B.text==="get"))&&x.test(A)?(A==="in"||A==="of")&&(B.type===a.WORD||B.type===a.STRING)?this._create_token(a.OPERATOR,A):this._create_token(a.RESERVED,A):this._create_token(a.WORD,A);if(A=this.__patterns.number.read(),A!=="")return this._create_token(a.WORD,A)},y.prototype._read_singles=function(B){var A=null;return B==="("||B==="["?A=this._create_token(a.START_EXPR,B):B===")"||B==="]"?A=this._create_token(a.END_EXPR,B):B==="{"?A=this._create_token(a.START_BLOCK,B):B==="}"?A=this._create_token(a.END_BLOCK,B):B===";"?A=this._create_token(a.SEMICOLON,B):B==="."&&O.test(this._input.peek(1))?A=this._create_token(a.DOT,B):B===","&&(A=this._create_token(a.COMMA,B)),A&&this._input.next(),A},y.prototype._read_punctuation=function(){var B=this.__patterns.punct.read();if(B!=="")return B==="="?this._create_token(a.EQUALS,B):B==="?."?this._create_token(a.DOT,B):this._create_token(a.OPERATOR,B)},y.prototype._read_non_javascript=function(B){var A="";if(B==="#"){if(this._is_first_token()&&(A=this.__patterns.shebang.read(),A))return this._create_token(a.UNKNOWN,A.trim()+`
|
|
`);if(A=this.__patterns.include.read(),A)return this._create_token(a.UNKNOWN,A.trim()+`
|
|
`);B=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(T)){do B=this._input.next(),j+=B;while(this._input.hasNext()&&B!=="#"&&B!=="=");return B==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(a.WORD,j)}this._input.back()}else if(B==="<"&&this._is_first_token()){if(A=this.__patterns.html_comment_start.read(),A){for(;this._input.hasNext()&&!this._input.testChar(p.newline);)A+=this._input.next();return v=!0,this._create_token(a.COMMENT,A)}}else if(v&&B==="-"&&(A=this.__patterns.html_comment_end.read(),A))return v=!1,this._create_token(a.COMMENT,A);return null},y.prototype._read_comment=function(B){var A=null;if(B==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var P=C.get_directives(j);P&&P.ignore==="start"&&(j+=C.readIgnored(this._input)),j=j.replace(p.allLineBreaks,`
|
|
`),A=this._create_token(a.BLOCK_COMMENT,j),A.directives=P}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),A=this._create_token(a.COMMENT,j))}return A},y.prototype._read_string=function(B){if(B==="`"||B==="'"||B==='"'){var A=this._input.next();return this.has_char_escapes=!1,B==="`"?A+=this._read_string_recursive("`",!0,"${"):A+=this._read_string_recursive(B),this.has_char_escapes&&this._options.unescape_strings&&(A=U(A)),this._input.peek()===B&&(A+=this._input.next()),A=A.replace(p.allLineBreaks,`
|
|
`),this._create_token(a.STRING,A)}return null},y.prototype._allow_regexp_or_xml=function(B){return B.type===a.RESERVED&&s(B.text,["return","case","throw","else","do","typeof","yield"])||B.type===a.END_EXPR&&B.text===")"&&B.opened.previous.type===a.RESERVED&&s(B.opened.previous.text,["if","while","for"])||s(B.type,[a.COMMENT,a.START_EXPR,a.START_BLOCK,a.START,a.END_BLOCK,a.OPERATOR,a.EQUALS,a.EOF,a.SEMICOLON,a.COMMA])},y.prototype._read_regexp=function(B,A){if(B==="/"&&this._allow_regexp_or_xml(A)){for(var j=this._input.next(),P=!1,b=!1;this._input.hasNext()&&(P||b||this._input.peek()!==B)&&!this._input.testChar(p.newline);)j+=this._input.peek(),P?P=!1:(P=this._input.peek()==="\\",this._input.peek()==="["?b=!0:this._input.peek()==="]"&&(b=!1)),this._input.next();return this._input.peek()===B&&(j+=this._input.next(),j+=this._input.read(p.identifier)),this._create_token(a.STRING,j)}return null},y.prototype._read_xml=function(B,A){if(this._options.e4x&&B==="<"&&this._allow_regexp_or_xml(A)){var j="",P=this.__patterns.xml.read_match();if(P){for(var b=P[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),V=b.indexOf("{")===0,ne=0;P;){var ce=!!P[1],me=P[2],Ie=!!P[P.length-1]||me.slice(0,8)==="![CDATA[";if(!Ie&&(me===b||V&&me.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ce?--ne:++ne),j+=P[0],ne<=0)break;P=this.__patterns.xml.read_match()}return P||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(p.allLineBreaks,`
|
|
`),this._create_token(a.STRING,j)}}return null};function U(B){for(var A="",j=0,P=new c(B),b=null;P.hasNext();)if(b=P.match(/([\s]|[^\\]|\\\\)+/g),b&&(A+=b[0]),P.peek()==="\\"){if(P.next(),P.peek()==="x")b=P.match(/x([0-9A-Fa-f]{2})/g);else if(P.peek()==="u")b=P.match(/u([0-9A-Fa-f]{4})/g);else{A+="\\",P.hasNext()&&(A+=P.next());continue}if(!b)return B;if(j=parseInt(b[1],16),j>126&&j<=255&&b[0].indexOf("x")===0)return B;if(j>=0&&j<32){A+="\\"+b[0];continue}else j===34||j===39||j===92?A+="\\"+String.fromCharCode(j):A+=String.fromCharCode(j)}return A}y.prototype._read_string_recursive=function(B,A,j){var P,b;B==="'"?b=this.__patterns.single_quote:B==='"'?b=this.__patterns.double_quote:B==="`"?b=this.__patterns.template_text:B==="}"&&(b=this.__patterns.template_expression);for(var V=b.read(),ne="";this._input.hasNext();){if(ne=this._input.next(),ne===B||!A&&p.newline.test(ne)){this._input.back();break}else ne==="\\"&&this._input.hasNext()?(P=this._input.peek(),P==="x"||P==="u"?this.has_char_escapes=!0:P==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),ne+=this._input.next()):j&&(j==="${"&&ne==="$"&&this._input.peek()==="{"&&(ne+=this._input.next()),j===ne&&(B==="`"?ne+=this._read_string_recursive("}",A,"`"):ne+=this._read_string_recursive("`",A,"${"),this._input.hasNext()&&(ne+=this._input.next())));ne+=b.read(),V+=ne}return V},i.exports.Tokenizer=y,i.exports.TOKEN=a,i.exports.positionable_operators=R.slice(),i.exports.line_starters=E.slice()},function(i){var L=RegExp.prototype.hasOwnProperty("sticky");function g(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var c=null;return this.hasNext()&&(c=this.__input.charAt(this.__position),this.__position+=1),c},g.prototype.peek=function(c){var m=null;return c=c||0,c+=this.__position,c>=0&&c<this.__input_length&&(m=this.__input.charAt(c)),m},g.prototype.__match=function(c,m){c.lastIndex=m;var u=c.exec(this.__input);return u&&!(L&&c.sticky)&&(u.index!==m&&(u=null)),u},g.prototype.test=function(c,m){return m=m||0,m+=this.__position,m>=0&&m<this.__input_length?!!this.__match(c,m):!1},g.prototype.testChar=function(c,m){var u=this.peek(m);return c.lastIndex=0,u!==null&&c.test(u)},g.prototype.match=function(c){var m=this.__match(c,this.__position);return m?this.__position+=m[0].length:m=null,m},g.prototype.read=function(c,m,u){var o="",p;return c&&(p=this.match(c),p&&(o+=p[0])),m&&(p||!c)&&(o+=this.readUntil(m,u)),o},g.prototype.readUntil=function(c,m){var u="",o=this.__position;c.lastIndex=this.__position;var p=c.exec(this.__input);return p?(o=p.index,m&&(o+=p[0].length)):o=this.__input_length,u=this.__input.substring(this.__position,o),this.__position=o,u},g.prototype.readUntilAfter=function(c){return this.readUntil(c,!0)},g.prototype.get_regexp=function(c,m){var u=null,o="g";return m&&L&&(o="y"),typeof c=="string"&&c!==""?u=new RegExp(c,o):c&&(u=new RegExp(c.source,o)),u},g.prototype.get_literal_regexp=function(c){return RegExp(c.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(c){var m=this.__position,u=this.readUntilAfter(c);return this.__position=m,u},g.prototype.lookBack=function(c){var m=this.__position-1;return m>=c.length&&this.__input.substring(m-c.length,m).toLowerCase()===c},i.exports.InputScanner=g},function(i,L,g){var c=g(8).InputScanner,m=g(3).Token,u=g(10).TokenStream,o=g(11).WhitespacePattern,p={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(h,s){this._input=new c(h),this._options=s||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var h,s=new m(p.START,""),a=null,C=[],_=new u;s.type!==p.EOF;){for(h=this._get_next_token(s,a);this._is_comment(h);)_.add(h),h=this._get_next_token(s,a);_.isEmpty()||(h.comments_before=_,_=new u),h.parent=a,this._is_opening(h)?(C.push(a),a=h):a&&this._is_closing(h,a)&&(h.opened=a,a.closed=h,a=C.pop(),h.parent=a),h.previous=s,s.next=h,this.__tokens.add(h),s=h}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(h,s){this._readWhitespace();var a=this._input.read(/.+/g);return a?this._create_token(p.RAW,a):this._create_token(p.EOF,"")},l.prototype._is_comment=function(h){return!1},l.prototype._is_opening=function(h){return!1},l.prototype._is_closing=function(h,s){return!1},l.prototype._create_token=function(h,s){var a=new m(h,s,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return a},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},i.exports.Tokenizer=l,i.exports.TOKEN=p},function(i){function L(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}L.prototype.restart=function(){this.__position=0},L.prototype.isEmpty=function(){return this.__tokens_length===0},L.prototype.hasNext=function(){return this.__position<this.__tokens_length},L.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},L.prototype.peek=function(g){var c=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(c=this.__tokens[g]),c},L.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},i.exports.TokenStream=L},function(i,L,g){var c=g(12).Pattern;function m(u,o){c.call(this,u,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}m.prototype=new c,m.prototype.__set_whitespace_patterns=function(u,o){u+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+u+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},m.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var u=this._input.read(this._match_pattern);if(u===" ")this.whitespace_before_token=" ";else if(u){var o=this.__split(this._newline_regexp,u);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return u},m.prototype.matching=function(u,o){var p=this._create();return p.__set_whitespace_patterns(u,o),p._update(),p},m.prototype._create=function(){return new m(this._input,this)},m.prototype.__split=function(u,o){u.lastIndex=0;for(var p=0,l=[],h=u.exec(o);h;)l.push(o.substring(p,h.index)),p=h.index+h[0].length,h=u.exec(o);return p<o.length?l.push(o.substring(p,o.length)):l.push(""),l},i.exports.WhitespacePattern=m},function(i){function L(g,c){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,c&&(this._starting_pattern=this._input.get_regexp(c._starting_pattern,!0),this._match_pattern=this._input.get_regexp(c._match_pattern,!0),this._until_pattern=this._input.get_regexp(c._until_pattern),this._until_after=c._until_after)}L.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},L.prototype.read_match=function(){return this._input.match(this._match_pattern)},L.prototype.until_after=function(g){var c=this._create();return c._until_after=!0,c._until_pattern=this._input.get_regexp(g),c._update(),c},L.prototype.until=function(g){var c=this._create();return c._until_after=!1,c._until_pattern=this._input.get_regexp(g),c._update(),c},L.prototype.starting_with=function(g){var c=this._create();return c._starting_pattern=this._input.get_regexp(g,!0),c._update(),c},L.prototype.matching=function(g){var c=this._create();return c._match_pattern=this._input.get_regexp(g,!0),c._update(),c},L.prototype._create=function(){return new L(this._input,this)},L.prototype._update=function(){},i.exports.Pattern=L},function(i){function L(g,c){g=typeof g=="string"?g:g.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+c,"g")}L.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var m=this.__directive_pattern.exec(g);m;)c[m[1]]=m[2],m=this.__directive_pattern.exec(g);return c},L.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},i.exports.Directives=L},function(i,L,g){var c=g(12).Pattern,m={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function u(o,p){c.call(this,o,p),this.__template_pattern=null,this._disabled=Object.assign({},m),this._excluded=Object.assign({},m),p&&(this.__template_pattern=this._input.get_regexp(p.__template_pattern),this._excluded=Object.assign(this._excluded,p._excluded),this._disabled=Object.assign(this._disabled,p._disabled));var l=new c(o);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}u.prototype=new c,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(o){var p=this._create();return p._disabled[o]=!0,p._update(),p},u.prototype.read_options=function(o){var p=this._create();for(var l in m)p._disabled[l]=o.templating.indexOf(l)===-1;return p._update(),p},u.prototype.exclude=function(o){var p=this._create();return p._excluded[o]=!0,p._update(),p},u.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var p=this._read_template();p;)this._match_pattern?p+=this._input.read(this._match_pattern):p+=this._input.readUntil(this.__template_pattern),o+=p,p=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},u.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},u.prototype._read_template=function(){var o="",p=this._input.peek();if(p==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(o=o||this.__patterns.erb.read())}else p==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},i.exports.TemplatablePattern=u}],M={};function W(i){var L=M[i];if(L!==void 0)return L.exports;var g=M[i]={exports:{}};return N[i](g,g.exports,W),g.exports}var H=W(0);D=H})();var z=D;!(oe=[],Y=function(){return{js_beautify:z}}.apply(Ee,oe),Y!==void 0&&(et.exports=Y))})()},"746U":function(et,Ee,J){"use strict";J.d(Ee,"f",function(){return oe}),J.d(Ee,"l",function(){return Y}),J.d(Ee,"k",function(){return D}),J.d(Ee,"j",function(){return z}),J.d(Ee,"g",function(){return N}),J.d(Ee,"m",function(){return M}),J.d(Ee,"h",function(){return W}),J.d(Ee,"n",function(){return H}),J.d(Ee,"c",function(){return i}),J.d(Ee,"a",function(){return L}),J.d(Ee,"i",function(){return g}),J.d(Ee,"o",function(){return c}),J.d(Ee,"e",function(){return o}),J.d(Ee,"d",function(){return p}),J.d(Ee,"p",function(){return l}),J.d(Ee,"b",function(){return h});function oe(s){return Array.isArray(s)}function Y(s){return typeof s=="string"}function D(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&!(s instanceof RegExp)&&!(s instanceof Date)}function z(s){return typeof s=="number"&&!isNaN(s)}function N(s){return s===!0||s===!1}function M(s){return typeof s=="undefined"}function W(s){return!H(s)}function H(s){return M(s)||s===null}function i(s,a){if(!s)throw new Error(a?`Unexpected type, expected '${a}'`:"Unexpected type")}function L(s){if(H(s))throw new Error("Assertion Failed: argument is undefined or null");return s}function g(s){return typeof s=="function"}function c(s,a){const C=Math.min(s.length,a.length);for(let _=0;_<C;_++)m(s[_],a[_])}function m(s,a){if(Y(a)){if(typeof s!==a)throw new Error(`argument does not match constraint: typeof ${a}`)}else if(g(a)){try{if(s instanceof a)return}catch(C){}if(!H(s)&&s.constructor===a)return;if(a.length===1&&a.call(void 0,s)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function u(s){let a=[],C=Object.getPrototypeOf(s);for(;Object.prototype!==C;)a=a.concat(Object.getOwnPropertyNames(C)),C=Object.getPrototypeOf(C);return a}function o(s){const a=[];for(const C of u(s))typeof s[C]=="function"&&a.push(C);return a}function p(s,a){const C=T=>function(){const O=Array.prototype.slice.call(arguments,0);return a(T,O)};let _={};for(const T of s)_[T]=C(T);return _}function l(s){return s===null?void 0:s}function h(s,a="Unreachable"){throw new Error(a)}},"7Cbv":function(et,Ee,J){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function D(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe(Y)}var z=/^(?:[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 N(m){return typeof m=="string"&&z.test(m)}for(var M=N,W=[],H=0;H<256;++H)W.push((H+256).toString(16).substr(1));function i(m){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(W[m[u+0]]+W[m[u+1]]+W[m[u+2]]+W[m[u+3]]+"-"+W[m[u+4]]+W[m[u+5]]+"-"+W[m[u+6]]+W[m[u+7]]+"-"+W[m[u+8]]+W[m[u+9]]+"-"+W[m[u+10]]+W[m[u+11]]+W[m[u+12]]+W[m[u+13]]+W[m[u+14]]+W[m[u+15]]).toLowerCase();if(!M(o))throw TypeError("Stringified UUID is invalid");return o}var L=i;function g(m,u,o){m=m||{};var p=m.random||(m.rng||D)();if(p[6]=p[6]&15|64,p[8]=p[8]&63|128,u){o=o||0;for(var l=0;l<16;++l)u[o+l]=p[l];return u}return L(p)}var c=Ee.a=g},"7ahc":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return C});var oe=J("k1fw"),Y=J("0Owb"),D=J("+L6B"),z=J("2/Rp"),N=J("y8nQ"),M=J("Vl3Y"),W=J("tJVT"),H=J("OaEy"),i=J("2fM7"),L=J("q1tI"),g=J.n(L),c=J("VrN/"),m=J.n(c),u=J("p77/"),o=J.n(u),p=J("c5Ni"),l=J.n(p),h=i.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},a={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"]};Ee.b=function(_){var T=_.callback,O=_.onCancel,R=Object(L.useState)("python"),S=Object(W.a)(R,2),w=S[0],E=S[1];function f(v){E(a[v][1])}function x(v){T(v)}return g.a.createElement(M.a,Object(Y.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),g.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(i.a,{onChange:f},Object.keys(a).map(function(v){return g.a.createElement(h,{key:v,value:v},a[v][0])}))),g.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(C,{mode:w})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(z.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function C(_){var T=_.value,O=_.onChange,R=_.mode,S=_.options,w=S===void 0?{}:S,E=Object(L.useRef)(),f=Object(L.useState)(),x=Object(W.a)(f,2),v=x[0],y=x[1];return Object(L.useEffect)(function(){if(v){function U(B){var A=B.getValue();O&&O(A)}return v.on("change",U),function(){v.off("change",U)}}},[v,O]),Object(L.useEffect)(function(){v&&v.setOption("mode",R)},[v,R]),Object(L.useEffect)(function(){v&&((T!==v.getValue()||T==="")&&setTimeout(function(){v.setValue(T||" ")},300))},[v,T]),Object(L.useEffect)(function(){if(E.current&&!v){var U=m.a.fromTextArea(E.current,Object(oe.a)({mode:R,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},w));y(U)}},[E.current,v]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:E}))}},"8EBN":function(et,Ee,J){(function(oe){oe(J("VrN/"))})(function(oe){"use strict";oe.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 Y=0;Y<oe.modeInfo.length;Y++){var D=oe.modeInfo[Y];D.mimes&&(D.mime=D.mimes[0])}oe.findModeByMIME=function(z){z=z.toLowerCase();for(var N=0;N<oe.modeInfo.length;N++){var M=oe.modeInfo[N];if(M.mime==z)return M;if(M.mimes){for(var W=0;W<M.mimes.length;W++)if(M.mimes[W]==z)return M}}if(/\+xml$/.test(z))return oe.findModeByMIME("application/xml");if(/\+json$/.test(z))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function(z){z=z.toLowerCase();for(var N=0;N<oe.modeInfo.length;N++){var M=oe.modeInfo[N];if(M.ext){for(var W=0;W<M.ext.length;W++)if(M.ext[W]==z)return M}}},oe.findModeByFileName=function(z){for(var N=0;N<oe.modeInfo.length;N++){var M=oe.modeInfo[N];if(M.file&&M.file.test(z))return M}var W=z.lastIndexOf("."),H=W>-1&&z.substring(W+1,z.length);if(H)return oe.findModeByExtension(H)},oe.findModeByName=function(z){z=z.toLowerCase();for(var N=0;N<oe.modeInfo.length;N++){var M=oe.modeInfo[N];if(M.name.toLowerCase()==z)return M;if(M.alias){for(var W=0;W<M.alias.length;W++)if(M.alias[W].toLowerCase()==z)return M}}}})},"8HAY":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return N}),J.d(Ee,"b",function(){return M}),J.d(Ee,"d",function(){return W}),J.d(Ee,"e",function(){return H}),J.d(Ee,"c",function(){return i});var oe=J("MI8n"),Y=J("pmY6"),D=J("3/fG"),z=function(L,g,c,m){function u(o){return o instanceof c?o:new c(function(p){p(o)})}return new(c||(c=Promise))(function(o,p){function l(a){try{s(m.next(a))}catch(C){p(C)}}function h(a){try{s(m.throw(a))}catch(C){p(C)}}function s(a){a.done?o(a.value):u(a.value).then(l,h)}s((m=m.apply(L,g||[])).next())})};class N extends Y.a{constructor(L,g="",c="",m=!0,u){super();this._onDidChange=this._register(new oe.b),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=L,this._label=g,this._cssClass=c,this._enabled=m,this._actionCallback=u}get id(){return this._id}get label(){return this._label}set label(L){this._setLabel(L)}_setLabel(L){this._label!==L&&(this._label=L,this._onDidChange.fire({label:L}))}get tooltip(){return this._tooltip||""}set tooltip(L){this._setTooltip(L)}_setTooltip(L){this._tooltip!==L&&(this._tooltip=L,this._onDidChange.fire({tooltip:L}))}get class(){return this._cssClass}set class(L){this._setClass(L)}_setClass(L){this._cssClass!==L&&(this._cssClass=L,this._onDidChange.fire({class:L}))}get enabled(){return this._enabled}set enabled(L){this._setEnabled(L)}_setEnabled(L){this._enabled!==L&&(this._enabled=L,this._onDidChange.fire({enabled:L}))}get checked(){return this._checked}set checked(L){this._setChecked(L)}_setChecked(L){this._checked!==L&&(this._checked=L,this._onDidChange.fire({checked:L}))}run(L,g){return z(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(L))})}}class M extends Y.a{constructor(){super(...arguments);this._onBeforeRun=this._register(new oe.b),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new oe.b),this.onDidRun=this._onDidRun.event}run(L,g){return z(this,void 0,void 0,function*(){if(!L.enabled)return;this._onBeforeRun.fire({action:L});let c;try{yield this.runAction(L,g)}catch(m){c=m}this._onDidRun.fire({action:L,error:c})})}runAction(L,g){return z(this,void 0,void 0,function*(){yield L.run(g)})}}class W extends N{constructor(L){super(W.ID,L,L?"separator text":"separator");this.checked=!1,this.enabled=!1}}W.ID="vs.actions.separator";class H{constructor(L,g,c,m){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=L,this.label=g,this.class=m,this._actions=c}get actions(){return this._actions}dispose(){}run(){return z(this,void 0,void 0,function*(){})}}class i extends N{constructor(){super(i.ID,D.a("submenu.empty","(empty)"),void 0,!1)}}i.ID="vs.actions.empty"},"8hTe":function(et,Ee,J){et.exports={button:"button___1wy9m"}},"9Bee":function(et,Ee,J){"use strict";var oe=J("DYRE"),Y=J("zeV3"),D=J("+L6B"),z=J("2/Rp"),N=J("k1fw"),M=J("9og8"),W=J("tJVT"),H=J("WmNS"),i=J.n(H),L=J("q1tI"),g=J.n(L),c=J("vg9a"),m=J("DlQD"),u=J.n(m),o=J("rUJ1");function p(le,Z){var ee=le.match(/^(\s+)(?:```)/);if(ee===null)return Z;var se=ee[1];return Z.split(`
|
|
`).map(function(he){var ie=he.match(/^\s+/);if(ie===null)return he;var ae=Object(W.a)(ie,1),de=ae[0];return de.length>=se.length?he.slice(se.length):he}).join(`
|
|
`)}var l=[],h=["<ul>"],s=new u.a.Renderer,a=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){l.length=0,h=["<ul>"]}var _={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function T(le,Z,ee,se){if(Z>=le.length||le[Z].level<=ee)return Z;var he=le[Z];se.push("<li><a href='#"+he.anchor+"'>"+he.text+"</a>"),Z++;var ie=[];return Z=T(le,Z,he.level,ie),ie.length>0&&(se.push("<ul>"),ie.forEach(function(ae){se.push(ae)}),se.push("</ul>")),se.push("</li>"),Z=T(le,Z,ee,se),Z}function O(){return T(l,0,0,h),h.push("</ul>"),h.join("")}var R={heading:function(Z){var ee=a.exec(Z);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},fences:function(Z){var ee=this.rules.block.fences.exec(Z);if(ee){var se=ee[0],he=p(se,ee[3]||""),ie=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(ie)>=0){var ae=E(),de=he;he=ae,f[ae]={type:"block",expression:de}}return{type:"code",raw:se,lang:ie,text:he}}}},S=/(?:\${2})([^\n`]+?)(?:\${2})/gi,w=0,E=function(){return"__special_katext_id_".concat(w++,"__")},f={};function x(){return f}function v(){w=0,f={}}function y(le){return le=le.replace(S,function(Z,ee){var se=E();return f[se]={type:"inline",expression:ee},se}),le}var U=s.listitem;s.listitem=function(le){return U(y(le))};var B=s.paragraph;s.paragraph=function(le){return B(y(le))};var A=s.tablecell;s.tablecell=function(le,Z){return A(y(le),Z)},s.code=function(le,Z,ee){var se=(Z||"").match(/\S*/)[0];return se?["latex","katex","math"].indexOf(se)>=0?"<p class='editormd-tex'>".concat(le,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Z,'">').concat(ee?le:Object(o.escape)(le,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ee?le:Object(o.escape)(le,!0))+"</code></pre>"},s.heading=function(le,Z,ee){var se=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:se,level:Z,text:le}),"<h"+Z+' id="'+se+'">'+le+"</h"+Z+">"},u.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),u.a.use({tokenizer:R,renderer:s});var j=u.a,P=J("SJMd"),b=J("ulZh"),V=J.n(b),ne=J("m3rI"),ce=J("Oy/b"),me=J("p5ED"),Ie=J("ErOA"),we=J("STEk");/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Le=function(le,Z){return(Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,se){ee.__proto__=se}||function(ee,se){for(var he in se)Object.prototype.hasOwnProperty.call(se,he)&&(ee[he]=se[he])})(le,Z)};function Re(le,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Class extends value "+String(Z)+" is not a constructor or null");function ee(){this.constructor=le}Le(le,Z),le.prototype=Z===null?Object.create(Z):(ee.prototype=Z.prototype,new ee)}function De(le,Z,ee,se){return new(ee||(ee=Promise))(function(he,ie){function ae(be){try{fe(se.next(be))}catch(Se){ie(Se)}}function de(be){try{fe(se.throw(be))}catch(Se){ie(Se)}}function fe(be){var Se;be.done?he(be.value):(Se=be.value,Se instanceof ee?Se:new ee(function(Pe){Pe(Se)})).then(ae,de)}fe((se=se.apply(le,Z||[])).next())})}function ye(le,Z){var ee,se,he,ie,ae={label:0,sent:function(){if(1&he[0])throw he[1];return he[1]},trys:[],ops:[]};return ie={next:de(0),throw:de(1),return:de(2)},typeof Symbol=="function"&&(ie[Symbol.iterator]=function(){return this}),ie;function de(fe){return function(be){return function(Se){if(ee)throw new TypeError("Generator is already executing.");for(;ae;)try{if(ee=1,se&&(he=2&Se[0]?se.return:Se[0]?se.throw||((he=se.return)&&he.call(se),0):se.next)&&!(he=he.call(se,Se[1])).done)return he;switch(se=0,he&&(Se=[2&Se[0],he.value]),Se[0]){case 0:case 1:he=Se;break;case 4:return ae.label++,{value:Se[1],done:!1};case 5:ae.label++,se=Se[1],Se=[0];continue;case 7:Se=ae.ops.pop(),ae.trys.pop();continue;default:if(!(he=ae.trys,(he=he.length>0&&he[he.length-1])||Se[0]!==6&&Se[0]!==2)){ae=0;continue}if(Se[0]===3&&(!he||Se[1]>he[0]&&Se[1]<he[3])){ae.label=Se[1];break}if(Se[0]===6&&ae.label<he[1]){ae.label=he[1],he=Se;break}if(he&&ae.label<he[2]){ae.label=he[2],ae.ops.push(Se);break}he[2]&&ae.ops.pop(),ae.trys.pop();continue}Se=Z.call(le,ae)}catch(Pe){Se=[6,Pe],se=0}finally{ee=he=0}if(5&Se[0])throw Se[1];return{value:Se[0]?Se[1]:void 0,done:!0}}([fe,be])}}}var X=function(){function le(){}return le.addKey=function(Z){le.key=Z},Object.defineProperty(le,"isLicensed",{get:function(){return!!le.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(le.key)},enumerable:!1,configurable:!0}),le}(),k=function(){function le(){}return le.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},le.setAttributes=function(Z,ee){for(var se=0,he=ee;se<he.length;se++){var ie=he[se],ae=ie[0],de=ie[1];Z.setAttribute(ae,de)}},le.createRect=function(Z,ee,se){var he=document.createElementNS("http://www.w3.org/2000/svg","rect");return he.setAttribute("width",Z.toString()),he.setAttribute("height",ee.toString()),se&&le.setAttributes(he,se),he},le.createLine=function(Z,ee,se,he,ie){var ae=document.createElementNS("http://www.w3.org/2000/svg","line");return ae.setAttribute("x1",Z.toString()),ae.setAttribute("y1",ee.toString()),ae.setAttribute("x2",se.toString()),ae.setAttribute("y2",he.toString()),ie&&le.setAttributes(ae,ie),ae},le.createPolygon=function(Z,ee){var se=document.createElementNS("http://www.w3.org/2000/svg","polygon");return se.setAttribute("points",Z),ee&&le.setAttributes(se,ee),se},le.createCircle=function(Z,ee){var se=document.createElementNS("http://www.w3.org/2000/svg","circle");return se.setAttribute("cx",(Z/2).toString()),se.setAttribute("cy",(Z/2).toString()),se.setAttribute("r",Z.toString()),ee&&le.setAttributes(se,ee),se},le.createEllipse=function(Z,ee,se){var he=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return he.setAttribute("cx",(Z/2).toString()),he.setAttribute("cy",(ee/2).toString()),he.setAttribute("rx",(Z/2).toString()),he.setAttribute("ry",(ee/2).toString()),se&&le.setAttributes(he,se),he},le.createGroup=function(Z){var ee=document.createElementNS("http://www.w3.org/2000/svg","g");return Z&&le.setAttributes(ee,Z),ee},le.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},le.createMarker=function(Z,ee,se,he,ie,ae,de){var fe=document.createElementNS("http://www.w3.org/2000/svg","marker");return le.setAttributes(fe,[["id",Z],["orient",ee],["markerWidth",se.toString()],["markerHeight",he.toString()],["refX",ie.toString()],["refY",ae.toString()]]),fe.appendChild(de),fe},le.createText=function(Z){var ee=document.createElementNS("http://www.w3.org/2000/svg","text");return ee.setAttribute("x","0"),ee.setAttribute("y","0"),Z&&le.setAttributes(ee,Z),ee},le.createTSpan=function(Z,ee){var se=document.createElementNS("http://www.w3.org/2000/svg","tspan");return se.textContent=Z,ee&&le.setAttributes(se,ee),se},le.createImage=function(Z){var ee=document.createElementNS("http://www.w3.org/2000/svg","image");return Z&&le.setAttributes(ee,Z),ee},le.createPoint=function(Z,ee){var se=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return se.x=Z,se.y=ee,se},le.createPath=function(Z,ee){var se=document.createElementNS("http://www.w3.org/2000/svg","path");return se.setAttribute("d",Z),ee&&le.setAttributes(se,ee),se},le.createElement=function(Z,ee){var se=document.createElementNS("http://www.w3.org/2000/svg",Z);return ee&&le.setAttributes(se,ee),se},le.getHollowRectanglePath=function(Z,ee,se,he,ie,ae,de,fe){return"M"+Z+","+ee+"V"+(ee+he)+"H"+(Z+se)+"V"+ee+"H"+ie+"V"+ae+"H"+(ie+de)+"V"+(ae+fe)+"H"+ie+"V"+ee+"Z"},le}(),F=function(){function le(Z){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+Z+"_"}return Object.defineProperty(le.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(le.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(le.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),le.prototype.addClass=function(Z){return this.styleSheet===void 0&&this.addStyleSheet(),Z.name=""+this.classNamePrefix+Z.localName,this.classes.push(Z),this.styleSheet.sheet.insertRule("."+Z.name+" {"+Z.style+"}",this.styleSheet.sheet.cssRules.length),Z},le.prototype.addRule=function(Z){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(Z),this.styleSheet.sheet.insertRule(Z.selector+" {"+Z.style+"}",this.styleSheet.sheet.cssRules.length)},le.prototype.addStyleSheet=function(){var Z;this.styleSheet=document.createElement("style"),((Z=this.styleSheetRoot)!==null&&Z!==void 0?Z:document.head).appendChild(this.styleSheet),this.addRule(new $("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new $("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new $("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new te("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new te("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},le.prototype.removeStyleSheet=function(){var Z;this.styleSheet&&(((Z=this.styleSheetRoot)!==null&&Z!==void 0?Z:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},le}(),$=function(le,Z){this.selector=le,this.style=Z},te=function(le,Z){this.localName=le,this.style=Z},K=function(){function le(){this.blocks=[],this.display=""}return le.prototype.addButtonBlock=function(Z){Z.className=this.blockClassName,Z.buttonClassName=this.buttonClassName,Z.buttonColorsClassName=this.buttonColorsClassName,Z.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(Z)},le.prototype.addElementBlock=function(Z){Z.className===void 0&&(Z.className=this.blockClassName),this.blocks.push(Z)},le.prototype.getUI=function(){var Z=document.createElement("div");return Z.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,Z.style.display=this.display,this.blocks.forEach(function(ee){return Z.appendChild(ee.getUI())}),Z},le}(),pe=function(){function le(){}return le.prototype.getUI=function(){var Z=document.createElement("div");if(Z.className=this.className,this.minWidth!==void 0&&(Z.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":Z.style.justifyContent="flex-start";break;case"center":Z.style.justifyContent="center";break;case"end":Z.style.justifyContent="flex-end"}return Z.style.whiteSpace="nowrap",Z},le}(),Te=function(le){function Z(){var ee=le!==null&&le.apply(this,arguments)||this;return ee.buttons=[],ee}return Re(Z,le),Z.prototype.addButton=function(ee){ee.className=this.buttonClassName,ee.colorsClassName=this.buttonColorsClassName,ee.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(ee)},Z.prototype.getUI=function(){var ee=le.prototype.getUI.call(this);return this.buttons.forEach(function(se){return ee.appendChild(se.getUI())}),ee},Z}(pe),ke=function(){function le(Z,ee){this._isActive=!1,this._isHidden=!1,this._icon=Z,this.title=ee,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(le.prototype,"icon",{get:function(){return this._icon},set:function(Z){this._icon=Z,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isActive",{get:function(){return this._isActive},set:function(Z){this._isActive=Z,this.adjustClassName()},enumerable:!1,configurable:!0}),le.prototype.getUI=function(){var Z=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 Z.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},le.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,"")))},le.prototype.hide=function(){this._isHidden=!0},le}(),ue=function(le){function Z(){var ee=le!==null&&le.apply(this,arguments)||this;return ee.elements=[],ee}return Re(Z,le),Z.prototype.addElement=function(ee){this.elements.push(ee)},Z.prototype.getUI=function(){var ee=le.prototype.getUI.call(this);return this.elements.forEach(function(se){return ee.appendChild(se)}),ee},Z}(pe),ve=function(){function le(Z,ee){this.horizontal=Z,this.vertical=ee}return Object.defineProperty(le.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),le.prototype.getVerticalLength=function(Z){return Z/this.ratio},le.prototype.getHorizontalLength=function(Z){return Z*this.ratio},le}(),xe=function(){function le(){}return le.getIcon=function(Z,ee){if(Z>0&&ee>0){var se=new ve(Z,ee),he=se.ratio>=1?20:se.getHorizontalLength(20),ie=se.ratio<1?20:se.getVerticalLength(20),ae=document.createElementNS("http://www.w3.org/2000/svg","svg");ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),ae.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ae);var de=k.createDefs();ae.appendChild(de);var fe=k.createElement("clipPath",[["id","text-bg-clip"]]);de.appendChild(fe);var be=k.createPath(k.getHollowRectanglePath((24-he)/2,(24-ie)/2,he,ie,(24-he)/2+2,(24-ie)/2+2,he-4,ie-4));ae.appendChild(be);var Se=k.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Se.appendChild(k.createTSpan(Z+":"+ee)),ae.appendChild(Se);var Pe=Se.getBBox();k.setAttributes(Se,[["x",((24-Pe.width)/2).toString()],["y",((24-Pe.height)/2-Pe.y).toString()]]);var Be=k.createPath(k.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Pe.width))/2,(24-Math.ceil(Pe.height))/2,Math.ceil(Pe.width),Math.ceil(Pe.height)));return fe.appendChild(Be),k.setAttributes(be,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ae),ae.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>'},le}(),Ce=function(le){function Z(ee,se,he){var ie=le.call(this,ee,se)||this;return ie.isDropdownOpen=!1,ie.onClick=ie.dropdownButtonClicked,ie.dropdownButtons=he,ie}return Re(Z,le),Z.prototype.setupDropdown=function(){var ee=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(se){se.className=ee.className,se.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(se.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},Z.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},Z.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},Z.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},Z.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},Z.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},Z}(ke),Ne=function(){function le(Z,ee){this.GRIP_SIZE=10,this.color=Z,this.fillColor=ee,this.visual=k.createGroup(),this.visual.appendChild(k.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(k.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return le.prototype.ownsTarget=function(Z){return Z===this.visual||Z===this.visual.childNodes[0]||Z===this.visual.childNodes[1]},le.prototype.setCenter=function(Z,ee){this.visual.childNodes.forEach(function(se){return k.setAttributes(se,[["cx",Z.toString()],["cy",ee.toString()]])})},le}(),Ue=function(){function le(Z,ee,se,he){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=Z,this.canvasHeight=ee,this.margin=se,this.container=he,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(le.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(Z){this._aspectRatio=Z,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(Z){this._isGridVisible=Z,this.gridContainer&&k.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(Z){this._zoomFactor=Z,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),le.prototype.open=function(){var Z=this;this.cropShadeElement=k.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=k.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var ee=0;ee<this.numberOfGridLines;ee++)this.horizontalGridLines.push(k.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(k.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(se){return Z.gridContainer.appendChild(se)}),this.verticalGridLines.forEach(function(se){return Z.gridContainer.appendChild(se)}),this.cropRectElement=k.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},le.prototype.setCropRectangle=function(Z){this.cropRect=Z;var ee=Object.assign({},this.cropRect);this.zoomFactor!==1&&(ee.width=this.cropRect.width*this.zoomFactor,ee.height=this.cropRect.height*this.zoomFactor,ee.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-ee.width/2,ee.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-ee.height/2),k.setAttributes(this.cropRectElement,[["x",ee.x.toString()],["y",ee.y.toString()],["width",ee.width.toString()],["height",ee.height.toString()]]);var se=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(ie,ae){var de=ee.y+se*(ae+1);k.setAttributes(ie,[["x1",""+ee.x],["y1",""+de],["x2",""+(ee.x+ee.width)],["y2",""+de]])});var he=ee.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(ie,ae){var de=ee.x+he*(ae+1);k.setAttributes(ie,[["x1",""+de],["y1",""+ee.y],["x2",""+de],["y2",""+(ee.y+ee.height)]])}),k.setAttributes(this.cropShadeElement,[["d",k.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,ee.x,ee.y,ee.width,ee.height)]]),this.topLeftGrip.setCenter(ee.x,ee.y),this.topRightGrip.setCenter(ee.x+ee.width,ee.y),this.bottomLeftGrip.setCenter(ee.x,ee.y+ee.height),this.bottomRightGrip.setCenter(ee.x+ee.width,ee.y+ee.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},le.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)},le.prototype.clientToLocalCoordinates=function(Z,ee){var se=this.container.getBoundingClientRect();return{x:Z-se.left+this.margin,y:ee-se.top+this.margin}},le.prototype.onPointerDown=function(Z){this.container.setPointerCapture(Z.pointerId),this.previousPoint=this.clientToLocalCoordinates(Z.clientX,Z.clientY),this.cropRectElement===Z.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(Z.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(Z.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(Z.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(Z.target)&&(this.activeGrip=this.bottomRightGrip)},le.prototype.onPointerMove=function(Z){if(this.isMoving)this.move(this.clientToLocalCoordinates(Z.clientX,Z.clientY));else if(this.activeGrip){var ee=this.clientToLocalCoordinates(Z.clientX,Z.clientY);this.resize(ee)}Z.preventDefault()},le.prototype.onPointerUp=function(Z){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(Z.pointerId)},le.prototype.move=function(Z){var ee=Z.x-this.previousPoint.x,se=Z.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,se=-se/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+ee),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+se),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=Z},le.prototype.resize=function(Z){var ee=Object.assign({},this.cropRect),se=Z.x-this.previousPoint.x,he=Z.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+se<this.margin&&(se=this.margin-ee.x),ee.x+=se,ee.width=this.cropRect.x+this.cropRect.width-ee.x;break;case this.bottomRightGrip:case this.topRightGrip:ee.width+se>this.canvasWidth*this.zoomFactor&&(se=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=se}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(ee.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(se),ee.height=this.aspectRatio.getVerticalLength(ee.width)):(ee.y+=he,ee.height=this.cropRect.y+this.cropRect.height-ee.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?ee.height=this.aspectRatio.getVerticalLength(ee.width):ee.height+=he}ee.width<10&&(ee.x=this.cropRect.x,ee.width=10),ee.height<10&&(ee.y=this.cropRect.y,ee.height=10),this.previousPoint=Z,ee.x>=this.margin&&ee.y>=this.margin&&ee.x-this.margin+ee.width<=this.canvasWidth&&ee.y-this.margin+ee.height<=this.canvasHeight&&(this.cropRect=ee,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},le.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var Z=this.cropRect.x+this.cropRect.width/2,ee=this.cropRect.y+this.cropRect.height/2,se=this.aspectRatio.getHorizontalLength(this.cropRect.height),he=this.aspectRatio.getVerticalLength(this.cropRect.width);se/this.canvasWidth<he/this.canvasHeight?this.cropRect.width=se:this.cropRect.height=he,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=Z-this.cropRect.width/2,this.cropRect.y=ee-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},le.prototype.getRescaledRect=function(Z,ee,se,he,ie,ae){var de=se/Z,fe=he/ee;return{x:(ie.x-ae)*de+ae,y:(ie.y-ae)*fe+ae,width:ie.width*de,height:ie.height*fe}},le.prototype.scaleCanvas=function(Z,ee){var se=this.getRescaledRect(this.canvasWidth,this.canvasHeight,Z,ee,this.cropRect,this.margin);this.canvasWidth=Z,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(se),this.setCropRectangle(se)},le}(),Ge=function(){function le(Z){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=Z,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(le.prototype,"angle",{get:function(){return this._angle},set:function(Z){this._angle=Z,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),le.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},le.prototype.onPointerDown=function(Z){this.controlContainer.setPointerCapture(Z.pointerId),this.isDragging=!0,this.previousPoint={x:Z.clientX,y:Z.clientY}},le.prototype.onPointerMove=function(Z){this.isDragging&&(this.onAngleChange&&this.onAngleChange((Z.clientX-this.previousPoint.x)/5),this.previousPoint.x=Z.clientX)},le.prototype.onPointerUp=function(Z){this.isDragging&&this.onAngleChange&&this.onAngleChange((Z.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(Z.pointerId)},le.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var Z=this.angleLabelText.getBBox();k.setAttributes(this.angleLabelElement,[["x",((this.width-Z.width)/2).toString()],["y",(this.height/2).toString()]])}},le.prototype.positionScaleShape=function(){if(this.scaleShape){var Z=this.scaleShape.transform.baseVal.getItem(0);Z.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(Z,0)}},le.prototype.getVisual=function(){var Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("xmlns","http://www.w3.org/2000/svg"),Z.setAttribute("width",this.width+"px"),Z.setAttribute("height",this.height+"px"),Z.setAttribute("viewBox","0 0 "+this.width+" "+this.height),Z.style.flexShrink="0",document.body.appendChild(Z);for(var ee="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,se=1;se<=this.width/5+10;se++){var he=se%5==0?this.height/3:this.height/6;ee+="h4v"+-he+"h1v"+he}ee+="v1H0Z",this.scaleShape=k.createPath(ee);var ie=k.createTransform();this.scaleShape.transform.baseVal.appendItem(ie),Z.appendChild(this.scaleShape),this.angleLabelElement=k.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=k.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ae=k.createTSpan("");return ae.innerHTML="°",this.angleLabelElement.appendChild(ae),Z.appendChild(this.angleLabelElement),document.body.removeChild(Z),Z},le}(),We=function(){function le(){this.naturalSize=!1,this.imageType="image/png"}return le.prototype.rasterize=function(Z,ee,se,he,ie,ae,de){var fe=this;return new Promise(function(be){var Se=document.createElement("canvas");Se.width=Z.width.baseVal.value-2*he,Se.height=Z.height.baseVal.value-2*he;var Pe=1,Be=1;fe.naturalSize===!0?(Pe=ee.naturalWidth/(Z.width.baseVal.value-2*he)/ae,Be=ee.naturalHeight/(Z.height.baseVal.value-2*he)/de,Se.width=ee.naturalWidth/ae,Se.height=ee.naturalHeight/de):fe.width!==void 0&&fe.height!==void 0&&(Pe=fe.width/se.width,Be=fe.height/se.height,Se.width*=Pe,Se.height*=Be);var Je=Se.getContext("2d");Je.translate(Se.width/2,Se.height/2),Je.rotate(ie*Math.PI/180),Je.scale(ae,de),Je.translate(-Se.width/2,-Se.height/2),Je.drawImage(ee,0,0,Se.width,Se.height);var $e=document.createElement("canvas");$e.width=se.width*Pe,$e.height=se.height*Be,$e.getContext("2d").putImageData(Je.getImageData((se.x-he)*Pe,(se.y-he)*Be,se.width*Pe,se.height*Be),0,0),be($e.toDataURL(fe.imageType,fe.imageQuality))})},le}(),it=function(){function le(Z){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=le.instanceCounter++,this.styles=new F(this.instanceNo),this.target=Z,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(le.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(Z){this._zoomToCropEnabled=Z,Z?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(Z){this._isGridVisible=Z,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"gridLines",{get:function(){return this._gridLines},set:function(Z){this._gridLines=Z,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(Z){this._rotationAngle=Z,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"aspectRatio",{get:function(){var Z;return(Z=this._aspectRatio)!==null&&Z!==void 0?Z:this.aspectRatios[0]},set:function(Z){this._aspectRatio=Z},enumerable:!1,configurable:!0}),le.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},le.prototype.show=function(){this.showUI(),this.open()},le.prototype.close=function(Z){Z===void 0&&(Z=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),Z||this.closeEventListeners.forEach(function(ee){return ee()}),this._isOpen=!1)},le.prototype.addRenderEventListener=function(Z){this.renderEventListeners.push(Z)},le.prototype.removeRenderEventListener=function(Z){this.renderEventListeners.indexOf(Z)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(Z),1)},le.prototype.addCloseEventListener=function(Z){this.closeEventListeners.push(Z)},le.prototype.removeCloseEventListener=function(Z){this.closeEventListeners.indexOf(Z)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(Z),1)},le.prototype.setupResizeObserver=function(){var Z=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){Z.resize(Z.target.clientWidth,Z.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))},le.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var Z=1*this.target.clientWidth/this.target.clientHeight,ee=this.contentDiv.clientWidth/Z>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*Z:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,se=ee+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/Z;this.resize(ee,se)}},le.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},le.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",k.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},le.prototype.resize=function(Z,ee){this.imageWidth=Math.round(Z),this.imageHeight=Math.round(ee),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},le.prototype.setEditingTarget=function(){var Z=document.createElement("canvas");Z.width=this.target.naturalWidth,Z.height=this.target.naturalHeight,Z.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var ee=Z.toDataURL();k.setAttributes(this.editingTarget,[["href",ee]]),this.setEditingTargetSize()},le.prototype.setTopLeft=function(){var Z=this.target.getBoundingClientRect(),ee=this.editorCanvas.getBoundingClientRect();this.left=Z.left-ee.left-this.CANVAS_MARGIN,this.top=Z.top-ee.top-this.CANVAS_MARGIN},le.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=k.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=k.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=k.createGroup(),this.editingTargetRotationScaleContainer=k.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var Z=k.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(Z);var ee=k.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(ee),this.editingTargetContainer=k.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)},le.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},le.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=k.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ue(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()},le.prototype.zoomToCrop=function(){if(this.cropRect){var Z=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,ee=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=Z+"px "+ee+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-Z+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-ee+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},le.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)},le.prototype.cropRectChanged=function(Z){this.cropRect=Z,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},le.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},le.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"},le.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},le.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 Z=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,ee=this.target.offsetTop>Z+this.CANVAS_MARGIN?this.target.offsetTop-(Z+this.CANVAS_MARGIN):0;this.coverDiv.style.top=ee+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},le.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},le.prototype.addTopToolbar=function(){var Z=this;this.topToolbar=new K,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new Te;ee.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(ee);var se=[];this.aspectRatios.forEach(function(Be){var Je=new ke(xe.getIcon(Be.horizontal,Be.vertical),Be.horizontal===0&&Be.vertical===0?"FREE":Be.horizontal+":"+Be.vertical);Je.onClick=function(){return Z.ratioButtonClicked(Be)},se.push(Je)}),this.aspectRatioButton=new Ce(xe.getIcon(0,0),"Aspect ratio",se),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,ee.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var he=new ke('<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");he.isActive=this.isGridVisible,he.onClick=function(){Z.isGridVisible=!Z.isGridVisible,he.isActive=Z.isGridVisible},ee.addButton(he);var ie=new ke('<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(ie.isActive=this.zoomToCropEnabled,ie.onClick=function(){Z.zoomToCropEnabled=!Z.zoomToCropEnabled,ie.isActive=Z.zoomToCropEnabled},ee.addButton(ie),!X.isLicensed){var ae=new ue;this.topToolbar.addElementBlock(ae);var de=document.createElement("div");de.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var fe=document.createElement("a");fe.style.color="currentColor",fe.href="https://markerjs.com/products/cropro",fe.target="_blank",fe.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>',de.appendChild(fe),ae.addElement(de)}var be=new Te;be.minWidth=3*this.toolbarHeight+"px",be.contentAlign="end",this.topToolbar.addButtonBlock(be);var Se=new ke('<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");Se.onClick=this.startRenderAndClose,be.addButton(Se),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Se.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Pe=new ke('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Pe.onClick=this.close,be.addButton(Pe),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Pe.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},le.prototype.addBottomToolbar=function(){var Z=this;this.bottomToolbar=new K,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new Te;ee.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(ee);var se=new ke('<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");se.onClick=this.rotateLeftButtonClicked,ee.addButton(se);var he=new ke('<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");he.onClick=this.rotateRightButtonClicked,ee.addButton(he);var ie=new ue;ie.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(ie),this.straightener=new Ge("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(be){Z.rotateBy(be),Z.straightener.angle=Z.rotationAngle},ie.addElement(this.straightener.getUI());var ae=new Te;ae.minWidth=2*this.toolbarHeight+"px",ae.contentAlign="end",this.bottomToolbar.addButtonBlock(ae);var de=new ke('<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");de.onClick=this.flipHorizontallyButtonClicked,ae.addButton(de);var fe=new ke('<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");fe.onClick=this.flipVerticallyButtonClicked,ae.addButton(fe)},le.prototype.ratioButtonClicked=function(Z){this.aspectRatio=Z,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},le.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=xe.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},le.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ve(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},le.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},le.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},le.prototype.restoreState=function(Z){if(Z){var ee=this.cropLayer.getRescaledRect(Z.width,Z.height,this.imageWidth,this.imageHeight,Z.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(ee),this.cropRectChanged(ee),this.flippedHorizontally=Z.flippedHorizontally,this.flippedVertically=Z.flippedVertically,this.applyFlip(),this.rotationAngle=Z.rotationAngle,this.applyRotation()}},le.prototype.clientToLocalCoordinates=function(Z,ee){var se=this.cropImage.getBoundingClientRect();return{x:Z-se.left,y:ee-se.top}},le.prototype.onWindowResize=function(){this.positionUI()},le.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var Z=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=Z+"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()},le.prototype.rotateLeftButtonClicked=function(){var Z=this.rotationAngle-90;this.rotationAngle%90!=0&&(Z+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(Z)},le.prototype.rotateRightButtonClicked=function(){var Z=this.rotationAngle+90;this.rotationAngle%90!=0&&(Z-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(Z)},le.prototype.rotateTo=function(Z){Z=(Z=Z>180?Z-360:Z)<=-180?Z+360:Z,this.rotationAngle=Z,this.applyRotation()},le.prototype.rotateBy=function(Z){this.rotateTo((this.rotationAngle+Z)%360)},le.prototype.applyRotation=function(){var Z=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var ee=this.editingTargetRotationContainer.transform.baseVal.getItem(0);ee.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(ee,0);var se=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/se.width,this.imageHeight/se.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=Z},le.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},le.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},le.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},le.prototype.startRenderAndClose=function(){return De(this,void 0,void 0,function(){var Z,ee;return ye(this,function(se){switch(se.label){case 0:return[4,this.render()];case 1:return Z=se.sent(),ee=this.getState(),this.renderEventListeners.forEach(function(he){return he(Z,ee)}),this.close(!0),[2]}})})},le.prototype.render=function(){return De(this,void 0,void 0,function(){var Z;return ye(this,function(ee){switch(ee.label){case 0:return(Z=new We).naturalSize=this.renderAtNaturalSize,Z.imageType=this.renderImageType,Z.imageQuality=this.renderImageQuality,Z.width=this.renderWidth,Z.height=this.renderHeight,this.unzoomFromCrop(),k.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,Z.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return ee.sent(),[4,Z.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,ee.sent()]}})})},le.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new te("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 te("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new te("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var Z=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new te("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*Z)+`px;
|
|
height: `+(this.toolbarHeight-2*Z)+`px;
|
|
padding: `+Z+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new te("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new te("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new $("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new $("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new te("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 te("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new te("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 te("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*Z)+`px;
|
|
padding: `+Z+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new te("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},le.instanceCounter=0,le}(),Ve=J("8hTe"),Xe=J.n(Ve),Me=/<pre[^>]*>/g;function rt(le){var Z=document.createElement("div");return Z.innerHTML=le,Z.childNodes.length===0?"":Z.childNodes[0].nodeValue}var tt=Ee.a=function(le){var Z=le.value,ee=Z===void 0?"":Z,se=le.edit,he=se===void 0?!1:se,ie=le.className,ae=le.showTextOnly,de=le.showLines,fe=le.replaces,be=le.zoomImg,Se=le.hasMask,Pe=le.style,Be=Pe===void 0?{}:Pe,Je=le.stylesPrev,$e=Je===void 0?{}:Je,lt=String(ee),at=Object(L.useRef)(),Qe=Object(L.useRef)(),Lt=Object(L.useState)(""),ct=Object(W.a)(Lt,2),Nt=ct[0],Ut=ct[1],Ct=Object(L.useState)("office"),Qt=Object(W.a)(Ct,2),ci=Qt[0],Kt=Qt[1],Zt=function(){var wt=new it(Qe.current);wt.displayMode="popup",wt.addRenderEventListener(function(){var Tt=Object(M.a)(i.a.mark(function ut(vt){var Rt;return i.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return at.current.style.display="none",Ht.next=3,Object(Ie.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:vt}});case 3:Rt=Ht.sent,Rt!=null&&Rt.id&&fe(Qe.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(Rt==null?void 0:Rt.id,"?type=").concat(Rt.content_type));case 5:case"end":return Ht.stop()}},ut)}));return function(ut){return Tt.apply(this,arguments)}}()),wt.show()},ft=function(){var wt=new we.a(Qe.current);wt.settings.displayMode="popup",wt.addEventListener("render",function(){var Tt=Object(M.a)(i.a.mark(function ut(vt){var Rt;return i.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:if(at.current.style.display="none",!Qe.current){Ht.next=6;break}return Ht.next=4,Object(Ie.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:vt.dataUrl}});case 4:Rt=Ht.sent,Rt!=null&&Rt.id&&fe(Qe.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(Rt==null?void 0:Rt.id,"?type=").concat(Rt.content_type));case 6:case"end":return Ht.stop()}},ut)}));return function(ut){return Tt.apply(this,arguments)}}()),wt.show(),window.markerArea=wt},_t=Object(L.useMemo)(function(){at.current&&(at.current.style.zIndex=-1);try{var Ye=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,wt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Tt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;lt=lt.replace(Ye,"("+ne.a.API_SERVER+"/api/attachments/").replace(wt,'"'+ne.a.API_SERVER+"/api/attachments/").replace(Tt,'"'+ne.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(ai){}var ut=j(lt),vt=x();if(lt.match(/\[TOC\]/)&&(ut=ut.replace("<p>[TOC]</p>",O()),C()),ut=ut.replace(/(__special_katext_id_\d+__)/g,function(ai,Ht){var He=vt[Ht],mt=He.type,nn=He.expression;return Object(ce.renderToString)(rt(nn)||"",{displayMode:mt==="block",throwOnError:!1,output:"html"})}),ut=ut.replace(/▁/g,"\u2581\u2581\u2581"),v(),ae){var Rt=document.createElement("div");return Rt.innerHTML=ut,Rt.innerText}return setTimeout(function(){return It()},500),ut},[lt]),xt=Object(L.useRef)();_.WebkitLineClamp=de,de&&(Be=Object(N.a)(Object(N.a)({},Be),_));function Et(Ye){var wt=Ye.target;if(wt.tagName.toUpperCase()==="IMG"){if(be){var Tt=wt.getAttribute("src");Ut(Tt),Kt("image")}}else if(wt.tagName.toUpperCase()==="A"){var ut=wt.getAttribute("href");if(ut.indexOf("office")>-1)Ye.preventDefault(),Ut(ut),Kt("office");else if(ut.indexOf("application/pdf")>-1)Ye.preventDefault(),Ut(ut),Kt("pdf");else if(ut.indexOf("text/html")>-1)Ye.preventDefault(),Ut(ut),Kt("html");else if(ut.startsWith("#")){Ye.preventDefault();var vt=document.getElementById(ut.replace("#",""));vt&&vt.scrollIntoView(!0)}}}var It=function(){var wt,Tt=(wt=xt.current)===null||wt===void 0?void 0:wt.querySelectorAll("video");Tt==null||Tt.forEach(function(ut){if(ut.oncontextmenu=function(){return!1},ut.src.indexOf(".m3u8")>-1&&!ut.canPlayType("application/vnd.apple.mpegurl")){if(V.a.isSupported()){var vt=new V.a;vt.loadSource(ut.src),vt.attachMedia(ut)}}})};Object(L.useEffect)(function(){if(xt.current&&_t&&(_t.match(Me)&&window.PR.prettyPrint()),xt.current)return xt.current.addEventListener("click",Et),function(){xt.current.removeEventListener("click",Et),v(),C()}},[_t,xt.current,Et]);var gt=function(wt){if(!he)return;wt.target.nodeName==="IMG"?(at.current.style.zIndex=1,at.current.style.display="flex",at.current.style.width=wt.target.clientWidth+"px",at.current.style.height=wt.target.clientHeight+"px",at.current.style.top=wt.target.offsetTop+"px",at.current.style.left=wt.target.offsetLeft+"px",Qe.current.src=wt.target.getAttribute("src")):at.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:xt,style:Object(N.a)({},Be),className:"".concat(ie||""," markdown-body ").concat(Xe.a.mdBody),onMouseOver:gt,dangerouslySetInnerHTML:{__html:_t}}),g.a.createElement("div",{ref:at,className:Xe.a.button},g.a.createElement(Y.a,null,g.a.createElement(z.a,{onClick:function(){return Zt()}},"\u88C1\u526A"),g.a.createElement(z.a,{onClick:function(){return ft()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Qe,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(me.a,{close:!0,data:Nt,type:Nt!=null&&Nt.length?ci:"",style:Object(N.a)({},$e),onClose:function(){return Ut("")}}))}},"9VGf":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return D});var oe=J("q1tI"),Y=J.n(oe);function D(z,N){var M=Object(oe.useRef)();Object(oe.useEffect)(function(){M.current=z}),Object(oe.useEffect)(function(){function W(){M.current()}if(N!==null){var H=setInterval(W,N);return function(){return clearInterval(H)}}},[N])}},BU3w:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return M});var oe=J("MNnm"),Y="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var H=document.querySelector("head");return H||document.body}function z(W){var H,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var L=document.createElement("style");if((H=i.csp)===null||H===void 0?void 0:H.nonce){var g;L.nonce=(g=i.csp)===null||g===void 0?void 0:g.nonce}L.innerHTML=W;var c=D(i),m=c.firstChild;return i.prepend&&c.prepend?c.prepend(L):i.prepend&&m?c.insertBefore(L,m):c.appendChild(L),L}var N=new Map;function M(W,H){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=D(i);if(!N.has(L)){var g=z("",i),c=g.parentNode;N.set(L,c),c.removeChild(g)}var m=Array.from(N.get(L).children).find(function(h){return h.tagName==="STYLE"&&h[Y]===H});if(m){var u,o;if(((u=i.csp)===null||u===void 0?void 0:u.nonce)&&m.nonce!==((o=i.csp)===null||o===void 0?void 0:o.nonce)){var p;m.nonce=(p=i.csp)===null||p===void 0?void 0:p.nonce}return m.innerHTML!==W&&(m.innerHTML=W),m}var l=z(W,i);return l[Y]=H,l}},Bd2K:function(et,Ee,J){(function(oe){oe(J("VrN/"),J("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(i,L,g){if(g!=oe.Init&&g&&i.removeKeyMap("autoCloseTags"),!L)return;var c={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(c["'/'"]=function(m){return M(m)}),(typeof L!="object"||L.whenOpening!==!1)&&(c["'>'"]=function(m){return z(m)}),i.addKeyMap(c)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(i){if(i.getOption("disableInput"))return oe.Pass;for(var L=i.listSelections(),g=[],c=i.getOption("autoCloseTags"),m=0;m<L.length;m++){if(!L[m].empty())return oe.Pass;var u=L[m].head,o=i.getTokenAt(u),p=oe.innerMode(i.getMode(),o.state),l=p.state,h=p.mode.xmlCurrentTag&&p.mode.xmlCurrentTag(l),s=h&&h.name;if(!s)return oe.Pass;var a=p.mode.configuration=="html",C=typeof c=="object"&&c.dontCloseTags||a&&Y,_=typeof c=="object"&&c.indentTags||a&&D;o.end>u.ch&&(s=s.slice(0,s.length-o.end+u.ch));var T=s.toLowerCase();if(!s||o.type=="string"&&(o.end!=u.ch||!/[\"\']/.test(o.string.charAt(o.string.length-1))||o.string.length==1)||o.type=="tag"&&h.close||o.string.indexOf("/")==u.ch-o.start-1||C&&W(C,T)>-1||H(i,p.mode.xmlCurrentContext&&p.mode.xmlCurrentContext(l)||[],s,u,!0))return oe.Pass;var O=typeof c=="object"&&c.emptyTags;if(O&&W(O,s)>-1){g[m]={text:"/>",newPos:oe.Pos(u.line,u.ch+2)};continue}var R=_&&W(_,T)>-1;g[m]={indent:R,text:">"+(R?`
|
|
|
|
`:"")+"</"+s+">",newPos:R?oe.Pos(u.line+1,0):oe.Pos(u.line,u.ch+1)}}for(var S=typeof c=="object"&&c.dontIndentOnAutoClose,m=L.length-1;m>=0;m--){var w=g[m];i.replaceRange(w.text,L[m].head,L[m].anchor,"+insert");var E=i.listSelections().slice(0);E[m]={head:w.newPos,anchor:w.newPos},i.setSelections(E),!S&&w.indent&&(i.indentLine(w.newPos.line,null,!0),i.indentLine(w.newPos.line+1,null,!0))}}function N(i,L){for(var g=i.listSelections(),c=[],m=L?"/":"</",u=i.getOption("autoCloseTags"),o=typeof u=="object"&&u.dontIndentOnSlash,p=0;p<g.length;p++){if(!g[p].empty())return oe.Pass;var l=g[p].head,h=i.getTokenAt(l),s=oe.innerMode(i.getMode(),h.state),a=s.state;if(L&&(h.type=="string"||h.string.charAt(0)!="<"||h.start!=l.ch-1))return oe.Pass;var C,_=s.mode.name!="xml"&&i.getMode().name=="htmlmixed";if(_&&s.mode.name=="javascript")C=m+"script";else if(_&&s.mode.name=="css")C=m+"style";else{var T=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(a);if(!T||T.length&&H(i,T,T[T.length-1],l))return oe.Pass;C=m+T[T.length-1]}i.getLine(l.line).charAt(h.end)!=">"&&(C+=">"),c[p]=C}if(i.replaceSelections(c),g=i.listSelections(),!o)for(var p=0;p<g.length;p++)(p==g.length-1||g[p].head.line<g[p+1].head.line)&&i.indentLine(g[p].head.line)}function M(i){return i.getOption("disableInput")?oe.Pass:N(i,!0)}oe.commands.closeTag=function(i){return N(i)};function W(i,L){if(i.indexOf)return i.indexOf(L);for(var g=0,c=i.length;g<c;++g)if(i[g]==L)return g;return-1}function H(i,L,g,c,m){if(!oe.scanForClosingTag)return!1;var u=Math.min(i.lastLine()+1,c.line+500),o=oe.scanForClosingTag(i,c,null,u);if(!o||o.tag!=g)return!1;for(var p=m?1:0,l=L.length-1;l>=0&&L[l]==g;l--)++p;c=o.to;for(var l=1;l<p;l++){var h=oe.scanForClosingTag(i,c,null,u);if(!h||h.tag!=g)return!1;c=h.to}return!0}})},BjJ7:function(et,Ee,J){"use strict";J.d(Ee,"d",function(){return Y}),J.d(Ee,"c",function(){return D}),J.d(Ee,"e",function(){return z}),J.d(Ee,"b",function(){return N}),J.d(Ee,"a",function(){return W});var oe=J("m3rI");function Y(H){var i=!0;if(H.length>0){for(var L=0;L<H.length;L++)if(H[L].compile_success==0||!H[L].compile_success){i=!1;break}}else i=!1;return i}function D(H){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],g=0;g<H.length;g++){var c=H[g],m=i?"".concat(i,"/").concat(c.name):"".concat(c.name);L.push({title:c.name,isLeaf:!(c.type==="tree"),key:m})}return L}function z(H,i,L){for(var g=0;g<H.length;g++){var c=H[g];if(c.key===i){c.children=L;break}c.children&&z(c.children,i,L)}return H}function N(H,i,L){var g;return function(){var c=this,m=arguments,u=function(){g=null,L||H.apply(c,m)},o=L&&!g;clearTimeout(g),g=setTimeout(u,i),o&&H.apply(c,m)}}var M=!0,W=oe.a.API_SERVER},"C+DQ":function(et,Ee,J){},"C/vA":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return oe});function oe(Y){const D=this;let z=!1,N;return function(){return z||(z=!0,N=Y.apply(D,arguments)),N}}},"Cg/j":function(et,Ee,J){"use strict";J.d(Ee,"b",function(){return oe}),J.d(Ee,"a",function(){return Y}),J.d(Ee,"c",function(){return z}),J.d(Ee,"d",function(){return N});var oe;(function(M){M.serviceIds=new Map,M.DI_TARGET="$di$target",M.DI_DEPENDENCIES="$di$dependencies";function W(H){return H[M.DI_DEPENDENCIES]||[]}M.getServiceDependencies=W})(oe||(oe={}));const Y=z("instantiationService");function D(M,W,H,i){W[oe.DI_TARGET]===W?W[oe.DI_DEPENDENCIES].push({id:M,index:H,optional:i}):(W[oe.DI_DEPENDENCIES]=[{id:M,index:H,optional:i}],W[oe.DI_TARGET]=W)}function z(M){if(oe.serviceIds.has(M))return oe.serviceIds.get(M);const W=function(H,i,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");D(W,H,L,!1)};return W.toString=()=>M,oe.serviceIds.set(M,W),W}function N(M){return function(W,H,i){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");D(M,W,i,!0)}}},DlQD:function(et,Ee,J){(function(oe,Y){et.exports=Y()})(this,function(){"use strict";function oe(ee,se){for(var he=0;he<se.length;he++){var ie=se[he];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(ee,ie.key,ie)}}function Y(ee,se,he){return se&&oe(ee.prototype,se),he&&oe(ee,he),ee}function D(ee,se){if(!ee)return;if(typeof ee=="string")return z(ee,se);var he=Object.prototype.toString.call(ee).slice(8,-1);if(he==="Object"&&ee.constructor&&(he=ee.constructor.name),he==="Map"||he==="Set")return Array.from(ee);if(he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he))return z(ee,se)}function z(ee,se){(se==null||se>ee.length)&&(se=ee.length);for(var he=0,ie=new Array(se);he<se;he++)ie[he]=ee[he];return ie}function N(ee,se){var he;if(typeof Symbol=="undefined"||ee[Symbol.iterator]==null){if(Array.isArray(ee)||(he=D(ee))||se&&ee&&typeof ee.length=="number"){he&&(ee=he);var ie=0;return function(){return ie>=ee.length?{done:!0}:{done:!1,value:ee[ie++]}}}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 he=ee[Symbol.iterator](),he.next.bind(he)}function M(ee,se){return se={exports:{}},ee(se,se.exports),se.exports}var W=M(function(ee){function se(){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 he(ie){ee.exports.defaults=ie}ee.exports={defaults:se(),getDefaults:se,changeDefaults:he}}),H=W.defaults,i=W.getDefaults,L=W.changeDefaults,g=/[&<>"']/,c=/[&<>"']/g,m=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,o={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(se){return o[se]};function l(ee,se){if(se){if(g.test(ee))return ee.replace(c,p)}else if(m.test(ee))return ee.replace(u,p);return ee}var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ee){return ee.replace(h,function(se,he){return he=he.toLowerCase(),he==="colon"?":":he.charAt(0)==="#"?he.charAt(1)==="x"?String.fromCharCode(parseInt(he.substring(2),16)):String.fromCharCode(+he.substring(1)):""})}var a=/(^|[^\[])\^/g;function C(ee,se){ee=ee.source||ee,se=se||"";var he={replace:function(ae,de){return de=de.source||de,de=de.replace(a,"$1"),ee=ee.replace(ae,de),he},getRegex:function(){return new RegExp(ee,se)}};return he}var _=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(ee,se,he){if(ee){var ie;try{ie=decodeURIComponent(s(he)).replace(_,"").toLowerCase()}catch(ae){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}se&&!T.test(he)&&(he=f(se,he));try{he=encodeURI(he).replace(/%25/g,"%")}catch(ae){return null}return he}var R={},S=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,E=/^([^:]+:\/*[^/]*)[\s\S]*$/;function f(ee,se){R[" "+ee]||(S.test(ee)?R[" "+ee]=ee+"/":R[" "+ee]=U(ee,"/",!0)),ee=R[" "+ee];var he=ee.indexOf(":")===-1;return se.substring(0,2)==="//"?he?se:ee.replace(w,"$1")+se:se.charAt(0)==="/"?he?se:ee.replace(E,"$1")+se:ee+se}var x={exec:function(){}};function v(ee){for(var se=1,he,ie;se<arguments.length;se++){he=arguments[se];for(ie in he)Object.prototype.hasOwnProperty.call(he,ie)&&(ee[ie]=he[ie])}return ee}function y(ee,se){var he=ee.replace(/\|/g,function(de,fe,be){for(var Se=!1,Pe=fe;--Pe>=0&&be[Pe]==="\\";)Se=!Se;return Se?"|":" |"}),ie=he.split(/ \|/),ae=0;if(ie.length>se)ie.splice(se);else for(;ie.length<se;)ie.push("");for(;ae<ie.length;ae++)ie[ae]=ie[ae].trim().replace(/\\\|/g,"|");return ie}function U(ee,se,he){var ie=ee.length;if(ie===0)return"";for(var ae=0;ae<ie;){var de=ee.charAt(ie-ae-1);if(de===se&&!he)ae++;else if(de!==se&&he)ae++;else break}return ee.substr(0,ie-ae)}function B(ee,se){if(ee.indexOf(se[1])===-1)return-1;for(var he=ee.length,ie=0,ae=0;ae<he;ae++)if(ee[ae]==="\\")ae++;else if(ee[ae]===se[0])ie++;else if(ee[ae]===se[1]&&(ie--,ie<0))return ae;return-1}function A(ee){ee&&ee.sanitize&&!ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var j={escape:l,unescape:s,edit:C,cleanUrl:O,resolveUrl:f,noopTest:x,merge:v,splitCells:y,rtrim:U,findClosingBracket:B,checkSanitizeDeprecation:A},P=W.defaults,b=j.rtrim,V=j.splitCells,ne=j.escape,ce=j.findClosingBracket;function me(ee,se,he){var ie=se.href,ae=se.title?ne(se.title):null,de=ee[1].replace(/\\([\[\]])/g,"$1");return ee[0].charAt(0)!=="!"?{type:"link",raw:he,href:ie,title:ae,text:de}:{type:"image",raw:he,href:ie,title:ae,text:ne(de)}}function Ie(ee,se){var he=ee.match(/^(\s+)(?:```)/);if(he===null)return se;var ie=he[1];return se.split(`
|
|
`).map(function(ae){var de=ae.match(/^\s+/);if(de===null)return ae;var fe=de[0];return fe.length>=ie.length?ae.slice(ie.length):ae}).join(`
|
|
`)}var we=function(){function ee(he){this.options=he||P}var se=ee.prototype;return se.space=function(ie){var ae=this.rules.block.newline.exec(ie);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
|
|
`}},se.code=function(ie,ae){var de=this.rules.block.code.exec(ie);if(de){var fe=ae[ae.length-1];if(fe&&fe.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var be=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?be:b(be,`
|
|
`)}}},se.fences=function(ie){var ae=this.rules.block.fences.exec(ie);if(ae){var de=ae[0],fe=Ie(de,ae[3]||"");return{type:"code",raw:de,lang:ae[2]?ae[2].trim():ae[2],text:fe}}},se.heading=function(ie){var ae=this.rules.block.heading.exec(ie);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},se.nptable=function(ie){var ae=this.rules.block.nptable.exec(ie);if(ae){var de={type:"table",header:V(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ae[0]};if(de.header.length===de.align.length){var fe=de.align.length,be;for(be=0;be<fe;be++)/^ *-+: *$/.test(de.align[be])?de.align[be]="right":/^ *:-+: *$/.test(de.align[be])?de.align[be]="center":/^ *:-+ *$/.test(de.align[be])?de.align[be]="left":de.align[be]=null;for(fe=de.cells.length,be=0;be<fe;be++)de.cells[be]=V(de.cells[be],de.header.length);return de}}},se.hr=function(ie){var ae=this.rules.block.hr.exec(ie);if(ae)return{type:"hr",raw:ae[0]}},se.blockquote=function(ie){var ae=this.rules.block.blockquote.exec(ie);if(ae){var de=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:de}}},se.list=function(ie){var ae=this.rules.block.list.exec(ie);if(ae){for(var de=ae[0],fe=ae[2],be=fe.length>1,Se=fe[fe.length-1]===")",Pe={type:"list",raw:de,ordered:be,start:be?+fe.slice(0,-1):"",loose:!1,items:[]},Be=ae[0].match(this.rules.block.item),Je=!1,$e,lt,at,Qe,Lt,ct,Nt,Ut=Be.length,Ct=0;Ct<Ut;Ct++)$e=Be[Ct],de=$e,lt=$e.length,$e=$e.replace(/^ *([*+-]|\d+[.)]) */,""),~$e.indexOf(`
|
|
`)&&(lt-=$e.length,$e=this.options.pedantic?$e.replace(/^ {1,4}/gm,""):$e.replace(new RegExp("^ {1,"+lt+"}","gm"),"")),Ct!==Ut-1&&(at=this.rules.block.bullet.exec(Be[Ct+1])[0],(be?at.length===1||!Se&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==fe)&&(Qe=Be.slice(Ct+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-Qe.length),Ct=Ut-1)),Lt=Je||/\n\n(?!\s*$)/.test($e),Ct!==Ut-1&&(Je=$e.charAt($e.length-1)===`
|
|
`,Lt||(Lt=Je)),Lt&&(Pe.loose=!0),ct=/^\[[ xX]\] /.test($e),Nt=void 0,ct&&(Nt=$e[1]!==" ",$e=$e.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:de,task:ct,checked:Nt,loose:Lt,text:$e});return Pe}},se.html=function(ie){var ae=this.rules.block.html.exec(ie);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]):ne(ae[0]):ae[0]}},se.def=function(ie){var ae=this.rules.block.def.exec(ie);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var de=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ae[0],href:ae[2],title:ae[3]}}},se.table=function(ie){var ae=this.rules.block.table.exec(ie);if(ae){var de={type:"table",header:V(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[]};if(de.header.length===de.align.length){de.raw=ae[0];var fe=de.align.length,be;for(be=0;be<fe;be++)/^ *-+: *$/.test(de.align[be])?de.align[be]="right":/^ *:-+: *$/.test(de.align[be])?de.align[be]="center":/^ *:-+ *$/.test(de.align[be])?de.align[be]="left":de.align[be]=null;for(fe=de.cells.length,be=0;be<fe;be++)de.cells[be]=V(de.cells[be].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},se.lheading=function(ie){var ae=this.rules.block.lheading.exec(ie);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},se.paragraph=function(ie){var ae=this.rules.block.paragraph.exec(ie);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
|
|
`?ae[1].slice(0,-1):ae[1]}},se.text=function(ie,ae){var de=this.rules.block.text.exec(ie);if(de){var fe=ae[ae.length-1];return fe&&fe.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},se.escape=function(ie){var ae=this.rules.inline.escape.exec(ie);if(ae)return{type:"escape",raw:ae[0],text:ne(ae[1])}},se.tag=function(ie,ae,de){var fe=this.rules.inline.tag.exec(ie);if(fe)return!ae&&/^<a /i.test(fe[0])?ae=!0:ae&&/^<\/a>/i.test(fe[0])&&(ae=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:ae,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):ne(fe[0]):fe[0]}},se.link=function(ie){var ae=this.rules.inline.link.exec(ie);if(ae){var de=ce(ae[2],"()");if(de>-1){var fe=ae[0].indexOf("!")===0?5:4,be=fe+ae[1].length+de;ae[2]=ae[2].substring(0,de),ae[0]=ae[0].substring(0,be).trim(),ae[3]=""}var Se=ae[2],Pe="";if(this.options.pedantic){var Be=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);Be?(Se=Be[1],Pe=Be[3]):Pe=""}else Pe=ae[3]?ae[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var Je=me(ae,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},ae[0]);return Je}},se.reflink=function(ie,ae){var de;if((de=this.rules.inline.reflink.exec(ie))||(de=this.rules.inline.nolink.exec(ie))){var fe=(de[2]||de[1]).replace(/\s+/g," ");if(fe=ae[fe.toLowerCase()],!fe||!fe.href){var be=de[0].charAt(0);return{type:"text",raw:be,text:be}}var Se=me(de,fe,de[0]);return Se}},se.strong=function(ie,ae,de){de===void 0&&(de="");var fe=this.rules.inline.strong.start.exec(ie);if(fe&&(!fe[1]||fe[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ae=ae.slice(-1*ie.length);var be=fe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Se;(fe=be.exec(ae))!=null;)if(Se=this.rules.inline.strong.middle.exec(ae.slice(0,fe.index+3)),Se)return{type:"strong",raw:ie.slice(0,Se[0].length),text:ie.slice(2,Se[0].length-2)}}},se.em=function(ie,ae,de){de===void 0&&(de="");var fe=this.rules.inline.em.start.exec(ie);if(fe&&(!fe[1]||fe[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ae=ae.slice(-1*ie.length);var be=fe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Se;(fe=be.exec(ae))!=null;)if(Se=this.rules.inline.em.middle.exec(ae.slice(0,fe.index+2)),Se)return{type:"em",raw:ie.slice(0,Se[0].length),text:ie.slice(1,Se[0].length-1)}}},se.codespan=function(ie){var ae=this.rules.inline.code.exec(ie);if(ae){var de=ae[2].replace(/\n/g," "),fe=/[^ ]/.test(de),be=de.startsWith(" ")&&de.endsWith(" ");return fe&&be&&(de=de.substring(1,de.length-1)),de=ne(de,!0),{type:"codespan",raw:ae[0],text:de}}},se.br=function(ie){var ae=this.rules.inline.br.exec(ie);if(ae)return{type:"br",raw:ae[0]}},se.del=function(ie){var ae=this.rules.inline.del.exec(ie);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},se.autolink=function(ie,ae){var de=this.rules.inline.autolink.exec(ie);if(de){var fe,be;return de[2]==="@"?(fe=ne(this.options.mangle?ae(de[1]):de[1]),be="mailto:"+fe):(fe=ne(de[1]),be=fe),{type:"link",raw:de[0],text:fe,href:be,tokens:[{type:"text",raw:fe,text:fe}]}}},se.url=function(ie,ae){var de;if(de=this.rules.inline.url.exec(ie)){var fe,be;if(de[2]==="@")fe=ne(this.options.mangle?ae(de[0]):de[0]),be="mailto:"+fe;else{var Se;do Se=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Se!==de[0]);fe=ne(de[0]),de[1]==="www."?be="http://"+fe:be=fe}return{type:"link",raw:de[0],text:fe,href:be,tokens:[{type:"text",raw:fe,text:fe}]}}},se.inlineText=function(ie,ae,de){var fe=this.rules.inline.text.exec(ie);if(fe){var be;return ae?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):ne(fe[0]):fe[0]:be=ne(this.options.smartypants?de(fe[0]):fe[0]),{type:"text",raw:fe[0],text:be}}},ee}(),Le=j.noopTest,Re=j.edit,De=j.merge,ye={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:Le,table:Le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ye._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ye._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ye.def=Re(ye.def).replace("label",ye._label).replace("title",ye._title).getRegex(),ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,ye.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ye.item=Re(ye.item,"gm").replace(/bull/g,ye.bullet).getRegex(),ye.list=Re(ye.list).replace(/bull/g,ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ye.def.source+")").getRegex(),ye._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",ye._comment=/<!--(?!-?>)[\s\S]*?-->/,ye.html=Re(ye.html,"i").replace("comment",ye._comment).replace("tag",ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye.paragraph=Re(ye._paragraph).replace("hr",ye.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",ye._tag).getRegex(),ye.blockquote=Re(ye.blockquote).replace("paragraph",ye.paragraph).getRegex(),ye.normal=De({},ye),ye.gfm=De({},ye.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*|$)"}),ye.gfm.nptable=Re(ye.gfm.nptable).replace("hr",ye.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",ye._tag).getRegex(),ye.gfm.table=Re(ye.gfm.table).replace("hr",ye.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",ye._tag).getRegex(),ye.pedantic=De({},ye.normal,{html:Re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye._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:Le,paragraph:Re(ye.normal._paragraph).replace("hr",ye.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var X={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Le,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:Le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};X._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",X.punctuation=Re(X.punctuation).replace(/punctuation/g,X._punctuation).getRegex(),X._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",X._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",X.em.start=Re(X.em.start).replace(/punctuation/g,X._punctuation).getRegex(),X.em.middle=Re(X.em.middle).replace(/punctuation/g,X._punctuation).replace(/overlapSkip/g,X._overlapSkip).getRegex(),X.em.endAst=Re(X.em.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.em.endUnd=Re(X.em.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.start=Re(X.strong.start).replace(/punctuation/g,X._punctuation).getRegex(),X.strong.middle=Re(X.strong.middle).replace(/punctuation/g,X._punctuation).replace(/blockSkip/g,X._blockSkip).getRegex(),X.strong.endAst=Re(X.strong.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.endUnd=Re(X.strong.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.blockSkip=Re(X._blockSkip,"g").getRegex(),X.overlapSkip=Re(X._overlapSkip,"g").getRegex(),X._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,X._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,X._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])?)+(?![-_])/,X.autolink=Re(X.autolink).replace("scheme",X._scheme).replace("email",X._email).getRegex(),X._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,X.tag=Re(X.tag).replace("comment",ye._comment).replace("attribute",X._attribute).getRegex(),X._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,X._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,X._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,X.link=Re(X.link).replace("label",X._label).replace("href",X._href).replace("title",X._title).getRegex(),X.reflink=Re(X.reflink).replace("label",X._label).getRegex(),X.reflinkSearch=Re(X.reflinkSearch,"g").replace("reflink",X.reflink).replace("nolink",X.nolink).getRegex(),X.normal=De({},X),X.pedantic=De({},X.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",X._label).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X._label).getRegex()}),X.gfm=De({},X.normal,{escape:Re(X.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),X.gfm.url=Re(X.gfm.url,"i").replace("email",X.gfm._extended_email).getRegex(),X.breaks=De({},X.gfm,{br:Re(X.br).replace("{2,}","*").getRegex(),text:Re(X.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var k={block:ye,inline:X},F=W.defaults,$=k.block,te=k.inline;function K(ee){return ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function pe(ee){var se="",he,ie,ae=ee.length;for(he=0;he<ae;he++)ie=ee.charCodeAt(he),Math.random()>.5&&(ie="x"+ie.toString(16)),se+="&#"+ie+";";return se}var Te=function(){function ee(he){this.tokens=[],this.tokens.links=Object.create(null),this.options=he||F,this.options.tokenizer=this.options.tokenizer||new we,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ie={block:$.normal,inline:te.normal};this.options.pedantic?(ie.block=$.pedantic,ie.inline=te.pedantic):this.options.gfm&&(ie.block=$.gfm,this.options.breaks?ie.inline=te.breaks:ie.inline=te.gfm),this.tokenizer.rules=ie}ee.lex=function(ie,ae){var de=new ee(ae);return de.lex(ie)};var se=ee.prototype;return se.lex=function(ie){return ie=ie.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ie,this.tokens,!0),this.inline(this.tokens),this.tokens},se.blockTokens=function(ie,ae,de){ae===void 0&&(ae=[]),de===void 0&&(de=!0),ie=ie.replace(/^ +$/gm,"");for(var fe,be,Se,Pe;ie;){if(fe=this.tokenizer.space(ie)){ie=ie.substring(fe.raw.length),fe.type&&ae.push(fe);continue}if(fe=this.tokenizer.code(ie,ae)){ie=ie.substring(fe.raw.length),fe.type?ae.push(fe):(Pe=ae[ae.length-1],Pe.raw+=`
|
|
`+fe.raw,Pe.text+=`
|
|
`+fe.text);continue}if(fe=this.tokenizer.fences(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.heading(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.nptable(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.hr(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.blockquote(ie)){ie=ie.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],de),ae.push(fe);continue}if(fe=this.tokenizer.list(ie)){for(ie=ie.substring(fe.raw.length),Se=fe.items.length,be=0;be<Se;be++)fe.items[be].tokens=this.blockTokens(fe.items[be].text,[],!1);ae.push(fe);continue}if(fe=this.tokenizer.html(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(de&&(fe=this.tokenizer.def(ie))){ie=ie.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.lheading(ie)){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(de&&(fe=this.tokenizer.paragraph(ie))){ie=ie.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.text(ie,ae)){ie=ie.substring(fe.raw.length),fe.type?ae.push(fe):(Pe=ae[ae.length-1],Pe.raw+=`
|
|
`+fe.raw,Pe.text+=`
|
|
`+fe.text);continue}if(ie){var Be="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(Be);break}else throw new Error(Be)}}return ae},se.inline=function(ie){var ae,de,fe,be,Se,Pe,Be=ie.length;for(ae=0;ae<Be;ae++){Pe=ie[ae];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},be=Pe.header.length,de=0;de<be;de++)Pe.tokens.header[de]=[],this.inlineTokens(Pe.header[de],Pe.tokens.header[de]);for(be=Pe.cells.length,de=0;de<be;de++)for(Se=Pe.cells[de],Pe.tokens.cells[de]=[],fe=0;fe<Se.length;fe++)Pe.tokens.cells[de][fe]=[],this.inlineTokens(Se[fe],Pe.tokens.cells[de][fe]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(be=Pe.items.length,de=0;de<be;de++)this.inline(Pe.items[de].tokens);break}}}return ie},se.inlineTokens=function(ie,ae,de,fe,be){ae===void 0&&(ae=[]),de===void 0&&(de=!1),fe===void 0&&(fe=!1),be===void 0&&(be="");var Se,Pe=ie,Be;if(this.tokens.links){var Je=Object.keys(this.tokens.links);if(Je.length>0)for(;(Be=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)Je.includes(Be[0].slice(Be[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,Be.index)+"["+"a".repeat(Be[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Be=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,Be.index)+"["+"a".repeat(Be[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ie;){if(Se=this.tokenizer.escape(ie)){ie=ie.substring(Se.raw.length),ae.push(Se);continue}if(Se=this.tokenizer.tag(ie,de,fe)){ie=ie.substring(Se.raw.length),de=Se.inLink,fe=Se.inRawBlock,ae.push(Se);continue}if(Se=this.tokenizer.link(ie)){ie=ie.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,fe)),ae.push(Se);continue}if(Se=this.tokenizer.reflink(ie,this.tokens.links)){ie=ie.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,fe)),ae.push(Se);continue}if(Se=this.tokenizer.strong(ie,Pe,be)){ie=ie.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],de,fe),ae.push(Se);continue}if(Se=this.tokenizer.em(ie,Pe,be)){ie=ie.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],de,fe),ae.push(Se);continue}if(Se=this.tokenizer.codespan(ie)){ie=ie.substring(Se.raw.length),ae.push(Se);continue}if(Se=this.tokenizer.br(ie)){ie=ie.substring(Se.raw.length),ae.push(Se);continue}if(Se=this.tokenizer.del(ie)){ie=ie.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],de,fe),ae.push(Se);continue}if(Se=this.tokenizer.autolink(ie,pe)){ie=ie.substring(Se.raw.length),ae.push(Se);continue}if(!de&&(Se=this.tokenizer.url(ie,pe))){ie=ie.substring(Se.raw.length),ae.push(Se);continue}if(Se=this.tokenizer.inlineText(ie,fe,K)){ie=ie.substring(Se.raw.length),be=Se.raw.slice(-1),ae.push(Se);continue}if(ie){var $e="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return ae},Y(ee,null,[{key:"rules",get:function(){return{block:$,inline:te}}}]),ee}(),ke=W.defaults,ue=j.cleanUrl,ve=j.escape,xe=function(){function ee(he){this.options=he||ke}var se=ee.prototype;return se.code=function(ie,ae,de){var fe=(ae||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(ie,fe);be!=null&&be!==ie&&(de=!0,ie=be)}return fe?'<pre><code class="'+this.options.langPrefix+ve(fe,!0)+'">'+(de?ie:ve(ie,!0))+`</code></pre>
|
|
`:"<pre><code>"+(de?ie:ve(ie,!0))+`</code></pre>
|
|
`},se.blockquote=function(ie){return`<blockquote>
|
|
`+ie+`</blockquote>
|
|
`},se.html=function(ie){return ie},se.heading=function(ie,ae,de,fe){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+fe.slug(de)+'">'+ie+"</h"+ae+`>
|
|
`:"<h"+ae+">"+ie+"</h"+ae+`>
|
|
`},se.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},se.list=function(ie,ae,de){var fe=ae?"ol":"ul",be=ae&&de!==1?' start="'+de+'"':"";return"<"+fe+be+`>
|
|
`+ie+"</"+fe+`>
|
|
`},se.listitem=function(ie){return"<li>"+ie+`</li>
|
|
`},se.checkbox=function(ie){return"<input "+(ie?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},se.paragraph=function(ie){return"<p>"+ie+`</p>
|
|
`},se.table=function(ie,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ie+`</thead>
|
|
`+ae+`</table>
|
|
`},se.tablerow=function(ie){return`<tr>
|
|
`+ie+`</tr>
|
|
`},se.tablecell=function(ie,ae){var de=ae.header?"th":"td",fe=ae.align?"<"+de+' align="'+ae.align+'">':"<"+de+">";return fe+ie+"</"+de+`>
|
|
`},se.strong=function(ie){return"<strong>"+ie+"</strong>"},se.em=function(ie){return"<em>"+ie+"</em>"},se.codespan=function(ie){return"<code>"+ie+"</code>"},se.br=function(){return this.options.xhtml?"<br/>":"<br>"},se.del=function(ie){return"<del>"+ie+"</del>"},se.link=function(ie,ae,de){if(ie=ue(this.options.sanitize,this.options.baseUrl,ie),ie===null)return de;var fe='<a href="'+ve(ie)+'"';return ae&&(fe+=' title="'+ae+'"'),fe+=">"+de+"</a>",fe},se.image=function(ie,ae,de){if(ie=ue(this.options.sanitize,this.options.baseUrl,ie),ie===null)return de;var fe='<img src="'+ie+'" alt="'+de+'"';return ae&&(fe+=' title="'+ae+'"'),fe+=this.options.xhtml?"/>":">",fe},se.text=function(ie){return ie},ee}(),Ce=function(){function ee(){}var se=ee.prototype;return se.strong=function(ie){return ie},se.em=function(ie){return ie},se.codespan=function(ie){return ie},se.del=function(ie){return ie},se.html=function(ie){return ie},se.text=function(ie){return ie},se.link=function(ie,ae,de){return""+de},se.image=function(ie,ae,de){return""+de},se.br=function(){return""},ee}(),Ne=function(){function ee(){this.seen={}}var se=ee.prototype;return se.slug=function(ie){var ae=ie.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var de=ae;do this.seen[de]++,ae=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},ee}(),Ue=W.defaults,Ge=j.unescape,We=function(){function ee(he){this.options=he||Ue,this.options.renderer=this.options.renderer||new xe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ce,this.slugger=new Ne}ee.parse=function(ie,ae){var de=new ee(ae);return de.parse(ie)};var se=ee.prototype;return se.parse=function(ie,ae){ae===void 0&&(ae=!0);var de="",fe,be,Se,Pe,Be,Je,$e,lt,at,Qe,Lt,ct,Nt,Ut,Ct,Qt,ci,Kt,Zt=ie.length;for(fe=0;fe<Zt;fe++){Qe=ie[fe];switch(Qe.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,Ge(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(lt="",$e="",Pe=Qe.header.length,be=0;be<Pe;be++)$e+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[be]),{header:!0,align:Qe.align[be]});for(lt+=this.renderer.tablerow($e),at="",Pe=Qe.cells.length,be=0;be<Pe;be++){for(Je=Qe.tokens.cells[be],$e="",Be=Je.length,Se=0;Se<Be;Se++)$e+=this.renderer.tablecell(this.parseInline(Je[Se]),{header:!1,align:Qe.align[Se]});at+=this.renderer.tablerow($e)}de+=this.renderer.table(lt,at);continue}case"blockquote":{at=this.parse(Qe.tokens),de+=this.renderer.blockquote(at);continue}case"list":{for(Lt=Qe.ordered,ct=Qe.start,Nt=Qe.loose,Pe=Qe.items.length,at="",be=0;be<Pe;be++)Ct=Qe.items[be],Qt=Ct.checked,ci=Ct.task,Ut="",Ct.task&&(Kt=this.renderer.checkbox(Qt),Nt?Ct.tokens.length>0&&Ct.tokens[0].type==="text"?(Ct.tokens[0].text=Kt+" "+Ct.tokens[0].text,Ct.tokens[0].tokens&&Ct.tokens[0].tokens.length>0&&Ct.tokens[0].tokens[0].type==="text"&&(Ct.tokens[0].tokens[0].text=Kt+" "+Ct.tokens[0].tokens[0].text)):Ct.tokens.unshift({type:"text",text:Kt}):Ut+=Kt),Ut+=this.parse(Ct.tokens,Nt),at+=this.renderer.listitem(Ut,ci,Qt);de+=this.renderer.list(at,Lt,ct);continue}case"html":{de+=this.renderer.html(Qe.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(at=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;fe+1<Zt&&ie[fe+1].type==="text";)Qe=ie[++fe],at+=`
|
|
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);de+=ae?this.renderer.paragraph(at):at;continue}default:{var ft='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(ft);return}else throw new Error(ft)}}}return de},se.parseInline=function(ie,ae){ae=ae||this.renderer;var de="",fe,be,Se=ie.length;for(fe=0;fe<Se;fe++){be=ie[fe];switch(be.type){case"escape":{de+=ae.text(be.text);break}case"html":{de+=ae.html(be.text);break}case"link":{de+=ae.link(be.href,be.title,this.parseInline(be.tokens,ae));break}case"image":{de+=ae.image(be.href,be.title,be.text);break}case"strong":{de+=ae.strong(this.parseInline(be.tokens,ae));break}case"em":{de+=ae.em(this.parseInline(be.tokens,ae));break}case"codespan":{de+=ae.codespan(be.text);break}case"br":{de+=ae.br();break}case"del":{de+=ae.del(this.parseInline(be.tokens,ae));break}case"text":{de+=ae.text(be.text);break}default:{var Pe='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return de},ee}(),it=j.merge,Ve=j.checkSanitizeDeprecation,Xe=j.escape,Me=W.getDefaults,rt=W.changeDefaults,tt=W.defaults;function le(ee,se,he){if(typeof ee=="undefined"||ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ee)+", string expected");if(typeof se=="function"&&(he=se,se=null),se=it({},le.defaults,se||{}),Ve(se),he){var ie=se.highlight,ae;try{ae=Te.lex(ee,se)}catch(Se){return he(Se)}var de=function(Pe){var Be;if(!Pe)try{Be=We.parse(ae,se)}catch(Je){Pe=Je}return se.highlight=ie,Pe?he(Pe):he(null,Be)};if(!ie||ie.length<3)return de();if(delete se.highlight,!ae.length)return de();var fe=0;le.walkTokens(ae,function(Se){Se.type==="code"&&(fe++,setTimeout(function(){ie(Se.text,Se.lang,function(Pe,Be){if(Pe)return de(Pe);Be!=null&&Be!==Se.text&&(Se.text=Be,Se.escaped=!0),fe--,fe===0&&de()})},0))}),fe===0&&de();return}try{var be=Te.lex(ee,se);return se.walkTokens&&le.walkTokens(be,se.walkTokens),We.parse(be,se)}catch(Se){if(Se.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,se.silent)return"<p>An error occurred:</p><pre>"+Xe(Se.message+"",!0)+"</pre>";throw Se}}le.options=le.setOptions=function(ee){return it(le.defaults,ee),rt(le.defaults),le},le.getDefaults=Me,le.defaults=tt,le.use=function(ee){var se=it({},ee);if(ee.renderer&&function(){var ie=le.defaults.renderer||new xe,ae=function(be){var Se=ie[be];ie[be]=function(){for(var Pe=arguments.length,Be=new Array(Pe),Je=0;Je<Pe;Je++)Be[Je]=arguments[Je];var $e=ee.renderer[be].apply(ie,Be);return $e===!1&&($e=Se.apply(ie,Be)),$e}};for(var de in ee.renderer)ae(de);se.renderer=ie}(),ee.tokenizer&&function(){var ie=le.defaults.tokenizer||new we,ae=function(be){var Se=ie[be];ie[be]=function(){for(var Pe=arguments.length,Be=new Array(Pe),Je=0;Je<Pe;Je++)Be[Je]=arguments[Je];var $e=ee.tokenizer[be].apply(ie,Be);return $e===!1&&($e=Se.apply(ie,Be)),$e}};for(var de in ee.tokenizer)ae(de);se.tokenizer=ie}(),ee.walkTokens){var he=le.defaults.walkTokens;se.walkTokens=function(ie){ee.walkTokens(ie),he&&he(ie)}}le.setOptions(se)},le.walkTokens=function(ee,se){for(var he=N(ee),ie;!(ie=he()).done;){var ae=ie.value;se(ae);switch(ae.type){case"table":{for(var de=N(ae.tokens.header),fe;!(fe=de()).done;){var be=fe.value;le.walkTokens(be,se)}for(var Se=N(ae.tokens.cells),Pe;!(Pe=Se()).done;)for(var Be=Pe.value,Je=N(Be),$e;!($e=Je()).done;){var lt=$e.value;le.walkTokens(lt,se)}break}case"list":{le.walkTokens(ae.items,se);break}default:ae.tokens&&le.walkTokens(ae.tokens,se)}}},le.Parser=We,le.parser=We.parse,le.Renderer=xe,le.TextRenderer=Ce,le.Lexer=Te,le.lexer=Te.lex,le.Tokenizer=we,le.Slugger=Ne,le.parse=le;var Z=le;return Z})},ELLl:function(et,Ee,J){(function(oe){oe(J("VrN/"))})(function(oe){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(o,p,l){l&&l!=oe.Init&&(o.removeKeyMap(N),o.state.closeBrackets=null),p&&(M(z(p,"pairs")),o.state.closeBrackets=p,o.addKeyMap(N))});function z(o,p){return p=="pairs"&&typeof o=="string"?o:typeof o=="object"&&o[p]!=null?o[p]:Y[p]}var N={Backspace:i,Enter:L};function M(o){for(var p=0;p<o.length;p++){var l=o.charAt(p),h="'"+l+"'";N[h]||(N[h]=W(l))}}M(Y.pairs+"`");function W(o){return function(p){return c(p,o)}}function H(o){var p=o.state.closeBrackets;if(!p||p.override)return p;var l=o.getModeAt(o.getCursor());return l.closeBrackets||p}function i(o){var p=H(o);if(!p||o.getOption("disableInput"))return oe.Pass;for(var l=z(p,"pairs"),h=o.listSelections(),s=0;s<h.length;s++){if(!h[s].empty())return oe.Pass;var a=m(o,h[s].head);if(!a||l.indexOf(a)%2!=0)return oe.Pass}for(var s=h.length-1;s>=0;s--){var C=h[s].head;o.replaceRange("",D(C.line,C.ch-1),D(C.line,C.ch+1),"+delete")}}function L(o){var p=H(o),l=p&&z(p,"explode");if(!l||o.getOption("disableInput"))return oe.Pass;for(var h=o.listSelections(),s=0;s<h.length;s++){if(!h[s].empty())return oe.Pass;var a=m(o,h[s].head);if(!a||l.indexOf(a)%2!=0)return oe.Pass}o.operation(function(){var C=o.lineSeparator()||`
|
|
`;o.replaceSelection(C+C,null),o.execCommand("goCharLeft"),h=o.listSelections();for(var _=0;_<h.length;_++){var T=h[_].head.line;o.indentLine(T,null,!0),o.indentLine(T+1,null,!0)}})}function g(o){var p=oe.cmpPos(o.anchor,o.head)>0;return{anchor:new D(o.anchor.line,o.anchor.ch+(p?-1:1)),head:new D(o.head.line,o.head.ch+(p?1:-1))}}function c(o,p){var l=H(o);if(!l||o.getOption("disableInput"))return oe.Pass;var h=z(l,"pairs"),s=h.indexOf(p);if(s==-1)return oe.Pass;for(var a=z(l,"closeBefore"),C=z(l,"triples"),_=h.charAt(s+1)==p,T=o.listSelections(),O=s%2==0,R,S=0;S<T.length;S++){var w=T[S],E=w.head,f,x=o.getRange(E,D(E.line,E.ch+1));if(O&&!w.empty())f="surround";else if((_||!O)&&x==p)_&&u(o,E)?f="both":C.indexOf(p)>=0&&o.getRange(E,D(E.line,E.ch+3))==p+p+p?f="skipThree":f="skip";else if(_&&E.ch>1&&C.indexOf(p)>=0&&o.getRange(D(E.line,E.ch-2),E)==p+p){if(E.ch>2&&/\bstring/.test(o.getTokenTypeAt(D(E.line,E.ch-2))))return oe.Pass;f="addFour"}else if(_){var v=E.ch==0?" ":o.getRange(D(E.line,E.ch-1),E);if(!oe.isWordChar(x)&&v!=p&&!oe.isWordChar(v))f="both";else return oe.Pass}else if(O&&(x.length===0||/\s/.test(x)||a.indexOf(x)>-1))f="both";else return oe.Pass;if(!R)R=f;else if(R!=f)return oe.Pass}var y=s%2?h.charAt(s-1):p,U=s%2?p:h.charAt(s+1);o.operation(function(){if(R=="skip")o.execCommand("goCharRight");else if(R=="skipThree")for(var B=0;B<3;B++)o.execCommand("goCharRight");else if(R=="surround"){for(var A=o.getSelections(),B=0;B<A.length;B++)A[B]=y+A[B]+U;o.replaceSelections(A,"around"),A=o.listSelections().slice();for(var B=0;B<A.length;B++)A[B]=g(A[B]);o.setSelections(A)}else R=="both"?(o.replaceSelection(y+U,null),o.triggerElectric(y+U),o.execCommand("goCharLeft")):R=="addFour"&&(o.replaceSelection(y+y+y+y,"before"),o.execCommand("goCharRight"))})}function m(o,p){var l=o.getRange(D(p.line,p.ch-1),D(p.line,p.ch+1));return l.length==2?l:null}function u(o,p){var l=o.getTokenAt(D(p.line,p.ch+1));return/\bstring/.test(l.type)&&l.start==p.ch&&(p.ch==0||!/\bstring/.test(o.getTokenTypeAt(p)))}})},FWmy:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return oe});function oe(Y,D){if(!Y)throw new Error(D?`Assertion failed (${D})`:"Assertion Failed")}},HmJG:function(et,Ee,J){},JYp7:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return oe});var oe;(function(Y){function D(a){return a&&typeof a=="object"&&typeof a[Symbol.iterator]=="function"}Y.is=D;const z=Object.freeze([]);function N(){return z}Y.empty=N;function*M(a){yield a}Y.single=M;function W(a){return a||z}Y.from=W;function H(a){return!a||a[Symbol.iterator]().next().done===!0}Y.isEmpty=H;function i(a){return a[Symbol.iterator]().next().value}Y.first=i;function L(a,C){for(const _ of a)if(C(_))return!0;return!1}Y.some=L;function g(a,C){for(const _ of a)if(C(_))return _;return}Y.find=g;function*c(a,C){for(const _ of a)C(_)&&(yield _)}Y.filter=c;function*m(a,C){let _=0;for(const T of a)yield C(T,_++)}Y.map=m;function*u(...a){for(const C of a)for(const _ of C)yield _}Y.concat=u;function*o(a){for(const C of a)for(const _ of C)yield _}Y.concatNested=o;function p(a,C,_){let T=_;for(const O of a)T=C(T,O);return T}Y.reduce=p;function*l(a,C,_=a.length){for(C<0&&(C+=a.length),_<0?_+=a.length:_>a.length&&(_=a.length);C<_;C++)yield a[C]}Y.slice=l;function h(a,C=Number.POSITIVE_INFINITY){const _=[];if(C===0)return[_,a];const T=a[Symbol.iterator]();for(let O=0;O<C;O++){const R=T.next();if(R.done)return[_,Y.empty()];_.push(R.value)}return[_,{[Symbol.iterator](){return T}}]}Y.consume=h;function s(a,C,_=(T,O)=>T===O){const T=a[Symbol.iterator](),O=C[Symbol.iterator]();for(;;){const R=T.next(),S=O.next();if(R.done!==S.done)return!1;if(R.done)return!0;if(!_(R.value,S.value))return!1}}Y.equals=s})(oe||(oe={}))},LSTS:function(et,Ee,J){"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});var oe=function(){function c(m,u){for(var o=0;o<u.length;o++){var p=u[o];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(m,p.key,p)}}return function(m,u,o){return u&&c(m.prototype,u),o&&c(m,o),m}}(),Y=J("q1tI"),D=M(Y),z=J("17x9"),N=M(z);function M(c){return c&&c.__esModule?c:{default:c}}function W(c,m){var u={};for(var o in c){if(m.indexOf(o)>=0)continue;if(!Object.prototype.hasOwnProperty.call(c,o))continue;u[o]=c[o]}return u}function H(c,m){if(!(c instanceof m))throw new TypeError("Cannot call a class as a function")}function i(c,m){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:c}function L(c,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);c.prototype=Object.create(m&&m.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(c,m):c.__proto__=m)}var g=function(c){L(m,c);function m(u){H(this,m);var o=i(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,u));return o.scrollListener=o.scrollListener.bind(o),o.eventListenerOptions=o.eventListenerOptions.bind(o),o.mousewheelListener=o.mousewheelListener.bind(o),o}return oe(m,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var o=this.getParentElement(this.scrollComponent);o.scrollTop=o.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var o=!1,p={get passive(){o=!0}};try{document.addEventListener("test",null,p),document.removeEventListener("test",null,p)}catch(l){}return o}},{key:"eventListenerOptions",value:function(){var o=this.props.useCapture;return this.isPassiveSupported()&&(o={useCapture:this.props.useCapture,passive:!0}),o}},{key:"setDefaultLoader",value:function(o){this.defaultLoader=o}},{key:"detachMousewheelListener",value:function(){var o=window;this.props.useWindow===!1&&(o=this.scrollComponent.parentNode),o.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var o=window;this.props.useWindow===!1&&(o=this.getParentElement(this.scrollComponent)),o.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),o.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(o){var p=this.props.getScrollParent&&this.props.getScrollParent();return p!=null?p:o&&o.parentNode}},{key:"filterProps",value:function(o){return o}},{key:"attachScrollListener",value:function(){var o=this.getParentElement(this.scrollComponent);if(!this.props.hasMore||!o)return;var p=window;this.props.useWindow===!1&&(p=o),p.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),p.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),p.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}},{key:"mousewheelListener",value:function(o){o.deltaY===1&&!this.isPassiveSupported()&&o.preventDefault()}},{key:"scrollListener",value:function(){var o=this.scrollComponent,p=window,l=this.getParentElement(o),h=void 0;if(this.props.useWindow){var s=document.documentElement||document.body.parentNode||document.body,a=p.pageYOffset!==void 0?p.pageYOffset:s.scrollTop;this.props.isReverse?h=a:h=this.calculateOffset(o,a)}else this.props.isReverse?h=l.scrollTop:h=o.scrollHeight-l.scrollTop-l.clientHeight;h<Number(this.props.threshold)&&o&&o.offsetParent!==null&&(this.detachScrollListener(),this.beforeScrollHeight=l.scrollHeight,this.beforeScrollTop=l.scrollTop,typeof this.props.loadMore=="function"&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function(o,p){return o?this.calculateTopPosition(o)+(o.offsetHeight-p-window.innerHeight):0}},{key:"calculateTopPosition",value:function(o){return o?o.offsetTop+this.calculateTopPosition(o.offsetParent):0}},{key:"render",value:function(){var o=this,p=this.filterProps(this.props),l=p.children,h=p.element,s=p.hasMore,a=p.initialLoad,C=p.isReverse,_=p.loader,T=p.loadMore,O=p.pageStart,R=p.ref,S=p.threshold,w=p.useCapture,E=p.useWindow,f=p.getScrollParent,x=W(p,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);x.ref=function(y){o.scrollComponent=y,R&&R(y)};var v=[l];return s&&(_?C?v.unshift(_):v.push(_):this.defaultLoader&&(C?v.unshift(this.defaultLoader):v.push(this.defaultLoader))),D.default.createElement(h,x,v)}}]),m}(Y.Component);g.propTypes={children:N.default.node.isRequired,element:N.default.node,hasMore:N.default.bool,initialLoad:N.default.bool,isReverse:N.default.bool,loader:N.default.node,loadMore:N.default.func.isRequired,pageStart:N.default.number,ref:N.default.func,getScrollParent:N.default.func,threshold:N.default.number,useCapture:N.default.bool,useWindow:N.default.bool},g.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},Ee.default=g,et.exports=Ee.default},LdHM:function(et,Ee,J){"use strict";J.d(Ee,"b",function(){return a}),J.d(Ee,"a",function(){return _});var oe=J("1OyB"),Y=J("vuIU"),D=J("Ji7U"),z=J("LK+K"),N=J("q1tI"),M=J("rePB"),W=J("Ff2n"),H=J("ODXe"),i=J("4IlW"),L=J("bX4T"),g=J("YrtM"),c=J("TSYQ"),m=J.n(c),u=J("+nKL"),o=J("8OUc"),p=function(V,ne){var ce=V.prefixCls,me=V.id,Ie=V.flattenOptions,we=V.childrenAsData,Le=V.values,Re=V.searchValue,De=V.multiple,ye=V.defaultActiveFirstOption,X=V.height,k=V.itemHeight,F=V.notFoundContent,$=V.open,te=V.menuItemSelectedIcon,K=V.virtual,pe=V.onSelect,Te=V.onToggleOpen,ke=V.onActiveValue,ue=V.onScroll,ve=V.onMouseEnter,xe="".concat(ce,"-item"),Ce=Object(g.a)(function(){return Ie},[$,Ie],function(Z,ee){return ee[0]&&Z[1]!==ee[1]}),Ne=N.useRef(null),Ue=function(ee){ee.preventDefault()},Ge=function(ee){Ne.current&&Ne.current.scrollTo({index:ee})},We=function(ee){for(var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=Ce.length,ie=0;ie<he;ie+=1){var ae=(ee+ie*se+he)%he,de=Ce[ae],fe=de.group,be=de.data;if(!fe&&!be.disabled)return ae}return-1},it=N.useState(function(){return We(0)}),Ve=Object(H.a)(it,2),Xe=Ve[0],Me=Ve[1],rt=function(ee){Me(ee);var se=Ce[ee];if(!se){ke(null,-1);return}ke(se.data.value,ee)};N.useEffect(function(){rt(ye!==!1?We(0):-1)},[Ce.length,Re]),N.useEffect(function(){var Z=setTimeout(function(){if(!De&&$&&Le.size===1){var ee=Array.from(Le)[0],se=Ce.findIndex(function(he){var ie=he.data;return ie.value===ee});rt(se),Ge(se)}});return function(){return clearTimeout(Z)}},[$]);var tt=function(ee){ee!==void 0&&pe(ee,{selected:!Le.has(ee)}),De||Te(!1)};if(N.useImperativeHandle(ne,function(){return{onKeyDown:function(ee){var se=ee.which;switch(se){case i.a.UP:case i.a.DOWN:{var he=0;if(se===i.a.UP?he=-1:se===i.a.DOWN&&(he=1),he!==0){var ie=We(Xe+he,he);Ge(ie),rt(ie)}break}case i.a.ENTER:{var ae=Ce[Xe];ae&&!ae.data.disabled?tt(ae.data.value):tt(void 0),$&&ee.preventDefault();break}case i.a.ESC:Te(!1)}},onKeyUp:function(){},scrollTo:function(ee){Ge(ee)}}}),Ce.length===0)return N.createElement("div",{role:"listbox",id:"".concat(me,"_list"),className:"".concat(xe,"-empty"),onMouseDown:Ue},F);function le(Z){var ee=Ce[Z];if(!ee)return null;var se=ee.data||{},he=se.value,ie=se.label,ae=se.children,de=Object(L.a)(se,!0),fe=we?ae:ie;return ee?N.createElement("div",Object.assign({"aria-label":typeof fe=="string"?fe:null},de,{key:Z,role:"option",id:"".concat(me,"_list_").concat(Z),"aria-selected":Le.has(he)}),he):null}return N.createElement(N.Fragment,null,N.createElement("div",{role:"listbox",id:"".concat(me,"_list"),style:{height:0,width:0,overflow:"hidden"}},le(Xe-1),le(Xe),le(Xe+1)),N.createElement(u.a,{itemKey:"key",ref:Ne,data:Ce,height:X,itemHeight:k,fullHeight:!1,onMouseDown:Ue,onScroll:ue,virtual:K,onMouseEnter:ve},function(Z,ee){var se,he=Z.group,ie=Z.groupOption,ae=Z.data,de=ae.label,fe=ae.key;if(he)return N.createElement("div",{className:m()(xe,"".concat(xe,"-group"))},de!==void 0?de:fe);var be=ae.disabled,Se=ae.value,Pe=ae.title,Be=ae.children,Je=ae.style,$e=ae.className,lt=Object(W.a)(ae,["disabled","value","title","children","style","className"]),at=Le.has(Se),Qe="".concat(xe,"-option"),Lt=m()(xe,Qe,$e,(se={},Object(M.a)(se,"".concat(Qe,"-grouped"),ie),Object(M.a)(se,"".concat(Qe,"-active"),Xe===ee&&!be),Object(M.a)(se,"".concat(Qe,"-disabled"),be),Object(M.a)(se,"".concat(Qe,"-selected"),at),se)),ct=we?Be:de,Nt=!te||typeof te=="function"||at;return N.createElement("div",Object.assign({},lt,{"aria-selected":at,className:Lt,title:Pe,onMouseMove:function(){if(Xe===ee||be)return;rt(ee)},onClick:function(){be||tt(Se)},style:Je}),N.createElement("div",{className:"".concat(Qe,"-content")},ct||Se),N.isValidElement(te)||at,Nt&&N.createElement(o.a,{className:"".concat(xe,"-option-state"),customizeIcon:te,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},l=N.forwardRef(p);l.displayName="OptionList";var h=l,s=function(){return null};s.isSelectOption=!0;var a=s,C=function(){return null};C.isSelectOptGroup=!0;var _=C,T=J("VTBJ"),O=J("Zm9Q");function R(b){var V=b.key,ne=b.props,ce=ne.children,me=ne.value,Ie=Object(W.a)(ne,["children","value"]);return Object(T.a)({key:V,value:me!==void 0?me:V,children:ce},Ie)}function S(b){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(b).map(function(ne,ce){if(!N.isValidElement(ne)||!ne.type)return null;var me=ne.type.isSelectOptGroup,Ie=ne.key,we=ne.props,Le=we.children,Re=Object(W.a)(we,["children"]);return V||!me?R(ne):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(Ie===null?ce:Ie,"__"),label:Ie},Re),{},{options:S(Le)})}).filter(function(ne){return ne})}var w=J("2Qr1"),E=J("qNPg"),f=J("U8pU"),x=J("Kwbf"),v=J("WKfj");function y(b){var V=b.mode,ne=b.options,ce=b.children,me=b.backfill,Ie=b.allowClear,we=b.placeholder,Le=b.getInputElement,Re=b.showSearch,De=b.onSearch,ye=b.defaultOpen,X=b.autoFocus,k=b.labelInValue,F=b.value,$=b.inputValue,te=b.optionLabelProp,K=V==="multiple"||V==="tags",pe=Re!==void 0?Re:K||V==="combobox",Te=ne||S(ce);if(Object(x.a)(V!=="tags"||Te.every(function(xe){return!xe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),V==="tags"||V==="combobox"){var ke=Te.some(function(xe){return xe.options?xe.options.some(function(Ce){return typeof("value"in Ce?Ce.value:Ce.key)=="number"}):typeof("value"in xe?xe.value:xe.key)=="number"});Object(x.a)(!ke,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(V!=="combobox"||!te,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(V==="combobox"||!me,"`backfill` only works with `combobox` mode."),Object(x.a)(V==="combobox"||!Le,"`getInputElement` only work with `combobox` mode."),Object(x.b)(V!=="combobox"||!Le||!Ie||!we,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),De&&!pe&&V!=="combobox"&&V!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ye||X,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),F!=null){var ue=Object(v.d)(F);Object(x.a)(!k||ue.every(function(xe){return Object(f.a)(xe)==="object"&&("key"in xe||"value"in xe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!K||Array.isArray(F),"`value` should be array when `mode` is `multiple` or `tags`")}if(ce){var ve=null;Object(O.a)(ce).some(function(xe){if(!N.isValidElement(xe)||!xe.type)return!1;var Ce=xe.type;if(Ce.isSelectOption)return!1;if(Ce.isSelectOptGroup){var Ne=Object(O.a)(xe.props.children).every(function(Ue){return!N.isValidElement(Ue)||!xe.type||Ue.type.isSelectOption?!0:(ve=Ue.type,!1)});return!Ne}return ve=Ce,!0}),ve&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ve.displayName||ve.name||ve,"`.")),Object(x.a)($===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var U=y,B=Object(E.a)({prefixCls:"rc-select",components:{optionList:h},convertChildrenToData:S,flattenOptions:w.d,getLabeledValue:w.e,filterOptions:w.b,isValueDisabled:w.g,findValueOption:w.c,warningProps:U,fillOptionsWithMissingValue:w.a}),A=function(b){Object(D.a)(ne,b);var V=Object(z.a)(ne);function ne(){var ce;return Object(oe.a)(this,ne),ce=V.apply(this,arguments),ce.selectRef=N.createRef(),ce.focus=function(){ce.selectRef.current.focus()},ce.blur=function(){ce.selectRef.current.blur()},ce}return Object(Y.a)(ne,[{key:"render",value:function(){return N.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),ne}(N.Component);A.Option=a,A.OptGroup=_;var j=A,P=Ee.c=j},M8RZ:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return i});var oe=J("fWQN"),Y=J("mtLc"),D=J("yKVA"),z=J("879j"),N=J("q1tI"),M=J.n(N),W=J("i8i4"),H=J.n(W),i=function(L){Object(D.a)(c,L);var g=Object(z.a)(c);function c(m){var u;Object(oe.a)(this,c),u=g.call(this,m);var o=window.document;return u.node=o.createElement("div"),o.body.appendChild(u.node),u}return Object(Y.a)(c,[{key:"render",value:function(){var u=this.props.children;return Object(W.createPortal)(u,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),c}(M.a.Component)},MI8n:function(et,Ee,J){"use strict";J.d(Ee,"c",function(){return N}),J.d(Ee,"b",function(){return i}),J.d(Ee,"e",function(){return L}),J.d(Ee,"a",function(){return g}),J.d(Ee,"d",function(){return c}),J.d(Ee,"f",function(){return m});var oe=J("/cxE"),Y=J("pmY6"),D=J("24hK"),z=J("5Y4S"),N;(function(u){u.None=()=>Y.a.None;function o(y){return(U,B=null,A)=>{let j=!1,P;return P=y(b=>j?void 0:(P?P.dispose():j=!0,U.call(B,b)),null,A),j&&P.dispose(),P}}u.once=o;function p(y,U){return _((B,A=null,j)=>y(P=>B.call(A,U(P)),null,j))}u.map=p;function l(y,U){return _((B,A=null,j)=>y(P=>{U(P),B.call(A,P)},null,j))}u.forEach=l;function h(y,U){return _((B,A=null,j)=>y(P=>U(P)&&B.call(A,P),null,j))}u.filter=h;function s(y){return y}u.signal=s;function a(...y){return(U,B=null,A)=>Object(Y.e)(...y.map(j=>j(P=>U.call(B,P),null,A)))}u.any=a;function C(y,U,B){let A=B;return p(y,j=>(A=U(A,j),A))}u.reduce=C;function _(y){let U;const B=new i({onFirstListenerAdd(){U=y(B.fire,B)},onLastListenerRemove(){U.dispose()}});return B.event}function T(y,U,B=100,A=!1,j){let P,b,V,ne=0;const ce=new i({leakWarningThreshold:j,onFirstListenerAdd(){P=y(me=>{ne++,b=U(b,me),A&&!V&&(ce.fire(b),b=void 0),clearTimeout(V),V=setTimeout(()=>{const Ie=b;b=void 0,V=void 0,(!A||ne>1)&&ce.fire(Ie),ne=0},B)})},onLastListenerRemove(){P.dispose()}});return ce.event}u.debounce=T;function O(y,U=(B,A)=>B===A){let B=!0,A;return h(y,j=>{const P=B||!U(j,A);return B=!1,A=j,P})}u.latch=O;function R(y,U){return[u.filter(y,U),u.filter(y,B=>!U(B))]}u.split=R;function S(y,U=!1,B=[]){let A=B.slice(),j=y(V=>{A?A.push(V):b.fire(V)});const P=()=>{A&&A.forEach(V=>b.fire(V)),A=null},b=new i({onFirstListenerAdd(){j||(j=y(V=>b.fire(V)))},onFirstListenerDidAdd(){A&&(U?setTimeout(P):P())},onLastListenerRemove(){j&&j.dispose(),j=null}});return b.event}u.buffer=S;class w{constructor(y){this.event=y}map(y){return new w(p(this.event,y))}forEach(y){return new w(l(this.event,y))}filter(y){return new w(h(this.event,y))}reduce(y,U){return new w(C(this.event,y,U))}latch(){return new w(O(this.event))}debounce(y,U=100,B=!1,A){return new w(T(this.event,y,U,B,A))}on(y,U,B){return this.event(y,U,B)}once(y,U,B){return o(this.event)(y,U,B)}}function E(y){return new w(y)}u.chain=E;function f(y,U,B=A=>A){const A=(...V)=>b.fire(B(...V)),j=()=>y.on(U,A),P=()=>y.removeListener(U,A),b=new i({onFirstListenerAdd:j,onLastListenerRemove:P});return b.event}u.fromNodeEventEmitter=f;function x(y,U,B=A=>A){const A=(...V)=>b.fire(B(...V)),j=()=>y.addEventListener(U,A),P=()=>y.removeEventListener(U,A),b=new i({onFirstListenerAdd:j,onLastListenerRemove:P});return b.event}u.fromDOMEventEmitter=x;function v(y){return new Promise(U=>o(y)(U))}u.toPromise=v})(N||(N={}));class M{constructor(u){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${u}_${M._idPool++}`}start(u){this._stopWatch=new z.a(!0),this._listenerCount=u}stop(){if(this._stopWatch){const u=this._stopWatch.elapsed();this._elapsedOverall+=u,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${u.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}M._idPool=0;let W=-1;class H{constructor(u,o=Math.random().toString(18).slice(2,5)){this.customThreshold=u,this.name=o,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(u){let o=W;if(typeof this.customThreshold=="number"&&(o=this.customThreshold),o<=0||u<o)return;this._stacks||(this._stacks=new Map);const p=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),l=this._stacks.get(p)||0;if(this._stacks.set(p,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;let h,s=0;for(const[a,C]of this._stacks)(!h||s<C)&&(h=a,s=C);console.warn(`[${this.name}] potential listener LEAK detected, having ${u} listeners already. MOST frequent listener (${s}):`),console.warn(h)}return()=>{const h=this._stacks.get(p)||0;this._stacks.set(p,h-1)}}}class i{constructor(u){var o;this._disposed=!1,this._options=u,this._leakageMon=W>0?new H(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((o=this._options)===null||o===void 0?void 0:o._profName)?new M(this._options._profName):void 0}get event(){return this._event||(this._event=(u,o,p)=>{var l;this._listeners||(this._listeners=new D.a);const h=this._listeners.isEmpty();h&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const s=this._listeners.push(o?[u,o]:u);h&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,u,o);const a=(l=this._leakageMon)===null||l===void 0?void 0:l.check(this._listeners.size),C=Object(Y.i)(()=>{if(a&&a(),!this._disposed&&(s(),this._options&&this._options.onLastListenerRemove)){const _=this._listeners&&!this._listeners.isEmpty();_||this._options.onLastListenerRemove(this)}});return p instanceof Y.b?p.add(C):Array.isArray(p)&&p.push(C),C}),this._event}fire(u){var o,p;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new D.a);for(let l of this._listeners)this._deliveryQueue.push([l,u]);for((o=this._perfMon)===null||o===void 0||o.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[l,h]=this._deliveryQueue.shift();try{typeof l=="function"?l.call(void 0,h):l[0].call(l[1],h)}catch(s){Object(oe.f)(s)}}(p=this._perfMon)===null||p===void 0||p.stop()}}dispose(){var u,o,p,l,h;this._disposed||(this._disposed=!0,(u=this._listeners)===null||u===void 0||u.clear(),(o=this._deliveryQueue)===null||o===void 0||o.clear(),(l=(p=this._options)===null||p===void 0?void 0:p.onLastListenerRemove)===null||l===void 0||l.call(p),(h=this._leakageMon)===null||h===void 0||h.dispose())}}class L extends i{constructor(u){super(u);this._isPaused=0,this._eventQueue=new D.a,this._mergeFn=u==null?void 0:u.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const u=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(u))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(u){this._listeners&&(this._isPaused!==0?this._eventQueue.push(u):super.fire(u))}}class g extends L{constructor(u){var o;super(u);this._delay=(o=u.delay)!==null&&o!==void 0?o:100}fire(u){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(u)}}class c{constructor(){this.buffers=[]}wrapEvent(u){return(o,p,l)=>u(h=>{const s=this.buffers[this.buffers.length-1];s?s.push(()=>o.call(p,h)):o.call(p,h)},void 0,l)}bufferEvents(u){const o=[];this.buffers.push(o);const p=u();return this.buffers.pop(),o.forEach(l=>l()),p}}class m{constructor(){this.listening=!1,this.inputEvent=N.None,this.inputEventListener=Y.a.None,this.emitter=new i({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(u){this.inputEvent=u,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=u(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},MNsG:function(et,Ee,J){"use strict";(function(oe,Y){J.d(Ee,"b",function(){return p}),J.d(Ee,"i",function(){return a}),J.d(Ee,"f",function(){return C}),J.d(Ee,"d",function(){return _}),J.d(Ee,"g",function(){return T}),J.d(Ee,"h",function(){return O}),J.d(Ee,"c",function(){return R}),J.d(Ee,"k",function(){return S}),J.d(Ee,"j",function(){return w}),J.d(Ee,"a",function(){return E}),J.d(Ee,"e",function(){return v});var D;const z="en";let N=!1,M=!1,W=!1,H=!1,i=!1,L=!1,g=!1,c,m=z,u,o;const p=typeof self=="object"?self:typeof oe=="object"?oe:{};let l;typeof p.vscode!="undefined"&&typeof p.vscode.process!="undefined"?l=p.vscode.process:typeof Y!="undefined"&&(l=Y);const h=typeof((D=l==null?void 0:l.versions)===null||D===void 0?void 0:D.electron)=="string"&&l.type==="renderer";if(typeof navigator=="object"&&!h)o=navigator.userAgent,N=o.indexOf("Windows")>=0,M=o.indexOf("Macintosh")>=0,g=(o.indexOf("Macintosh")>=0||o.indexOf("iPad")>=0||o.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,W=o.indexOf("Linux")>=0,L=!0,c=navigator.language,m=c;else if(typeof l=="object"){N=l.platform==="win32",M=l.platform==="darwin",W=l.platform==="linux",H=W&&!!l.env.SNAP&&!!l.env.SNAP_REVISION,c=z,m=z;const y=l.env.VSCODE_NLS_CONFIG;if(y)try{const U=JSON.parse(y),B=U.availableLanguages["*"];c=U.locale,m=B||z,u=U._translationsConfigFile}catch(U){}i=!0}else console.error("Unable to resolve platform.");let s=0;M?s=1:N?s=3:W&&(s=2);const a=N,C=M,_=W,T=i,O=L,R=g,S=o,w=function(){if(p.setImmediate)return p.setImmediate.bind(p);if(typeof p.postMessage=="function"&&!p.importScripts){let B=[];p.addEventListener("message",j=>{if(j.data&&j.data.vscodeSetImmediateId)for(let P=0,b=B.length;P<b;P++){const V=B[P];if(V.id===j.data.vscodeSetImmediateId){B.splice(P,1),V.callback();return}}});let A=0;return j=>{const P=++A;B.push({id:P,callback:j}),p.postMessage({vscodeSetImmediateId:P},"*")}}if(typeof(l==null?void 0:l.nextTick)=="function")return l.nextTick.bind(l);const U=Promise.resolve();return B=>U.then(B)}(),E=M||g?2:N?1:3;let f=!0,x=!1;function v(){if(!x){x=!0;const y=new Uint8Array(2);y[0]=1,y[1]=2;const U=new Uint16Array(y.buffer);f=U[0]===(2<<8)+1}return f}}).call(this,J("IyRk"),J("Q2Ig"))},N0LK:function(et,Ee,J){"use strict";J.d(Ee,"C",function(){return oe}),J.d(Ee,"v",function(){return D}),J.d(Ee,"s",function(){return z}),J.d(Ee,"t",function(){return N}),J.d(Ee,"U",function(){return M}),J.d(Ee,"J",function(){return W}),J.d(Ee,"O",function(){return H}),J.d(Ee,"p",function(){return i}),J.d(Ee,"T",function(){return L}),J.d(Ee,"q",function(){return g}),J.d(Ee,"N",function(){return c}),J.d(Ee,"M",function(){return m}),J.d(Ee,"Q",function(){return u}),J.d(Ee,"u",function(){return o}),J.d(Ee,"x",function(){return p}),J.d(Ee,"I",function(){return l}),J.d(Ee,"f",function(){return h}),J.d(Ee,"h",function(){return s}),J.d(Ee,"g",function(){return a}),J.d(Ee,"i",function(){return C}),J.d(Ee,"G",function(){return _}),J.d(Ee,"H",function(){return T}),J.d(Ee,"r",function(){return O}),J.d(Ee,"R",function(){return R}),J.d(Ee,"d",function(){return S}),J.d(Ee,"e",function(){return w}),J.d(Ee,"E",function(){return E}),J.d(Ee,"F",function(){return f}),J.d(Ee,"j",function(){return x}),J.d(Ee,"z",function(){return v}),J.d(Ee,"K",function(){return U}),J.d(Ee,"L",function(){return B}),J.d(Ee,"m",function(){return j}),J.d(Ee,"k",function(){return b}),J.d(Ee,"A",function(){return ne}),J.d(Ee,"a",function(){return ce}),J.d(Ee,"n",function(){return me}),J.d(Ee,"l",function(){return Ie}),J.d(Ee,"D",function(){return we}),J.d(Ee,"B",function(){return Le}),J.d(Ee,"b",function(){return Re}),J.d(Ee,"S",function(){return De}),J.d(Ee,"o",function(){return ye}),J.d(Ee,"P",function(){return X}),J.d(Ee,"w",function(){return k}),J.d(Ee,"c",function(){return F}),J.d(Ee,"y",function(){return K});function oe(ue){return!ue||typeof ue!="string"?!0:ue.trim().length===0}const Y=/{(\d+)}/g;function D(ue,...ve){return ve.length===0?ue:ue.replace(Y,function(xe,Ce){const Ne=parseInt(Ce,10);return isNaN(Ne)||Ne<0||Ne>=ve.length?xe:ve[Ne]})}function z(ue){return ue.replace(/[<>&]/g,function(ve){switch(ve){case"<":return"<";case">":return">";case"&":return"&";default:return ve}})}function N(ue){return ue.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function M(ue,ve=" "){const xe=W(ue,ve);return H(xe,ve)}function W(ue,ve){if(!ue||!ve)return ue;const xe=ve.length;if(xe===0||ue.length===0)return ue;let Ce=0;for(;ue.indexOf(ve,Ce)===Ce;)Ce=Ce+xe;return ue.substring(Ce)}function H(ue,ve){if(!ue||!ve)return ue;const xe=ve.length,Ce=ue.length;if(xe===0||Ce===0)return ue;let Ne=Ce,Ue=-1;for(;!(Ue=ue.lastIndexOf(ve,Ne-1),Ue===-1||Ue+xe!==Ne);){if(Ue===0)return"";Ne=Ue}return ue.substring(0,Ne)}function i(ue){return ue.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function L(ue){return ue.replace(/\*/g,"")}function g(ue,ve,xe={}){if(!ue)throw new Error("Cannot create regex from empty string");ve||(ue=N(ue)),xe.wholeWord&&(/\B/.test(ue.charAt(0))||(ue="\\b"+ue),/\B/.test(ue.charAt(ue.length-1))||(ue=ue+"\\b"));let Ce="";return xe.global&&(Ce+="g"),xe.matchCase||(Ce+="i"),xe.multiline&&(Ce+="m"),xe.unicode&&(Ce+="u"),new RegExp(ue,Ce)}function c(ue){if(ue.source==="^"||ue.source==="^$"||ue.source==="$"||ue.source==="^\\s*$")return!1;const ve=ue.exec("");return!!(ve&&ue.lastIndex===0)}function m(ue){return(ue.global?"g":"")+(ue.ignoreCase?"i":"")+(ue.multiline?"m":"")+(ue.unicode?"u":"")}function u(ue){return ue.split(/\r\n|\r|\n/)}function o(ue){for(let ve=0,xe=ue.length;ve<xe;ve++){const Ce=ue.charCodeAt(ve);if(Ce!==32&&Ce!==9)return ve}return-1}function p(ue,ve=0,xe=ue.length){for(let Ce=ve;Ce<xe;Ce++){const Ne=ue.charCodeAt(Ce);if(Ne!==32&&Ne!==9)return ue.substring(ve,Ce)}return ue.substring(ve,xe)}function l(ue,ve=ue.length-1){for(let xe=ve;xe>=0;xe--){const Ce=ue.charCodeAt(xe);if(Ce!==32&&Ce!==9)return xe}return-1}function h(ue,ve){return ue<ve?-1:ue>ve?1:0}function s(ue,ve,xe=0,Ce=ue.length,Ne=0,Ue=ve.length){for(;xe<Ce&&Ne<Ue;xe++,Ne++){let it=ue.charCodeAt(xe),Ve=ve.charCodeAt(Ne);if(it<Ve)return-1;if(it>Ve)return 1}const Ge=Ce-xe,We=Ue-Ne;return Ge<We?-1:Ge>We?1:0}function a(ue,ve){return C(ue,ve,0,ue.length,0,ve.length)}function C(ue,ve,xe=0,Ce=ue.length,Ne=0,Ue=ve.length){for(;xe<Ce&&Ne<Ue;xe++,Ne++){let it=ue.charCodeAt(xe),Ve=ve.charCodeAt(Ne);if(it===Ve)continue;if(it>=128||Ve>=128)return s(ue.toLowerCase(),ve.toLowerCase(),xe,Ce,Ne,Ue);_(it)&&(it-=32),_(Ve)&&(Ve-=32);const Xe=it-Ve;if(Xe===0)continue;return Xe}const Ge=Ce-xe,We=Ue-Ne;return Ge<We?-1:Ge>We?1:0}function _(ue){return ue>=97&&ue<=122}function T(ue){return ue>=65&&ue<=90}function O(ue,ve){return ue.length===ve.length&&C(ue,ve)===0}function R(ue,ve){const xe=ve.length;return ve.length>ue.length?!1:C(ue,ve,0,xe)===0}function S(ue,ve){let xe,Ce=Math.min(ue.length,ve.length);for(xe=0;xe<Ce;xe++)if(ue.charCodeAt(xe)!==ve.charCodeAt(xe))return xe;return Ce}function w(ue,ve){let xe,Ce=Math.min(ue.length,ve.length);const Ne=ue.length-1,Ue=ve.length-1;for(xe=0;xe<Ce;xe++)if(ue.charCodeAt(Ne-xe)!==ve.charCodeAt(Ue-xe))return xe;return Ce}function E(ue){return 55296<=ue&&ue<=56319}function f(ue){return 56320<=ue&&ue<=57343}function x(ue,ve){return(ue-55296<<10)+(ve-56320)+65536}function v(ue,ve,xe){const Ce=ue.charCodeAt(xe);if(E(Ce)&&xe+1<ve){const Ne=ue.charCodeAt(xe+1);if(f(Ne))return x(Ce,Ne)}return Ce}function y(ue,ve){const xe=ue.charCodeAt(ve-1);if(f(xe)&&ve>1){const Ce=ue.charCodeAt(ve-2);if(E(Ce))return x(Ce,xe)}return xe}function U(ue,ve){const xe=$.getInstance(),Ce=ve,Ne=ue.length,Ue=v(ue,Ne,ve);ve+=Ue>=65536?2:1;let Ge=xe.getGraphemeBreakType(Ue);for(;ve<Ne;){const We=v(ue,Ne,ve),it=xe.getGraphemeBreakType(We);if(F(Ge,it))break;ve+=We>=65536?2:1,Ge=it}return ve-Ce}function B(ue,ve){const xe=$.getInstance(),Ce=ve,Ne=y(ue,ve);ve-=Ne>=65536?2:1;let Ue=xe.getGraphemeBreakType(Ne);for(;ve>0;){const Ge=y(ue,ve),We=xe.getGraphemeBreakType(Ge);if(F(We,Ue))break;ve-=Ge>=65536?2:1,Ue=We}return Ce-ve}const A=/(?:[\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 j(ue){return A.test(ue)}const P=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function b(ue){return P.test(ue)}const V=/^[\t\n\r\x20-\x7E]*$/;function ne(ue){return V.test(ue)}const ce=/[\u2028\u2029]/;function me(ue){return ce.test(ue)}function Ie(ue){for(let ve=0,xe=ue.length;ve<xe;ve++)if(we(ue.charCodeAt(ve)))return!0;return!1}function we(ue){return ue=+ue,ue>=11904&&ue<=55215||ue>=63744&&ue<=64255||ue>=65281&&ue<=65374}function Le(ue){return ue>=127462&&ue<=127487||ue===8986||ue===8987||ue===9200||ue===9203||ue>=9728&&ue<=10175||ue===11088||ue===11093||ue>=127744&&ue<=128591||ue>=128640&&ue<=128764||ue>=128992&&ue<=129003||ue>=129280&&ue<=129535||ue>=129648&&ue<=129750}const Re=String.fromCharCode(65279);function De(ue){return!!(ue&&ue.length>0&&ue.charCodeAt(0)===65279)}function ye(ue,ve=!1){return ue?(ve&&(ue=ue.replace(/\\./g,"")),ue.toLowerCase()!==ue):!1}function X(ue){const ve=90-65+1;return ue=ue%(2*ve),ue<ve?String.fromCharCode(97+ue):String.fromCharCode(65+ue-ve)}function k(ue){const ve=$.getInstance();return ve.getGraphemeBreakType(ue)}function F(ue,ve){return ue===0?ve!==5&&ve!==7:ue===2&&ve===3?!1:ue===4||ue===2||ue===3||(ve===4||ve===2||ve===3)?!0:ue===8&&(ve===8||ve===9||ve===11||ve===12)||((ue===11||ue===9)&&(ve===9||ve===10)||((ue===12||ue===10)&&ve===10||(ve===5||ve===13||(ve===7||(ue===1||ue===13&&ve===14)))))?!1:!(ue===6&&ve===6)}class ${constructor(){this._data=te()}static getInstance(){return $._INSTANCE||($._INSTANCE=new $),$._INSTANCE}getGraphemeBreakType(ue){if(ue<32)return ue===10?3:ue===13?2:4;if(ue<127)return 0;const ve=this._data,xe=ve.length/3;let Ce=1;for(;Ce<=xe;)if(ue<ve[3*Ce])Ce=2*Ce;else if(ue>ve[3*Ce+1])Ce=2*Ce+1;else return ve[3*Ce+2];return 0}}$._INSTANCE=null;function te(){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]")}function K(ue,ve){if(ue===0)return 0;const xe=pe(ue,ve);if(xe!==void 0)return xe;const Ce=y(ve,ue);return ue-=Te(Ce),ue}function pe(ue,ve){let xe=y(ve,ue);for(ue-=Te(xe);ke(xe)||xe===65039||xe===8419;){if(ue===0)return;xe=y(ve,ue),ue-=Te(xe)}if(!Le(xe))return;if(ue>=0){const Ce=y(ve,ue);Ce===8205&&(ue-=Te(Ce))}return ue}function Te(ue){return ue>=65536?2:1}function ke(ue){return 127995<=ue&&ue<=127999}},Ot1p:function(et,Ee,J){"use strict";var oe=J("2qtc"),Y=J("kLXV"),D=J("rAM+"),z=J("miYZ"),N=J("tsqr"),M=J("9og8"),W=J("tJVT"),H=J("jrin"),i=J("WmNS"),L=J.n(i),g=J("q1tI"),c=J.n(g),m=J("VrN/"),u=J.n(m),o=J("bdgK"),p=J("p77/"),l=J("Bd2K"),h=J("ELLl"),s=J("19Vz"),a=J("lZu9"),C=J("+NIl"),_=J("kSUc"),T=J("9Bee"),O=function(be){var Se=be.value,Pe=Se===void 0?"":Se,Be=be.className,Je=be.showTextOnly,$e=be.showLines,lt=be.style,at=lt===void 0?{}:lt,Qe=Object(g.useMemo)(function(){return""},[Pe]);return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{dangerouslySetInnerHTML:{__html:Qe}}))},R=J("0Owb"),S=J("dejd"),w=J("C+DQ"),E=J("1vsH"),f=J("m3rI"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function v(be){var Se=be.onActionCallback,Pe=be.title,Be=be.icon,Je=be.actionName,$e=be.className,lt=$e===void 0?"":$e,at=be.children;function Qe(){Se(Je)}return c.a.createElement("a",{title:Pe,className:lt,onClick:Qe},c.a.createElement("i",{className:"md-iconfont ".concat(Be)}),at)}var y=function(be){var Se=be.watch,Pe=be.showNullButton,Be=be.onActionCallback,Je=be.fullScreen,$e=be.insertTemp,lt=be.hidetoolBar,at=be.uuid,Qe=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(E.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(E.F)("_educoder_session"),"&key=").concat(at,"&api=").concat(encodeURIComponent(f.a.PROXY_SERVER)));var Lt=[].concat(x,[{title:"".concat(Se?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Se?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return c.a.createElement("ul",{className:"markdown-toolbar-container"},!lt&&Lt.map(function(ct,Nt){return c.a.createElement("li",{key:Nt},ct.actionName?c.a.createElement(v,Object(R.a)({},ct,{onActionCallback:Be})):c.a.createElement("span",{className:"v-line"}))}),Pe?c.a.createElement("li",null,c.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Be},c.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,$e&&c.a.createElement("li",null,c.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat($e),onActionCallback:Be},c.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),c.a.createElement("li",{className:"btn-full-screen"},c.a.createElement(v,{icon:"".concat(Je?"icon-shrink":"icon-enlarge"),title:Je?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Be})))},U=J("M8RZ"),B=J("+L6B"),A=J("2/Rp"),j=J("y8nQ"),P=J("Vl3Y"),b=J("5NDa"),V=J("5rEg"),ne={labelCol:{span:4},wrapperCol:{span:20}},ce=function(be){var Se=be.callback,Pe=be.onCancel;function Be(Je){Se(Je)}return c.a.createElement(P.a,Object(R.a)({},ne,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Be}),c.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},c.a.createElement(V.a,null)),c.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},c.a.createElement(V.a,null)),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(A.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(A.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},me=J("7ahc"),Ie=J("HmJG"),we=J("BjJ7"),Le=P.a.useForm,Re={width:280,marginRight:10},De={labelCol:{span:5},wrapperCol:{span:19}},ye=function(be){var Se=be.callback,Pe=be.onCancel,Be=Le(),Je=Object(W.a)(Be,1),$e=Je[0];function lt(Lt){Se(Lt)}function at(Lt,ct){if(Lt.status===-1){N.b.error(Lt.message);return}$e.setFieldsValue({src:"/api/attachments/".concat(Lt.id),type:ct.type})}function Qe(Lt){var ct=Lt.target.files[0];k(ct,at)}return c.a.createElement(P.a,Object(R.a)({form:$e},De,{className:"upload-image-panel",onFinish:lt}),c.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},c.a.createElement("div",{className:"flex-container"},c.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},c.a.createElement(V.a,{style:Re})),c.a.createElement(X,{onFileChange:Qe}))),c.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},c.a.createElement(V.a,{style:{width:264}})),c.a.createElement(P.a.Item,{style:{textAlign:"right"}},c.a.createElement(A.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(A.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))};function X(be){var Se=be.onFileChange;return c.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",c.a.createElement("input",{type:"file",onChange:Se}))}function k(be,Se){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var Pe=new FormData;Pe.append("editormd-image-file",be),Pe.append("file_param_name","editormd-image-file"),Pe.append("byxhr","true");var Be=new window.XMLHttpRequest;Be.withCredentials=!0,Be.addEventListener("load",function(Je){Se(JSON.parse(Je.target.responseText),be)},!1),Be.addEventListener("error",function(Je){console.error(Je)},!1),Be.open("POST","".concat(we.a,"/api/attachments.json")),Be.send(Pe)}var F=J("giR+"),$=J("fyUT"),te=J("7Kak"),K=J("9yH6"),pe=K.a.Group,Te={margin:"0 8px"},ke=function(be){var Se=be.callback,Pe=be.onCancel;function Be(Je){Se(Je)}return c.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Be},c.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},c.a.createElement("span",{style:Te},"\u5355\u5143\u683C\u6570\uFF1A"),c.a.createElement("span",{style:Te},"\u884C\u6570"),c.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},c.a.createElement($.a,null)),c.a.createElement("span",{style:Te},"\u5217\u6570"),c.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},c.a.createElement($.a,null))),c.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},c.a.createElement("span",{style:Te},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),c.a.createElement(P.a.Item,{name:"align"},c.a.createElement(pe,null,c.a.createElement(K.a,{value:"default"},c.a.createElement("i",{className:"fa fa-align-justify"})),c.a.createElement(K.a,{value:"left"},c.a.createElement("i",{className:"fa fa-align-left"})),c.a.createElement(K.a,{value:"center"},c.a.createElement("i",{className:"fa fa-align-center"})),c.a.createElement(K.a,{value:"right"},c.a.createElement("i",{className:"fa fa-align-right"}))))),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(A.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(A.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},ue=J("ErOA"),ve=J("7Cbv"),xe="link",Ce="upload-image",Ne="code-block",Ue="add-table",Ge="------------",We={default:Ge,left:":".concat(Ge),center:":".concat(Ge,":"),right:"".concat(Ge,":")},it=J("9VGf"),Ve,Xe;function Me(){}var rt=0,tt=1e4,le="\u2581",Z=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ee(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,he=se?"Cmd":"Ctrl",ie=["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"],ae=(Ve={},Object(H.a)(Ve,he+"-B","bold"),Object(H.a)(Ve,he+"-I","italic"),Ve),de=(Xe={},Object(H.a)(Xe,xe,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(Xe,Ne,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(Xe,Ce,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(Xe,Ue,"\u6DFB\u52A0\u8868\u683C"),Xe),fe=Ee.a=function(be){var Se=be.defaultValue,Pe=Se===void 0?"":Se,Be=be.onChange,Je=be.width,$e=Je===void 0?"100%":Je,lt=be.height,at=lt===void 0?400:lt,Qe=be.miniToolbar,Lt=Qe===void 0?!1:Qe,ct=be.isFocus,Nt=ct===void 0?!1:ct,Ut=be.watch,Ct=be.insertTemp,Qt=be.mode,ci=Qt===void 0?"markdown":Qt,Kt=be.id,Zt=Kt===void 0?"markdown-editor-id":Kt,ft=be.showResizeBar,_t=ft===void 0?!1:ft,xt=be.noStorage,Et=xt===void 0?!1:xt,It=be.showNullButton,gt=It===void 0?!1:It,Ye=be.hidetoolBar,wt=Ye===void 0?!1:Ye,Tt=be.fullScreen,ut=Tt===void 0?!1:Tt,vt=be.onBlur,Rt=be.onCMBeforeChange,ai=be.onFullScreen,Ht=be.className,He=Ht===void 0?"":Ht,mt=be.disablePaste,nn=mt===void 0?!1:mt,_n=be.placeholder,En=_n===void 0?"":_n,rn=be.values,xn=rn===void 0?"":rn,bt=Object(g.useState)(null),Ar=Object(W.a)(bt,2),Ke=Ar[0],Tn=Ar[1],Si=Object(g.useState)(Pe),Vn=Object(W.a)(Si,2),an=Vn[0],Ai=Vn[1],Xn=Object(g.useState)(Ut),Yn=Object(W.a)(Xn,2),Ri=Yn[0],$n=Yn[1],Rr=Object(g.useState)(ut),Jn=Object(W.a)(Rr,2),Oi=Jn[0],Or=Jn[1],aa=Object(g.useState)(""),Qn=Object(W.a)(aa,2),ui=Qn[0],Vi=Qn[1],sa=Object(g.useState)(0),sn=Object(W.a)(sa,2),Li=sn[0],Zn=sn[1],oa=Object(g.useState)(at),Lr=Object(W.a)(oa,2),Ir=Lr[0],wn=Lr[1],Dr=Object(g.useState)(!1),kr=Object(W.a)(Dr,2),la=kr[0],Sn=kr[1],on=Object(g.useRef)(Object(ve.a)()),ln=Object(g.useRef)(!1),Cn=Object(g.useRef)(),Bi=Object(g.useRef)(),ji=Object(g.useRef)(),Hi=Object(g.useRef)(),An=Object(g.useRef)(),Mr=function(){var ot=Object(M.a)(L.a.mark(function yt(){var dt,At;return L.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:return Bt.next=2,Object(ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:At=Bt.sent,At!=null&&(dt=At.attachments)!==null&&dt!==void 0&&dt.length&&(console.log("cm:",Ke,Bi),At.attachments.map(function(Dt){Dt.content_type.indexOf("image")>-1?Ke.replaceSelection(".concat(Dt.content_type,")")):Dt.content_type.indexOf("video")>-1?Ke.replaceSelection('<video width="100%" controls src="'.concat(f.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Dt.content_type.indexOf("pdf")>-1?Ke.replaceSelection('<a href="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,'&disposition=inline" target="_blank">').concat(Dt.name,"</a>")):Ke.replaceSelection("[".concat(Dt.name,"](").concat(f.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}));case 4:case"end":return Bt.stop()}},yt)}));return function(){return ot.apply(this,arguments)}}();Object(g.useEffect)(function(){Ai(xn),Ke==null||Ke.setValue(xn)},[xn]),Object(g.useEffect)(function(){ai==null||ai(Oi)},[Oi]),Object(g.useEffect)(function(){if(Bi.current){var ot=u.a.fromTextArea(Bi.current,{mode:ci,lineNumbers:!Lt,lineWrapping:!0,value:Pe,autoCloseTags:!0,autoCloseBrackets:!0});Nt&&ot.focus();function yt(dt,At){if(nn){At.preventDefault();return}var kt=At.clipboardData;if(kt){var Bt=kt.types.toString(),Dt=kt.items;if(Bt==="Files"||kt.types.indexOf("Files")>-1){if(At.preventDefault(),ci=="stex")return;try{var $t,fi=Dt[1];(($t=Dt[0])===null||$t===void 0?void 0:$t.kind)==="file"&&(fi=Dt[0]);var Ot=fi.getAsFile(),Wi=Ot.name.split(".").pop();k(Ot,function(Mt){if(Mt.id){var pi,si,Ci;(Ot==null||((pi=Ot.type)===null||pi===void 0)?void 0:pi.indexOf("image"))>-1?ot.replaceSelection(".concat(Mt.content_type,")")):(Ot==null||((si=Ot.type)===null||si===void 0)?void 0:si.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,'"></video>')):(Ot==null||((Ci=Ot.type)===null||Ci===void 0)?void 0:Ci.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,"?type=").concat(Ot.type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):ie.includes(Wi)?ot.replaceSelection('<a href="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,'?type=office&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):ot.replaceSelection("[".concat(Ot.name,"](").concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,"?type=").concat(Mt.content_type,")"))}else(Mt==null?void 0:Mt.status)===401&&(document.location.href="/user/login")})}catch(Mt){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ot.on("paste",yt),ot.on("dragleave",function(dt,At){ji.current.classList.remove("mouse-hover-md")}),ot.on("dragover",function(dt,At){ji.current.classList.add("mouse-hover-md")}),ot.on("drop",function(dt,At){ji.current.classList.add("mouse-hover-md");var kt;if(kt=At.dataTransfer.files,kt.length>0){At.preventDefault(),At.stopPropagation();for(var Bt=function(fi){var Ot=kt[fi],Wi=Ot.name.split(".").pop();k(Ot,function(Mt){if(Mt.id){var pi,si,Ci;(Ot==null||((pi=Ot.type)===null||pi===void 0)?void 0:pi.indexOf("image"))>-1?ot.replaceSelection(".concat(Mt.content_type,")")):(Ot==null||((si=Ot.type)===null||si===void 0)?void 0:si.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,'"></video>')):(Ot==null||((Ci=Ot.type)===null||Ci===void 0)?void 0:Ci.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,"?type=").concat(Ot.type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):ie.includes(Wi)?ot.replaceSelection('<a href="'.concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,'?type=office&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):ot.replaceSelection("[".concat(Ot.name,"](").concat(f.a.API_SERVER,"/api/attachments/").concat(Mt.id,"?type=").concat(Mt.content_type,")"))}else(Mt==null?void 0:Mt.status)===401&&(document.location.href="/user/login")})},Dt=0;Dt<kt.length;Dt++)Bt(Dt)}}),Tn(ot),function(){ot.off("paste",yt)}}},[]);var xi=Object(g.useCallback)(function(){if(ji.current)try{}catch(ot){console.log(ot,"---- to set md editor body height")}},[Ir,ji,Oi]);Object(g.useEffect)(function(){function ot(){var dt=new o.default(function(At){var kt=Object(D.a)(At),Bt;try{for(kt.s();!(Bt=kt.n()).done;){var Dt=Bt.value;(Dt.target.offsetHeight>0||Dt.target.offsetWidth>0)&&(xi(),Ke.setSize("100%","100%"),Ke.refresh())}}catch($t){kt.e($t)}finally{kt.f()}});return dt.observe(Bi.current.parentElement),dt}if(Ke){var yt=ot();return function(){yt.unobserve(Bi.current.parentElement)}}},[Ke,xi]),Object(g.useEffect)(function(){if(Ke){for(var ot=[],yt=function(){var Dt=At[dt];kt=Object(W.a)(Dt,2);var $t=kt[0],fi=kt[1],Ot=Object(H.a)({},$t,function(){Pr(fi)});ot.push(Ot),Ke.addKeyMap(Ot)},dt=0,At=Object.entries(ae);dt<At.length;dt++){var kt;yt()}return Cn.current=setInterval(function(){ln.current&&Mr()},4e3),function(){clearInterval(Cn.current);var Bt=Object(D.a)(ot),Dt;try{for(Bt.s();!(Dt=Bt.n()).done;){var $t=Dt.value;Ke.removeKeyMap($t)}}catch(fi){Bt.e(fi)}finally{Bt.f()}}}},[Ke]),Object(g.useEffect)(function(){ut!==Oi&&Or(ut)},[ut]),Object(it.a)(function(){if(!Et&&Li>0){var ot=new Date().getTime(),yt=window.sessionStorage.getItem(Zt);ot>=Li+tt&&(!yt||yt!==an)&&(window.sessionStorage.setItem(Zt,an),Sn(!0))}},tt),Object(g.useEffect)(function(){$n(Ut)},[Ke,Ut]),Object(g.useEffect)(function(){Ke&&(Nt&&Ke.focus())},[Ke,Nt]),Object(g.useEffect)(function(){if(Ri&&Ke){var ot=Ke.getScrollerElement();function yt(dt){var At=dt.target;if(An.current){var kt=At.scrollTop/At.scrollHeight;An.current.scrollTop=An.current.scrollHeight*kt}}return ot.addEventListener("scroll",yt),function(){ot.removeEventListener("scroll",yt)}}},[Ke,Ri]),Object(g.useEffect)(function(){if(Ke&&Rt){function ot(yt,dt){Rt(yt,dt)}return Ke.on("beforeChange",ot),function(){Ke.off("beforeChange",ot)}}},[Ke,Rt]),Object(g.useEffect)(function(){if(Ke&&vt){function ot(){vt(Ke.getValue())}return Ke.on("blur",ot),function(){Ke.off("blur",ot)}}},[Ke,vt]),Object(g.useEffect)(function(){if(Ke){function ot(yt){var dt=yt.getValue();Ai(dt),Zn(new Date().getTime()),yt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Be&&Be(dt)}return Ke.on("change",ot),function(){Ke.off("change",ot)}}},[Ke,Be]),Object(g.useEffect)(function(){Ke&&(Pe==null?(Ke.setValue(""),Ai("")):Pe!==Ke.getValue()&&(Ke.setValue(Pe),Ai(Pe),Ke.setCursor(Ke.lineCount(),0)))},[Ke,Pe]);var Pr=Object(g.useCallback)(function(ot){var yt=Ke.getCursor(),dt=Ke.getSelection(),At=dt.split(`
|
|
`);switch(ot){case"bold":return Ke.replaceSelection("**"+dt+"**"),dt===""&&Ke.setCursor(yt.line,yt.ch+2),Ke.focus();case"italic":return Ke.replaceSelection("*"+dt+"*"),dt===""&&Ke.setCursor(yt.line,yt.ch+1),Ke.focus();case"code":return Ke.replaceSelection("`"+dt+"`"),dt===""&&Ke.setCursor(yt.line,yt.ch+1),Ke.focus();case"inline-latex":return Ke.replaceSelection("`$$"+dt+"$$`"),dt===""&&Ke.setCursor(yt.line,yt.ch+3),Ke.focus();case"latex":return Ke.replaceSelection("```latex\n"+dt+"\n```"),Ke.setCursor(yt.line+1,dt.length+1),Ke.focus();case"line-break":return Ke.replaceSelection(`<br/>
|
|
`),Ke.focus();case"list-ul":return dt===""?Ke.replaceSelection("- "+dt):Ke.replaceSelection(At.map(function(kt){return kt===""?"":"- ".concat(kt)}).join(`
|
|
`)),Ke.focus();case"list-ol":return dt===""?Ke.replaceSelection("1. "+dt):Ke.replaceSelection(At.map(function(kt,Bt){return kt===""?"":"".concat(Bt+1,". ").concat(kt)}).join(`
|
|
`)),Ke.focus();case"add-null-ch":return dt===""&&Ke.setCursor(yt.line,yt.ch+1),Ke.replaceSelection(le),Ke.focus();case"inster-template-1":return dt===""&&Ke.setCursor(yt.line,yt.ch),Ke.replaceSelection(Z),Ke.focus();case"eraser":return Ke.setValue(""),Ke.focus();case"trigger-watch":return $n(!Ri),Ke.focus();case"trigger-full-screen":return Or(!Oi),Ke.focus();case xe:Vi(xe);return;case Ne:Vi(Ne);return;case Ce:Vi(Ce);return;case Ue:Vi(Ue);return;default:throw new Error}},[Ke,Ri,Oi]),Rn=Object(g.useCallback)(function(ot){Vi("");switch(ui){case xe:var yt=ot.title,dt=ot.link;return Ke.replaceSelection("[".concat(yt,"](").concat(dt,")")),Ke.focus();case Ne:var At=ot.language,kt=ot.content;return Ke.replaceSelection(["```"+At,kt,"```"].join(`
|
|
`)),Ke.focus();case Ce:var Bt=ot.src,Dt=ot.alt;return Dt?Ke.replaceSelection(".concat(Bt,' "').concat(Dt,'" )')):Ke.replaceSelection("")),Ke.focus();case Ue:for(var $t=ot.row,fi=ot.col,Ot=ot.align,Wi=`
|
|
`,Mt=0;Mt<$t;Mt++){for(var pi=[],si=[],Ci=0;Ci<fi;Ci++)Mt===1&&si.push(We[Ot]),pi.push(" ");Mt===1&&(Wi+="| ".concat(si.join(" | "),` |
|
|
`)),Wi+="| ".concat(pi.join(fi===1?"":" | "),` |
|
|
`)}return Ke.replaceSelection(Wi+`
|
|
`),Ke.focus();default:throw new Error}},[Ke,ui]),qn=Object(g.useMemo)(function(){switch(ui){case xe:return c.a.createElement(ce,{callback:Rn,onCancel:Xi});case Ne:return c.a.createElement(me.b,{callback:Rn,onCancel:Xi});case Ce:return c.a.createElement(ye,{callback:Rn,onCancel:Xi});case Ue:return c.a.createElement(ke,{callback:Rn,onCancel:Xi});default:return null}},[ui]);function Xi(){Vi("")}Object(g.useEffect)(function(){if(Hi.current){var ot=Hi.current,yt=!1,dt=0;function At(Dt){yt=!0,dt=Dt.pageY}function kt(){yt=!1}function Bt(Dt){if(yt){var $t=Dt.pageY-dt;$t<0&&($t=0),$t>300&&($t=300);var fi=at+$t+"px";wn(fi)}}return ot.addEventListener("mousedown",At),document.addEventListener("mousemove",Bt),document.addEventListener("mouseup",kt),function(){ot.removeEventListener("mousedown",At),document.removeEventListener("mousemove",Bt),document.removeEventListener("mouseup",kt)}}},[Ke,Hi]),Object(g.useEffect)(function(){wn(at)},[at]);var Pi=ee($e),er=ee(Ir),Ii={width:Pi,height:er},tr=Object(g.useMemo)(function(){if(Li){var ot=new Date(Li),yt=ot.getHours(),dt=ot.getMinutes(),At=ot.getSeconds();return yt=yt<10?"0"+yt:yt,dt=dt<10?"0"+dt:dt,At=At<10?"0"+At:At,"".concat(yt,":").concat(dt,":").concat(At)}return 0},[Li]);function Nr(){window.sessionStorage.removeItem(Zt),Sn(!1),Zn(0)}function un(){Sn(!1),Zn(0),Ke.setValue(window.sessionStorage.getItem(Zt))}function ua(ot,yt){var dt=Ke.getValue();dt=dt.replace(ot,yt),Ai(dt),Ke==null||Ke.setValue(dt)}return c.a.createElement(g.Fragment,null,c.a.createElement("div",{className:"markdown-editor-wrapper",ref:ji},c.a.createElement("div",{className:"markdown-editor-container ".concat(He," ").concat(Ri?"on-preview":""," ").concat(Lt?"mini":""," ").concat(Oi?"full-screen":""),style:Ii},c.a.createElement(y,{insertTemp:Ct,watch:Ri,fullScreen:Oi,showNullButton:gt,onActionCallback:Pr,hidetoolBar:wt,uuid:on.current,setOpenPhones:function(){ln.current=!0}}),c.a.createElement("div",{className:"markdown-editor-body"},c.a.createElement("div",{className:"codemirror-container"},c.a.createElement("textarea",{ref:Bi,placeholder:En})),Ri?c.a.createElement("div",{ref:An,className:"preview-container"},ci==="stex"&&c.a.createElement(O,{value:an}),ci!=="stex"&&c.a.createElement(T.a,{edit:!0,value:an,replaces:ua})):null))),_t?c.a.createElement("a",{ref:Hi,className:"editor-resize"}):null,c.a.createElement(U.a,null,de[ui]?c.a.createElement(Y.a,{centered:!0,title:de[ui],visible:!0,onCancel:Xi,footer:null,className:"markdown-popup-form"},qn):null))}},RotF:function(et,Ee,J){et.exports=J("LSTS")},SJMd:function(et,Ee){/**
|
|
* @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 J,oe,Y,D=!1,z,N;window.PR_SHOULD_USE_CONTINUATION=!0;var M,W;(function(){var H=window,i=["break,continue,do,else,for,if,return,while"],L=[i,"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"],g=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],c=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],m=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],u=[g,"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"],o="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",p=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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",h=[i,"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=[i,"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"],a=[i,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[c,u,m,p,l,h,s,a],_=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",O="kwd",R="com",S="typ",w="lit",E="pun",f="pln",x="tag",v="dec",y="src",U="atn",B="atv",A="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(pe){for(var Te=0,ke=!1,ue=!1,ve=0,xe=pe.length;ve<xe;++ve){var Ce=pe[ve];if(Ce.ignoreCase)ue=!0;else if(/[a-z]/i.test(Ce.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ke=!0,ue=!1;break}}var Ne={b:8,t:9,n:10,v:11,f:12,r:13};function Ue(Xe){var Me=Xe.charCodeAt(0);if(Me!==92)return Me;var rt=Xe.charAt(1);return Me=Ne[rt],Me||("0"<=rt&&rt<="7"?parseInt(Xe.substring(1),8):rt==="u"||rt==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Ge(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Me=String.fromCharCode(Xe);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function We(Xe){var Me=Xe.substring(1,Xe.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")),rt=[],tt=Me[0]==="^",le=["["];tt&&le.push("^");for(var Z=tt?1:0,ee=Me.length;Z<ee;++Z){var se=Me[Z];if(/\\[bdsw]/i.test(se))le.push(se);else{var he=Ue(se),ie;Z+2<ee&&Me[Z+1]==="-"?(ie=Ue(Me[Z+2]),Z+=2):ie=he,rt.push([he,ie]),ie<65||he>122||(ie<65||he>90||rt.push([Math.max(65,he)|32,Math.min(ie,90)|32]),ie<97||he>122||rt.push([Math.max(97,he)&~32,Math.min(ie,122)&~32]))}}rt.sort(function(be,Se){return be[0]-Se[0]||Se[1]-be[1]});for(var ae=[],de=[],Z=0;Z<rt.length;++Z){var fe=rt[Z];fe[0]<=de[1]+1?de[1]=Math.max(de[1],fe[1]):ae.push(de=fe)}for(var Z=0;Z<ae.length;++Z){var fe=ae[Z];le.push(Ge(fe[0])),fe[1]>fe[0]&&(fe[1]+1>fe[0]&&le.push("-"),le.push(Ge(fe[1])))}return le.push("]"),le.join("")}function it(Xe){for(var Me=Xe.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")),rt=Me.length,tt=[],le=0,Z=0;le<rt;++le){var ee=Me[le];if(ee==="(")++Z;else if(ee.charAt(0)==="\\"){var se=+ee.substring(1);se&&(se<=Z?tt[se]=-1:Me[le]=Ge(se))}}for(var le=1;le<tt.length;++le)tt[le]===-1&&(tt[le]=++Te);for(var le=0,Z=0;le<rt;++le){var ee=Me[le];if(ee==="(")++Z,tt[Z]||(Me[le]="(?:");else if(ee.charAt(0)==="\\"){var se=+ee.substring(1);se&&se<=Z&&(Me[le]="\\"+tt[se])}}for(var le=0;le<rt;++le)Me[le]==="^"&&Me[le+1]!=="^"&&(Me[le]="");if(Xe.ignoreCase&&ke)for(var le=0;le<rt;++le){var ee=Me[le],he=ee.charAt(0);ee.length>=2&&he==="["?Me[le]=We(ee):he!=="\\"&&(Me[le]=ee.replace(/[a-zA-Z]/g,function(de){var fe=de.charCodeAt(0);return"["+String.fromCharCode(fe&~32,fe|32)+"]"}))}return Me.join("")}for(var Ve=[],ve=0,xe=pe.length;ve<xe;++ve){var Ce=pe[ve];if(Ce.global||Ce.multiline)throw new Error(""+Ce);Ve.push("(?:"+it(Ce)+")")}return new RegExp(Ve.join("|"),ue?"gi":"g")}function b(pe,Te){var ke=/(?:^|\s)nocode(?:\s|$)/,ue=[],ve=0,xe=[],Ce=0;function Ne(Ue){var Ge=Ue.nodeType;if(Ge==1){if(ke.test(Ue.className))return;for(var We=Ue.firstChild;We;We=We.nextSibling)Ne(We);var it=Ue.nodeName.toLowerCase();(it==="br"||it==="li")&&(ue[Ce]=`
|
|
`,xe[Ce<<1]=ve++,xe[Ce++<<1|1]=Ue)}else if(Ge==3||Ge==4){var Ve=Ue.nodeValue;Ve.length&&(Te?Ve=Ve.replace(/\r\n?/g,`
|
|
`):Ve=Ve.replace(/[ \t\r\n]+/g," "),ue[Ce]=Ve,xe[Ce<<1]=ve,ve+=Ve.length,xe[Ce++<<1|1]=Ue)}}return Ne(pe),{sourceCode:ue.join("").replace(/\n$/,""),spans:xe}}function V(pe,Te,ke,ue,ve){if(!ke)return;var xe={sourceNode:pe,pre:1,langExtension:null,numberLines:null,sourceCode:ke,spans:null,basePos:Te,decorations:null};ue(xe),ve.push.apply(ve,xe.decorations)}var ne=/\S/;function ce(pe){for(var Te=void 0,ke=pe.firstChild;ke;ke=ke.nextSibling){var ue=ke.nodeType;Te=ue===1?Te?pe:ke:ue===3&&ne.test(ke.nodeValue)?pe:Te}return Te===pe?void 0:Te}function me(pe,Te){var ke={},ue;(function(){for(var Ce=pe.concat(Te),Ne=[],Ue={},Ge=0,We=Ce.length;Ge<We;++Ge){var it=Ce[Ge],Ve=it[3];if(Ve)for(var Xe=Ve.length;--Xe>=0;)ke[Ve.charAt(Xe)]=it;var Me=it[1],rt=""+Me;Ue.hasOwnProperty(rt)||(Ne.push(Me),Ue[rt]=null)}Ne.push(/[\0-\uffff]/),ue=P(Ne)})();var ve=Te.length,xe=function(Ce){for(var Ne=Ce.sourceCode,Ue=Ce.basePos,Ge=Ce.sourceNode,We=[Ue,f],it=0,Ve=Ne.match(ue)||[],Xe={},Me=0,rt=Ve.length;Me<rt;++Me){var tt=Ve[Me],le=Xe[tt],Z=void 0,ee;if(typeof le=="string")ee=!1;else{var se=ke[tt.charAt(0)];if(se)Z=tt.match(se[1]),le=se[0];else{for(var he=0;he<ve;++he)if(se=Te[he],Z=tt.match(se[1]),Z){le=se[0];break}Z||(le=f)}ee=le.length>=5&&le.substring(0,5)==="lang-",ee&&!(Z&&typeof Z[1]=="string")&&(ee=!1,le=y),ee||(Xe[tt]=le)}var ie=it;if(it+=tt.length,!ee)We.push(Ue+ie,le);else{var ae=Z[1],de=tt.indexOf(ae),fe=de+ae.length;Z[2]&&(fe=tt.length-Z[2].length,de=fe-ae.length);var be=le.substring(5);V(Ge,Ue+ie,tt.substring(0,de),xe,We),V(Ge,Ue+ie+de,ae,X(be,ae),We),V(Ge,Ue+ie+fe,tt.substring(fe),xe,We)}}Ce.decorations=We};return xe}function Ie(pe){var Te=[],ke=[];pe.tripleQuotedStrings?Te.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):pe.multiLineStrings?Te.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Te.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),pe.verbatimStrings&&ke.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ue=pe.hashComments;ue&&(pe.cStyleComments?(ue>1?Te.push([R,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Te.push([R,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ke.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Te.push([R,/^#[^\r\n]*/,null,"#"])),pe.cStyleComments&&(ke.push([R,/^\/\/[^\r\n]*/,null]),ke.push([R,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ve=pe.regexLiterals;if(ve){var xe=ve>1?"":`
|
|
\r`,Ce=xe?".":"[\\S\\s]",Ne="/(?=[^/*"+xe+"])(?:[^/\\x5B\\x5C"+xe+"]|\\x5C"+Ce+"|\\x5B(?:[^\\x5C\\x5D"+xe+"]|\\x5C"+Ce+")*(?:\\x5D|$))+/";ke.push(["lang-regex",RegExp("^"+j+"("+Ne+")")])}var Ue=pe.types;Ue&&ke.push([S,Ue]);var Ge=(""+pe.keywords).replace(/^ | $/g,"");Ge.length&&ke.push([O,new RegExp("^(?:"+Ge.replace(/[\s,]+/g,"|")+")\\b"),null]),Te.push([f,/^\s+/,null,` \r
|
|
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return pe.regexLiterals&&(We+="(?!s*/)"),ke.push([w,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[f,/^[a-z_$][a-z_$@0-9]*/i,null],[w,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[f,/^\\[\s\S]?/,null],[E,new RegExp(We),null]),me(Te,ke)}var we=Ie({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Le(pe,Te,ke){for(var ue=/(?:^|\s)nocode(?:\s|$)/,ve=/\r\n?|\n/,xe=pe.ownerDocument,Ce=xe.createElement("li");pe.firstChild;)Ce.appendChild(pe.firstChild);var Ne=[Ce];function Ue(Me){var rt=Me.nodeType;if(rt==1&&!ue.test(Me.className))if(Me.nodeName==="br")Ge(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var tt=Me.firstChild;tt;tt=tt.nextSibling)Ue(tt);else if((rt==3||rt==4)&&ke){var le=Me.nodeValue,Z=le.match(ve);if(Z){var ee=le.substring(0,Z.index);Me.nodeValue=ee;var se=le.substring(Z.index+Z[0].length);if(se){var he=Me.parentNode;he.insertBefore(xe.createTextNode(se),Me.nextSibling)}Ge(Me),ee||Me.parentNode.removeChild(Me)}}}function Ge(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)return;function rt(Z,ee){var se=ee?Z.cloneNode(!1):Z,he=Z.parentNode;if(he){var ie=rt(he,1),ae=Z.nextSibling;ie.appendChild(se);for(var de=ae;de;de=ae)ae=de.nextSibling,ie.appendChild(de)}return se}for(var tt=rt(Me.nextSibling,0),le;(le=tt.parentNode)&&le.nodeType===1;)tt=le;Ne.push(tt)}for(var We=0;We<Ne.length;++We)Ue(Ne[We]);Te===(Te|0)&&Ne[0].setAttribute("value",Te);var it=xe.createElement("ol");it.className="linenums";for(var Ve=Math.max(0,Te-1|0)||0,We=0,Xe=Ne.length;We<Xe;++We)Ce=Ne[We],Ce.className="L"+(We+Ve)%10,Ce.firstChild||Ce.appendChild(xe.createTextNode("\xA0")),it.appendChild(Ce);pe.appendChild(it)}function Re(pe){var Te=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Te=Te&&+Te[1]<=8;var ke=/\n/g,ue=pe.sourceCode,ve=ue.length,xe=0,Ce=pe.spans,Ne=Ce.length,Ue=0,Ge=pe.decorations,We=Ge.length,it=0;Ge[We]=ve;var Ve,Xe;for(Xe=Ve=0;Xe<We;)Ge[Xe]!==Ge[Xe+2]?(Ge[Ve++]=Ge[Xe++],Ge[Ve++]=Ge[Xe++]):Xe+=2;for(We=Ve,Xe=Ve=0;Xe<We;){for(var Me=Ge[Xe],rt=Ge[Xe+1],tt=Xe+2;tt+2<=We&&Ge[tt+1]===rt;)tt+=2;Ge[Ve++]=Me,Ge[Ve++]=rt,Xe=tt}We=Ge.length=Ve;var le=pe.sourceNode,Z="";le&&(Z=le.style.display,le.style.display="none");try{for(var ee=null;Ue<Ne;){var se=Ce[Ue],he=Ce[Ue+2]||ve,ie=Ge[it+2]||ve,tt=Math.min(he,ie),ae=Ce[Ue+1],de;if(ae.nodeType!==1&&(de=ue.substring(xe,tt))){Te&&(de=de.replace(ke,"\r")),ae.nodeValue=de;var fe=ae.ownerDocument,be=fe.createElement("span");be.className=Ge[it+1];var Se=ae.parentNode;Se.replaceChild(be,ae),be.appendChild(ae),xe<he&&(Ce[Ue+1]=ae=fe.createTextNode(ue.substring(tt,he)),Se.insertBefore(ae,be.nextSibling))}xe=tt,xe>=he&&(Ue+=2),xe>=ie&&(it+=2)}}finally{le&&(le.style.display=Z)}}var De={};function ye(pe,Te){for(var ke=Te.length;--ke>=0;){var ue=Te[ke];De.hasOwnProperty(ue)?H.console&&console.warn("cannot override language handler %s",ue):De[ue]=pe}}function X(pe,Te){return pe&&De.hasOwnProperty(pe)||(pe=/^\s*</.test(Te)?"default-markup":"default-code"),De[pe]}ye(we,["default-code"]),ye(me([],[[f,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[R,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["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"]),ye(me([[f,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[U,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["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"]),ye(me([],[[B,/^[\s\S]+/]]),["uq.val"]),ye(Ie({keywords:c,hashComments:!0,cStyleComments:!0,types:_}),["c","cc","cpp","cxx","cyc","m"]),ye(Ie({keywords:"null,true,false"}),["json"]),ye(Ie({keywords:u,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:_}),["cs"]),ye(Ie({keywords:m,cStyleComments:!0}),["java"]),ye(Ie({keywords:a,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ye(Ie({keywords:h,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ye(Ie({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ye(Ie({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ye(Ie({keywords:p,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ye(Ie({keywords:o,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ye(me([],[[T,/^[\s\S]+/]]),["regex"]);function k(pe){var Te=pe.langExtension;try{var ke=b(pe.sourceNode,pe.pre),ue=ke.sourceCode;pe.sourceCode=ue,pe.spans=ke.spans,pe.basePos=0,X(Te,ue)(pe),Re(pe)}catch(ve){H.console&&console.log(ve&&ve.stack||ve)}}function F(pe,Te,ke){var ue=ke||!1,ve=Te||null,xe=document.createElement("div");xe.innerHTML="<pre>"+pe+"</pre>",xe=xe.firstChild,ue&&Le(xe,ue,!0);var Ce={langExtension:ve,numberLines:ue,sourceNode:xe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return k(Ce),xe.innerHTML}function $(pe,Te){var ke=Te||document.body,ue=ke.ownerDocument||document;function ve(se){return ke.getElementsByTagName(se)}for(var xe=[ve("pre"),ve("code"),ve("xmp")],Ce=[],Ne=0;Ne<xe.length;++Ne)for(var Ue=0,Ge=xe[Ne].length;Ue<Ge;++Ue)Ce.push(xe[Ne][Ue]);xe=null;var We=Date;We.now||(We={now:function(){return+new Date}});var it=0,Ve=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Me=/\bprettyprinted\b/,rt=/pre|xmp/i,tt=/^code$/i,le=/^(?:pre|code|xmp)$/i,Z={};function ee(){for(var se=H.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;it<Ce.length&&We.now()<se;it++){for(var he=Ce[it],ie=Z,ae=he;ae=ae.previousSibling;){var de=ae.nodeType,fe=(de===7||de===8)&&ae.nodeValue;if(fe?!/^\??prettify\b/.test(fe):de!==3||/\S/.test(ae.nodeValue))break;if(fe){ie={},fe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ut,Ct,Qt){ie[Ct]=Qt});break}}var be=he.className;if((ie!==Z||Xe.test(be))&&!Me.test(be)){for(var Se=!1,Pe=he.parentNode;Pe;Pe=Pe.parentNode){var Be=Pe.tagName;if(le.test(Be)&&Pe.className&&Xe.test(Pe.className)){Se=!0;break}}if(!Se){he.className+=" prettyprinted";var Je=ie.lang;if(!Je){Je=be.match(Ve);var $e;!Je&&($e=ce(he))&&tt.test($e.tagName)&&(Je=$e.className.match(Ve)),Je&&(Je=Je[1])}var lt;if(rt.test(he.tagName))lt=1;else{var at=he.currentStyle,Qe=ue.defaultView,Lt=at?at.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(he,null).getPropertyValue("white-space"):0;lt=Lt&&Lt.substring(0,3)==="pre"}var ct=ie.linenums;(ct=ct==="true"||+ct)||(ct=be.match(/\blinenums\b(?::(\d+))?/),ct=ct?ct[1]&&ct[1].length?+ct[1]:!0:!1),ct&&Le(he,ct,lt);var Nt={langExtension:Je,sourceNode:he,numberLines:ct,pre:lt,sourceCode:null,basePos:null,spans:null,decorations:null};k(Nt)}}}it<Ce.length?H.setTimeout(ee,250):typeof pe=="function"&&pe()}ee()}var te=H.PR={createSimpleLexer:me,registerLangHandler:ye,sourceDecorator:Ie,PR_ATTRIB_NAME:U,PR_ATTRIB_VALUE:B,PR_COMMENT:R,PR_DECLARATION:v,PR_KEYWORD:O,PR_LITERAL:w,PR_NOCODE:A,PR_PLAIN:f,PR_PUNCTUATION:E,PR_SOURCE:y,PR_STRING:T,PR_TAG:x,PR_TYPE:S,prettyPrintOne:D?H.prettyPrintOne=F:M=F,prettyPrint:W=D?H.prettyPrint=$:W=$},K=H.define;typeof K=="function"&&K.amd&&K("google-code-prettify",[],function(){return te})})()},STEk:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return ye});/*! *****************************************************************************
|
|
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 oe=function(X,k){return(oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,$){F.__proto__=$}||function(F,$){for(var te in $)Object.prototype.hasOwnProperty.call($,te)&&(F[te]=$[te])})(X,k)};function Y(X,k){function F(){this.constructor=X}oe(X,k),X.prototype=k===null?Object.create(k):(F.prototype=k.prototype,new F)}function D(X,k,F,$){return new(F||(F=Promise))(function(te,K){function pe(ue){try{ke($.next(ue))}catch(ve){K(ve)}}function Te(ue){try{ke($.throw(ue))}catch(ve){K(ve)}}function ke(ue){var ve;ue.done?te(ue.value):(ve=ue.value,ve instanceof F?ve:new F(function(xe){xe(ve)})).then(pe,Te)}ke(($=$.apply(X,k||[])).next())})}function z(X,k){var F,$,te,K,pe={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return K={next:Te(0),throw:Te(1),return:Te(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Te(ke){return function(ue){return function(ve){if(F)throw new TypeError("Generator is already executing.");for(;pe;)try{if(F=1,$&&(te=2&ve[0]?$.return:ve[0]?$.throw||((te=$.return)&&te.call($),0):$.next)&&!(te=te.call($,ve[1])).done)return te;switch($=0,te&&(ve=[2&ve[0],te.value]),ve[0]){case 0:case 1:te=ve;break;case 4:return pe.label++,{value:ve[1],done:!1};case 5:pe.label++,$=ve[1],ve=[0];continue;case 7:ve=pe.ops.pop(),pe.trys.pop();continue;default:if(!(te=pe.trys,(te=te.length>0&&te[te.length-1])||ve[0]!==6&&ve[0]!==2)){pe=0;continue}if(ve[0]===3&&(!te||ve[1]>te[0]&&ve[1]<te[3])){pe.label=ve[1];break}if(ve[0]===6&&pe.label<te[1]){pe.label=te[1],te=ve;break}if(te&&pe.label<te[2]){pe.label=te[2],pe.ops.push(ve);break}te[2]&&pe.ops.pop(),pe.trys.pop();continue}ve=k.call(X,pe)}catch(xe){ve=[6,xe],$=0}finally{F=te=0}if(5&ve[0])throw ve[1];return{value:ve[0]?ve[1]:void 0,done:!0}}([ke,ue])}}}function N(){for(var X=0,k=0,F=arguments.length;k<F;k++)X+=arguments[k].length;var $=Array(X),te=0;for(k=0;k<F;k++)for(var K=arguments[k],pe=0,Te=K.length;pe<Te;pe++,te++)$[te]=K[pe];return $}var M=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(k,F){for(var $=0,te=F;$<te.length;$++){var K=te[$],pe=K[0],Te=K[1];k.setAttribute(pe,Te)}},X.createRect=function(k,F,$){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",k.toString()),te.setAttribute("height",F.toString()),$&&X.setAttributes(te,$),te},X.createLine=function(k,F,$,te,K){var pe=document.createElementNS("http://www.w3.org/2000/svg","line");return pe.setAttribute("x1",k.toString()),pe.setAttribute("y1",F.toString()),pe.setAttribute("x2",$.toString()),pe.setAttribute("y2",te.toString()),K&&X.setAttributes(pe,K),pe},X.createPolygon=function(k,F){var $=document.createElementNS("http://www.w3.org/2000/svg","polygon");return $.setAttribute("points",k),F&&X.setAttributes($,F),$},X.createCircle=function(k,F){var $=document.createElementNS("http://www.w3.org/2000/svg","circle");return $.setAttribute("cx",(k/2).toString()),$.setAttribute("cy",(k/2).toString()),$.setAttribute("r",k.toString()),F&&X.setAttributes($,F),$},X.createEllipse=function(k,F,$){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(k/2).toString()),te.setAttribute("cy",(F/2).toString()),te.setAttribute("rx",(k/2).toString()),te.setAttribute("ry",(F/2).toString()),$&&X.setAttributes(te,$),te},X.createGroup=function(k){var F=document.createElementNS("http://www.w3.org/2000/svg","g");return k&&X.setAttributes(F,k),F},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(k,F,$,te,K,pe,Te){var ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(ke,[["id",k],["orient",F],["markerWidth",$.toString()],["markerHeight",te.toString()],["refX",K.toString()],["refY",pe.toString()]]),ke.appendChild(Te),ke},X.createText=function(k){var F=document.createElementNS("http://www.w3.org/2000/svg","text");return F.setAttribute("x","0"),F.setAttribute("y","0"),k&&X.setAttributes(F,k),F},X.createTSpan=function(k,F){var $=document.createElementNS("http://www.w3.org/2000/svg","tspan");return $.textContent=k,F&&X.setAttributes($,F),$},X.createImage=function(k){var F=document.createElementNS("http://www.w3.org/2000/svg","image");return k&&X.setAttributes(F,k),F},X.createPoint=function(k,F){var $=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return $.x=k,$.y=F,$},X.createPath=function(k,F){var $=document.createElementNS("http://www.w3.org/2000/svg","path");return $.setAttribute("d",k),F&&X.setAttributes($,F),$},X}(),W=function(){function X(){}return X.addKey=function(k){X.key=k},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),H=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(k,F,$){var te=this;return new Promise(function(K){var pe=$!==void 0?$:document.createElement("canvas");k===null&&(te.markersOnly=!0,te.naturalSize=!1);var Te=document.createElementNS("http://www.w3.org/2000/svg","svg");Te.setAttribute("xmlns","http://www.w3.org/2000/svg"),Te.setAttribute("width",F.width.baseVal.valueAsString),Te.setAttribute("height",F.height.baseVal.valueAsString),Te.setAttribute("viewBox","0 0 "+F.viewBox.baseVal.width.toString()+" "+F.viewBox.baseVal.height.toString()),Te.innerHTML=F.innerHTML,te.naturalSize===!0?(Te.width.baseVal.value=k.naturalWidth,Te.height.baseVal.value=k.naturalHeight):te.width!==void 0&&te.height!==void 0&&(Te.width.baseVal.value=te.width,Te.height.baseVal.value=te.height),pe.width=Te.width.baseVal.value,pe.height=Te.height.baseVal.value;var ke=Te.outerHTML,ue=pe.getContext("2d");te.markersOnly!==!0&&ue.drawImage(k,0,0,pe.width,pe.height);var ve=window.URL,xe=new Image(pe.width,pe.height);xe.setAttribute("crossOrigin","anonymous");var Ce=new Blob([ke],{type:"image/svg+xml"}),Ne=ve.createObjectURL(Ce);xe.onload=function(){ue.drawImage(xe,0,0),ve.revokeObjectURL(Ne);var Ue=pe.toDataURL(te.imageType,te.imageQuality);K(Ue)},xe.src=Ne})},X}(),i=function(){},L=function(){function X(k){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+k+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(k){return this.styleSheet===void 0&&this.addStyleSheet(),k.name=""+this.classNamePrefix+k.localName,this.classes.push(k),this.styleSheet.sheet.insertRule("."+k.name+" {"+k.style+"}",this.styleSheet.sheet.cssRules.length),k},X.prototype.addRule=function(k){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(k),this.styleSheet.sheet.insertRule(k.selector+" {"+k.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var k;this.styleSheet=document.createElement("style"),((k=this.styleSheetRoot)!==null&&k!==void 0?k:document.head).appendChild(this.styleSheet),this.addRule(new g("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new g("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new g("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new c("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new c("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},X.prototype.removeStyleSheet=function(){var k;this.styleSheet&&(((k=this.styleSheetRoot)!==null&&k!==void 0?k:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),g=function(X,k){this.selector=X,this.style=k},c=function(X,k){this.localName=X,this.style=k},m=function(){function X(k,F,$,te,K){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=k,this.displayMode=F,this.markerItems=$,this.uiStyleSettings=te,this.styles=K,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(k){var F=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=k,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var $=document.createElement("div");$.className=this.toolbarBlockStyleClass.name,$.style.whiteSpace="nowrap",this.uiContainer.appendChild($),this.addActionButton($,'<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($,'<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($,'<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($,'<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($,'<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($,'<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($,'<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($,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(K){var pe=document.createElement("div");pe.className=""+F.toolbarButtonStyleClass.name,pe.setAttribute("data-type-name",K.typeName),pe.innerHTML=K.icon,pe.addEventListener("click",function(){F.markerToolbarButtonClicked(pe,K)}),F.buttons.push(pe),F.markerButtons.push(pe)}),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 te=document.createElement("div");te.className=this.toolbarBlockStyleClass.name,te.style.whiteSpace="nowrap",te.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(te),this.addActionButton(te,'<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(te,'<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()},X.prototype.addButtonClickListener=function(k){this.buttonClickListeners.push(k)},X.prototype.removeButtonClickListener=function(k){this.buttonClickListeners.indexOf(k)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(k),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var k=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var F=0;F<this.markerButtons.length;F++)F<k||F===k&&this.markerButtons.length-1===k?this.markerButtonBlock.appendChild(this.markerButtons[F]):(F===k&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[F]))}},X.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")},X.prototype.resetButtonStyles=function(){var k=this;this.buttons.forEach(function(F){F.className=F.className.replace(k.uiStyleSettings.toolbarButtonStyleColorsClassName?k.uiStyleSettings.toolbarButtonStyleColorsClassName:k.toolbarButtonStyleColorsClass.name,"").trim(),F.className=F.className.replace(k.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?k.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:k.toolbarActiveButtonStyleColorsClass.name,"").trim(),F.className+=" "+(k.uiStyleSettings.toolbarButtonStyleColorsClassName?k.uiStyleSettings.toolbarButtonStyleColorsClassName:k.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(k,F,$){var te=this,K=document.createElement("div");switch(K.className=""+this.toolbarButtonStyleClass.name,K.innerHTML=F,K.setAttribute("data-action",$),K.addEventListener("click",function(){te.actionToolbarButtonClicked(K,$)}),$){case"select":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":K.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":K.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":K.style.fill=this.uiStyleSettings.closeButtonColor}k.appendChild(K),this.buttons.push(K)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new c("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 c("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new c("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new c("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 c("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var k=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new c("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*k)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*k)+`px;
|
|
padding: `+k+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new c("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new c("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new g("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new g("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},X.prototype.markerToolbarButtonClicked=function(k,F){this.setActiveButton(k),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function($){return $("marker",F)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(k,F){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function($){return $("action",F)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(k){this.resetButtonStyles(),k.className=k.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),k.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(k){var F=this.markerButtons.find(function($){return $.getAttribute("data-type-name")===k});F&&this.setActiveButton(F)},X.prototype.setCurrentMarker=function(k){var F=this;this.currentMarker=k,this.buttons.filter(function($){return/delete|notes/.test($.getAttribute("data-action"))}).forEach(function($){F.currentMarker===void 0?($.style.fillOpacity="0.4",$.style.pointerEvents="none"):($.style.fillOpacity="1",$.style.pointerEvents="all")})},X}(),u=function(){function X(k,F,$,te){this.panels=[],this.panelButtons=[],this.markerjsContainer=k,this.displayMode=F,this.uiStyleSettings=$,this.styles=te,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var k;this.toolboxStyleClass=this.styles.addClass(new c("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 c("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var F=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new c("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new c("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new c("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 c("toolbox-panel-row_colors",`
|
|
background-color: `+((k=this.uiStyleSettings.toolboxBackgroundColor)!==null&&k!==void 0?k:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new c("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*F)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*F)+`px;
|
|
padding: `+F+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new c("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new c("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new g("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new g("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},X.prototype.show=function(k){var F;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=k,this.uiContainer.className=this.toolboxStyleClass.name+" "+((F=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(k){var F,$,te=this;this.panels=k,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((F=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(($=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&$!==void 0?$:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(K){var pe;K.uiStyleSettings=te.uiStyleSettings;var Te=document.createElement("div");Te.className=te.toolboxButtonStyleClass.name+" "+((pe=te.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&pe!==void 0?pe:te.toolboxButtonStyleColorsClass.name),Te.innerHTML=K.icon,Te.title=K.title,Te.addEventListener("click",function(){te.panelButtonClick(K)}),te.panelButtons.push(Te),te.buttonRow.appendChild(Te)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(k){var F=this,$=-1;if(k!==this.activePanel){$=this.panels.indexOf(k),this.panelRow.innerHTML="";var te=k.getUi();te.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(te),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=k}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){F.displayMode==="inline"?F.panelRow.style.display="none":F.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(K,pe){var Te,ke;K.className=F.toolboxButtonStyleClass.name+" "+(pe===$?""+((Te=F.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Te!==void 0?Te:F.toolboxActiveButtonStyleColorsClass.name):""+((ke=F.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ke!==void 0?ke:F.toolboxButtonStyleColorsClass.name))})},X}(),o=function(X,k){this.title=X,this.icon=k},p=function(X){function k(F,$,te,K){var pe=X.call(this,F,K||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return pe.colors=[],pe.addTransparent=!1,pe.colorBoxes=[],pe.colors=$,pe.currentColor=te,pe.setCurrentColor=pe.setCurrentColor.bind(pe),pe.getColorBox=pe.getColorBox.bind(pe),pe}return Y(k,X),k.prototype.getUi=function(){var F=this,$=document.createElement("div");return $.style.overflow="hidden",$.style.whiteSpace="nowrap",this.colors.forEach(function(te){var K=F.getColorBox(te);$.appendChild(K),F.colorBoxes.push(K)}),$},k.prototype.getColorBox=function(F){var $=this,te=this.uiStyleSettings.toolbarHeight/4,K=this.uiStyleSettings.toolbarHeight-te,pe=document.createElement("div");pe.style.display="inline-block",pe.style.boxSizing="content-box",pe.style.width=K-2+"px",pe.style.height=K-2+"px",pe.style.padding="1px",pe.style.marginRight="2px",pe.style.marginBottom="2px",pe.style.borderWidth="2px",pe.style.borderStyle="solid",pe.style.borderRadius=(K+2)/2+"px",pe.style.borderColor=F===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",pe.addEventListener("click",function(){$.setCurrentColor(F,pe)});var Te=document.createElement("div");return Te.style.display="inline-block",Te.style.width=K-2+"px",Te.style.height=K-2+"px",Te.style.backgroundColor=F,Te.style.borderRadius=K/2+"px",F==="transparent"&&(Te.style.fill=this.uiStyleSettings.toolboxAccentColor,Te.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>`),pe.appendChild(Te),pe},k.prototype.setCurrentColor=function(F,$){var te=this;this.currentColor=F,this.colorBoxes.forEach(function(K){K.style.borderColor=K===$?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(F)},k}(o),l=function(){function X(k,F,$){this._state="new",this._isSelected=!1,this._container=k,this._overlayContainer=F,this.globalSettings=$,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(k){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(k,F){},X.prototype.dblClick=function(k,F){},X.prototype.manipulate=function(k){},X.prototype.pointerUp=function(k){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(k){this.container.childNodes.length>0?this.container.insertBefore(k,this.container.childNodes[0]):this.container.appendChild(k)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(k){this._state=k.state,this.notes=k.notes},X.prototype.scale=function(k,F){},X.prototype.colorChanged=function(k){this.onColorChanged&&this.onColorChanged(k),this.stateChanged()},X.prototype.fillColorChanged=function(k){this.onFillColorChanged&&this.onFillColorChanged(k),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var k=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),k.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(k)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),h=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(k){return this.topLeft.ownsTarget(k)?this.topLeft:this.topCenter.ownsTarget(k)?this.topCenter:this.topRight.ownsTarget(k)?this.topRight:this.centerLeft.ownsTarget(k)?this.centerLeft:this.centerRight.ownsTarget(k)?this.centerRight:this.bottomLeft.ownsTarget(k)?this.bottomLeft:this.bottomCenter.ownsTarget(k)?this.bottomCenter:this.bottomRight.ownsTarget(k)?this.bottomRight:void 0},X}(),s=function(){function X(){this.GRIP_SIZE=10,this.visual=M.createGroup(),this.visual.appendChild(M.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(M.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(k){return k===this.visual||k===this.visual.childNodes[0]||k===this.visual.childNodes[1]},X}(),a=function(){function X(){}return X.toITransformMatrix=function(k){return{a:k.a,b:k.b,c:k.c,d:k.d,e:k.e,f:k.f}},X.toSVGMatrix=function(k,F){return k.a=F.a,k.b=F.b,k.c=F.c,k.d=F.d,k.e=F.e,k.f=F.f,k},X}(),C=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.left=0,K.top=0,K.width=0,K.height=0,K.defaultSize={x:50,y:20},K.offsetX=0,K.offsetY=0,K.rotationAngle=0,K.CB_DISTANCE=10,K._suppressMarkerCreateEvent=!1,K.container.transform.baseVal.appendItem(M.createTransform()),K.setupControlBox(),K}return Y(k,X),Object.defineProperty(k.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"visual",{get:function(){return this._visual},set:function(F){this._visual=F;var $=M.createTransform();this._visual.transform.baseVal.appendItem($)},enumerable:!1,configurable:!0}),k.prototype.ownsTarget=function(F){return!!X.prototype.ownsTarget.call(this,F)||!!(this.controlGrips.findGripByVisual(F)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F))},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.state==="new"&&(this.left=F.x,this.top=F.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var te=this.unrotatePoint(F);if(this.manipulationStartX=te.x,this.manipulationStartY=te.y,this.offsetX=te.x-this.left,this.offsetY=te.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual($),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget($)){this.activeGrip=this.rotatorGrip;var K=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=K.x-this.width/2,this.top=K.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var pe=this.container.transform.baseVal.getItem(0);pe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(pe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},k.prototype.pointerUp=function(F){var $=this.state;X.prototype.pointerUp.call(this,F),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(F),this._state="select",$==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},k.prototype.moveVisual=function(F){this.visual.style.transform="translate("+F.x+"px, "+F.y+"px)"},k.prototype.manipulate=function(F){var $=this.unrotatePoint(F);this.state==="creating"?this.resize(F):this.state==="move"?(this.left=this.manipulationStartLeft+($.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+($.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize($):this.state==="rotate"&&this.rotate(F)},k.prototype.resize=function(F){var $=this.manipulationStartLeft,te=this.manipulationStartWidth,K=this.manipulationStartTop,pe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:$=this.manipulationStartLeft+F.x-this.manipulationStartX,te=this.manipulationStartWidth+this.manipulationStartLeft-$;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:te=this.manipulationStartWidth+F.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:K=this.manipulationStartTop+F.y-this.manipulationStartY,pe=this.manipulationStartHeight+this.manipulationStartTop-K;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:pe=this.manipulationStartHeight+F.y-this.manipulationStartY}te>=0?(this.left=$,this.width=te):(this.left=$+te,this.width=-te),pe>=0?(this.top=K,this.height=pe):(this.top=K+pe,this.height=-pe),this.setSize()},k.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},k.prototype.rotate=function(F){if(Math.abs(F.x-this.centerX)>.1){var $=Math.sign(F.x-this.centerX);this.rotationAngle=180*Math.atan((F.y-this.centerY)/(F.x-this.centerX))/Math.PI+90*$,this.applyRotation()}},k.prototype.applyRotation=function(){var F=this.container.transform.baseVal.getItem(0);F.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(F,0)},k.prototype.rotatePoint=function(F){if(this.rotationAngle===0)return F;var $=this.container.getCTM(),te=M.createPoint(F.x,F.y);return{x:(te=te.matrixTransform($)).x,y:te.y}},k.prototype.unrotatePoint=function(F){if(this.rotationAngle===0)return F;var $=this.container.getCTM();$=$.inverse();var te=M.createPoint(F.x,F.y);return{x:(te=te.matrixTransform($)).x,y:te.y}},k.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},k.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},k.prototype.setupControlBox=function(){this.controlBox=M.createGroup();var F=M.createTransform();F.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(F),this.container.appendChild(this.controlBox),this.controlRect=M.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=M.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 h,this.addControlGrips(),this.controlBox.style.display="none"},k.prototype.adjustControlBox=function(){var F=this.controlBox.transform.baseVal.getItem(0);F.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(F,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},k.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()},k.prototype.createGrip=function(){var F=new s;return F.visual.transform.baseVal.appendItem(M.createTransform()),this.controlBox.appendChild(F.visual),F},k.prototype.positionGrips=function(){var F=this.controlGrips.topLeft.GRIP_SIZE,$=-F/2,te=$,K=(this.width+this.CB_DISTANCE)/2-F/2,pe=(this.height+this.CB_DISTANCE)/2-F/2,Te=this.height+this.CB_DISTANCE-F/2,ke=this.width+this.CB_DISTANCE-F/2;this.positionGrip(this.controlGrips.topLeft.visual,$,te),this.positionGrip(this.controlGrips.topCenter.visual,K,te),this.positionGrip(this.controlGrips.topRight.visual,ke,te),this.positionGrip(this.controlGrips.centerLeft.visual,$,pe),this.positionGrip(this.controlGrips.centerRight.visual,ke,pe),this.positionGrip(this.controlGrips.bottomLeft.visual,$,Te),this.positionGrip(this.controlGrips.bottomCenter.visual,K,Te),this.positionGrip(this.controlGrips.bottomRight.visual,ke,Te),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,K,te-3*this.CB_DISTANCE)},k.prototype.positionGrip=function(F,$,te){var K=F.transform.baseVal.getItem(0);K.setTranslate($,te),F.transform.baseVal.replaceItem(K,0)},k.prototype.hideControlBox=function(){this.controlBox.style.display="none"},k.prototype.showControlBox=function(){this.controlBox.style.display=""},k.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:a.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:a.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},k.prototype.restoreState=function(F){X.prototype.restoreState.call(this,F);var $=F;this.left=$.left,this.top=$.top,this.width=$.width,this.height=$.height,this.rotationAngle=$.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(a.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,$.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(a.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,$.containerTransformMatrix))},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$);var te=this.rotatePoint({x:this.left,y:this.top}),K=this.unrotatePoint({x:te.x*F,y:te.y*$});this.left=K.x,this.top=K.y,this.width=this.width*F,this.height=this.height*$,this.adjustControlBox()},k}(l),_=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K}return Y(k,X),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.visual)},k.prototype.createVisual=function(){this.visual=M.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)},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.state==="new"&&(this.createVisual(),this.moveVisual(F),this._state="creating")},k.prototype.manipulate=function(F){X.prototype.manipulate.call(this,F)},k.prototype.resize=function(F){X.prototype.resize.call(this,F),this.setSize()},k.prototype.setSize=function(){X.prototype.setSize.call(this),M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},k.prototype.pointerUp=function(F){X.prototype.pointerUp.call(this,F),this.setSize()},k.prototype.setStrokeColor=function(F){this.strokeColor=F,this.visual&&M.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(F),this.stateChanged()},k.prototype.setFillColor=function(F){this.fillColor=F,this.visual&&M.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},k.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.visual&&M.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},k.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.visual&&M.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},k.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},k.prototype.restoreState=function(F){var $=F;this.fillColor=$.fillColor,this.strokeColor=$.strokeColor,this.strokeWidth=$.strokeWidth,this.strokeDasharray=$.strokeDasharray,this.opacity=$.opacity,this.createVisual(),X.prototype.restoreState.call(this,F),this.setSize()},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$),this.setSize()},k.title="Rectangle marker",k}(C),T=function(X){function k(F,$,te,K){var pe=X.call(this,F,K||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return pe.widths=[],pe.widthBoxes=[],pe.widths=$,pe.currentWidth=te,pe.setCurrentWidth=pe.setCurrentWidth.bind(pe),pe}return Y(k,X),k.prototype.getUi=function(){var F=this,$=document.createElement("div");return $.style.display="flex",$.style.overflow="hidden",$.style.flexGrow="2",this.widths.forEach(function(te){var K=document.createElement("div");K.style.display="flex",K.style.flexGrow="2",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=te===F.currentWidth?F.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){F.setCurrentWidth(te,K)}),$.appendChild(K);var pe=document.createElement("div");pe.innerText=te.toString(),pe.style.marginRight="5px",K.appendChild(pe);var Te=document.createElement("div");Te.style.minHeight="20px",Te.style.flexGrow="2",Te.style.display="flex",Te.style.alignItems="center";var ke=document.createElement("hr");ke.style.minWidth="20px",ke.style.border="0px",ke.style.borderTop=te+"px solid "+F.uiStyleSettings.toolboxColor,ke.style.flexGrow="2",Te.appendChild(ke),K.appendChild(Te),F.widthBoxes.push(K)}),$},k.prototype.setCurrentWidth=function(F,$){var te=this;this.currentWidth=F,this.widthBoxes.forEach(function(K){K.style.borderColor=K===$?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},k}(o),O=function(X){function k(F,$,te,K){var pe=X.call(this,F,K||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return pe.styles=[],pe.styleBoxes=[],pe.styles=$,pe.currentStyle=te,pe.setCurrentStyle=pe.setCurrentStyle.bind(pe),pe}return Y(k,X),k.prototype.getUi=function(){var F=this,$=document.createElement("div");return $.style.display="flex",$.style.overflow="hidden",$.style.flexGrow="2",this.styles.forEach(function(te){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/F.styles.length-5+"%",K.style.borderColor=te===F.currentStyle?F.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){F.setCurrentStyle(te,K)}),$.appendChild(K);var pe=document.createElement("div");pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.overflow="hidden";var Te=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+F.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(te!==""?'stroke-dasharray="'+te+'"':"")+` />
|
|
</svg>`;pe.innerHTML=Te,K.appendChild(pe),F.styleBoxes.push(K)}),$},k.prototype.setCurrentStyle=function(F,$){var te=this;this.currentStyle=F,this.styleBoxes.forEach(function(K){K.style.borderColor=K===$?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},k}(o),R=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.strokeColor=te.defaultColor,K.strokeWidth=te.defaultStrokeWidth,K.strokeDasharray=te.defaultStrokeDasharray,K.strokePanel=new p("Line color",te.defaultColorSet,te.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new T("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new O("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Y(k,X),Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=X.prototype.getState.call(this);return F.typeName=k.typeName,F},k.typeName="FrameMarker",k.title="Frame marker",k.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',k}(_),S=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},w=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.x1=0,K.y1=0,K.x2=0,K.y2=0,K.defaultLength=50,K.manipulationStartX=0,K.manipulationStartY=0,K.manipulationStartX1=0,K.manipulationStartY1=0,K.manipulationStartX2=0,K.manipulationStartY2=0,K.setupControlBox(),K}return Y(k,X),k.prototype.ownsTarget=function(F){return!!X.prototype.ownsTarget.call(this,F)||!(!this.grip1.ownsTarget(F)&&!this.grip2.ownsTarget(F))},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.manipulationStartX=F.x,this.manipulationStartY=F.y,this.state==="new"&&(this.x1=F.x,this.y1=F.y,this.x2=F.x,this.y2=F.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget($)?this.activeGrip=this.grip1:this.grip2.ownsTarget($)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},k.prototype.pointerUp=function(F){var $=this.state;X.prototype.pointerUp.call(this,F),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(F),this._state="select",$==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},k.prototype.adjustVisual=function(){},k.prototype.manipulate=function(F){this.state==="creating"?this.resize(F):this.state==="move"?(this.x1=this.manipulationStartX1+F.x-this.manipulationStartX,this.y1=this.manipulationStartY1+F.y-this.manipulationStartY,this.x2=this.manipulationStartX2+F.x-this.manipulationStartX,this.y2=this.manipulationStartY2+F.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(F)},k.prototype.resize=function(F){switch(this.activeGrip){case this.grip1:this.x1=F.x,this.y1=F.y;break;case this.grip2:case void 0:this.x2=F.x,this.y2=F.y}this.adjustVisual(),this.adjustControlBox()},k.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},k.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},k.prototype.setupControlBox=function(){this.controlBox=M.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},k.prototype.adjustControlBox=function(){this.positionGrips()},k.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},k.prototype.createGrip=function(){var F=new s;return F.visual.transform.baseVal.appendItem(M.createTransform()),this.controlBox.appendChild(F.visual),F},k.prototype.positionGrips=function(){var F=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-F/2,this.y1-F/2),this.positionGrip(this.grip2.visual,this.x2-F/2,this.y2-F/2)},k.prototype.positionGrip=function(F,$,te){var K=F.transform.baseVal.getItem(0);K.setTranslate($,te),F.transform.baseVal.replaceItem(K,0)},k.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},k.prototype.restoreState=function(F){X.prototype.restoreState.call(this,F);var $=F;this.x1=$.x1,this.y1=$.y1,this.x2=$.x2,this.y2=$.y2},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$),this.x1=this.x1*F,this.y1=this.y1*$,this.x2=this.x2*F,this.y2=this.y2*$,this.adjustVisual(),this.adjustControlBox()},k}(l),E=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.strokeColor=te.defaultColor,K.strokeWidth=te.defaultStrokeWidth,K.strokeDasharray=te.defaultStrokeDasharray,K.strokePanel=new p("Line color",te.defaultColorSet,te.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new T("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new O("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Y(k,X),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.visual&&F!==this.selectorLine&&F!==this.visibleLine)},k.prototype.createVisual=function(){this.visual=M.createGroup(),this.selectorLine=M.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=M.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)},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},k.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()),M.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),M.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),M.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},k.prototype.setStrokeColor=function(F){this.strokeColor=F,this.adjustVisual(),this.colorChanged(F)},k.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.adjustVisual()},k.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.adjustVisual(),this.stateChanged()},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){X.prototype.restoreState.call(this,F);var $=F;this.strokeColor=$.strokeColor,this.strokeWidth=$.strokeWidth,this.strokeDasharray=$.strokeDasharray,this.createVisual(),this.adjustVisual()},k.typeName="LineMarker",k.title="Line marker",k.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',k}(w),f=function(X){function k(F,$,te,K){var pe=X.call(this,F,K||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return pe.fonts=[],pe.fontBoxes=[],pe.fonts=$,pe.currentFont=te,pe.setCurrentFont=pe.setCurrentFont.bind(pe),pe}return Y(k,X),k.prototype.getUi=function(){var F=this,$=document.createElement("div");return $.style.overflow="hidden",$.style.flexGrow="2",this.fonts.forEach(function(te){var K=document.createElement("div");K.style.display="inline-block",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/F.fonts.length-5+"%",K.style.borderColor=te===F.currentFont?F.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){F.setCurrentFont(te,K)}),$.appendChild(K);var pe=document.createElement("div");pe.style.display="flex",pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.fontFamily=te,pe.style.overflow="hidden";var Te=document.createElement("div");Te.style.whiteSpace="nowrap",Te.style.overflow="hidden",Te.style.textOverflow="ellipsis",Te.innerHTML="The quick brown fox jumps over the lazy dog",pe.appendChild(Te),K.appendChild(pe),F.fontBoxes.push(K)}),$},k.prototype.setCurrentFont=function(F,$){var te=this;this.currentFont=F,this.fontBoxes.forEach(function(K){K.style.borderColor=K===$?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},k}(o),x=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.color="transparent",K.padding=5,K.DEFAULT_TEXT="your text here",K.text=K.DEFAULT_TEXT,K.isMoved=!1,K.color=te.defaultColor,K.fontFamily=te.defaultFontFamily,K.defaultSize={x:100,y:30},K.setColor=K.setColor.bind(K),K.setFont=K.setFont.bind(K),K.renderText=K.renderText.bind(K),K.sizeText=K.sizeText.bind(K),K.textEditDivClicked=K.textEditDivClicked.bind(K),K.showTextEditor=K.showTextEditor.bind(K),K.setSize=K.setSize.bind(K),K.positionTextEditor=K.positionTextEditor.bind(K),K.colorPanel=new p("Color",te.defaultColorSet,te.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.fontFamilyPanel=new f("Font",te.defaultFontFamilies,te.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K}return Y(k,X),k.prototype.ownsTarget=function(F){if(X.prototype.ownsTarget.call(this,F)||F===this.visual||F===this.textElement||F===this.bgRectangle)return!0;var $=!1;return this.textElement.childNodes.forEach(function(te){te===F&&($=!0)}),$},k.prototype.createVisual=function(){this.visual=M.createGroup(),this.bgRectangle=M.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=M.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(M.createTransform()),this.textElement.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.isMoved=!1,this.pointerDownPoint=F,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(F),this._state="creating")},k.prototype.renderText=function(){var F=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function($){F.textElement.appendChild(M.createTSpan($.trim()===""?" ":$.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},k.prototype.getTextScale=function(){var F=this.textElement.getBBox(),$=1;if(F.width>0&&F.height>0){var te=(1*this.width-this.width*this.padding*2/100)/F.width,K=(1*this.height-this.height*this.padding*2/100)/F.height;$=Math.min(te,K)}return $},k.prototype.getTextPosition=function(F){var $=this.textElement.getBBox(),te=0,K=0;return $.width>0&&$.height>0&&(te=(this.width-$.width*F)/2,K=this.height/2-$.height*F/2),{x:te,y:K}},k.prototype.sizeText=function(){var F=this.textElement.getBBox(),$=this.getTextScale(),te=this.getTextPosition($);te.y-=F.y*$,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+te.x+"px, "+te.y+"px) scale("+$+", "+$+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(te.x,te.y),this.textElement.transform.baseVal.getItem(1).setScale($,$))},k.prototype.manipulate=function(F){X.prototype.manipulate.call(this,F),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(F.x-this.pointerDownPoint.x)>5||Math.abs(F.y-this.pointerDownPoint.y)>5)},k.prototype.resize=function(F){X.prototype.resize.call(this,F),this.isMoved=!0,this.setSize(),this.sizeText()},k.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},k.prototype.pointerUp=function(F){var $=this.state;$==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,F),this.setSize(),($==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},k.prototype.showTextEditor=function(){var F=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function($){$.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var $=Number.parseFloat(F.textEditor.style.fontSize);F.textEditor.clientWidth>=Number.parseInt(F.textEditor.style.maxWidth)&&$>.9;)$-=.1,F.textEditor.style.fontSize=Math.max($,.9)+"em"}),this.textEditor.addEventListener("keyup",function($){$.cancelBubble=!0}),this.textEditor.addEventListener("paste",function($){if($.clipboardData){var te=$.clipboardData.getData("text"),K=window.getSelection();if(!K.rangeCount)return!1;K.deleteFromDocument(),K.getRangeAt(0).insertNode(document.createTextNode(te)),$.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){F.textEditDivClicked(F.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},k.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var F=this.getTextScale(),$=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),te=this.textElement.getBBox(),K={x:te.width*F,y:te.height*F};$.x-=K.x/2,$.y-=K.y/2,this.textEditor.style.top=$.y+"px",this.textEditor.style.left=$.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-$.x+"px",this.textEditor.style.fontSize=Math.max(16*F,12)+"px",this.textElement.style.display="none"}},k.prototype.textEditDivClicked=function(F){this.text=F.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},k.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},k.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},k.prototype.dblClick=function(F,$){X.prototype.dblClick.call(this,F,$),this.showTextEditor()},k.prototype.setColor=function(F){this.textElement&&M.setAttributes(this.textElement,[["fill",F]]),this.color=F,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(F)},k.prototype.setFont=function(F){this.textElement&&M.setAttributes(this.textElement,[["font-family",F]]),this.fontFamily=F,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},k.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},k.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){var $=F;this.color=$.color,this.fontFamily=$.fontFamily,this.padding=$.padding,this.text=$.text,this.createVisual(),X.prototype.restoreState.call(this,F),this.setSize()},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$),this.setSize(),this.sizeText(),this.positionTextEditor()},k.typeName="TextMarker",k.title="Text marker",k.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>',k}(C),v=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.color="transparent",K.lineWidth=3,K.drawing=!1,K.pixelRatio=1,K.color=te.defaultColor,K.lineWidth=te.defaultStrokeWidth,K.pixelRatio=te.freehandPixelRatio,K.setColor=K.setColor.bind(K),K.addCanvas=K.addCanvas.bind(K),K.finishCreation=K.finishCreation.bind(K),K.setLineWidth=K.setLineWidth.bind(K),K.colorPanel=new p("Color",te.defaultColorSet,te.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.lineWidthPanel=new T("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),K.lineWidthPanel.onWidthChanged=K.setLineWidth,K}return Y(k,X),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.visual&&F!==this.drawingImage)},k.prototype.createVisual=function(){this.visual=M.createGroup(),this.drawingImage=M.createImage(),this.visual.appendChild(this.drawingImage);var F=M.createTransform();this.visual.transform.baseVal.appendItem(F),this.addMarkerVisualToContainer(this.visual)},k.prototype.pointerDown=function(F,$){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(F.x,F.y),this.drawing=!0):X.prototype.pointerDown.call(this,F,$)},k.prototype.manipulate=function(F){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(F.x,F.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,F)},k.prototype.resize=function(F){X.prototype.resize.call(this,F),M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},k.prototype.pointerUp=function(F){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,F)},k.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)},k.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},k.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},k.prototype.finishCreation=function(){for(var F=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),$=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],te=$[0],K=$[1],pe=$[2],Te=$[3],ke=!1,ue=0;ue<this.canvasElement.height;ue++)for(var ve=0;ve<this.canvasElement.width;ve++)F.data[ue*this.canvasElement.width*4+4*ve+3]>0&&(ke=!0,ue<K&&(K=ue),ve<te&&(te=ve),ue>Te&&(Te=ue),ve>pe&&(pe=ve));if(ke){this.left=te/this.pixelRatio,this.top=K/this.pixelRatio,this.width=(pe-te)/this.pixelRatio,this.height=(Te-K)/this.pixelRatio;var xe=document.createElement("canvas");xe.width=pe-te,xe.height=Te-K,xe.getContext("2d").putImageData(this.canvasContext.getImageData(te,K,pe-te,Te-K),0,0),this.drawingImgUrl=xe.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},k.prototype.setDrawingImage=function(){M.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},k.prototype.setColor=function(F){this.color=F,this.colorChanged(F)},k.prototype.setLineWidth=function(F){this.lineWidth=F},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){this.createVisual(),X.prototype.restoreState.call(this,F),this.drawingImgUrl=F.drawingImgUrl,this.setDrawingImage()},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$),this.setDrawingImage()},k.typeName="FreehandMarker",k.title="Freehand marker",k.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>',k}(C),y=function(X){function k(F,$,te){var K=X.call(this,F,te||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return K.typeBoxes=[],K.currentType=$,K.setCurrentType=K.setCurrentType.bind(K),K}return Y(k,X),k.prototype.getUi=function(){var F=this,$=document.createElement("div");$.style.display="flex",$.style.overflow="hidden",$.style.flexGrow="2";for(var te=function(Te){var ke="both";switch(Te){case 0:ke="both";break;case 1:ke="start";break;case 2:ke="end";break;case 3:ke="none"}var ue=document.createElement("div");if(ue.style.display="flex",ue.style.flexGrow="2",ue.style.alignItems="center",ue.style.justifyContent="space-between",ue.style.padding="5px",ue.style.borderWidth="2px",ue.style.borderStyle="solid",ue.style.borderColor=ke===K.currentType?K.uiStyleSettings.toolboxAccentColor:"transparent",ue.addEventListener("click",function(){F.setCurrentType(ke,ue)}),$.appendChild(ue),ke==="both"||ke==="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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,ve.style.marginLeft="5px",ue.appendChild(ve)}var xe=document.createElement("div");xe.style.display="flex",xe.style.alignItems="center",xe.style.minHeight="20px",xe.style.flexGrow="2";var Ce=document.createElement("hr");if(Ce.style.minWidth="20px",Ce.style.border="0px",Ce.style.borderTop="3px solid "+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee"),Ce.style.flexGrow="2",xe.appendChild(Ce),ue.appendChild(xe),ke==="both"||ke==="end"){var Ne=document.createElement("div");Ne.style.display="flex",Ne.style.alignItems="center",Ne.style.minHeight="20px",Ne.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ne.style.marginRight="5px",ue.appendChild(Ne)}K.typeBoxes.push(ue)},K=this,pe=0;pe<4;pe++)te(pe);return $},k.prototype.setCurrentType=function(F,$){var te=this;this.currentType=F,this.typeBoxes.forEach(function(K){K.style.borderColor=K===$?te.uiStyleSettings!==void 0?te.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},k}(o),U=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.arrowType="end",K.arrowBaseHeight=10,K.arrowBaseWidth=10,K.getArrowPoints=K.getArrowPoints.bind(K),K.setArrowType=K.setArrowType.bind(K),K.arrowTypePanel=new y("Arrow type","end"),K.arrowTypePanel.onArrowTypeChanged=K.setArrowType,K}return Y(k,X),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.arrow1&&F!==this.arrow2)},k.prototype.getArrowPoints=function(F,$){var te=this.arrowBaseWidth+2*this.strokeWidth,K=this.arrowBaseHeight+2*this.strokeWidth;return F-te/2+","+($+K/2)+" "+F+","+($-K/2)+" "+(F+te/2)+","+($+K/2)},k.prototype.createTips=function(){this.arrow1=M.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=M.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.arrow2)},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.state==="creating"&&this.createTips()},k.prototype.adjustVisual=function(){if(X.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",M.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),M.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var F=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),$=this.arrow1.transform.baseVal.getItem(0);$.setRotate(F,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem($,0);var te=this.arrow2.transform.baseVal.getItem(0);te.setRotate(F+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(te,0)}},k.prototype.setArrowType=function(F){this.arrowType=F,this.adjustVisual(),this.stateChanged()},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){X.prototype.restoreState.call(this,F);var $=F;this.arrowType=$.arrowType,this.createTips(),this.adjustVisual()},k.typeName="ArrowMarker",k.title="Arrow marker",k.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',k}(E),B=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.fillColor=te.defaultFillColor,K.strokeWidth=0,K.fillPanel=new p("Color",te.defaultColorSet,te.defaultFillColor),K.fillPanel.onColorChanged=K.setFillColor,K}return Y(k,X),Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=X.prototype.getState.call(this);return F.typeName=k.typeName,F},k.typeName="CoverMarker",k.title="Cover marker",k.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',k}(_),A=function(X){function k(F,$,te,K){var pe=X.call(this,F,K||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return pe.opacities=[],pe.opacityBoxes=[],pe.opacities=$,pe.currentOpacity=te,pe.setCurrentOpacity=pe.setCurrentOpacity.bind(pe),pe}return Y(k,X),k.prototype.getUi=function(){var F=this,$=document.createElement("div");return $.style.display="flex",$.style.overflow="hidden",$.style.flexGrow="2",$.style.justifyContent="space-between",this.opacities.forEach(function(te){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="center",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=te===F.currentOpacity?F.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){F.setCurrentOpacity(te,K)}),$.appendChild(K);var pe=document.createElement("div");pe.innerText=100*te+"%",K.appendChild(pe),F.opacityBoxes.push(K)}),$},k.prototype.setCurrentOpacity=function(F,$){var te=this;this.currentOpacity=F,this.opacityBoxes.forEach(function(K){K.style.borderColor=K===$?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},k}(o),j=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.setOpacity=K.setOpacity.bind(K),K.fillColor=te.defaultHighlightColor,K.strokeWidth=0,K.opacity=te.defaultHighlightOpacity,K.fillPanel=new p("Color",te.defaultColorSet,K.fillColor),K.fillPanel.onColorChanged=K.setFillColor,K.opacityPanel=new A("Opacity",te.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return Y(k,X),k.prototype.setOpacity=function(F){this.opacity=F,this.visual&&M.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=X.prototype.getState.call(this);return F.typeName=k.typeName,F},k.typeName="HighlightMarker",k.title="Highlight marker",k.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>',k}(B),P='<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>',b=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.bgColor="transparent",K.tipPosition={x:0,y:0},K.tipBase1Position={x:0,y:0},K.tipBase2Position={x:0,y:0},K.tipMoving=!1,K.color=te.defaultStrokeColor,K.bgColor=te.defaultFillColor,K.fontFamily=te.defaultFontFamily,K.defaultSize={x:100,y:30},K.setBgColor=K.setBgColor.bind(K),K.getTipPoints=K.getTipPoints.bind(K),K.positionTip=K.positionTip.bind(K),K.setTipPoints=K.setTipPoints.bind(K),K.colorPanel=new p("Text color",te.defaultColorSet,K.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),K.colorPanel.onColorChanged=K.setColor,K.bgColorPanel=new p("Fill color",te.defaultColorSet,K.bgColor,P),K.bgColorPanel.onColorChanged=K.setBgColor,K.fontFamilyPanel=new f("Font",te.defaultFontFamilies,te.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.tipGrip=new s,K.tipGrip.visual.transform.baseVal.appendItem(M.createTransform()),K.controlBox.appendChild(K.tipGrip.visual),K}return Y(k,X),k.prototype.ownsTarget=function(F){return X.prototype.ownsTarget.call(this,F)||this.tipGrip.ownsTarget(F)||this.tip===F},k.prototype.createTip=function(){M.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=M.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},k.prototype.pointerDown=function(F,$){this.state==="new"&&X.prototype.pointerDown.call(this,F,$),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget($)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,F,$)},k.prototype.pointerUp=function(F){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,F);else{var $=this.state==="creating";X.prototype.pointerUp.call(this,F),this.setTipPoints($),this.positionTip()}},k.prototype.manipulate=function(F){if(this.tipMoving){var $=this.unrotatePoint(F);this.tipPosition={x:$.x-this.manipulationStartLeft,y:$.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,F)},k.prototype.setBgColor=function(F){this.bgRectangle&&this.tip&&(M.setAttributes(this.bgRectangle,[["fill",F]]),M.setAttributes(this.tip,[["fill",F]])),this.bgColor=F,this.fillColorChanged(F)},k.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},k.prototype.setTipPoints=function(F){F===void 0&&(F=!1);var $=Math.min(this.height/2,15),te=this.height/5;F&&(this.tipPosition={x:$+te/2,y:this.height+20});var K=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(te=this.width/5,$=Math.min(this.width/2,15),this.tipBase1Position={x:$,y:0},this.tipBase2Position={x:$+te,y:0}):(this.tipBase1Position={x:0,y:$},this.tipBase2Position={x:0,y:$+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(te=this.width/5,$=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-$-te,y:0},this.tipBase2Position={x:this.width-$,y:0}):(this.tipBase1Position={x:this.width,y:$},this.tipBase2Position={x:this.width,y:$+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?K<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(te=this.width/5,$=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-$-te,y:this.height},this.tipBase2Position={x:this.width-$,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-$-te},this.tipBase2Position={x:this.width,y:this.height-$}):K<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(te=this.width/5,$=Math.min(this.width/2,15),this.tipBase1Position={x:$,y:this.height},this.tipBase2Position={x:$+te,y:this.height}):(this.tipBase1Position={x:0,y:this.height-$},this.tipBase2Position={x:0,y:this.height-$-te})},k.prototype.resize=function(F){X.prototype.resize.call(this,F),this.positionTip()},k.prototype.positionTip=function(){M.setAttributes(this.tip,[["points",this.getTipPoints()]]);var F=this.tipGrip.visual.transform.baseVal.getItem(0);F.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(F,0)},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),k.prototype.select=function(){this.positionTip(),X.prototype.select.call(this)},k.prototype.getState=function(){var F=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){var $=F;this.bgColor=$.bgColor,this.tipPosition=$.tipPosition,X.prototype.restoreState.call(this,F),this.createTip(),this.setTipPoints()},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$),this.tipPosition={x:this.tipPosition.x*F,y:this.tipPosition.y*$},this.positionTip()},k.typeName="CalloutMarker",k.title="Callout marker",k.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>',k}(x),V=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.strokeColor=te.defaultColor,K.strokeWidth=te.defaultStrokeWidth,K.strokeDasharray=te.defaultStrokeDasharray,K.fillColor=te.defaultFillColor,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.setOpacity=K.setOpacity.bind(K),K.createVisual=K.createVisual.bind(K),K.strokePanel=new p("Line color",N(te.defaultColorSet,["transparent"]),te.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new p("Fill color",N(te.defaultColorSet,["transparent"]),K.fillColor,P),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new T("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new O("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.opacityPanel=new A("Opacity",te.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return Y(k,X),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.visual)},k.prototype.createVisual=function(){this.visual=M.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)},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.state==="new"&&(this.createVisual(),this.moveVisual(F),this._state="creating")},k.prototype.manipulate=function(F){X.prototype.manipulate.call(this,F)},k.prototype.resize=function(F){X.prototype.resize.call(this,F),this.setSize()},k.prototype.setSize=function(){X.prototype.setSize.call(this),M.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},k.prototype.pointerUp=function(F){X.prototype.pointerUp.call(this,F),this.setSize()},k.prototype.setStrokeColor=function(F){this.strokeColor=F,this.visual&&M.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(F),this.stateChanged()},k.prototype.setFillColor=function(F){this.fillColor=F,this.visual&&M.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(F),this.stateChanged()},k.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.visual&&M.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},k.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.visual&&M.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},k.prototype.setOpacity=function(F){this.opacity=F,this.visual&&M.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){var $=F;this.fillColor=$.fillColor,this.strokeColor=$.strokeColor,this.strokeWidth=$.strokeWidth,this.strokeDasharray=$.strokeDasharray,this.opacity=$.opacity,this.createVisual(),X.prototype.restoreState.call(this,F),this.setSize()},k.prototype.scale=function(F,$){X.prototype.scale.call(this,F,$),this.setSize()},k.typeName="EllipseMarker",k.title="Ellipse marker",k.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>',k}(C),ne=function(X){function k(F,$,te){return X.call(this,F,$,te)||this}return Y(k,X),Object.defineProperty(k.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.tip1&&F!==this.tip2)},k.prototype.createTips=function(){this.tip1=M.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(M.createTransform()),this.visual.appendChild(this.tip1),this.tip2=M.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(M.createTransform()),this.visual.appendChild(this.tip2)},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.state==="creating"&&this.createTips()},k.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(M.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()]]),M.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var F=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),$=this.tip1.transform.baseVal.getItem(0);$.setRotate(F,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem($,0);var te=this.tip2.transform.baseVal.getItem(0);te.setRotate(F+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(te,0)}},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=X.prototype.getState.call(this);return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){X.prototype.restoreState.call(this,F),this.createTips(),this.adjustVisual()},k.typeName="MeasurementMarker",k.title="Measurement marker",k.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>',k}(E),ce=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.strokePanel.colors=te.defaultColorSet,K.fillColor="transparent",K}return Y(k,X),Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=X.prototype.getState.call(this);return F.typeName=k.typeName,F},k.typeName="EllipseFrameMarker",k.title="Ellipse frame marker",k.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>',k}(V),me=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.prototype.addUndoStep=function(k){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(k)||(this.undoStack.push(k),JSON.stringify(this.lastRedoStep)!==JSON.stringify(k)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(k){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=k)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.prototype.undo=function(){if(this.undoStack.length>1){var k=this.undoStack.pop();return k!==void 0&&this.redoStack.push(k),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),Ie=function(X){function k(F,$,te){var K=X.call(this,F,$,te)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.curveX=0,K.curveY=0,K.manipulationStartCurveX=0,K.manipulationStartCurveY=0,K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.positionGrips=K.positionGrips.bind(K),K.addControlGrips=K.addControlGrips.bind(K),K.adjustVisual=K.adjustVisual.bind(K),K.setupControlBox=K.setupControlBox.bind(K),K.resize=K.resize.bind(K),K.strokeColor=te.defaultColor,K.strokeWidth=te.defaultStrokeWidth,K.strokeDasharray=te.defaultStrokeDasharray,K.strokePanel=new p("Line color",te.defaultColorSet,te.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new T("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new O("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return Y(k,X),k.prototype.ownsTarget=function(F){return!(!X.prototype.ownsTarget.call(this,F)&&F!==this.visual&&F!==this.selectorCurve&&F!==this.visibleCurve&&!this.curveGrip.ownsTarget(F))},k.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},k.prototype.createVisual=function(){this.visual=M.createGroup(),this.selectorCurve=M.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=M.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)},k.prototype.pointerDown=function(F,$){X.prototype.pointerDown.call(this,F,$),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=F.x,this.curveY=F.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget($)&&(this.activeGrip=this.curveGrip,this._state="resize")},k.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),M.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),M.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),M.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},k.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=M.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=M.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)},k.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},k.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var F=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-F/2,this.curveY-F/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},k.prototype.manipulate=function(F){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+F.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+F.y-this.manipulationStartY),X.prototype.manipulate.call(this,F)},k.prototype.resize=function(F){this.activeGrip===this.curveGrip&&(this.curveX=F.x,this.curveY=F.y),X.prototype.resize.call(this,F),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},k.prototype.setStrokeColor=function(F){this.strokeColor=F,this.adjustVisual(),this.colorChanged(F)},k.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.adjustVisual()},k.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.adjustVisual()},k.prototype.scale=function(F,$){this.curveX=this.curveX*F,this.curveY=this.curveY*$,X.prototype.scale.call(this,F,$)},Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),k.prototype.getState=function(){var F=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return F.typeName=k.typeName,F},k.prototype.restoreState=function(F){X.prototype.restoreState.call(this,F);var $=F;this.strokeColor=$.strokeColor,this.strokeWidth=$.strokeWidth,this.strokeDasharray=$.strokeDasharray,this.curveX=$.curveX,this.curveY=$.curveY,this.createVisual(),this.adjustVisual()},k.typeName="CurveMarker",k.title="Curve marker",k.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>',k}(w),we=function(){function X(k,F){F===void 0&&(F=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=k,this.cancelable=F}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),Le=function(X){function k(F,$,te){var K=X.call(this,F,!1)||this;return K.dataUrl=$,K.state=te,K}return Y(k,X),k}(we),Re=function(X){function k(F,$,te){te===void 0&&(te=!1);var K=X.call(this,F,te)||this;return K.marker=$,K}return Y(k,X),k}(we),De=function(){function X(){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 X.prototype.addEventListener=function(k,F){this[k].push(F)},X.prototype.removeEventListener=function(k,F){var $=this[k].indexOf(F);$>-1&&this[k].splice($,1)},X}(),ye=function(){function X(k){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new S,this._isOpen=!1,this.undoRedoManager=new me,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 De,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new L(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=k,this.targetRoot=document.body,this.width=k.clientWidth,this.height=k.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(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[R,v,U,x,ce,V,j,b,ne,B,E,Ie]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[R,v,U,x,V,j,b]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[R,v,U,x,j]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(k){var F=this;this._availableMarkerTypes.splice(0),k.forEach(function($){if(typeof $=="string"){var te=F.ALL_MARKER_TYPES.find(function(K){return K.typeName===$});te!==void 0&&F._availableMarkerTypes.push(te)}else F._availableMarkerTypes.push($)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(k){this._zoomLevel=k,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),W.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var k=this;this.styles.styleSheetRoot===void 0&&i.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=i.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(F){return F(new we(k))})},X.prototype.render=function(){return D(this,void 0,void 0,function(){var k;return z(this,function(F){switch(F.label){case 0:return this.setCurrentMarker(),(k=new H).naturalSize=this.renderAtNaturalSize,k.imageType=this.renderImageType,k.imageQuality=this.renderImageQuality,k.markersOnly=this.renderMarkersOnly,k.width=this.renderWidth,k.height=this.renderHeight,[4,k.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return F.sent(),[4,k.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,F.sent()]}})})},X.prototype.close=function(k){var F=this;if(k===void 0&&(k=!1),this.isOpen){var $=!1;k||this.eventListeners.beforeclose.forEach(function(te){var K=new we(F,!0);te(K),K.defaultPrevented&&($=!0)}),$||(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(te){return te(new we(F))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var k,F=[],$=0;$<arguments.length;$++)F[$]=arguments[$];(k=this._availableMarkerTypes).push.apply(k,F)},X.prototype.addRenderEventListener=function(k){this.addEventListener("render",function(F){k(F.dataUrl,F.state)})},X.prototype.removeRenderEventListener=function(k){},X.prototype.addCloseEventListener=function(k){this.addEventListener("close",function(){k()})},X.prototype.removeCloseEventListener=function(k){},X.prototype.setupResizeObserver=function(){var k=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){k.resize(k.target.clientWidth,k.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return k.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupTargetResize=function(){var k=1*this.target.clientWidth/this.target.clientHeight,F=this.editorCanvas.clientWidth/k>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*k:this.editorCanvas.clientWidth,$=F<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/k;this.resize(F,$)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(k,F){this._isResizing=!0;var $=k/this.imageWidth,te=F/this.imageHeight;this.imageWidth=Math.round(k),this.imageHeight=Math.round(F),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers($,te),this._isResizing=!1},X.prototype.scaleMarkers=function(k,F){var $,te=this;this._currentMarker&&this._currentMarker instanceof x?this._currentMarker.scale(k,F):($=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(K){K!==te._currentMarker&&K.scale(k,F)}),$!==void 0&&this.setCurrentMarker($)},X.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"},X.prototype.setTopLeft=function(){var k=this.editingTarget.getBoundingClientRect(),F=this.editorCanvas.getBoundingClientRect();this.left=k.left-F.left,this.top=k.top-F.top},X.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)},X.prototype.addDefs=function(){for(var k,F=[],$=0;$<arguments.length;$++)F[$]=arguments[$];this.defs=M.createDefs(),this.addDefsToImage(),(k=this.defs).append.apply(k,F)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.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)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.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)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.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)},X.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 k=document.createElement("a");k.href="https://markerjs.com/",k.target="_blank",k.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>',k.title="Powered by marker.js",k.style.display="grid",k.style.alignItems="center",k.style.justifyItems="center",k.style.padding="3px",k.style.width="20px",k.style.height="20px",this.logoUI.appendChild(k),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},X.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")},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 k=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=k+"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 m(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 u(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(k){this.markerImage.removeChild(k.container),this.markers.indexOf(k)>-1&&this.markers.splice(this.markers.indexOf(k),1),k.dispose()},X.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())},X.prototype.toolbarButtonClicked=function(k,F){if(k==="marker"&&F!==void 0)this.createNewMarker(F);else if(k==="action")switch(F){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},X.prototype.deleteSelectedMarker=function(){var k=this;if(this._currentMarker!==void 0){var F=!1;if(this.eventListeners.markerbeforedelete.forEach(function(te){var K=new Re(k,k._currentMarker,!0);te(K),K.defaultPrevented&&(F=!0)}),!F){var $=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(te){return te(new Re(k,$))})}}},X.prototype.clear=function(){var k=this,F=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(pe){var Te=new Re(k,void 0,!0);pe(Te),Te.defaultPrevented&&(F=!0)}),!F)){this.setCurrentMarker();for(var $=function(pe){var Te=te.markers[pe];te.setCurrentMarker(te.markers[pe]),te._currentMarker.dispose(),te.markerImage.removeChild(te._currentMarker.container),te.markers.splice(te.markers.indexOf(te._currentMarker),1),te.eventListeners.markerdelete.forEach(function(ke){return ke(new Re(k,Te))})},te=this,K=this.markers.length-1;K>=0;K--)$(K);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var k;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=(k=this._currentMarker.notes)!==null&&k!==void 0?k:"",this.overlayContainer.appendChild(this.notesArea))},X.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)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var k=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var F=this.getState(),$=this.undoRedoManager.getLastUndoStep();if(!$||$.width===F.width&&$.height===F.height){var te=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(F),te<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(K){return K(new we(k))})}else this.undoRedoManager.replaceLastUndoStep(F),this.eventListeners.statechange.forEach(function(K){return K(new we(k))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var k=this,F=this.undoRedoManager.undo();F!==void 0&&(this.restoreState(F),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function($){return $(new we(k))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var k=this,F=this.undoRedoManager.redo();F!==void 0&&(this.restoreState(F),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function($){return $(new we(k))}))},X.prototype.stepZoom=function(){var k=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=k<this.zoomSteps.length-1?this.zoomSteps[k+1]:this.zoomSteps[0]},X.prototype.panTo=function(k){this.contentDiv.scrollBy({left:this.prevPanPoint.x-k.x,top:this.prevPanPoint.y-k.y}),this.prevPanPoint=k},X.prototype.startRenderAndClose=function(){return D(this,void 0,void 0,function(){var k,F,$=this;return z(this,function(te){switch(te.label){case 0:return[4,this.render()];case 1:return k=te.sent(),F=this.getState(),this.eventListeners.render.forEach(function(K){return K(new Le($,k,F))}),this.close(!0),[2]}})})},X.prototype.getState=function(k){k===!0&&this.setCurrentMarker();var F={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function($){return F.markers.push($.getState())}),F},X.prototype.restoreState=function(k){var F=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);k.markers.forEach(function($){var te=F._availableMarkerTypes.find(function(pe){return pe.typeName===$.typeName});if(te!==void 0){var K=F.addNewMarker(te);K.restoreState($),F.markers.push(K)}}),k.width&&k.height&&(k.width!==this.imageWidth||k.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/k.width,this.imageHeight/k.height),this.eventListeners.restorestate.forEach(function($){return $(new we(F))})},X.prototype.addNewMarker=function(k){var F=M.createGroup();return this.markerImage.appendChild(F),new k(F,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(k){var F,$=this;(F=typeof k=="string"?this._availableMarkerTypes.find(function(te){return te.typeName===k}):k)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(F),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(F.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(te){return te(new Re($,$._currentMarker))}))},X.prototype.markerCreated=function(k){var F=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(k),this.setCurrentMarker(k),k instanceof v&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(v):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function($){return $(new Re(F,F._currentMarker))})},X.prototype.colorChanged=function(k){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=k,this.settings.defaultStrokeColor=k)},X.prototype.fillColorChanged=function(k){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=k)},X.prototype.markerStateChanged=function(k){var F=this;this.eventListeners.markerchange.forEach(function($){return $(new Re(F,k))})},X.prototype.setCurrentMarker=function(k){var F=this;this._currentMarker!==k&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function($){return $(new Re(F,F._currentMarker))})),this._currentMarker=k,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($){return $(new Re(F,F._currentMarker))}))},X.prototype.onPointerDown=function(k){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||k.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var F=this.markers.find(function($){return $.ownsTarget(k.target)});F!==void 0?(this.setCurrentMarker(F),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(k.clientX,k.clientY),k.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:k.clientX,y:k.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(k.clientX,k.clientY))},X.prototype.onDblClick=function(k){if(this._isFocused||this.focus(),this.mode==="select"){var F=this.markers.find(function($){return $.ownsTarget(k.target)});F!==void 0&&F!==this._currentMarker&&this.setCurrentMarker(F),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(k.clientX,k.clientY),k.target):this.setCurrentMarker()}},X.prototype.onPointerMove=function(k){this.touchPoints!==1&&k.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||k.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(k.clientX,k.clientY)):this.zoomLevel>1&&this.panTo({x:k.clientX,y:k.clientY}))},X.prototype.onPointerUp=function(k){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(k.clientX,k.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(k){this._currentMarker===void 0||this.notesArea!==void 0||k.key!=="Delete"&&k.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(k,F){var $=this.markerImage.getBoundingClientRect();return{x:(k-$.left)/this.zoomLevel,y:(F-$.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var k=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=k+"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()},X.prototype.addLicenseKey=function(k){W.addKey(k)},X.prototype.addEventListener=function(k,F){this.eventListeners.addEventListener(k,F)},X.prototype.removeEventListener=function(k,F){this.eventListeners.removeEventListener(k,F)},X.prototype.renderState=function(k){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(k),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var k=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(F){return F(new we(k))}))},X.prototype.blur=function(){var k=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(F){return F(new we(k))}))},X.instanceCounter=0,X}()},SbmS:function(et,Ee,J){et.exports={flex_box_center:"flex_box_center___HG_ui",flex_space_between:"flex_space_between___i7dgQ",flex_box_vertical_center:"flex_box_vertical_center___25J9O",flex_box_center_end:"flex_box_center_end___Q7-xc",flex_box_column:"flex_box_column___2Q6GJ",userInfo:"userInfo___2ECUY",navInfo:"navInfo___3H3dt",actived:"actived___ilDpa",topBar:"topBar___2O4NK",tabs:"tabs___yp4Rb",active:"active___3Xgtk",list:"list___U4GMG",tags:"tags___2IWIk",searchWrp:"searchWrp___1-W5t",listMessage:"listMessage___1M4jE",deleteMsg:"deleteMsg___1HDtB",listRightMessage:"listRightMessage___1rCRK",content:"content___KsZrb",msg:"msg___35IM3",msgDate:"msgDate___ovoCe"}},T8No:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return W}),J.d(Ee,"e",function(){return H}),J.d(Ee,"c",function(){return E}),J.d(Ee,"b",function(){return f}),J.d(Ee,"d",function(){return x}),J.d(Ee,"f",function(){return U});var oe=J("MNsG"),Y=J("N0LK"),D=J("Cg/j");let z=oe.k||"";const N=new Map;N.set("false",!1),N.set("true",!0),N.set("isMac",oe.f),N.set("isLinux",oe.d),N.set("isWindows",oe.i),N.set("isWeb",oe.h),N.set("isMacNative",oe.f&&!oe.h),N.set("isEdge",z.indexOf("Edg/")>=0),N.set("isFirefox",z.indexOf("Firefox")>=0),N.set("isChrome",z.indexOf("Chrome")>=0),N.set("isSafari",z.indexOf("Safari")>=0);const M=Object.prototype.hasOwnProperty;class W{static has(A){return c.create(A)}static equals(A,j){return m.create(A,j)}static regex(A,j){return T.create(A,j)}static not(A){return l.create(A)}static and(...A){return S.create(A,null)}static or(...A){return w.create(A,null,!0)}static deserialize(A,j=!1){return A?this._deserializeOrExpression(A,j):void 0}static _deserializeOrExpression(A,j){let P=A.split("||");return w.create(P.map(b=>this._deserializeAndExpression(b,j)),null,!0)}static _deserializeAndExpression(A,j){let P=A.split("&&");return S.create(P.map(b=>this._deserializeOne(b,j)),null)}static _deserializeOne(A,j){if(A=A.trim(),A.indexOf("!=")>=0){let P=A.split("!=");return p.create(P[0].trim(),this._deserializeValue(P[1],j))}if(A.indexOf("==")>=0){let P=A.split("==");return m.create(P[0].trim(),this._deserializeValue(P[1],j))}if(A.indexOf("=~")>=0){let P=A.split("=~");return T.create(P[0].trim(),this._deserializeRegexValue(P[1],j))}if(A.indexOf(" in ")>=0){let P=A.split(" in ");return u.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(A)){const P=A.split(">=");return a.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(A)){const P=A.split(">");return s.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(A)){const P=A.split("<=");return _.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(A)){const P=A.split("<");return C.create(P[0].trim(),P[1].trim())}return/^\!\s*/.test(A)?l.create(A.substr(1).trim()):c.create(A)}static _deserializeValue(A,j){if(A=A.trim(),A==="true")return!0;if(A==="false")return!1;let P=/^'([^']*)'$/.exec(A);return P?P[1].trim():A}static _deserializeRegexValue(A,j){if(Object(Y.C)(A)){if(j)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let P=A.indexOf("/"),b=A.lastIndexOf("/");if(P===b||P<0){if(j)throw new Error(`bad regexp-value '${A}', missing /-enclosure`);return console.warn(`bad regexp-value '${A}', missing /-enclosure`),null}let V=A.slice(P+1,b),ne=A[b+1]==="i"?"i":"";try{return new RegExp(V,ne)}catch(ce){if(j)throw new Error(`bad regexp-value '${A}', parse error: ${ce}`);return console.warn(`bad regexp-value '${A}', parse error: ${ce}`),null}}}function H(A,j){const P=A?A.substituteConstants():void 0,b=j?j.substituteConstants():void 0;return!P&&!b?!0:!P||!b?!1:P.equals(b)}function i(A,j){return A.cmp(j)}class L{constructor(){this.type=0}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!1}serialize(){return"false"}keys(){return[]}negate(){return g.INSTANCE}}L.INSTANCE=new L;class g{constructor(){this.type=1}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!0}serialize(){return"true"}keys(){return[]}negate(){return L.INSTANCE}}g.INSTANCE=new g;class c{constructor(A,j){this.key=A,this.negated=j,this.type=2}static create(A,j=null){const P=N.get(A);return typeof P=="boolean"?P?g.INSTANCE:L.INSTANCE:new c(A,j)}cmp(A){return A.type!==this.type?this.type-A.type:v(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=N.get(this.key);return typeof A=="boolean"?A?g.INSTANCE:L.INSTANCE:this}evaluate(A){return!!A.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=l.create(this.key,this)),this.negated}}class m{constructor(A,j,P){this.key=A,this.value=j,this.negated=P,this.type=4}static create(A,j,P=null){if(typeof j=="boolean")return j?c.create(A,P):l.create(A,P);const b=N.get(A);if(typeof b=="boolean"){const V=b?"true":"false";return j===V?g.INSTANCE:L.INSTANCE}return new m(A,j,P)}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=N.get(this.key);if(typeof A=="boolean"){const j=A?"true":"false";return this.value===j?g.INSTANCE:L.INSTANCE}return this}evaluate(A){return A.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=p.create(this.key,this.value,this)),this.negated}}class u{constructor(A,j){this.key=A,this.valueKey=j,this.type=10,this.negated=null}static create(A,j){return new u(A,j)}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.valueKey,A.key,A.valueKey)}equals(A){return A.type===this.type?this.key===A.key&&this.valueKey===A.valueKey:!1}substituteConstants(){return this}evaluate(A){const j=A.getValue(this.valueKey),P=A.getValue(this.key);return Array.isArray(j)?j.indexOf(P)>=0:typeof P=="string"&&typeof j=="object"&&j!==null?M.call(j,P):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=o.create(this)),this.negated}}class o{constructor(A){this._actual=A,this.type=11}static create(A){return new o(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class p{constructor(A,j,P){this.key=A,this.value=j,this.negated=P,this.type=5}static create(A,j,P=null){if(typeof j=="boolean")return j?l.create(A,P):c.create(A,P);const b=N.get(A);if(typeof b=="boolean"){const V=b?"true":"false";return j===V?L.INSTANCE:g.INSTANCE}return new p(A,j,P)}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=N.get(this.key);if(typeof A=="boolean"){const j=A?"true":"false";return this.value===j?L.INSTANCE:g.INSTANCE}return this}evaluate(A){return A.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this.value,this)),this.negated}}class l{constructor(A,j){this.key=A,this.negated=j,this.type=3}static create(A,j=null){const P=N.get(A);return typeof P=="boolean"?P?L.INSTANCE:g.INSTANCE:new l(A,j)}cmp(A){return A.type!==this.type?this.type-A.type:v(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=N.get(this.key);return typeof A=="boolean"?A?L.INSTANCE:g.INSTANCE:this}evaluate(A){return!A.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=c.create(this.key,this)),this.negated}}function h(A,j){if(typeof A=="string"){const P=parseFloat(A);isNaN(P)||(A=P)}return typeof A=="string"||typeof A=="number"?j(A):L.INSTANCE}class s{constructor(A,j,P){this.key=A,this.value=j,this.negated=P,this.type=12}static create(A,j,P=null){return h(j,b=>new s(A,b,P))}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class a{constructor(A,j,P){this.key=A,this.value=j,this.negated=P,this.type=13}static create(A,j,P=null){return h(j,b=>new a(A,b,P))}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this.value,this)),this.negated}}class C{constructor(A,j,P){this.key=A,this.value=j,this.negated=P,this.type=14}static create(A,j,P=null){return h(j,b=>new C(A,b,P))}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=a.create(this.key,this.value,this)),this.negated}}class _{constructor(A,j,P){this.key=A,this.value=j,this.negated=P,this.type=15}static create(A,j,P=null){return h(j,b=>new _(A,b,P))}cmp(A){return A.type!==this.type?this.type-A.type:y(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=s.create(this.key,this.value,this)),this.negated}}class T{constructor(A,j){this.key=A,this.regexp=j,this.type=7,this.negated=null}static create(A,j){return new T(A,j)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.key<A.key)return-1;if(this.key>A.key)return 1;const j=this.regexp?this.regexp.source:"",P=A.regexp?A.regexp.source:"";return j<P?-1:j>P?1:0}equals(A){if(A.type===this.type){const j=this.regexp?this.regexp.source:"",P=A.regexp?A.regexp.source:"";return this.key===A.key&&j===P}return!1}substituteConstants(){return this}evaluate(A){let j=A.getValue(this.key);return this.regexp?this.regexp.test(j):!1}serialize(){const A=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${A}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=O.create(this)),this.negated}}class O{constructor(A){this._actual=A,this.type=8}static create(A){return new O(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function R(A){let j=null;for(let P=0,b=A.length;P<b;P++){const V=A[P].substituteConstants();if(A[P]!==V&&j===null){j=[];for(let ne=0;ne<P;ne++)j[ne]=A[ne]}j!==null&&(j[P]=V)}return j===null?A:j}class S{constructor(A,j){this.expr=A,this.negated=j,this.type=6}static create(A,j){return S._normalizeArr(A,j)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let j=0,P=this.expr.length;j<P;j++){const b=i(this.expr[j],A.expr[j]);if(b!==0)return b}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let j=0,P=this.expr.length;j<P;j++)if(!this.expr[j].equals(A.expr[j]))return!1;return!0}return!1}substituteConstants(){const A=R(this.expr);return A===this.expr?this:S.create(A,this.negated)}evaluate(A){for(let j=0,P=this.expr.length;j<P;j++)if(!this.expr[j].evaluate(A))return!1;return!0}static _normalizeArr(A,j){const P=[];let b=!1;for(const V of A){if(!V)continue;if(V.type===1){b=!0;continue}if(V.type===0)return L.INSTANCE;if(V.type===6){P.push(...V.expr);continue}P.push(V)}if(P.length===0&&b)return g.INSTANCE;if(P.length===0)return;if(P.length===1)return P[0];P.sort(i);for(let V=1;V<P.length;V++)P[V-1].equals(P[V])&&(P.splice(V,1),V--);if(P.length===1)return P[0];for(;P.length>1;){const V=P[P.length-1];if(V.type!==9)break;P.pop();const ne=P.pop(),ce=P.length===0,me=w.create(V.expr.map(Ie=>S.create([Ie,ne],null)),null,ce);me&&(P.push(me),P.sort(i))}return P.length===1?P[0]:new S(P,j)}serialize(){return this.expr.map(A=>A.serialize()).join(" && ")}keys(){const A=[];for(let j of this.expr)A.push(...j.keys());return A}negate(){if(!this.negated){const A=[];for(let j of this.expr)A.push(j.negate());this.negated=w.create(A,this,!0)}return this.negated}}class w{constructor(A,j){this.expr=A,this.negated=j,this.type=9}static create(A,j,P){return w._normalizeArr(A,j,P)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let j=0,P=this.expr.length;j<P;j++){const b=i(this.expr[j],A.expr[j]);if(b!==0)return b}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let j=0,P=this.expr.length;j<P;j++)if(!this.expr[j].equals(A.expr[j]))return!1;return!0}return!1}substituteConstants(){const A=R(this.expr);return A===this.expr?this:w.create(A,this.negated,!1)}evaluate(A){for(let j=0,P=this.expr.length;j<P;j++)if(this.expr[j].evaluate(A))return!0;return!1}static _normalizeArr(A,j,P){let b=[],V=!1;if(A){for(let ne=0,ce=A.length;ne<ce;ne++){const me=A[ne];if(!me)continue;if(me.type===0){V=!0;continue}if(me.type===1)return g.INSTANCE;if(me.type===9){b=b.concat(me.expr);continue}b.push(me)}if(b.length===0&&V)return L.INSTANCE;b.sort(i)}if(b.length===0)return;if(b.length===1)return b[0];for(let ne=1;ne<b.length;ne++)b[ne-1].equals(b[ne])&&(b.splice(ne,1),ne--);if(b.length===1)return b[0];if(P){for(let ne=0;ne<b.length;ne++)for(let ce=ne+1;ce<b.length;ce++)U(b[ne],b[ce])&&(b.splice(ce,1),ce--);if(b.length===1)return b[0]}return new w(b,j)}serialize(){return this.expr.map(A=>A.serialize()).join(" || ")}keys(){const A=[];for(let j of this.expr)A.push(...j.keys());return A}negate(){if(!this.negated){let A=[];for(let j of this.expr)A.push(j.negate());for(;A.length>1;){const j=A.shift(),P=A.shift(),b=[];for(const ne of B(j))for(const ce of B(P))b.push(S.create([ne,ce],null));const V=A.length===0;A.unshift(w.create(b,null,V))}this.negated=A[0]}return this.negated}}class E extends c{constructor(A,j,P){super(A,null);this._defaultValue=j,typeof P=="object"?E._info.push(Object.assign(Object.assign({},P),{key:A})):P!==!0&&E._info.push({key:A,description:P,type:j!=null?typeof j:void 0})}static all(){return E._info.values()}bindTo(A){return A.createKey(this.key,this._defaultValue)}getValue(A){return A.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(A){return m.create(this.key,A)}}E._info=[];const f=Object(D.c)("contextKeyService"),x="setContext";function v(A,j){return A<j?-1:A>j?1:0}function y(A,j,P,b){return A<P?-1:A>P?1:j<b?-1:j>b?1:0}function U(A,j){if(j.type===6&&A.type!==9&&A.type!==6){for(const V of j.expr)if(A.equals(V))return!0}const P=A.negate(),b=B(P).concat(B(j));b.sort(i);for(let V=0;V<b.length;V++){const ne=b[V],ce=ne.negate();for(let me=V+1;me<b.length;me++){const Ie=b[me];if(ce.equals(Ie))return!0}}return!1}function B(A){return A.type===9?A.expr:[A]}},TXwP:function(et,Ee,J){var oe,Y;(function(){var D;(function(){"use strict";var N=[,,function(i){function L(m){this.__parent=m,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var m=new L(this.__parent);return m.set_indent(this.__indent_count,this.__alignment_count),m},L.prototype.item=function(m){return m<0?this.__items[this.__items.length+m]:this.__items[m]},L.prototype.has_match=function(m){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(m))return!0;return!1},L.prototype.set_indent=function(m,u){this.is_empty()&&(this.__indent_count=m||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var m=this.__parent.current_line;return m.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),m.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),m.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,m.__items[0]===" "&&(m.__items.splice(0,1),m.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(m){this.__items.push(m);var u=m.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=m.length-u:this.__character_count+=m.length},L.prototype.pop=function(){var m=null;return this.is_empty()||(m=this.__items.pop(),this.__character_count-=m.length),m},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var m="";return this.is_empty()?this.__parent.indent_empty_lines&&(m=this.__parent.get_indent_string(this.__indent_count)):(m=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),m+=this.__items.join("")),m};function g(m,u){this.__cache=[""],this.__indent_size=m.indent_size,this.__indent_string=m.indent_char,m.indent_with_tabs||(this.__indent_string=new Array(m.indent_size+1).join(m.indent_char)),u=u||"",m.indent_level>0&&(u=new Array(m.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}g.prototype.get_indent_size=function(m,u){var o=this.__base_string_length;return u=u||0,m<0&&(o=0),o+=m*this.__indent_size,o+=u,o},g.prototype.get_indent_string=function(m,u){var o=this.__base_string;return u=u||0,m<0&&(m=0,o=""),u+=m*this.__indent_size,this.__ensure_cache(u),o+=this.__cache[u],o},g.prototype.__ensure_cache=function(m){for(;m>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var m=this.__cache.length,u=0,o="";this.__indent_size&&m>=this.__indent_size&&(u=Math.floor(m/this.__indent_size),m-=u*this.__indent_size,o=new Array(u+1).join(this.__indent_string)),m&&(o+=new Array(m+1).join(" ")),this.__cache.push(o)};function c(m,u){this.__indent_cache=new g(m,u),this.raw=!1,this._end_with_newline=m.end_with_newline,this.indent_size=m.indent_size,this.wrap_line_length=m.wrap_line_length,this.indent_empty_lines=m.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(m,u){return this.__indent_cache.get_indent_string(m,u)},c.prototype.get_indent_size=function(m,u){return this.__indent_cache.get_indent_size(m,u)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(m){return this.is_empty()||!m&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(m){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
|
|
`);return m!==`
|
|
`&&(o=o.replace(/[\n]/g,m)),o},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(m,u){return m=m||0,u=u||0,this.next_line.set_indent(m,u),this.__lines.length>1?(this.current_line.set_indent(m,u),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(m){for(var u=0;u<m.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(m.whitespace_before),this.current_line.push(m.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},c.prototype.add_token=function(m){this.__add_space_before_token(),this.current_line.push(m),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},c.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},c.prototype.remove_indent=function(m){for(var u=this.__lines.length;m<u;)this.__lines[m]._remove_indent(),m++;this.current_line._remove_wrap_indent()},c.prototype.trim=function(m){for(m=m===void 0?!1:m,this.current_line.trim();m&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(m,u){for(var o=this.__lines.length-2;o>=0;){var p=this.__lines[o];if(p.is_empty())break;if(p.item(0).indexOf(m)!==0&&p.item(-1)!==u){this.__lines.splice(o+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},i.exports.Output=c},,,,function(i){function L(m,u){this.raw_options=g(m,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(m,u){var o=this.raw_options[m],p=u||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(p=o.concat()):typeof o=="string"&&(p=o.split(/[^a-zA-Z0-9_\/\-]+/)),p},L.prototype._get_boolean=function(m,u){var o=this.raw_options[m],p=o===void 0?!!u:!!o;return p},L.prototype._get_characters=function(m,u){var o=this.raw_options[m],p=u||"";return typeof o=="string"&&(p=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),p},L.prototype._get_number=function(m,u){var o=this.raw_options[m];u=parseInt(u,10),isNaN(u)&&(u=0);var p=parseInt(o,10);return isNaN(p)&&(p=u),p},L.prototype._get_selection=function(m,u,o){var p=this._get_selection_list(m,u,o);if(p.length!==1)throw new Error("Invalid Option Value: The option '"+m+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return p[0]},L.prototype._get_selection_list=function(m,u,o){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[u[0]],!this._is_valid_selection(o,u))throw new Error("Invalid Default Value!");var p=this._get_array(m,o);if(!this._is_valid_selection(p,u))throw new Error("Invalid Option Value: The option '"+m+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return p},L.prototype._is_valid_selection=function(m,u){return m.length&&u.length&&!m.some(function(o){return u.indexOf(o)===-1})};function g(m,u){var o={};m=c(m);var p;for(p in m)p!==u&&(o[p]=m[p]);if(u&&m[u])for(p in m[u])o[p]=m[u][p];return o}function c(m){var u={},o;for(o in m){var p=o.replace(/-/g,"_");u[p]=m[o]}return u}i.exports.Options=L,i.exports.normalizeOpts=c,i.exports.mergeOpts=g},,function(i){var L=RegExp.prototype.hasOwnProperty("sticky");function g(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var c=null;return this.hasNext()&&(c=this.__input.charAt(this.__position),this.__position+=1),c},g.prototype.peek=function(c){var m=null;return c=c||0,c+=this.__position,c>=0&&c<this.__input_length&&(m=this.__input.charAt(c)),m},g.prototype.__match=function(c,m){c.lastIndex=m;var u=c.exec(this.__input);return u&&!(L&&c.sticky)&&(u.index!==m&&(u=null)),u},g.prototype.test=function(c,m){return m=m||0,m+=this.__position,m>=0&&m<this.__input_length?!!this.__match(c,m):!1},g.prototype.testChar=function(c,m){var u=this.peek(m);return c.lastIndex=0,u!==null&&c.test(u)},g.prototype.match=function(c){var m=this.__match(c,this.__position);return m?this.__position+=m[0].length:m=null,m},g.prototype.read=function(c,m,u){var o="",p;return c&&(p=this.match(c),p&&(o+=p[0])),m&&(p||!c)&&(o+=this.readUntil(m,u)),o},g.prototype.readUntil=function(c,m){var u="",o=this.__position;c.lastIndex=this.__position;var p=c.exec(this.__input);return p?(o=p.index,m&&(o+=p[0].length)):o=this.__input_length,u=this.__input.substring(this.__position,o),this.__position=o,u},g.prototype.readUntilAfter=function(c){return this.readUntil(c,!0)},g.prototype.get_regexp=function(c,m){var u=null,o="g";return m&&L&&(o="y"),typeof c=="string"&&c!==""?u=new RegExp(c,o):c&&(u=new RegExp(c.source,o)),u},g.prototype.get_literal_regexp=function(c){return RegExp(c.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(c){var m=this.__position,u=this.readUntilAfter(c);return this.__position=m,u},g.prototype.lookBack=function(c){var m=this.__position-1;return m>=c.length&&this.__input.substring(m-c.length,m).toLowerCase()===c},i.exports.InputScanner=g},,,,,function(i){function L(g,c){g=typeof g=="string"?g:g.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+c,"g")}L.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var m=this.__directive_pattern.exec(g);m;)c[m[1]]=m[2],m=this.__directive_pattern.exec(g);return c},L.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},i.exports.Directives=L},,function(i,L,g){var c=g(16).Beautifier,m=g(17).Options;function u(o,p){var l=new c(o,p);return l.beautify()}i.exports=u,i.exports.defaultOptions=function(){return new m}},function(i,L,g){var c=g(17).Options,m=g(2).Output,u=g(8).InputScanner,o=g(13).Directives,p=new o(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,h=/\r\n|[\r\n]/g,s=/\s/,a=/(?:\s|\n)+/g,C=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,_=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function T(O,R){this._source_text=O||"",this._options=new c(R),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}T.prototype.eatString=function(O){var R="";for(this._ch=this._input.next();this._ch;){if(R+=this._ch,this._ch==="\\")R+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return R},T.prototype.eatWhitespace=function(O){for(var R=s.test(this._input.peek()),S=0;s.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
|
|
`&&((S===0||S<this._options.max_preserve_newlines)&&(S++,this._output.add_new_line(!0)));return R},T.prototype.foundNestedPseudoClass=function(){for(var O=0,R=1,S=this._input.peek(R);S;){if(S==="{")return!0;if(S==="(")O+=1;else if(S===")"){if(O===0)return!1;O-=1}else if(S===";"||S==="}")return!1;R++,S=this._input.peek(R)}return!1},T.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},T.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},T.prototype.indent=function(){this._indentLevel++},T.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,R=this._options.eol;R==="auto"&&(R=`
|
|
`,O&&l.test(O||"")&&(R=O.match(l)[0])),O=O.replace(h,`
|
|
`);var S=O.match(/^[\t ]*/)[0];this._output=new m(this._options,S),this._input=new u(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var w=0,E=!1,f=!1,x=!1,v=!1,y=!1,U=!1,B=this._ch,A=!1,j,P,b;j=this._input.read(a),P=j!=="",b=B,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),B=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var V=this._input.read(C),ne=p.get_directives(V);ne&&ne.ignore==="start"&&(V+=p.readIgnored(this._input)),this.print_string(V),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(_)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(P),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ce=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ce.match(/[ :]$/)&&(ce=this.eatString(": ").replace(/\s$/,""),this.print_string(ce),this._output.space_before_token=!0),ce=ce.replace(/\s$/,""),ce==="extend"?v=!0:ce==="import"&&(y=!0),ce in this.NESTED_AT_RULE?(this._nestedLevel+=1,ce in this.CONDITIONAL_GROUP_RULE&&(x=!0)):!E&&w===0&&ce.indexOf(":")!==-1&&(f=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(P),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")f&&(f=!1,this.outdent()),x?(x=!1,E=this._indentLevel>=this._nestedLevel):E=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&E&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(b==="("?this._output.space_before_token=!1:b!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),b==="{"&&this._output.trim(!0),y=!1,v=!1,f&&(this.outdent(),f=!1),this.print_string(this._ch),E=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var me=0;me<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;me++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[me])){A=!0;break}(E||x)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!v&&w===0?(this.print_string(":"),f||(f=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Ie=b==='"'||b==="'";this.preserveSingleSpace(Ie||P),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")A=!1,w===0?(f&&(this.outdent(),f=!1),v=!1,y=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),w++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),w&&(w--,this.outdent()));else{var we=!1;this._input.lookBack("with")&&(we=!0),this.preserveSingleSpace(P||we),this.print_string(this._ch),f&&b==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),U=!0):(this.eatWhitespace(),w++,this.indent())}else if(this._ch===")")w&&(w--,this.outdent()),U&&this._input.peek()===";"&&this._options.selector_separator_newline&&(U=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!f||U)&&w===0&&!y&&!v?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!f&&w===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&s.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(P),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),s.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Le=b==='"'||b==="'";this.preserveSingleSpace(Le||P),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&A&&this._output.add_new_line()}var Re=this._output.get_code(R);return Re},i.exports.Beautifier=T},function(i,L,g){var c=g(6).Options;function m(u){c.call(this,u,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var o=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||o;var p=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<p.length;l++)p[l]!=="expand"?this.brace_style="collapse":this.brace_style=p[l]}m.prototype=new c,i.exports.Options=m}],M={};function W(i){var L=M[i];if(L!==void 0)return L.exports;var g=M[i]={exports:{}};return N[i](g,g.exports,W),g.exports}var H=W(15);D=H})();var z=D;!(oe=[],Y=function(){return{css_beautify:z}}.apply(Ee,oe),Y!==void 0&&(et.exports=Y))})()},UZu5:function(et,Ee,J){},Vhoy:function(et,Ee,J){"use strict";J.d(Ee,"d",function(){return z}),J.d(Ee,"e",function(){return N}),J.d(Ee,"c",function(){return M}),J.d(Ee,"b",function(){return W}),J.d(Ee,"a",function(){return H});var oe=J("MI8n");class Y{constructor(){this._icons=new Map,this._onDidRegister=new oe.b}add(i){const L=this._icons.get(i.id);L?i.description?L.description=i.description:console.error(`Duplicate registration of codicon ${i.id}`):(this._icons.set(i.id,i),this._onDidRegister.fire(i))}get(i){return this._icons.get(i)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const D=new Y,z=D;function N(i,L){return new W(i,L)}function M(i){return i?i.replace(/\$\((.*?)\)/g,(L,g)=>` ${g} `).trim():""}class W{constructor(i,L,g){this.id=i,this.definition=L,this.description=g,D.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var H;(function(i){i.iconNameSegment="[A-Za-z0-9]+",i.iconNameExpression="[A-Za-z0-9\\-]+",i.iconModifierExpression="~[A-Za-z]+";const L=new RegExp(`^(${i.iconNameExpression})(${i.iconModifierExpression})?$`);function g(u){if(u instanceof W)return["codicon","codicon-"+u.id];const o=L.exec(u.id);if(!o)return g(W.error);let[,p,l]=o;const h=["codicon","codicon-"+p];return l&&h.push("codicon-modifier-"+l.substr(1)),h}i.asClassNameArray=g;function c(u){return g(u).join(" ")}i.asClassName=c;function m(u){return"."+g(u).join(".")}i.asCSSSelector=m})(H||(H={})),function(i){i.add=new i("add",{fontCharacter:"\\ea60"}),i.plus=new i("plus",i.add.definition),i.gistNew=new i("gist-new",i.add.definition),i.repoCreate=new i("repo-create",i.add.definition),i.lightbulb=new i("lightbulb",{fontCharacter:"\\ea61"}),i.lightBulb=new i("light-bulb",{fontCharacter:"\\ea61"}),i.repo=new i("repo",{fontCharacter:"\\ea62"}),i.repoDelete=new i("repo-delete",{fontCharacter:"\\ea62"}),i.gistFork=new i("gist-fork",{fontCharacter:"\\ea63"}),i.repoForked=new i("repo-forked",{fontCharacter:"\\ea63"}),i.gitPullRequest=new i("git-pull-request",{fontCharacter:"\\ea64"}),i.gitPullRequestAbandoned=new i("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),i.recordKeys=new i("record-keys",{fontCharacter:"\\ea65"}),i.keyboard=new i("keyboard",{fontCharacter:"\\ea65"}),i.tag=new i("tag",{fontCharacter:"\\ea66"}),i.tagAdd=new i("tag-add",{fontCharacter:"\\ea66"}),i.tagRemove=new i("tag-remove",{fontCharacter:"\\ea66"}),i.person=new i("person",{fontCharacter:"\\ea67"}),i.personFollow=new i("person-follow",{fontCharacter:"\\ea67"}),i.personOutline=new i("person-outline",{fontCharacter:"\\ea67"}),i.personFilled=new i("person-filled",{fontCharacter:"\\ea67"}),i.gitBranch=new i("git-branch",{fontCharacter:"\\ea68"}),i.gitBranchCreate=new i("git-branch-create",{fontCharacter:"\\ea68"}),i.gitBranchDelete=new i("git-branch-delete",{fontCharacter:"\\ea68"}),i.sourceControl=new i("source-control",{fontCharacter:"\\ea68"}),i.mirror=new i("mirror",{fontCharacter:"\\ea69"}),i.mirrorPublic=new i("mirror-public",{fontCharacter:"\\ea69"}),i.star=new i("star",{fontCharacter:"\\ea6a"}),i.starAdd=new i("star-add",{fontCharacter:"\\ea6a"}),i.starDelete=new i("star-delete",{fontCharacter:"\\ea6a"}),i.starEmpty=new i("star-empty",{fontCharacter:"\\ea6a"}),i.comment=new i("comment",{fontCharacter:"\\ea6b"}),i.commentAdd=new i("comment-add",{fontCharacter:"\\ea6b"}),i.alert=new i("alert",{fontCharacter:"\\ea6c"}),i.warning=new i("warning",{fontCharacter:"\\ea6c"}),i.search=new i("search",{fontCharacter:"\\ea6d"}),i.searchSave=new i("search-save",{fontCharacter:"\\ea6d"}),i.logOut=new i("log-out",{fontCharacter:"\\ea6e"}),i.signOut=new i("sign-out",{fontCharacter:"\\ea6e"}),i.logIn=new i("log-in",{fontCharacter:"\\ea6f"}),i.signIn=new i("sign-in",{fontCharacter:"\\ea6f"}),i.eye=new i("eye",{fontCharacter:"\\ea70"}),i.eyeUnwatch=new i("eye-unwatch",{fontCharacter:"\\ea70"}),i.eyeWatch=new i("eye-watch",{fontCharacter:"\\ea70"}),i.circleFilled=new i("circle-filled",{fontCharacter:"\\ea71"}),i.primitiveDot=new i("primitive-dot",{fontCharacter:"\\ea71"}),i.closeDirty=new i("close-dirty",{fontCharacter:"\\ea71"}),i.debugBreakpoint=new i("debug-breakpoint",{fontCharacter:"\\ea71"}),i.debugBreakpointDisabled=new i("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),i.debugHint=new i("debug-hint",{fontCharacter:"\\ea71"}),i.primitiveSquare=new i("primitive-square",{fontCharacter:"\\ea72"}),i.edit=new i("edit",{fontCharacter:"\\ea73"}),i.pencil=new i("pencil",{fontCharacter:"\\ea73"}),i.info=new i("info",{fontCharacter:"\\ea74"}),i.issueOpened=new i("issue-opened",{fontCharacter:"\\ea74"}),i.gistPrivate=new i("gist-private",{fontCharacter:"\\ea75"}),i.gitForkPrivate=new i("git-fork-private",{fontCharacter:"\\ea75"}),i.lock=new i("lock",{fontCharacter:"\\ea75"}),i.mirrorPrivate=new i("mirror-private",{fontCharacter:"\\ea75"}),i.close=new i("close",{fontCharacter:"\\ea76"}),i.removeClose=new i("remove-close",{fontCharacter:"\\ea76"}),i.x=new i("x",{fontCharacter:"\\ea76"}),i.repoSync=new i("repo-sync",{fontCharacter:"\\ea77"}),i.sync=new i("sync",{fontCharacter:"\\ea77"}),i.clone=new i("clone",{fontCharacter:"\\ea78"}),i.desktopDownload=new i("desktop-download",{fontCharacter:"\\ea78"}),i.beaker=new i("beaker",{fontCharacter:"\\ea79"}),i.microscope=new i("microscope",{fontCharacter:"\\ea79"}),i.vm=new i("vm",{fontCharacter:"\\ea7a"}),i.deviceDesktop=new i("device-desktop",{fontCharacter:"\\ea7a"}),i.file=new i("file",{fontCharacter:"\\ea7b"}),i.fileText=new i("file-text",{fontCharacter:"\\ea7b"}),i.more=new i("more",{fontCharacter:"\\ea7c"}),i.ellipsis=new i("ellipsis",{fontCharacter:"\\ea7c"}),i.kebabHorizontal=new i("kebab-horizontal",{fontCharacter:"\\ea7c"}),i.mailReply=new i("mail-reply",{fontCharacter:"\\ea7d"}),i.reply=new i("reply",{fontCharacter:"\\ea7d"}),i.organization=new i("organization",{fontCharacter:"\\ea7e"}),i.organizationFilled=new i("organization-filled",{fontCharacter:"\\ea7e"}),i.organizationOutline=new i("organization-outline",{fontCharacter:"\\ea7e"}),i.newFile=new i("new-file",{fontCharacter:"\\ea7f"}),i.fileAdd=new i("file-add",{fontCharacter:"\\ea7f"}),i.newFolder=new i("new-folder",{fontCharacter:"\\ea80"}),i.fileDirectoryCreate=new i("file-directory-create",{fontCharacter:"\\ea80"}),i.trash=new i("trash",{fontCharacter:"\\ea81"}),i.trashcan=new i("trashcan",{fontCharacter:"\\ea81"}),i.history=new i("history",{fontCharacter:"\\ea82"}),i.clock=new i("clock",{fontCharacter:"\\ea82"}),i.folder=new i("folder",{fontCharacter:"\\ea83"}),i.fileDirectory=new i("file-directory",{fontCharacter:"\\ea83"}),i.symbolFolder=new i("symbol-folder",{fontCharacter:"\\ea83"}),i.logoGithub=new i("logo-github",{fontCharacter:"\\ea84"}),i.markGithub=new i("mark-github",{fontCharacter:"\\ea84"}),i.github=new i("github",{fontCharacter:"\\ea84"}),i.terminal=new i("terminal",{fontCharacter:"\\ea85"}),i.console=new i("console",{fontCharacter:"\\ea85"}),i.repl=new i("repl",{fontCharacter:"\\ea85"}),i.zap=new i("zap",{fontCharacter:"\\ea86"}),i.symbolEvent=new i("symbol-event",{fontCharacter:"\\ea86"}),i.error=new i("error",{fontCharacter:"\\ea87"}),i.stop=new i("stop",{fontCharacter:"\\ea87"}),i.variable=new i("variable",{fontCharacter:"\\ea88"}),i.symbolVariable=new i("symbol-variable",{fontCharacter:"\\ea88"}),i.array=new i("array",{fontCharacter:"\\ea8a"}),i.symbolArray=new i("symbol-array",{fontCharacter:"\\ea8a"}),i.symbolModule=new i("symbol-module",{fontCharacter:"\\ea8b"}),i.symbolPackage=new i("symbol-package",{fontCharacter:"\\ea8b"}),i.symbolNamespace=new i("symbol-namespace",{fontCharacter:"\\ea8b"}),i.symbolObject=new i("symbol-object",{fontCharacter:"\\ea8b"}),i.symbolMethod=new i("symbol-method",{fontCharacter:"\\ea8c"}),i.symbolFunction=new i("symbol-function",{fontCharacter:"\\ea8c"}),i.symbolConstructor=new i("symbol-constructor",{fontCharacter:"\\ea8c"}),i.symbolBoolean=new i("symbol-boolean",{fontCharacter:"\\ea8f"}),i.symbolNull=new i("symbol-null",{fontCharacter:"\\ea8f"}),i.symbolNumeric=new i("symbol-numeric",{fontCharacter:"\\ea90"}),i.symbolNumber=new i("symbol-number",{fontCharacter:"\\ea90"}),i.symbolStructure=new i("symbol-structure",{fontCharacter:"\\ea91"}),i.symbolStruct=new i("symbol-struct",{fontCharacter:"\\ea91"}),i.symbolParameter=new i("symbol-parameter",{fontCharacter:"\\ea92"}),i.symbolTypeParameter=new i("symbol-type-parameter",{fontCharacter:"\\ea92"}),i.symbolKey=new i("symbol-key",{fontCharacter:"\\ea93"}),i.symbolText=new i("symbol-text",{fontCharacter:"\\ea93"}),i.symbolReference=new i("symbol-reference",{fontCharacter:"\\ea94"}),i.goToFile=new i("go-to-file",{fontCharacter:"\\ea94"}),i.symbolEnum=new i("symbol-enum",{fontCharacter:"\\ea95"}),i.symbolValue=new i("symbol-value",{fontCharacter:"\\ea95"}),i.symbolRuler=new i("symbol-ruler",{fontCharacter:"\\ea96"}),i.symbolUnit=new i("symbol-unit",{fontCharacter:"\\ea96"}),i.activateBreakpoints=new i("activate-breakpoints",{fontCharacter:"\\ea97"}),i.archive=new i("archive",{fontCharacter:"\\ea98"}),i.arrowBoth=new i("arrow-both",{fontCharacter:"\\ea99"}),i.arrowDown=new i("arrow-down",{fontCharacter:"\\ea9a"}),i.arrowLeft=new i("arrow-left",{fontCharacter:"\\ea9b"}),i.arrowRight=new i("arrow-right",{fontCharacter:"\\ea9c"}),i.arrowSmallDown=new i("arrow-small-down",{fontCharacter:"\\ea9d"}),i.arrowSmallLeft=new i("arrow-small-left",{fontCharacter:"\\ea9e"}),i.arrowSmallRight=new i("arrow-small-right",{fontCharacter:"\\ea9f"}),i.arrowSmallUp=new i("arrow-small-up",{fontCharacter:"\\eaa0"}),i.arrowUp=new i("arrow-up",{fontCharacter:"\\eaa1"}),i.bell=new i("bell",{fontCharacter:"\\eaa2"}),i.bold=new i("bold",{fontCharacter:"\\eaa3"}),i.book=new i("book",{fontCharacter:"\\eaa4"}),i.bookmark=new i("bookmark",{fontCharacter:"\\eaa5"}),i.debugBreakpointConditionalUnverified=new i("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),i.debugBreakpointConditional=new i("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),i.debugBreakpointConditionalDisabled=new i("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),i.debugBreakpointDataUnverified=new i("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),i.debugBreakpointData=new i("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),i.debugBreakpointDataDisabled=new i("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),i.debugBreakpointLogUnverified=new i("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),i.debugBreakpointLog=new i("debug-breakpoint-log",{fontCharacter:"\\eaab"}),i.debugBreakpointLogDisabled=new i("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),i.briefcase=new i("briefcase",{fontCharacter:"\\eaac"}),i.broadcast=new i("broadcast",{fontCharacter:"\\eaad"}),i.browser=new i("browser",{fontCharacter:"\\eaae"}),i.bug=new i("bug",{fontCharacter:"\\eaaf"}),i.calendar=new i("calendar",{fontCharacter:"\\eab0"}),i.caseSensitive=new i("case-sensitive",{fontCharacter:"\\eab1"}),i.check=new i("check",{fontCharacter:"\\eab2"}),i.checklist=new i("checklist",{fontCharacter:"\\eab3"}),i.chevronDown=new i("chevron-down",{fontCharacter:"\\eab4"}),i.dropDownButton=new i("drop-down-button",i.chevronDown.definition),i.chevronLeft=new i("chevron-left",{fontCharacter:"\\eab5"}),i.chevronRight=new i("chevron-right",{fontCharacter:"\\eab6"}),i.chevronUp=new i("chevron-up",{fontCharacter:"\\eab7"}),i.chromeClose=new i("chrome-close",{fontCharacter:"\\eab8"}),i.chromeMaximize=new i("chrome-maximize",{fontCharacter:"\\eab9"}),i.chromeMinimize=new i("chrome-minimize",{fontCharacter:"\\eaba"}),i.chromeRestore=new i("chrome-restore",{fontCharacter:"\\eabb"}),i.circleOutline=new i("circle-outline",{fontCharacter:"\\eabc"}),i.debugBreakpointUnverified=new i("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),i.circleSlash=new i("circle-slash",{fontCharacter:"\\eabd"}),i.circuitBoard=new i("circuit-board",{fontCharacter:"\\eabe"}),i.clearAll=new i("clear-all",{fontCharacter:"\\eabf"}),i.clippy=new i("clippy",{fontCharacter:"\\eac0"}),i.closeAll=new i("close-all",{fontCharacter:"\\eac1"}),i.cloudDownload=new i("cloud-download",{fontCharacter:"\\eac2"}),i.cloudUpload=new i("cloud-upload",{fontCharacter:"\\eac3"}),i.code=new i("code",{fontCharacter:"\\eac4"}),i.collapseAll=new i("collapse-all",{fontCharacter:"\\eac5"}),i.colorMode=new i("color-mode",{fontCharacter:"\\eac6"}),i.commentDiscussion=new i("comment-discussion",{fontCharacter:"\\eac7"}),i.compareChanges=new i("compare-changes",{fontCharacter:"\\eafd"}),i.creditCard=new i("credit-card",{fontCharacter:"\\eac9"}),i.dash=new i("dash",{fontCharacter:"\\eacc"}),i.dashboard=new i("dashboard",{fontCharacter:"\\eacd"}),i.database=new i("database",{fontCharacter:"\\eace"}),i.debugContinue=new i("debug-continue",{fontCharacter:"\\eacf"}),i.debugDisconnect=new i("debug-disconnect",{fontCharacter:"\\ead0"}),i.debugPause=new i("debug-pause",{fontCharacter:"\\ead1"}),i.debugRestart=new i("debug-restart",{fontCharacter:"\\ead2"}),i.debugStart=new i("debug-start",{fontCharacter:"\\ead3"}),i.debugStepInto=new i("debug-step-into",{fontCharacter:"\\ead4"}),i.debugStepOut=new i("debug-step-out",{fontCharacter:"\\ead5"}),i.debugStepOver=new i("debug-step-over",{fontCharacter:"\\ead6"}),i.debugStop=new i("debug-stop",{fontCharacter:"\\ead7"}),i.debug=new i("debug",{fontCharacter:"\\ead8"}),i.deviceCameraVideo=new i("device-camera-video",{fontCharacter:"\\ead9"}),i.deviceCamera=new i("device-camera",{fontCharacter:"\\eada"}),i.deviceMobile=new i("device-mobile",{fontCharacter:"\\eadb"}),i.diffAdded=new i("diff-added",{fontCharacter:"\\eadc"}),i.diffIgnored=new i("diff-ignored",{fontCharacter:"\\eadd"}),i.diffModified=new i("diff-modified",{fontCharacter:"\\eade"}),i.diffRemoved=new i("diff-removed",{fontCharacter:"\\eadf"}),i.diffRenamed=new i("diff-renamed",{fontCharacter:"\\eae0"}),i.diff=new i("diff",{fontCharacter:"\\eae1"}),i.discard=new i("discard",{fontCharacter:"\\eae2"}),i.editorLayout=new i("editor-layout",{fontCharacter:"\\eae3"}),i.emptyWindow=new i("empty-window",{fontCharacter:"\\eae4"}),i.exclude=new i("exclude",{fontCharacter:"\\eae5"}),i.extensions=new i("extensions",{fontCharacter:"\\eae6"}),i.eyeClosed=new i("eye-closed",{fontCharacter:"\\eae7"}),i.fileBinary=new i("file-binary",{fontCharacter:"\\eae8"}),i.fileCode=new i("file-code",{fontCharacter:"\\eae9"}),i.fileMedia=new i("file-media",{fontCharacter:"\\eaea"}),i.filePdf=new i("file-pdf",{fontCharacter:"\\eaeb"}),i.fileSubmodule=new i("file-submodule",{fontCharacter:"\\eaec"}),i.fileSymlinkDirectory=new i("file-symlink-directory",{fontCharacter:"\\eaed"}),i.fileSymlinkFile=new i("file-symlink-file",{fontCharacter:"\\eaee"}),i.fileZip=new i("file-zip",{fontCharacter:"\\eaef"}),i.files=new i("files",{fontCharacter:"\\eaf0"}),i.filter=new i("filter",{fontCharacter:"\\eaf1"}),i.flame=new i("flame",{fontCharacter:"\\eaf2"}),i.foldDown=new i("fold-down",{fontCharacter:"\\eaf3"}),i.foldUp=new i("fold-up",{fontCharacter:"\\eaf4"}),i.fold=new i("fold",{fontCharacter:"\\eaf5"}),i.folderActive=new i("folder-active",{fontCharacter:"\\eaf6"}),i.folderOpened=new i("folder-opened",{fontCharacter:"\\eaf7"}),i.gear=new i("gear",{fontCharacter:"\\eaf8"}),i.gift=new i("gift",{fontCharacter:"\\eaf9"}),i.gistSecret=new i("gist-secret",{fontCharacter:"\\eafa"}),i.gist=new i("gist",{fontCharacter:"\\eafb"}),i.gitCommit=new i("git-commit",{fontCharacter:"\\eafc"}),i.gitCompare=new i("git-compare",{fontCharacter:"\\eafd"}),i.gitMerge=new i("git-merge",{fontCharacter:"\\eafe"}),i.githubAction=new i("github-action",{fontCharacter:"\\eaff"}),i.githubAlt=new i("github-alt",{fontCharacter:"\\eb00"}),i.globe=new i("globe",{fontCharacter:"\\eb01"}),i.grabber=new i("grabber",{fontCharacter:"\\eb02"}),i.graph=new i("graph",{fontCharacter:"\\eb03"}),i.gripper=new i("gripper",{fontCharacter:"\\eb04"}),i.heart=new i("heart",{fontCharacter:"\\eb05"}),i.home=new i("home",{fontCharacter:"\\eb06"}),i.horizontalRule=new i("horizontal-rule",{fontCharacter:"\\eb07"}),i.hubot=new i("hubot",{fontCharacter:"\\eb08"}),i.inbox=new i("inbox",{fontCharacter:"\\eb09"}),i.issueClosed=new i("issue-closed",{fontCharacter:"\\eba4"}),i.issueReopened=new i("issue-reopened",{fontCharacter:"\\eb0b"}),i.issues=new i("issues",{fontCharacter:"\\eb0c"}),i.italic=new i("italic",{fontCharacter:"\\eb0d"}),i.jersey=new i("jersey",{fontCharacter:"\\eb0e"}),i.json=new i("json",{fontCharacter:"\\eb0f"}),i.kebabVertical=new i("kebab-vertical",{fontCharacter:"\\eb10"}),i.key=new i("key",{fontCharacter:"\\eb11"}),i.law=new i("law",{fontCharacter:"\\eb12"}),i.lightbulbAutofix=new i("lightbulb-autofix",{fontCharacter:"\\eb13"}),i.linkExternal=new i("link-external",{fontCharacter:"\\eb14"}),i.link=new i("link",{fontCharacter:"\\eb15"}),i.listOrdered=new i("list-ordered",{fontCharacter:"\\eb16"}),i.listUnordered=new i("list-unordered",{fontCharacter:"\\eb17"}),i.liveShare=new i("live-share",{fontCharacter:"\\eb18"}),i.loading=new i("loading",{fontCharacter:"\\eb19"}),i.location=new i("location",{fontCharacter:"\\eb1a"}),i.mailRead=new i("mail-read",{fontCharacter:"\\eb1b"}),i.mail=new i("mail",{fontCharacter:"\\eb1c"}),i.markdown=new i("markdown",{fontCharacter:"\\eb1d"}),i.megaphone=new i("megaphone",{fontCharacter:"\\eb1e"}),i.mention=new i("mention",{fontCharacter:"\\eb1f"}),i.milestone=new i("milestone",{fontCharacter:"\\eb20"}),i.mortarBoard=new i("mortar-board",{fontCharacter:"\\eb21"}),i.move=new i("move",{fontCharacter:"\\eb22"}),i.multipleWindows=new i("multiple-windows",{fontCharacter:"\\eb23"}),i.mute=new i("mute",{fontCharacter:"\\eb24"}),i.noNewline=new i("no-newline",{fontCharacter:"\\eb25"}),i.note=new i("note",{fontCharacter:"\\eb26"}),i.octoface=new i("octoface",{fontCharacter:"\\eb27"}),i.openPreview=new i("open-preview",{fontCharacter:"\\eb28"}),i.package_=new i("package",{fontCharacter:"\\eb29"}),i.paintcan=new i("paintcan",{fontCharacter:"\\eb2a"}),i.pin=new i("pin",{fontCharacter:"\\eb2b"}),i.play=new i("play",{fontCharacter:"\\eb2c"}),i.run=new i("run",{fontCharacter:"\\eb2c"}),i.plug=new i("plug",{fontCharacter:"\\eb2d"}),i.preserveCase=new i("preserve-case",{fontCharacter:"\\eb2e"}),i.preview=new i("preview",{fontCharacter:"\\eb2f"}),i.project=new i("project",{fontCharacter:"\\eb30"}),i.pulse=new i("pulse",{fontCharacter:"\\eb31"}),i.question=new i("question",{fontCharacter:"\\eb32"}),i.quote=new i("quote",{fontCharacter:"\\eb33"}),i.radioTower=new i("radio-tower",{fontCharacter:"\\eb34"}),i.reactions=new i("reactions",{fontCharacter:"\\eb35"}),i.references=new i("references",{fontCharacter:"\\eb36"}),i.refresh=new i("refresh",{fontCharacter:"\\eb37"}),i.regex=new i("regex",{fontCharacter:"\\eb38"}),i.remoteExplorer=new i("remote-explorer",{fontCharacter:"\\eb39"}),i.remote=new i("remote",{fontCharacter:"\\eb3a"}),i.remove=new i("remove",{fontCharacter:"\\eb3b"}),i.replaceAll=new i("replace-all",{fontCharacter:"\\eb3c"}),i.replace=new i("replace",{fontCharacter:"\\eb3d"}),i.repoClone=new i("repo-clone",{fontCharacter:"\\eb3e"}),i.repoForcePush=new i("repo-force-push",{fontCharacter:"\\eb3f"}),i.repoPull=new i("repo-pull",{fontCharacter:"\\eb40"}),i.repoPush=new i("repo-push",{fontCharacter:"\\eb41"}),i.report=new i("report",{fontCharacter:"\\eb42"}),i.requestChanges=new i("request-changes",{fontCharacter:"\\eb43"}),i.rocket=new i("rocket",{fontCharacter:"\\eb44"}),i.rootFolderOpened=new i("root-folder-opened",{fontCharacter:"\\eb45"}),i.rootFolder=new i("root-folder",{fontCharacter:"\\eb46"}),i.rss=new i("rss",{fontCharacter:"\\eb47"}),i.ruby=new i("ruby",{fontCharacter:"\\eb48"}),i.saveAll=new i("save-all",{fontCharacter:"\\eb49"}),i.saveAs=new i("save-as",{fontCharacter:"\\eb4a"}),i.save=new i("save",{fontCharacter:"\\eb4b"}),i.screenFull=new i("screen-full",{fontCharacter:"\\eb4c"}),i.screenNormal=new i("screen-normal",{fontCharacter:"\\eb4d"}),i.searchStop=new i("search-stop",{fontCharacter:"\\eb4e"}),i.server=new i("server",{fontCharacter:"\\eb50"}),i.settingsGear=new i("settings-gear",{fontCharacter:"\\eb51"}),i.settings=new i("settings",{fontCharacter:"\\eb52"}),i.shield=new i("shield",{fontCharacter:"\\eb53"}),i.smiley=new i("smiley",{fontCharacter:"\\eb54"}),i.sortPrecedence=new i("sort-precedence",{fontCharacter:"\\eb55"}),i.splitHorizontal=new i("split-horizontal",{fontCharacter:"\\eb56"}),i.splitVertical=new i("split-vertical",{fontCharacter:"\\eb57"}),i.squirrel=new i("squirrel",{fontCharacter:"\\eb58"}),i.starFull=new i("star-full",{fontCharacter:"\\eb59"}),i.starHalf=new i("star-half",{fontCharacter:"\\eb5a"}),i.symbolClass=new i("symbol-class",{fontCharacter:"\\eb5b"}),i.symbolColor=new i("symbol-color",{fontCharacter:"\\eb5c"}),i.symbolConstant=new i("symbol-constant",{fontCharacter:"\\eb5d"}),i.symbolEnumMember=new i("symbol-enum-member",{fontCharacter:"\\eb5e"}),i.symbolField=new i("symbol-field",{fontCharacter:"\\eb5f"}),i.symbolFile=new i("symbol-file",{fontCharacter:"\\eb60"}),i.symbolInterface=new i("symbol-interface",{fontCharacter:"\\eb61"}),i.symbolKeyword=new i("symbol-keyword",{fontCharacter:"\\eb62"}),i.symbolMisc=new i("symbol-misc",{fontCharacter:"\\eb63"}),i.symbolOperator=new i("symbol-operator",{fontCharacter:"\\eb64"}),i.symbolProperty=new i("symbol-property",{fontCharacter:"\\eb65"}),i.wrench=new i("wrench",{fontCharacter:"\\eb65"}),i.wrenchSubaction=new i("wrench-subaction",{fontCharacter:"\\eb65"}),i.symbolSnippet=new i("symbol-snippet",{fontCharacter:"\\eb66"}),i.tasklist=new i("tasklist",{fontCharacter:"\\eb67"}),i.telescope=new i("telescope",{fontCharacter:"\\eb68"}),i.textSize=new i("text-size",{fontCharacter:"\\eb69"}),i.threeBars=new i("three-bars",{fontCharacter:"\\eb6a"}),i.thumbsdown=new i("thumbsdown",{fontCharacter:"\\eb6b"}),i.thumbsup=new i("thumbsup",{fontCharacter:"\\eb6c"}),i.tools=new i("tools",{fontCharacter:"\\eb6d"}),i.triangleDown=new i("triangle-down",{fontCharacter:"\\eb6e"}),i.triangleLeft=new i("triangle-left",{fontCharacter:"\\eb6f"}),i.triangleRight=new i("triangle-right",{fontCharacter:"\\eb70"}),i.triangleUp=new i("triangle-up",{fontCharacter:"\\eb71"}),i.twitter=new i("twitter",{fontCharacter:"\\eb72"}),i.unfold=new i("unfold",{fontCharacter:"\\eb73"}),i.unlock=new i("unlock",{fontCharacter:"\\eb74"}),i.unmute=new i("unmute",{fontCharacter:"\\eb75"}),i.unverified=new i("unverified",{fontCharacter:"\\eb76"}),i.verified=new i("verified",{fontCharacter:"\\eb77"}),i.versions=new i("versions",{fontCharacter:"\\eb78"}),i.vmActive=new i("vm-active",{fontCharacter:"\\eb79"}),i.vmOutline=new i("vm-outline",{fontCharacter:"\\eb7a"}),i.vmRunning=new i("vm-running",{fontCharacter:"\\eb7b"}),i.watch=new i("watch",{fontCharacter:"\\eb7c"}),i.whitespace=new i("whitespace",{fontCharacter:"\\eb7d"}),i.wholeWord=new i("whole-word",{fontCharacter:"\\eb7e"}),i.window=new i("window",{fontCharacter:"\\eb7f"}),i.wordWrap=new i("word-wrap",{fontCharacter:"\\eb80"}),i.zoomIn=new i("zoom-in",{fontCharacter:"\\eb81"}),i.zoomOut=new i("zoom-out",{fontCharacter:"\\eb82"}),i.listFilter=new i("list-filter",{fontCharacter:"\\eb83"}),i.listFlat=new i("list-flat",{fontCharacter:"\\eb84"}),i.listSelection=new i("list-selection",{fontCharacter:"\\eb85"}),i.selection=new i("selection",{fontCharacter:"\\eb85"}),i.listTree=new i("list-tree",{fontCharacter:"\\eb86"}),i.debugBreakpointFunctionUnverified=new i("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),i.debugBreakpointFunction=new i("debug-breakpoint-function",{fontCharacter:"\\eb88"}),i.debugBreakpointFunctionDisabled=new i("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),i.debugStackframeActive=new i("debug-stackframe-active",{fontCharacter:"\\eb89"}),i.debugStackframeDot=new i("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),i.debugStackframe=new i("debug-stackframe",{fontCharacter:"\\eb8b"}),i.debugStackframeFocused=new i("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),i.debugBreakpointUnsupported=new i("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),i.symbolString=new i("symbol-string",{fontCharacter:"\\eb8d"}),i.debugReverseContinue=new i("debug-reverse-continue",{fontCharacter:"\\eb8e"}),i.debugStepBack=new i("debug-step-back",{fontCharacter:"\\eb8f"}),i.debugRestartFrame=new i("debug-restart-frame",{fontCharacter:"\\eb90"}),i.callIncoming=new i("call-incoming",{fontCharacter:"\\eb92"}),i.callOutgoing=new i("call-outgoing",{fontCharacter:"\\eb93"}),i.menu=new i("menu",{fontCharacter:"\\eb94"}),i.expandAll=new i("expand-all",{fontCharacter:"\\eb95"}),i.feedback=new i("feedback",{fontCharacter:"\\eb96"}),i.groupByRefType=new i("group-by-ref-type",{fontCharacter:"\\eb97"}),i.ungroupByRefType=new i("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),i.account=new i("account",{fontCharacter:"\\eb99"}),i.bellDot=new i("bell-dot",{fontCharacter:"\\eb9a"}),i.debugConsole=new i("debug-console",{fontCharacter:"\\eb9b"}),i.library=new i("library",{fontCharacter:"\\eb9c"}),i.output=new i("output",{fontCharacter:"\\eb9d"}),i.runAll=new i("run-all",{fontCharacter:"\\eb9e"}),i.syncIgnored=new i("sync-ignored",{fontCharacter:"\\eb9f"}),i.pinned=new i("pinned",{fontCharacter:"\\eba0"}),i.githubInverted=new i("github-inverted",{fontCharacter:"\\eba1"}),i.debugAlt=new i("debug-alt",{fontCharacter:"\\eb91"}),i.serverProcess=new i("server-process",{fontCharacter:"\\eba2"}),i.serverEnvironment=new i("server-environment",{fontCharacter:"\\eba3"}),i.pass=new i("pass",{fontCharacter:"\\eba4"}),i.stopCircle=new i("stop-circle",{fontCharacter:"\\eba5"}),i.playCircle=new i("play-circle",{fontCharacter:"\\eba6"}),i.record=new i("record",{fontCharacter:"\\eba7"}),i.debugAltSmall=new i("debug-alt-small",{fontCharacter:"\\eba8"}),i.vmConnect=new i("vm-connect",{fontCharacter:"\\eba9"}),i.cloud=new i("cloud",{fontCharacter:"\\ebaa"}),i.merge=new i("merge",{fontCharacter:"\\ebab"}),i.exportIcon=new i("export",{fontCharacter:"\\ebac"}),i.graphLeft=new i("graph-left",{fontCharacter:"\\ebad"}),i.magnet=new i("magnet",{fontCharacter:"\\ebae"}),i.notebook=new i("notebook",{fontCharacter:"\\ebaf"}),i.redo=new i("redo",{fontCharacter:"\\ebb0"}),i.checkAll=new i("check-all",{fontCharacter:"\\ebb1"}),i.pinnedDirty=new i("pinned-dirty",{fontCharacter:"\\ebb2"}),i.passFilled=new i("pass-filled",{fontCharacter:"\\ebb3"}),i.circleLargeFilled=new i("circle-large-filled",{fontCharacter:"\\ebb4"}),i.circleLargeOutline=new i("circle-large-outline",{fontCharacter:"\\ebb5"}),i.combine=new i("combine",{fontCharacter:"\\ebb6"}),i.gather=new i("gather",{fontCharacter:"\\ebb6"}),i.table=new i("table",{fontCharacter:"\\ebb7"}),i.variableGroup=new i("variable-group",{fontCharacter:"\\ebb8"}),i.typeHierarchy=new i("type-hierarchy",{fontCharacter:"\\ebb9"}),i.typeHierarchySub=new i("type-hierarchy-sub",{fontCharacter:"\\ebba"}),i.typeHierarchySuper=new i("type-hierarchy-super",{fontCharacter:"\\ebbb"}),i.gitPullRequestCreate=new i("git-pull-request-create",{fontCharacter:"\\ebbc"}),i.runAbove=new i("run-above",{fontCharacter:"\\ebbd"}),i.runBelow=new i("run-below",{fontCharacter:"\\ebbe"}),i.notebookTemplate=new i("notebook-template",{fontCharacter:"\\ebbf"}),i.debugRerun=new i("debug-rerun",{fontCharacter:"\\ebc0"}),i.workspaceTrusted=new i("workspace-trusted",{fontCharacter:"\\ebc1"}),i.workspaceUntrusted=new i("workspace-untrusted",{fontCharacter:"\\ebc2"}),i.workspaceUnspecified=new i("workspace-unspecified",{fontCharacter:"\\ebc3"}),i.terminalCmd=new i("terminal-cmd",{fontCharacter:"\\ebc4"}),i.terminalDebian=new i("terminal-debian",{fontCharacter:"\\ebc5"}),i.terminalLinux=new i("terminal-linux",{fontCharacter:"\\ebc6"}),i.terminalPowershell=new i("terminal-powershell",{fontCharacter:"\\ebc7"}),i.terminalTmux=new i("terminal-tmux",{fontCharacter:"\\ebc8"}),i.terminalUbuntu=new i("terminal-ubuntu",{fontCharacter:"\\ebc9"}),i.terminalBash=new i("terminal-bash",{fontCharacter:"\\ebca"}),i.arrowSwap=new i("arrow-swap",{fontCharacter:"\\ebcb"}),i.copy=new i("copy",{fontCharacter:"\\ebcc"}),i.personAdd=new i("person-add",{fontCharacter:"\\ebcd"}),i.filterFilled=new i("filter-filled",{fontCharacter:"\\ebce"}),i.wand=new i("wand",{fontCharacter:"\\ebcf"}),i.debugLineByLine=new i("debug-line-by-line",{fontCharacter:"\\ebd0"}),i.inspect=new i("inspect",{fontCharacter:"\\ebd1"}),i.layers=new i("layers",{fontCharacter:"\\ebd2"}),i.layersDot=new i("layers-dot",{fontCharacter:"\\ebd3"}),i.layersActive=new i("layers-active",{fontCharacter:"\\ebd4"}),i.compass=new i("compass",{fontCharacter:"\\ebd5"}),i.compassDot=new i("compass-dot",{fontCharacter:"\\ebd6"}),i.compassActive=new i("compass-active",{fontCharacter:"\\ebd7"}),i.azure=new i("azure",{fontCharacter:"\\ebd8"}),i.issueDraft=new i("issue-draft",{fontCharacter:"\\ebd9"}),i.gitPullRequestClosed=new i("git-pull-request-closed",{fontCharacter:"\\ebda"}),i.gitPullRequestDraft=new i("git-pull-request-draft",{fontCharacter:"\\ebdb"}),i.debugAll=new i("debug-all",{fontCharacter:"\\ebdc"}),i.debugCoverage=new i("debug-coverage",{fontCharacter:"\\ebdd"}),i.runErrors=new i("run-errors",{fontCharacter:"\\ebde"}),i.folderLibrary=new i("folder-library",{fontCharacter:"\\ebdf"}),i.debugContinueSmall=new i("debug-continue-small",{fontCharacter:"\\ebe0"}),i.beakerStop=new i("beaker-stop",{fontCharacter:"\\ebe1"}),i.graphLine=new i("graph-line",{fontCharacter:"\\ebe2"}),i.graphScatter=new i("graph-scatter",{fontCharacter:"\\ebe3"}),i.pieChart=new i("pie-chart",{fontCharacter:"\\ebe4"}),i.bracket=new i("bracket",i.json.definition),i.bracketDot=new i("bracket-dot",{fontCharacter:"\\ebe5"}),i.bracketError=new i("bracket-error",{fontCharacter:"\\ebe6"}),i.lockSmall=new i("lock-small",{fontCharacter:"\\ebe7"}),i.azureDevops=new i("azure-devops",{fontCharacter:"\\ebe8"}),i.verifiedFilled=new i("verified-filled",{fontCharacter:"\\ebe9"})}(W||(W={}))},"VrN/":function(et,Ee,J){(function(oe,Y){et.exports=Y()})(this,function(){"use strict";var oe=navigator.userAgent,Y=navigator.platform,D=/gecko\/\d/i.test(oe),z=/MSIE \d/.test(oe),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),M=/Edge\/(\d+)/.exec(oe),W=z||N||M,H=W&&(z?document.documentMode||6:+(M||N)[1]),i=!M&&/WebKit\//.test(oe),L=i&&/Qt\/\d+\.\d+/.test(oe),g=!M&&/Chrome\//.test(oe),c=/Opera\//.test(oe),m=/Apple Computer/.test(navigator.vendor),u=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(oe),o=/PhantomJS/.test(oe),p=!M&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),l=/Android/.test(oe),h=p||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),s=p||/Mac/.test(Y),a=/\bCrOS\b/.test(oe),C=/win/i.test(Y),_=c&&oe.match(/Version\/(\d*\.\d*)/);_&&(_=Number(_[1])),_&&_>=15&&(c=!1,i=!0);var T=s&&(L||c&&(_==null||_<12.11)),O=D||W&&H>=9;function R(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S=function(e,t){var r=e.className,n=R(t).exec(r);if(n){var d=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(d?n[1]+d:"")}};function w(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function E(e,t){return w(e).appendChild(t)}function f(e,t,r,n){var d=document.createElement(e);if(r&&(d.className=r),n&&(d.style.cssText=n),typeof t=="string")d.appendChild(document.createTextNode(t));else if(t)for(var I=0;I<t.length;++I)d.appendChild(t[I]);return d}function x(e,t,r,n){var d=f(e,t,r,n);return d.setAttribute("role","presentation"),d}var v;document.createRange?v=function(e,t,r,n){var d=document.createRange();return d.setEnd(n||e,r),d.setStart(e,t),d}:v=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(d){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function y(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function U(){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 r=e.className;R(t).test(r)||(e.className+=(r?" ":"")+t)}function A(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!R(r[n]).test(t)&&(t+=" "+r[n]);return t}var j=function(e){e.select()};p?j=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(j=function(e){try{e.select()}catch(t){}});function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function b(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function V(e,t,r,n,d){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var I=n||0,G=d||0;;){var Q=e.indexOf(" ",I);if(Q<0||Q>=t)return G+(t-I);G+=Q-I,G+=r-G%r,I=Q+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};ne.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ne.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function ce(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var me=50,Ie={toString:function(){return"CodeMirror.Pass"}},we={scroll:!1},Le={origin:"*mouse"},Re={origin:"+move"};function De(e,t,r){for(var n=0,d=0;;){var I=e.indexOf(" ",n);I==-1&&(I=e.length);var G=I-n;if(I==e.length||d+G>=t)return n+Math.min(G,t-d);if(d+=I-n,d+=r-d%r,n=I+1,d>=t)return n}}var ye=[""];function X(e){for(;ye.length<=e;)ye.push(k(ye)+" ");return ye[e]}function k(e){return e[e.length-1]}function F(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function $(e,t,r){for(var n=0,d=r(t);n<e.length&&r(e[n])<=d;)n++;e.splice(n,0,t)}function te(){}function K(e,t){var r;return Object.create?r=Object.create(e):(te.prototype=e,r=new te),t&&b(t,r),r}var pe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Te(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||pe.test(e))}function ke(e,t){return t?t.source.indexOf("\\w")>-1&&Te(e)?!0:t.test(e):Te(e)}function ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ve=/[\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 xe(e){return e.charCodeAt(0)>=768&&ve.test(e)}function Ce(e,t,r){for(;(r<0?t>0:t<e.length)&&xe(e.charAt(t));)t+=r;return t}function Ne(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var d=(t+r)/2,I=n<0?Math.ceil(d):Math.floor(d);if(I==t)return e(I)?t:r;e(I)?r=I:t=I+n}}function Ue(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var d=!1,I=0;I<e.length;++I){var G=e[I];(G.from<r&&G.to>t||t==r&&G.to==t)&&(n(Math.max(G.from,t),Math.min(G.to,r),G.level==1?"rtl":"ltr",I),d=!0)}d||n(t,r,"ltr")}var Ge=null;function We(e,t,r){var n;Ge=null;for(var d=0;d<e.length;++d){var I=e[d];if(I.from<t&&I.to>t)return d;I.to==t&&(I.from!=I.to&&r=="before"?n=d:Ge=d),I.from==t&&(I.from!=I.to&&r!="before"?n=d:Ge=d)}return n!=null?n:Ge}var it=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,I=/[LRr]/,G=/[Lb1n]/,Q=/[1n]/;function q(re,ge,_e){this.level=re,this.from=ge,this.to=_e}return function(re,ge){var _e=ge=="ltr"?"L":"R";if(re.length==0||ge=="ltr"&&!n.test(re))return!1;for(var Oe=re.length,Ae=[],Fe=0;Fe<Oe;++Fe)Ae.push(r(re.charCodeAt(Fe)));for(var je=0,ze=_e;je<Oe;++je){var Ze=Ae[je];Ze=="m"?Ae[je]=ze:ze=Ze}for(var nt=0,qe=_e;nt<Oe;++nt){var st=Ae[nt];st=="1"&&qe=="r"?Ae[nt]="n":I.test(st)&&(qe=st,st=="r"&&(Ae[nt]="R"))}for(var pt=1,ht=Ae[0];pt<Oe-1;++pt){var St=Ae[pt];St=="+"&&ht=="1"&&Ae[pt+1]=="1"?Ae[pt]="1":St==","&&ht==Ae[pt+1]&&(ht=="1"||ht=="n")&&(Ae[pt]=ht),ht=St}for(var jt=0;jt<Oe;++jt){var ti=Ae[jt];if(ti==",")Ae[jt]="N";else if(ti=="%"){var Gt=void 0;for(Gt=jt+1;Gt<Oe&&Ae[Gt]=="%";++Gt);for(var Ei=jt&&Ae[jt-1]=="!"||Gt<Oe&&Ae[Gt]=="1"?"1":"N",vi=jt;vi<Gt;++vi)Ae[vi]=Ei;jt=Gt-1}}for(var Xt=0,yi=_e;Xt<Oe;++Xt){var ri=Ae[Xt];yi=="L"&&ri=="1"?Ae[Xt]="L":I.test(ri)&&(yi=ri)}for(var Jt=0;Jt<Oe;++Jt)if(d.test(Ae[Jt])){var Yt=void 0;for(Yt=Jt+1;Yt<Oe&&d.test(Ae[Yt]);++Yt);for(var zt=(Jt?Ae[Jt-1]:_e)=="L",bi=(Yt<Oe?Ae[Yt]:_e)=="L",Kn=zt==bi?zt?"L":"R":_e,tn=Jt;tn<Yt;++tn)Ae[tn]=Kn;Jt=Yt-1}for(var li=[],Ui,ii=0;ii<Oe;)if(G.test(Ae[ii])){var Va=ii;for(++ii;ii<Oe&&G.test(Ae[ii]);++ii);li.push(new q(0,Va,ii))}else{var zi=ii,yn=li.length,bn=ge=="rtl"?1:0;for(++ii;ii<Oe&&Ae[ii]!="L";++ii);for(var di=zi;di<ii;)if(Q.test(Ae[di])){zi<di&&(li.splice(yn,0,new q(1,zi,di)),yn+=bn);var zn=di;for(++di;di<ii&&Q.test(Ae[di]);++di);li.splice(yn,0,new q(2,zn,di)),yn+=bn,zi=di}else++di;zi<ii&&li.splice(yn,0,new q(1,zi,ii))}return ge=="ltr"&&(li[0].level==1&&(Ui=re.match(/^\s+/))&&(li[0].from=Ui[0].length,li.unshift(new q(0,0,Ui[0].length))),k(li).level==1&&(Ui=re.match(/\s+$/))&&(k(li).to-=Ui[0].length,li.push(new q(0,Oe-Ui[0].length,Oe)))),ge=="rtl"?li.reverse():li}}();function Ve(e,t){var r=e.order;return r==null&&(r=e.order=it(e.text,t)),r}var Xe=[],Me=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Xe).concat(r)}};function rt(e,t){return e._handlers&&e._handlers[t]||Xe}function tt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,d=n&&n[t];if(d){var I=ce(d,r);I>-1&&(n[t]=d.slice(0,I).concat(d.slice(I+1)))}}}function le(e,t){var r=rt(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),d=0;d<r.length;++d)r[d].apply(null,n)}function Z(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),le(e,r||t.type,e,t),de(t)||t.codemirrorIgnore}function ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)ce(r,t[n])==-1&&r.push(t[n])}function se(e,t){return rt(e,t).length>0}function he(e){e.prototype.on=function(t,r){Me(this,t,r)},e.prototype.off=function(t,r){tt(this,t,r)}}function ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function fe(e){ie(e),ae(e)}function be(e){return e.target||e.srcElement}function Se(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 Pe=function(){if(W&&H<9)return!1;var e=f("div");return"draggable"in e||"dragDrop"in e}(),Be;function Je(e){if(Be==null){var t=f("span","\u200B");E(e,f("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Be=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&H<8))}var r=Be?f("span","\u200B"):f("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var $e;function lt(e){if($e!=null)return $e;var t=E(e,document.createTextNode("A\u062EA")),r=v(t,0,1).getBoundingClientRect(),n=v(t,1,2).getBoundingClientRect();return w(e),!r||r.left==r.right?!1:$e=n.right-r.right<3}var at=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var d=e.indexOf(`
|
|
`,t);d==-1&&(d=e.length);var I=e.slice(t,e.charAt(d-1)=="\r"?d-1:d),G=I.indexOf("\r");G!=-1?(r.push(I.slice(0,G)),t+=G+1):(r.push(I),t=d+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Qe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Lt=function(){var e=f("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ct=null;function Nt(e){if(ct!=null)return ct;var t=E(e,f("span","x")),r=t.getBoundingClientRect(),n=v(t,0,1).getBoundingClientRect();return ct=Math.abs(r.left-n.left)>1}var Ut={},Ct={};function Qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function ci(e,t){Ct[e]=t}function Kt(e){if(typeof e=="string"&&Ct.hasOwnProperty(e))e=Ct[e];else if(e&&typeof e.name=="string"&&Ct.hasOwnProperty(e.name)){var t=Ct[e.name];typeof t=="string"&&(t={name:t}),e=K(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Kt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Kt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Zt(e,t){t=Kt(t);var r=Ut[t.name];if(!r)return Zt(e,"text/plain");var n=r(e,t);if(ft.hasOwnProperty(t.name)){var d=ft[t.name];for(var I in d){if(!d.hasOwnProperty(I))continue;n.hasOwnProperty(I)&&(n["_"+I]=n[I]),n[I]=d[I]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var G in t.modeProps)n[G]=t.modeProps[G];return n}var ft={};function _t(e,t){var r=ft.hasOwnProperty(e)?ft[e]:ft[e]={};b(t,r)}function xt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var d=t[n];d instanceof Array&&(d=d.concat([])),r[n]=d}return r}function Et(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function It(e,t,r){return e.startState?e.startState(t,r):!0}var gt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};gt.prototype.eol=function(){return this.pos>=this.string.length},gt.prototype.sol=function(){return this.pos==this.lineStart},gt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},gt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},gt.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},gt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},gt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},gt.prototype.skipToEnd=function(){this.pos=this.string.length},gt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},gt.prototype.backUp=function(e){this.pos-=e},gt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},gt.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},gt.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(G){return r?G.toLowerCase():G},d=this.string.substr(this.pos,e.length);if(n(d)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var I=this.string.slice(this.pos).match(e);return I&&I.index>0?null:(I&&t!==!1&&(this.pos+=I[0].length),I)}},gt.prototype.current=function(){return this.string.slice(this.start,this.pos)},gt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},gt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},gt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ye(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 r=e;!r.lines;)for(var n=0;;++n){var d=r.children[n],I=d.chunkSize();if(t<I){r=d;break}t-=I}return r.lines[t]}function wt(e,t,r){var n=[],d=t.line;return e.iter(t.line,r.line+1,function(I){var G=I.text;d==r.line&&(G=G.slice(0,r.ch)),d==t.line&&(G=G.slice(t.ch)),n.push(G),++d}),n}function Tt(e,t,r){var n=[];return e.iter(t,r,function(d){n.push(d.text)}),n}function ut(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function vt(e){if(e.parent==null)return null;for(var t=e.parent,r=ce(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var d=0;!(n.children[d]==t);++d)r+=n.children[d].chunkSize();return r+t.first}function Rt(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var d=e.children[n],I=d.height;if(t<I){e=d;continue e}t-=I,r+=d.chunkSize()}return r}while(!e.lines);for(var G=0;G<e.lines.length;++G){var Q=e.lines[G],q=Q.height;if(t<q)break;t-=q}return r+G}function ai(e,t){return t>=e.first&&t<e.first+e.size}function Ht(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function He(e,t,r){if(r===void 0&&(r=null),!(this instanceof He))return new He(e,t,r);this.line=e,this.ch=t,this.sticky=r}function mt(e,t){return e.line-t.line||e.ch-t.ch}function nn(e,t){return e.sticky==t.sticky&&mt(e,t)==0}function _n(e){return He(e.line,e.ch)}function En(e,t){return mt(e,t)<0?t:e}function rn(e,t){return mt(e,t)<0?e:t}function xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function bt(e,t){if(t.line<e.first)return He(e.first,0);var r=e.first+e.size-1;return t.line>r?He(r,Ye(e,r).text.length):Ar(t,Ye(e,t.line).text.length)}function Ar(e,t){var r=e.ch;return r==null||r>t?He(e.line,t):r<0?He(e.line,0):e}function Ke(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=bt(e,t[n]);return r}var Tn=function(e,t){this.state=e,this.lookAhead=t},Si=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};Si.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Si.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}},Si.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Si.fromSaved=function(e,t,r){return t instanceof Tn?new Si(e,xt(e.mode,t.state),r,t.lookAhead):new Si(e,xt(e.mode,t),r)},Si.prototype.save=function(e){var t=e!==!1?xt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Tn(t,this.maxLookAhead):t};function Vn(e,t,r,n){var d=[e.state.modeGen],I={};Oi(e,t.text,e.doc.mode,r,function(re,ge){return d.push(re,ge)},I,n);for(var G=r.state,Q=function(re){r.baseTokens=d;var ge=e.state.overlays[re],_e=1,Oe=0;r.state=!0,Oi(e,t.text,ge.mode,r,function(Ae,Fe){for(var je=_e;Oe<Ae;){var ze=d[_e];ze>Ae&&d.splice(_e,1,Ae,d[_e+1],ze),_e+=2,Oe=Math.min(Ae,ze)}if(!Fe)return;if(ge.opaque)d.splice(je,_e-je,Ae,"overlay "+Fe),_e=je+2;else for(;je<_e;je+=2){var Ze=d[je+1];d[je+1]=(Ze?Ze+" ":"")+"overlay "+Fe}},I),r.state=G,r.baseTokens=null,r.baseTokenPos=1},q=0;q<e.state.overlays.length;++q)Q(q);return{styles:d,classes:I.bgClass||I.textClass?I:null}}function an(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ai(e,vt(t)),d=t.text.length>e.options.maxHighlightLength&&xt(e.doc.mode,n.state),I=Vn(e,t,n);d&&(n.state=d),t.stateAfter=n.save(!d),t.styles=I.styles,I.classes?t.styleClasses=I.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ai(e,t,r){var n=e.doc,d=e.display;if(!n.mode.startState)return new Si(n,!0,t);var I=Or(e,t,r),G=I>n.first&&Ye(n,I-1).stateAfter,Q=G?Si.fromSaved(n,G,I):new Si(n,It(n.mode),I);return n.iter(I,t,function(q){Xn(e,q.text,Q);var re=Q.line;q.stateAfter=re==t-1||re%5==0||re>=d.viewFrom&&re<d.viewTo?Q.save():null,Q.nextLine()}),r&&(n.modeFrontier=Q.line),Q}function Xn(e,t,r,n){var d=e.doc.mode,I=new gt(t,e.options.tabSize,r);for(I.start=I.pos=n||0,t==""&&Yn(d,r.state);!I.eol();)Ri(d,I,r.state),I.start=I.pos}function Yn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=Et(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function Ri(e,t,r,n){for(var d=0;d<10;d++){n&&(n[0]=Et(e,r).mode);var I=e.token(t,r);if(t.pos>t.start)return I}throw new Error("Mode "+e.name+" failed to advance stream.")}var $n=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Rr(e,t,r,n){var d=e.doc,I=d.mode,G;t=bt(d,t);var Q=Ye(d,t.line),q=Ai(e,t.line,r),re=new gt(Q.text,e.options.tabSize,q),ge;for(n&&(ge=[]);(n||re.pos<t.ch)&&!re.eol();)re.start=re.pos,G=Ri(I,re,q.state),n&&ge.push(new $n(re,G,xt(d.mode,q.state)));return n?ge:new $n(re,G,q.state)}function Jn(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Oi(e,t,r,n,d,I,G){var Q=r.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var q=0,re=null,ge=new gt(t,e.options.tabSize,n),_e,Oe=e.options.addModeClass&&[null];for(t==""&&Jn(Yn(r,n.state),I);!ge.eol();){if(ge.pos>e.options.maxHighlightLength?(Q=!1,G&&Xn(e,t,n,ge.pos),ge.pos=t.length,_e=null):_e=Jn(Ri(r,ge,n.state,Oe),I),Oe){var Ae=Oe[0].name;Ae&&(_e="m-"+(_e?Ae+" "+_e:Ae))}if(!Q||re!=_e){for(;q<ge.start;)q=Math.min(ge.start,q+5e3),d(q,re);re=_e}ge.start=ge.pos}for(;q<ge.pos;){var Fe=Math.min(ge.pos,q+5e3);d(Fe,re),q=Fe}}function Or(e,t,r){for(var n,d,I=e.doc,G=r?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>G;--Q){if(Q<=I.first)return I.first;var q=Ye(I,Q-1),re=q.stateAfter;if(re&&(!r||Q+(re instanceof Tn?re.lookAhead:0)<=I.modeFrontier))return Q;var ge=V(q.text,null,e.options.tabSize);(d==null||n>ge)&&(d=Q-1,n=ge)}return d}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var d=Ye(e,n).stateAfter;if(d&&(!(d instanceof Tn)||n+d.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Qn=!1,ui=!1;function Vi(){Qn=!0}function sa(){ui=!0}function sn(e,t,r){this.marker=e,this.from=t,this.to=r}function Li(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Zn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function oa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Lr(e,t,r){var n;if(e)for(var d=0;d<e.length;++d){var I=e[d],G=I.marker,Q=I.from==null||(G.inclusiveLeft?I.from<=t:I.from<t);if(Q||I.from==t&&G.type=="bookmark"&&(!r||!I.marker.insertLeft)){var q=I.to==null||(G.inclusiveRight?I.to>=t:I.to>t);(n||(n=[])).push(new sn(G,I.from,q?null:I.to))}}return n}function Ir(e,t,r){var n;if(e)for(var d=0;d<e.length;++d){var I=e[d],G=I.marker,Q=I.to==null||(G.inclusiveRight?I.to>=t:I.to>t);if(Q||I.from==t&&G.type=="bookmark"&&(!r||I.marker.insertLeft)){var q=I.from==null||(G.inclusiveLeft?I.from<=t:I.from<t);(n||(n=[])).push(new sn(G,q?null:I.from-t,I.to==null?null:I.to-t))}}return n}function wn(e,t){if(t.full)return null;var r=ai(e,t.from.line)&&Ye(e,t.from.line).markedSpans,n=ai(e,t.to.line)&&Ye(e,t.to.line).markedSpans;if(!r&&!n)return null;var d=t.from.ch,I=t.to.ch,G=mt(t.from,t.to)==0,Q=Lr(r,d,G),q=Ir(n,I,G),re=t.text.length==1,ge=k(t.text).length+(re?d:0);if(Q)for(var _e=0;_e<Q.length;++_e){var Oe=Q[_e];if(Oe.to==null){var Ae=Li(q,Oe.marker);Ae?re&&(Oe.to=Ae.to==null?null:Ae.to+ge):Oe.to=d}}if(q)for(var Fe=0;Fe<q.length;++Fe){var je=q[Fe];if(je.to!=null&&(je.to+=ge),je.from==null){var ze=Li(Q,je.marker);ze||(je.from=ge,re&&(Q||(Q=[])).push(je))}else je.from+=ge,re&&(Q||(Q=[])).push(je)}Q&&(Q=Dr(Q)),q&&q!=Q&&(q=Dr(q));var Ze=[Q];if(!re){var nt=t.text.length-2,qe;if(nt>0&&Q)for(var st=0;st<Q.length;++st)Q[st].to==null&&(qe||(qe=[])).push(new sn(Q[st].marker,null,null));for(var pt=0;pt<nt;++pt)Ze.push(qe);Ze.push(q)}return Ze}function Dr(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function kr(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Ae){if(Ae.markedSpans)for(var Fe=0;Fe<Ae.markedSpans.length;++Fe){var je=Ae.markedSpans[Fe].marker;je.readOnly&&(!n||ce(n,je)==-1)&&(n||(n=[])).push(je)}}),!n)return null;for(var d=[{from:t,to:r}],I=0;I<n.length;++I)for(var G=n[I],Q=G.find(0),q=0;q<d.length;++q){var re=d[q];if(mt(re.to,Q.from)<0||mt(re.from,Q.to)>0)continue;var ge=[q,1],_e=mt(re.from,Q.from),Oe=mt(re.to,Q.to);(_e<0||!G.inclusiveLeft&&!_e)&&ge.push({from:re.from,to:Q.from}),(Oe>0||!G.inclusiveRight&&!Oe)&&ge.push({from:Q.to,to:re.to}),d.splice.apply(d,ge),q+=ge.length-3}return d}function la(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function Sn(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function on(e){return e.inclusiveLeft?-1:0}function ln(e){return e.inclusiveRight?1:0}function Cn(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),d=t.find(),I=mt(n.from,d.from)||on(e)-on(t);if(I)return-I;var G=mt(n.to,d.to)||ln(e)-ln(t);return G||t.id-e.id}function Bi(e,t){var r=ui&&e.markedSpans,n;if(r)for(var d=void 0,I=0;I<r.length;++I)d=r[I],d.marker.collapsed&&(t?d.from:d.to)==null&&(!n||Cn(n,d.marker)<0)&&(n=d.marker);return n}function ji(e){return Bi(e,!0)}function Hi(e){return Bi(e,!1)}function An(e,t){var r=ui&&e.markedSpans,n;if(r)for(var d=0;d<r.length;++d){var I=r[d];I.marker.collapsed&&(I.from==null||I.from<t)&&(I.to==null||I.to>t)&&(!n||Cn(n,I.marker)<0)&&(n=I.marker)}return n}function Mr(e,t,r,n,d){var I=Ye(e,t),G=ui&&I.markedSpans;if(G)for(var Q=0;Q<G.length;++Q){var q=G[Q];if(!q.marker.collapsed)continue;var re=q.marker.find(0),ge=mt(re.from,r)||on(q.marker)-on(d),_e=mt(re.to,n)||ln(q.marker)-ln(d);if(ge>=0&&_e<=0||ge<=0&&_e>=0)continue;if(ge<=0&&(q.marker.inclusiveRight&&d.inclusiveLeft?mt(re.to,r)>=0:mt(re.to,r)>0)||ge>=0&&(q.marker.inclusiveRight&&d.inclusiveLeft?mt(re.from,n)<=0:mt(re.from,n)<0))return!0}}function xi(e){for(var t;t=ji(e);)e=t.find(-1,!0).line;return e}function Pr(e){for(var t;t=Hi(e);)e=t.find(1,!0).line;return e}function Rn(e){for(var t,r;t=Hi(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function qn(e,t){var r=Ye(e,t),n=xi(r);return r==n?t:vt(n)}function Xi(e,t){if(t>e.lastLine())return t;var r=Ye(e,t),n;if(!Pi(e,r))return t;for(;n=Hi(r);)r=n.find(1,!0).line;return vt(r)+1}function Pi(e,t){var r=ui&&t.markedSpans;if(r)for(var n=void 0,d=0;d<r.length;++d){if(n=r[d],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&er(e,t,n))return!0}}function er(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return er(e,n.line,Li(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var d=void 0,I=0;I<t.markedSpans.length;++I)if(d=t.markedSpans[I],d.marker.collapsed&&!d.marker.widgetNode&&d.from==r.to&&(d.to==null||d.to!=r.from)&&(d.marker.inclusiveLeft||r.marker.inclusiveRight)&&er(e,t,d))return!0}function Ii(e){e=xi(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var d=r.lines[n];if(d==e)break;t+=d.height}for(var I=r.parent;I;r=I,I=r.parent)for(var G=0;G<I.children.length;++G){var Q=I.children[G];if(Q==r)break;t+=Q.height}return t}function tr(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=ji(n);){var d=r.find(0,!0);n=d.from.line,t+=d.from.ch-d.to.ch}for(n=e;r=Hi(n);){var I=r.find(0,!0);t-=n.text.length-I.from.ch,n=I.to.line,t+=n.text.length-I.to.ch}return t}function Nr(e){var t=e.display,r=e.doc;t.maxLine=Ye(r,r.first),t.maxLineLength=tr(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var d=tr(n);d>t.maxLineLength&&(t.maxLineLength=d,t.maxLine=n)})}var un=function(e,t,r){this.text=e,Sn(this,t),this.height=r?r(this):1};un.prototype.lineNo=function(){return vt(this)},he(un);function ua(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Sn(e,r);var d=n?n(e):1;d!=e.height&&ut(e,d)}function ot(e){e.parent=null,la(e)}var yt={},dt={};function At(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?dt:yt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function kt(e,t){var r=x("span",null,null,i?"padding-right: .1px":null),n={pre:x("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var d=0;d<=(t.rest?t.rest.length:0);d++){var I=d?t.rest[d-1]:t.line,G=void 0;n.pos=0,n.addToken=Dt,lt(e.display.measure)&&(G=Ve(I,e.doc.direction))&&(n.addToken=fi(n.addToken,G)),n.map=[];var Q=t!=e.display.externalMeasured&&vt(I);Wi(I,n,an(e,I,Q)),I.styleClasses&&(I.styleClasses.bgClass&&(n.bgClass=A(I.styleClasses.bgClass,n.bgClass||"")),I.styleClasses.textClass&&(n.textClass=A(I.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(Je(e.display.measure))),d==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(i){var q=n.content.lastChild;(/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return le(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=A(n.pre.className,n.textClass||"")),n}function Bt(e){var t=f("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Dt(e,t,r,n,d,I,G){if(!t)return;var Q=e.splitSpaces?$t(t,e.trailingSpace):t,q=e.cm.state.specialChars,re=!1,ge;if(!q.test(t))e.col+=t.length,ge=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,ge),W&&H<9&&(re=!0),e.pos+=t.length;else{ge=document.createDocumentFragment();for(var _e=0;;){q.lastIndex=_e;var Oe=q.exec(t),Ae=Oe?Oe.index-_e:t.length-_e;if(Ae){var Fe=document.createTextNode(Q.slice(_e,_e+Ae));W&&H<9?ge.appendChild(f("span",[Fe])):ge.appendChild(Fe),e.map.push(e.pos,e.pos+Ae,Fe),e.col+=Ae,e.pos+=Ae}if(!Oe)break;_e+=Ae+1;var je=void 0;if(Oe[0]==" "){var ze=e.cm.options.tabSize,Ze=ze-e.col%ze;je=ge.appendChild(f("span",X(Ze),"cm-tab")),je.setAttribute("role","presentation"),je.setAttribute("cm-text"," "),e.col+=Ze}else Oe[0]=="\r"||Oe[0]==`
|
|
`?(je=ge.appendChild(f("span",Oe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),je.setAttribute("cm-text",Oe[0]),e.col+=1):(je=e.cm.options.specialCharPlaceholder(Oe[0]),je.setAttribute("cm-text",Oe[0]),W&&H<9?ge.appendChild(f("span",[je])):ge.appendChild(je),e.col+=1);e.map.push(e.pos,e.pos+1,je),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,r||n||d||re||I||G){var nt=r||"";n&&(nt+=n),d&&(nt+=d);var qe=f("span",[ge],nt,I);if(G)for(var st in G)G.hasOwnProperty(st)&&st!="style"&&st!="class"&&qe.setAttribute(st,G[st]);return e.content.appendChild(qe)}e.content.appendChild(ge)}function $t(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",d=0;d<e.length;d++){var I=e.charAt(d);I==" "&&r&&(d==e.length-1||e.charCodeAt(d+1)==32)&&(I="\xA0"),n+=I,r=I==" "}return n}function fi(e,t){return function(r,n,d,I,G,Q,q){d=d?d+" cm-force-border":"cm-force-border";for(var re=r.pos,ge=re+n.length;;){for(var _e=void 0,Oe=0;Oe<t.length&&!(_e=t[Oe],_e.to>re&&_e.from<=re);Oe++);if(_e.to>=ge)return e(r,n,d,I,G,Q,q);e(r,n.slice(0,_e.to-re),d,I,null,Q,q),I=null,n=n.slice(_e.to-re),re=_e.to}}}function Ot(e,t,r,n){var d=!n&&r.widgetNode;d&&e.map.push(e.pos,e.pos+t,d),!n&&e.cm.display.input.needsContentAttribute&&(d||(d=e.content.appendChild(document.createElement("span"))),d.setAttribute("cm-marker",r.id)),d&&(e.cm.display.input.setUneditable(d),e.content.appendChild(d)),e.pos+=t,e.trailingSpace=!1}function Wi(e,t,r){var n=e.markedSpans,d=e.text,I=0;if(!n){for(var G=1;G<r.length;G+=2)t.addToken(t,d.slice(I,I=r[G]),At(r[G+1],t.cm.options));return}for(var Q=d.length,q=0,re=1,ge="",_e,Oe,Ae=0,Fe,je,ze,Ze,nt;;){if(Ae==q){Fe=je=ze=Oe="",nt=null,Ze=null,Ae=Infinity;for(var qe=[],st=void 0,pt=0;pt<n.length;++pt){var ht=n[pt],St=ht.marker;if(St.type=="bookmark"&&ht.from==q&&St.widgetNode)qe.push(St);else if(ht.from<=q&&(ht.to==null||ht.to>q||St.collapsed&&ht.to==q&&ht.from==q)){if(ht.to!=null&&ht.to!=q&&Ae>ht.to&&(Ae=ht.to,je=""),St.className&&(Fe+=" "+St.className),St.css&&(Oe=(Oe?Oe+";":"")+St.css),St.startStyle&&ht.from==q&&(ze+=" "+St.startStyle),St.endStyle&&ht.to==Ae&&(st||(st=[])).push(St.endStyle,ht.to),St.title&&((nt||(nt={})).title=St.title),St.attributes)for(var jt in St.attributes)(nt||(nt={}))[jt]=St.attributes[jt];St.collapsed&&(!Ze||Cn(Ze.marker,St)<0)&&(Ze=ht)}else ht.from>q&&Ae>ht.from&&(Ae=ht.from)}if(st)for(var ti=0;ti<st.length;ti+=2)st[ti+1]==Ae&&(je+=" "+st[ti]);if(!Ze||Ze.from==q)for(var Gt=0;Gt<qe.length;++Gt)Ot(t,0,qe[Gt]);if(Ze&&(Ze.from||0)==q){if(Ot(t,(Ze.to==null?Q+1:Ze.to)-q,Ze.marker,Ze.from==null),Ze.to==null)return;Ze.to==q&&(Ze=!1)}}if(q>=Q)break;for(var Ei=Math.min(Q,Ae);;){if(ge){var vi=q+ge.length;if(!Ze){var Xt=vi>Ei?ge.slice(0,Ei-q):ge;t.addToken(t,Xt,_e?_e+Fe:Fe,ze,q+Xt.length==Ae?je:"",Oe,nt)}if(vi>=Ei){ge=ge.slice(Ei-q),q=Ei;break}q=vi,ze=""}ge=d.slice(I,I=r[re++]),_e=At(r[re++],t.cm.options)}}}function Mt(e,t,r){this.line=t,this.rest=Rn(t),this.size=this.rest?vt(k(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Pi(e,t)}function pi(e,t,r){for(var n=[],d,I=t;I<r;I=d){var G=new Mt(e.doc,Ye(e.doc,I),I);d=I+G.size,n.push(G)}return n}var si=null;function Ci(e){si?si.ops.push(e):e.ownsGroup=si={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var d=e.ops[n];if(d.cursorActivityHandlers)for(;d.cursorActivityCalled<d.cursorActivityHandlers.length;)d.cursorActivityHandlers[d.cursorActivityCalled++].call(null,d.cm)}}while(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Lo(r)}finally{si=null,t(r)}}var ir=null;function ni(e,t){var r=rt(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),d;si?d=si.delayedCallbacks:ir?d=ir:(d=ir=[],setTimeout(Do,0));for(var I=function(Q){d.push(function(){return r[Q].apply(null,n)})},G=0;G<r.length;++G)I(G)}function Do(){var e=ir;ir=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,n){for(var d=0;d<t.changes.length;d++){var I=t.changes[d];I=="text"?Mo(e,t):I=="gutter"?Ja(e,t,r,n):I=="class"?ha(e,t):I=="widget"&&Po(e,t,n)}t.changes=null}function nr(e){return e.node==e.text&&(e.node=f("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&H<8&&(e.node.style.zIndex=2)),e.node}function ko(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=nr(t);t.background=n.insertBefore(f("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):kt(e,t)}function Mo(e,t){var r=t.text.className,n=$a(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,ha(e,t)):r&&(t.text.className=r)}function ha(e,t){ko(e,t),t.line.wrapClass?nr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Ja(e,t,r,n){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 d=nr(t);t.gutterBackground=f("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),d.insertBefore(t.gutterBackground,t.text)}var I=t.line.gutterMarkers;if(e.options.lineNumbers||I){var G=nr(t),Q=t.gutter=f("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),G.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!I||!I["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(f("div",Ht(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),I)for(var q=0;q<e.display.gutterSpecs.length;++q){var re=e.display.gutterSpecs[q].className,ge=I.hasOwnProperty(re)&&I[re];ge&&Q.appendChild(f("div",[ge],"CodeMirror-gutter-elt","left: "+n.gutterLeft[re]+"px; width: "+n.gutterWidth[re]+"px"))}}}function Po(e,t,r){t.alignable&&(t.alignable=null);for(var n=R("CodeMirror-linewidget"),d=t.node.firstChild,I=void 0;d;d=I)I=d.nextSibling,n.test(d.className)&&t.node.removeChild(d);Qa(e,t,r)}function No(e,t,r,n){var d=$a(e,t);return t.text=t.node=d.pre,d.bgClass&&(t.bgClass=d.bgClass),d.textClass&&(t.textClass=d.textClass),ha(e,t),Ja(e,t,r,n),Qa(e,t,n),t.node}function Qa(e,t,r){if(Za(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)Za(e,t.rest[n],t,r,!1)}function Za(e,t,r,n,d){if(!t.widgets)return;for(var I=nr(r),G=0,Q=t.widgets;G<Q.length;++G){var q=Q[G],re=f("div",[q.node],"CodeMirror-linewidget"+(q.className?" "+q.className:""));q.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Fo(q,re,r,n),e.display.input.setUneditable(re),d&&q.above?I.insertBefore(re,r.gutter||r.text):I.appendChild(re),ni(q,"redraw")}}function Fo(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var d=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(d-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=d+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function rr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),E(t.display.measure,f("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Gi(e,t){for(var r=be(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function Fr(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=E(e.measure,f("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function Ni(e){return me-e.display.nativeBarWidth}function hn(e){return e.display.scroller.clientWidth-Ni(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-Ni(e)-e.display.barHeight}function Uo(e,t,r){var n=e.options.lineWrapping,d=n&&hn(e);if(!t.measure.heights||n&&t.measure.width!=d){var I=t.measure.heights=[];if(n){t.measure.width=d;for(var G=t.text.firstChild.getClientRects(),Q=0;Q<G.length-1;Q++){var q=G[Q],re=G[Q+1];Math.abs(q.bottom-re.bottom)>2&&I.push((q.bottom+re.top)/2-r.top)}}I.push(r.bottom-r.top)}}function es(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var d=0;d<e.rest.length;d++)if(vt(e.rest[d])>r)return{map:e.measure.maps[d],cache:e.measure.caches[d],before:!0}}function Bo(e,t){t=xi(t);var r=vt(t),n=e.display.externalMeasured=new Mt(e.doc,t,r);n.lineN=r;var d=n.built=kt(e,n);return n.text=d.pre,E(e.display.lineMeasure,d.pre),n}function ts(e,t,r,n){return Fi(e,On(e,t),r,n)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[fn(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function On(e,t){var r=vt(t),n=fa(e,r);n&&!n.text?n=null:n&&n.changes&&(Ya(e,n,r,ba(e)),e.curOp.forceUpdate=!0),n||(n=Bo(e,t));var d=es(n,t,r);return{line:t,view:n,rect:null,map:d.map,cache:d.cache,before:d.before,hasHeights:!1}}function Fi(e,t,r,n,d){t.before&&(r=-1);var I=r+(n||""),G;return t.cache.hasOwnProperty(I)?G=t.cache[I]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),G=Ho(e,t,r,n),G.bogus||(t.cache[I]=G)),{left:G.left,right:G.right,top:d?G.rtop:G.top,bottom:d?G.rbottom:G.bottom}}var is={left:0,right:0,top:0,bottom:0};function ns(e,t,r){for(var n,d,I,G,Q,q,re=0;re<e.length;re+=3)if(Q=e[re],q=e[re+1],t<Q?(d=0,I=1,G="left"):t<q?(d=t-Q,I=d+1):(re==e.length-3||t==q&&e[re+3]>t)&&(I=q-Q,d=I-1,t>=q&&(G="right")),d!=null){if(n=e[re+2],Q==q&&r==(n.insertLeft?"left":"right")&&(G=r),r=="left"&&d==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)n=e[(re-=3)+2],G="left";if(r=="right"&&d==q-Q)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)n=e[(re+=3)+2],G="right";break}return{node:n,start:d,end:I,collapse:G,coverStart:Q,coverEnd:q}}function jo(e,t){var r=is;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var d=e.length-1;d>=0&&!((r=e[d]).left!=r.right);d--);return r}function Ho(e,t,r,n){var d=ns(t.map,r,n),I=d.node,G=d.start,Q=d.end,q=d.collapse,re;if(I.nodeType==3){for(var ge=0;ge<4;ge++){for(;G&&xe(t.line.text.charAt(d.coverStart+G));)--G;for(;d.coverStart+Q<d.coverEnd&&xe(t.line.text.charAt(d.coverStart+Q));)++Q;if(W&&H<9&&G==0&&Q==d.coverEnd-d.coverStart?re=I.parentNode.getBoundingClientRect():re=jo(v(I,G,Q).getClientRects(),n),re.left||re.right||G==0)break;Q=G,G=G-1,q="right"}W&&H<11&&(re=Wo(e.display.measure,re))}else{G>0&&(q=n="right");var _e;e.options.lineWrapping&&(_e=I.getClientRects()).length>1?re=_e[n=="right"?_e.length-1:0]:re=I.getBoundingClientRect()}if(W&&H<9&&!G&&(!re||!re.left&&!re.right)){var Oe=I.parentNode.getClientRects()[0];Oe?re={left:Oe.left,right:Oe.left+In(e.display),top:Oe.top,bottom:Oe.bottom}:re=is}for(var Ae=re.top-t.rect.top,Fe=re.bottom-t.rect.top,je=(Ae+Fe)/2,ze=t.view.measure.heights,Ze=0;Ze<ze.length-1&&!(je<ze[Ze]);Ze++);var nt=Ze?ze[Ze-1]:0,qe=ze[Ze],st={left:(q=="right"?re.right:re.left)-t.rect.left,right:(q=="left"?re.left:re.right)-t.rect.left,top:nt,bottom:qe};return!re.left&&!re.right&&(st.bogus=!0),e.options.singleCursorHeightPerLine||(st.rtop=Ae,st.rbottom=Fe),st}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Nt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function rs(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 as(e){e.display.externalMeasure=null,w(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rs(e.display.view[t])}function ar(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return g&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=rr(e.widgets[r]));return t}function Ur(e,t,r,n,d){if(!d){var I=pa(t);r.top+=I,r.bottom+=I}if(n=="line")return r;n||(n="local");var G=Ii(t);if(n=="local"?G+=Fr(e.display):G-=e.display.viewOffset,n=="page"||n=="window"){var Q=e.display.lineSpace.getBoundingClientRect();G+=Q.top+(n=="window"?0:os());var q=Q.left+(n=="window"?0:ss());r.left+=q,r.right+=q}return r.top+=G,r.bottom+=G,r}function ls(e,t,r){if(r=="div")return t;var n=t.left,d=t.top;if(r=="page")n-=ss(),d-=os();else if(r=="local"||!r){var I=e.display.sizer.getBoundingClientRect();n+=I.left,d+=I.top}var G=e.display.lineSpace.getBoundingClientRect();return{left:n-G.left,top:d-G.top}}function ma(e,t,r,n,d){return n||(n=Ye(e.doc,t.line)),Ur(e,n,ts(e,n,t.ch,d),r)}function Di(e,t,r,n,d,I){n=n||Ye(e.doc,t.line),d||(d=On(e,n));function G(Fe,je){var ze=Fi(e,d,Fe,je?"right":"left",I);return je?ze.left=ze.right:ze.right=ze.left,Ur(e,n,ze,r)}var Q=Ve(n,e.doc.direction),q=t.ch,re=t.sticky;if(q>=n.text.length?(q=n.text.length,re="before"):q<=0&&(q=0,re="after"),!Q)return G(re=="before"?q-1:q,re=="before");function ge(Fe,je,ze){var Ze=Q[je],nt=Ze.level==1;return G(ze?Fe-1:Fe,nt!=ze)}var _e=We(Q,q,re),Oe=Ge,Ae=ge(q,_e,re=="before");return Oe!=null&&(Ae.other=ge(q,Oe,re!="before")),Ae}function us(e,t){var r=0;t=bt(e.doc,t),e.options.lineWrapping||(r=In(e.display)*t.ch);var n=Ye(e.doc,t.line),d=Ii(n)+Fr(e.display);return{left:r,right:r,top:d,bottom:d+n.height}}function ga(e,t,r,n,d){var I=He(e,t,r);return I.xRel=d,n&&(I.outside=n),I}function va(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return ga(n.first,0,null,-1,-1);var d=Rt(n,r),I=n.first+n.size-1;if(d>I)return ga(n.first+n.size-1,Ye(n,I).text.length,null,1,1);t<0&&(t=0);for(var G=Ye(n,d);;){var Q=Go(e,G,d,t,r),q=An(G,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!q)return Q;var re=q.find(1);if(re.line==d)return re;G=Ye(n,d=re.line)}}function hs(e,t,r,n){n-=pa(t);var d=t.text.length,I=Ne(function(G){return Fi(e,r,G-1).bottom<=n},d,0);return d=Ne(function(G){return Fi(e,r,G).top>n},I,d),{begin:I,end:d}}function ds(e,t,r,n){r||(r=On(e,t));var d=Ur(e,t,Fi(e,r,n),"line").top;return hs(e,t,r,d)}function ya(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Go(e,t,r,n,d){d-=Ii(t);var I=On(e,t),G=pa(t),Q=0,q=t.text.length,re=!0,ge=Ve(t,e.doc.direction);if(ge){var _e=(e.options.lineWrapping?zo:Ko)(e,t,r,I,ge,n,d);re=_e.level!=1,Q=re?_e.from:_e.to-1,q=re?_e.to:_e.from-1}var Oe=null,Ae=null,Fe=Ne(function(pt){var ht=Fi(e,I,pt);return ht.top+=G,ht.bottom+=G,ya(ht,n,d,!1)?(ht.top<=d&&ht.left<=n&&(Oe=pt,Ae=ht),!0):!1},Q,q),je,ze,Ze=!1;if(Ae){var nt=n-Ae.left<Ae.right-n,qe=nt==re;Fe=Oe+(qe?0:1),ze=qe?"after":"before",je=nt?Ae.left:Ae.right}else{!re&&(Fe==q||Fe==Q)&&Fe++,ze=Fe==0?"after":Fe==t.text.length?"before":Fi(e,I,Fe-(re?1:0)).bottom+G<=d==re?"after":"before";var st=Di(e,He(r,Fe,ze),"line",t,I);je=st.left,Ze=d<st.top?-1:d>=st.bottom?1:0}return Fe=Ce(t.text,Fe,1),ga(r,Fe,ze,Ze,n-je)}function Ko(e,t,r,n,d,I,G){var Q=Ne(function(_e){var Oe=d[_e],Ae=Oe.level!=1;return ya(Di(e,He(r,Ae?Oe.to:Oe.from,Ae?"before":"after"),"line",t,n),I,G,!0)},0,d.length-1),q=d[Q];if(Q>0){var re=q.level!=1,ge=Di(e,He(r,re?q.from:q.to,re?"after":"before"),"line",t,n);ya(ge,I,G,!0)&&ge.top>G&&(q=d[Q-1])}return q}function zo(e,t,r,n,d,I,G){var Q=hs(e,t,n,G),q=Q.begin,re=Q.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var ge=null,_e=null,Oe=0;Oe<d.length;Oe++){var Ae=d[Oe];if(Ae.from>=re||Ae.to<=q)continue;var Fe=Ae.level!=1,je=Fi(e,n,Fe?Math.min(re,Ae.to)-1:Math.max(q,Ae.from)).right,ze=je<I?I-je+1e9:je-I;(!ge||_e>ze)&&(ge=Ae,_e=ze)}return ge||(ge=d[d.length-1]),ge.from<q&&(ge={from:q,to:ge.to,level:ge.level}),ge.to>re&&(ge={from:ge.from,to:re,level:ge.level}),ge}var dn;function Ln(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(dn==null){dn=f("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)dn.appendChild(document.createTextNode("x")),dn.appendChild(f("br"));dn.appendChild(document.createTextNode("x"))}E(e.measure,dn);var r=dn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),w(e.measure),r||1}function In(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=f("span","xxxxxxxxxx"),r=f("pre",[t],"CodeMirror-line-like");E(e.measure,r);var n=t.getBoundingClientRect(),d=(n.right-n.left)/10;return d>2&&(e.cachedCharWidth=d),d||10}function ba(e){for(var t=e.display,r={},n={},d=t.gutters.clientLeft,I=t.gutters.firstChild,G=0;I;I=I.nextSibling,++G){var Q=e.display.gutterSpecs[G].className;r[Q]=I.offsetLeft+I.clientLeft+d,n[Q]=I.clientWidth}return{fixedPos:_a(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function _a(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Ln(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/In(e.display)-3);return function(d){if(Pi(e.doc,d))return 0;var I=0;if(d.widgets)for(var G=0;G<d.widgets.length;G++)d.widgets[G].height&&(I+=d.widgets[G].height);return r?I+(Math.ceil(d.text.length/n)||1)*t:I+t}}function Ea(e){var t=e.doc,r=cs(e);t.iter(function(n){var d=r(n);d!=n.height&&ut(n,d)})}function cn(e,t,r,n){var d=e.display;if(!r&&be(t).getAttribute("cm-not-content")=="true")return null;var I,G,Q=d.lineSpace.getBoundingClientRect();try{I=t.clientX-Q.left,G=t.clientY-Q.top}catch(_e){return null}var q=va(e,I,G),re;if(n&&q.xRel>0&&(re=Ye(e.doc,q.line).text).length==q.ch){var ge=V(re,re.length,e.options.tabSize)-re.length;q=He(q.line,Math.max(0,Math.round((I-qa(e.display).left)/In(e.display))-ge))}return q}function fn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function mi(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var d=e.display;if(n&&r<d.viewTo&&(d.updateLineNumbers==null||d.updateLineNumbers>t)&&(d.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=d.viewTo)ui&&qn(e.doc,t)<d.viewTo&&$i(e);else if(r<=d.viewFrom)ui&&Xi(e.doc,r+n)>d.viewFrom?$i(e):(d.viewFrom+=n,d.viewTo+=n);else if(t<=d.viewFrom&&r>=d.viewTo)$i(e);else if(t<=d.viewFrom){var I=Br(e,r,r+n,1);I?(d.view=d.view.slice(I.index),d.viewFrom=I.lineN,d.viewTo+=n):$i(e)}else if(r>=d.viewTo){var G=Br(e,t,t,-1);G?(d.view=d.view.slice(0,G.index),d.viewTo=G.lineN):$i(e)}else{var Q=Br(e,t,t,-1),q=Br(e,r,r+n,1);Q&&q?(d.view=d.view.slice(0,Q.index).concat(pi(e,Q.lineN,q.lineN)).concat(d.view.slice(q.index)),d.viewTo+=n):$i(e)}var re=d.externalMeasured;re&&(r<re.lineN?re.lineN+=n:t<re.lineN+re.size&&(d.externalMeasured=null))}function Yi(e,t,r){e.curOp.viewChanged=!0;var n=e.display,d=e.display.externalMeasured;if(d&&t>=d.lineN&&t<d.lineN+d.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var I=n.view[fn(e,t)];if(I.node==null)return;var G=I.changes||(I.changes=[]);ce(G,r)==-1&&G.push(r)}function $i(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Br(e,t,r,n){var d=fn(e,t),I,G=e.display.view;if(!ui||r==e.doc.first+e.doc.size)return{index:d,lineN:r};for(var Q=e.display.viewFrom,q=0;q<d;q++)Q+=G[q].size;if(Q!=t){if(n>0){if(d==G.length-1)return null;I=Q+G[d].size-t,d++}else I=Q-t;t+=I,r+=I}for(;qn(e.doc,r)!=r;){if(d==(n<0?0:G.length-1))return null;r+=n*G[d-(n<0?1:0)].size,d+=n}return{index:d,lineN:r}}function Vo(e,t,r){var n=e.display,d=n.view;d.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=pi(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=pi(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(fn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(pi(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,fn(e,r)))),n.viewTo=r}function fs(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var d=t[n];!d.hidden&&(!d.node||d.changes)&&++r}return r}function sr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},d=n.cursors=document.createDocumentFragment(),I=n.selection=document.createDocumentFragment(),G=0;G<r.sel.ranges.length;G++){if(!t&&G==r.sel.primIndex)continue;var Q=r.sel.ranges[G];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var q=Q.empty();(q||e.options.showCursorWhenSelecting)&&ms(e,Q.head,d),q||Xo(e,Q,I)}return n}function ms(e,t,r){var n=Di(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),d=r.appendChild(f("div","\xA0","CodeMirror-cursor"));if(d.style.left=n.left+"px",d.style.top=n.top+"px",d.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var I=r.appendChild(f("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));I.style.display="",I.style.left=n.other.left+"px",I.style.top=n.other.top+"px",I.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function jr(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var n=e.display,d=e.doc,I=document.createDocumentFragment(),G=qa(e.display),Q=G.left,q=Math.max(n.sizerWidth,hn(e)-n.sizer.offsetLeft)-G.right,re=d.direction=="ltr";function ge(qe,st,pt,ht){st<0&&(st=0),st=Math.round(st),ht=Math.round(ht),I.appendChild(f("div",null,"CodeMirror-selected","position: absolute; left: "+qe+`px;
|
|
top: `+st+"px; width: "+(pt==null?q-qe:pt)+`px;
|
|
height: `+(ht-st)+"px"))}function _e(qe,st,pt){var ht=Ye(d,qe),St=ht.text.length,jt,ti;function Gt(Xt,yi){return ma(e,He(qe,Xt),"div",ht,yi)}function Ei(Xt,yi,ri){var Jt=ds(e,ht,null,Xt),Yt=yi=="ltr"==(ri=="after")?"left":"right",zt=ri=="after"?Jt.begin:Jt.end-(/\s/.test(ht.text.charAt(Jt.end-1))?2:1);return Gt(zt,Yt)[Yt]}var vi=Ve(ht,d.direction);return Ue(vi,st||0,pt==null?St:pt,function(Xt,yi,ri,Jt){var Yt=ri=="ltr",zt=Gt(Xt,Yt?"left":"right"),bi=Gt(yi-1,Yt?"right":"left"),Kn=st==null&&Xt==0,tn=pt==null&&yi==St,li=Jt==0,Ui=!vi||Jt==vi.length-1;if(bi.top-zt.top<=3){var ii=(re?Kn:tn)&&li,Va=(re?tn:Kn)&&Ui,zi=ii?Q:(Yt?zt:bi).left,yn=Va?q:(Yt?bi:zt).right;ge(zi,zt.top,yn-zi,zt.bottom)}else{var bn,di,zn,Xa;Yt?(bn=re&&Kn&&li?Q:zt.left,di=re?q:Ei(Xt,ri,"before"),zn=re?Q:Ei(yi,ri,"after"),Xa=re&&tn&&Ui?q:bi.right):(bn=re?Ei(Xt,ri,"before"):Q,di=!re&&Kn&&li?q:zt.right,zn=!re&&tn&&Ui?Q:bi.left,Xa=re?Ei(yi,ri,"after"):q),ge(bn,zt.top,di-bn,zt.bottom),zt.bottom<bi.top&&ge(Q,zt.bottom,null,bi.top),ge(zn,bi.top,Xa-zn,bi.bottom)}(!jt||jr(zt,jt)<0)&&(jt=zt),jr(bi,jt)<0&&(jt=bi),(!ti||jr(zt,ti)<0)&&(ti=zt),jr(bi,ti)<0&&(ti=bi)}),{start:jt,end:ti}}var Oe=t.from(),Ae=t.to();if(Oe.line==Ae.line)_e(Oe.line,Oe.ch,Ae.ch);else{var Fe=Ye(d,Oe.line),je=Ye(d,Ae.line),ze=xi(Fe)==xi(je),Ze=_e(Oe.line,Oe.ch,ze?Fe.text.length+1:null).end,nt=_e(Ae.line,ze?0:null,Ae.ch).start;ze&&(Ze.top<nt.top-2?(ge(Ze.right,Ze.top,null,Ze.bottom),ge(Q,nt.top,nt.left,nt.bottom)):ge(Ze.right,Ze.top,nt.left-Ze.right,Ze.bottom)),Ze.bottom<nt.top&&ge(Q,Ze.bottom,null,nt.top)}r.appendChild(I)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Dn(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(le(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(),i&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(le(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Hr(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var d=t.view[n],I=e.options.lineWrapping,G=void 0,Q=0;if(d.hidden)continue;if(W&&H<8){var q=d.node.offsetTop+d.node.offsetHeight;G=q-r,r=q}else{var re=d.node.getBoundingClientRect();G=re.bottom-re.top,!I&&d.text.firstChild&&(Q=d.text.firstChild.getBoundingClientRect().right-re.left-1)}var ge=d.line.height-G;if((ge>.005||ge<-.005)&&(ut(d.line,G),ys(d.line),d.rest))for(var _e=0;_e<d.rest.length;_e++)ys(d.rest[_e]);if(Q>e.display.sizerWidth){var Oe=Math.ceil(Q/In(e.display));Oe>e.display.maxLineLength&&(e.display.maxLineLength=Oe,e.display.maxLine=d.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Wr(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Fr(e));var d=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,I=Rt(t,n),G=Rt(t,d);if(r&&r.ensure){var Q=r.ensure.from.line,q=r.ensure.to.line;Q<I?(I=Q,G=Rt(t,Ii(Ye(t,Q))+e.wrapper.clientHeight)):Math.min(q,t.lastLine())>=G&&(I=Rt(t,Ii(Ye(t,q))-e.wrapper.clientHeight),G=q)}return{from:I,to:Math.max(G,I+1)}}function Yo(e,t){if(Z(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),d=null;if(t.top+n.top<0?d=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(d=!1),d!=null&&!o){var I=f("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Fr(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ni(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(I),I.scrollIntoView(d),e.display.lineSpace.removeChild(I)}}function $o(e,t,r,n){n==null&&(n=0);var d;!e.options.lineWrapping&&t==r&&(t=t.ch?He(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?He(t.line,t.ch+1,"before"):t);for(var I=0;I<5;I++){var G=!1,Q=Di(e,t),q=!r||r==t?Q:Di(e,r);d={left:Math.min(Q.left,q.left),top:Math.min(Q.top,q.top)-n,right:Math.max(Q.left,q.left),bottom:Math.max(Q.bottom,q.bottom)+n};var re=wa(e,d),ge=e.doc.scrollTop,_e=e.doc.scrollLeft;if(re.scrollTop!=null&&(lr(e,re.scrollTop),Math.abs(e.doc.scrollTop-ge)>1&&(G=!0)),re.scrollLeft!=null&&(pn(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-_e)>1&&(G=!0)),!G)break}return d}function Jo(e,t){var r=wa(e,t);r.scrollTop!=null&&lr(e,r.scrollTop),r.scrollLeft!=null&&pn(e,r.scrollLeft)}function wa(e,t){var r=e.display,n=Ln(e.display);t.top<0&&(t.top=0);var d=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,I=ca(e),G={};t.bottom-t.top>I&&(t.bottom=t.top+I);var Q=e.doc.height+da(r),q=t.top<n,re=t.bottom>Q-n;if(t.top<d)G.scrollTop=q?0:t.top;else if(t.bottom>d+I){var ge=Math.min(t.top,(re?Q:t.bottom)-I);ge!=d&&(G.scrollTop=ge)}var _e=e.options.fixedGutter?0:r.gutters.offsetWidth,Oe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-_e,Ae=hn(e)-r.gutters.offsetWidth,Fe=t.right-t.left>Ae;return Fe&&(t.right=t.left+Ae),t.left<10?G.scrollLeft=0:t.left<Oe?G.scrollLeft=Math.max(0,t.left+_e-(Fe?0:10)):t.right>Ae+Oe-3&&(G.scrollLeft=t.right+(Fe?0:10)-Ae),G}function Sa(e,t){if(t==null)return;Gr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function kn(e){Gr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function or(e,t,r){(t!=null||r!=null)&&Gr(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qo(e,t){Gr(e),e.curOp.scrollToPos=t}function Gr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),n=us(e,t.to);bs(e,r,n,t.margin)}}function bs(e,t,r,n){var d=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});or(e,d.scrollLeft,d.scrollTop)}function lr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Aa(e,{top:t}),_s(e,t,!0),D&&Aa(e),dr(e,100)}function _s(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function pn(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ur(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+da(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var mn=function(e,t,r){this.cm=r;var n=this.vert=f("div",[f("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),d=this.horiz=f("div",[f("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=d.tabIndex=-1,e(n),e(d),Me(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Me(d,"scroll",function(){d.clientWidth&&t(d.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};mn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var d=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+d)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var I=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+I)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},mn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},mn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},mn.prototype.zeroWidthHack=function(){var e=s&&!u?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ne,this.disableVert=new ne},mn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var d=e.getBoundingClientRect(),I=r=="vert"?document.elementFromPoint(d.right-1,(d.top+d.bottom)/2):document.elementFromPoint((d.right+d.left)/2,d.bottom-1);I!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},mn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hr=function(){};hr.prototype.update=function(){return{bottom:0,right:0}},hr.prototype.setScrollLeft=function(){},hr.prototype.setScrollTop=function(){},hr.prototype.clear=function(){};function Mn(e,t){t||(t=ur(e));var r=e.display.barWidth,n=e.display.barHeight;Es(e,t);for(var d=0;d<4&&r!=e.display.barWidth||n!=e.display.barHeight;d++)r!=e.display.barWidth&&e.options.lineWrapping&&Hr(e),Es(e,ur(e)),r=e.display.barWidth,n=e.display.barHeight}function Es(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:mn,null:hr};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&S(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?pn(e,t):lr(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function gn(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:++Zo},Ci(e.curOp)}function vn(e){var t=e.curOp;t&&Io(t,function(r){for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var n=0;n<t.length;n++)tl(t[n]);for(var d=0;d<t.length;d++)il(t[d]);for(var I=0;I<t.length;I++)nl(t[I]);for(var G=0;G<t.length;G++)rl(t[G])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&Nr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Kr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,r=t.display;e.updatedDisplay&&Hr(t),e.barMeasure=ur(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-hn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.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&&pn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==U();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Mn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function rl(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&ws(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&_s(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&pn(t,e.scrollLeft,!0,!0),e.scrollToPos){var d=$o(t,bt(n,e.scrollToPos.from),bt(n,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,d)}var I=e.maybeHiddenMarkers,G=e.maybeUnhiddenMarkers;if(I)for(var Q=0;Q<I.length;++Q)I[Q].lines.length||le(I[Q],"hide");if(G)for(var q=0;q<G.length;++q)G[q].lines.length&&le(G[q],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function _i(e,t){if(e.curOp)return t();gn(e);try{return t()}finally{vn(e)}}function qt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);gn(e);try{return t.apply(e,arguments)}finally{vn(e)}}}function hi(e){return function(){if(this.curOp)return e.apply(this,arguments);gn(this);try{return e.apply(this,arguments)}finally{vn(this)}}}function ei(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);gn(t);try{return e.apply(this,arguments)}finally{vn(t)}}}function dr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Ai(e,t.highlightFrontier),d=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(I){if(n.line>=e.display.viewFrom){var G=I.styles,Q=I.text.length>e.options.maxHighlightLength?xt(t.mode,n.state):null,q=Vn(e,I,n,!0);Q&&(n.state=Q),I.styles=q.styles;var re=I.styleClasses,ge=q.classes;ge?I.styleClasses=ge:re&&(I.styleClasses=null);for(var _e=!G||G.length!=I.styles.length||re!=ge&&(!re||!ge||re.bgClass!=ge.bgClass||re.textClass!=ge.textClass),Oe=0;!_e&&Oe<G.length;++Oe)_e=G[Oe]!=I.styles[Oe];_e&&d.push(n.line),I.stateAfter=n.save(),n.nextLine()}else I.text.length<=e.options.maxHighlightLength&&Xn(e,I.text,n),I.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return dr(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),d.length&&_i(e,function(){for(var I=0;I<d.length;I++)Yi(e,d[I],"text")})}var Kr=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Wr(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=hn(e),this.force=r,this.dims=ba(e),this.events=[]};Kr.prototype.signal=function(e,t){se(e,t)&&this.events.push(arguments)},Kr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)le.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ni(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=U();if(!t||!y(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&y(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==U())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return $i(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Cs(e)&&($i(e),t.dims=ba(e));var d=n.first+n.size,I=Math.max(t.visible.from-e.options.viewportMargin,n.first),G=Math.min(d,t.visible.to+e.options.viewportMargin);r.viewFrom<I&&I-r.viewFrom<20&&(I=Math.max(n.first,r.viewFrom)),r.viewTo>G&&r.viewTo-G<20&&(G=Math.min(d,r.viewTo)),ui&&(I=qn(e.doc,I),G=Xi(e.doc,G));var Q=I!=r.viewFrom||G!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,I,G),r.viewOffset=Ii(Ye(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var q=fs(e);if(!Q&&q==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var re=ol(e);return q>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),q>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(re),w(r.cursorDiv),w(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Q&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,dr(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==hn(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+da(e.display)-ca(e),r.top)}),t.visible=Wr(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Wr(e.display,e.doc,r));if(!Ca(e,t))break;Hr(e);var d=ur(e);sr(e),Mn(e,d),Oa(e,d),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var r=new Kr(e,t);if(Ca(e,r)){Hr(e),ws(e,r);var n=ur(e);sr(e),Mn(e,n),Oa(e,n),r.finish()}}function ul(e,t,r){var n=e.display,d=e.options.lineNumbers,I=n.lineDiv,G=I.firstChild;function Q(Fe){var je=Fe.nextSibling;return i&&s&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),je}for(var q=n.view,re=n.viewFrom,ge=0;ge<q.length;ge++){var _e=q[ge];if(!_e.hidden)if(!_e.node||_e.node.parentNode!=I){var Oe=No(e,_e,re,r);I.insertBefore(Oe,G)}else{for(;G!=_e.node;)G=Q(G);var Ae=d&&t!=null&&t<=re&&_e.lineNumber;_e.changes&&(ce(_e.changes,"gutter")>-1&&(Ae=!1),Ya(e,_e,re,r)),Ae&&(w(_e.lineNumber),_e.lineNumber.appendChild(document.createTextNode(Ht(e.options,re)))),G=_e.node.nextSibling}re+=_e.size}for(;G;)G=Q(G)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ni(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=_a(t)-t.scroller.scrollLeft+e.doc.scrollLeft,d=t.gutters.offsetWidth,I=n+"px",G=0;G<r.length;G++)if(!r[G].hidden){e.options.fixedGutter&&(r[G].gutter&&(r[G].gutter.style.left=I),r[G].gutterBackground&&(r[G].gutterBackground.style.left=I));var Q=r[G].alignable;if(Q)for(var q=0;q<Q.length;q++)Q[q].style.left=I}e.options.fixedGutter&&(t.gutters.style.left=n+d+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Ht(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var d=n.measure.appendChild(f("div",[f("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),I=d.firstChild.offsetWidth,G=d.offsetWidth-I;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(I,n.lineGutter.offsetWidth-G)+1,n.lineNumWidth=n.lineNumInnerWidth+G,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Ra(e.display),!0}return!1}function La(e,t){for(var r=[],n=!1,d=0;d<e.length;d++){var I=e[d],G=null;if(typeof I!="string"&&(G=I.style,I=I.className),I=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:I,style:G})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;w(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var d=r[n],I=d.className,G=d.style,Q=t.appendChild(f("div",null,"CodeMirror-gutter "+I));G&&(Q.style.cssText=G),I=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ra(e)}function cr(e){As(e.display),mi(e),Ss(e)}function hl(e,t,r,n){var d=this;this.input=r,d.scrollbarFiller=f("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=f("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=x("div",null,"CodeMirror-code"),d.selectionDiv=f("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=f("div",null,"CodeMirror-cursors"),d.measure=f("div",null,"CodeMirror-measure"),d.lineMeasure=f("div",null,"CodeMirror-measure"),d.lineSpace=x("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none");var I=x("div",[d.lineSpace],"CodeMirror-lines");d.mover=f("div",[I],null,"position: relative"),d.sizer=f("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=f("div",null,null,"position: absolute; height: "+me+"px; width: 1px;"),d.gutters=f("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=f("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=f("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),W&&H<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),!i&&!(D&&h)&&(d.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(d.wrapper):e(d.wrapper)),d.viewFrom=d.viewTo=t.first,d.reportedViewFrom=d.reportedViewTo=t.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,d.gutterSpecs=La(n.gutters,n.lineNumbers),As(d),r.init(d)}var zr=0,Ti=null;W?Ti=-.53:D?Ti=15:g?Ti=-.7:m&&(Ti=-1/3);function Rs(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function dl(e){var t=Rs(e);return t.x*=Ti,t.y*=Ti,t}function Os(e,t){var r=Rs(t),n=r.x,d=r.y,I=e.display,G=I.scroller,Q=G.scrollWidth>G.clientWidth,q=G.scrollHeight>G.clientHeight;if(!(n&&Q||d&&q))return;if(d&&s&&i){e:for(var re=t.target,ge=I.view;re!=G;re=re.parentNode)for(var _e=0;_e<ge.length;_e++)if(ge[_e].node==re){e.display.currentWheelTarget=re;break e}}if(n&&!D&&!c&&Ti!=null){d&&q&&lr(e,Math.max(0,G.scrollTop+d*Ti)),pn(e,Math.max(0,G.scrollLeft+n*Ti)),(!d||d&&q)&&ie(t),I.wheelStartX=null;return}if(d&&Ti!=null){var Oe=d*Ti,Ae=e.doc.scrollTop,Fe=Ae+I.wrapper.clientHeight;Oe<0?Ae=Math.max(0,Ae+Oe-50):Fe=Math.min(e.doc.height,Fe+Oe+50),Aa(e,{top:Ae,bottom:Fe})}zr<20&&(I.wheelStartX==null?(I.wheelStartX=G.scrollLeft,I.wheelStartY=G.scrollTop,I.wheelDX=n,I.wheelDY=d,setTimeout(function(){if(I.wheelStartX==null)return;var je=G.scrollLeft-I.wheelStartX,ze=G.scrollTop-I.wheelStartY,Ze=ze&&I.wheelDY&&ze/I.wheelDY||je&&I.wheelDX&&je/I.wheelDX;if(I.wheelStartX=I.wheelStartY=null,!Ze)return;Ti=(Ti*zr+Ze)/(zr+1),++zr},200)):(I.wheelDX+=n,I.wheelDY+=d))}var wi=function(e,t){this.ranges=e,this.primIndex=t};wi.prototype.primary=function(){return this.ranges[this.primIndex]},wi.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 r=this.ranges[t],n=e.ranges[t];if(!nn(r.anchor,n.anchor)||!nn(r.head,n.head))return!1}return!0},wi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Pt(_n(this.ranges[t].anchor),_n(this.ranges[t].head));return new wi(e,this.primIndex)},wi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},wi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(mt(t,n.from())>=0&&mt(e,n.to())<=0)return r}return-1};var Pt=function(e,t){this.anchor=e,this.head=t};Pt.prototype.from=function(){return rn(this.anchor,this.head)},Pt.prototype.to=function(){return En(this.anchor,this.head)},Pt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ki(e,t,r){var n=e&&e.options.selectionsMayTouch,d=t[r];t.sort(function(Oe,Ae){return mt(Oe.from(),Ae.from())}),r=ce(t,d);for(var I=1;I<t.length;I++){var G=t[I],Q=t[I-1],q=mt(Q.to(),G.from());if(n&&!G.empty()?q>0:q>=0){var re=rn(Q.from(),G.from()),ge=En(Q.to(),G.to()),_e=Q.empty()?G.from()==G.head:Q.from()==Q.head;I<=r&&--r,t.splice(--I,2,new Pt(_e?ge:re,_e?re:ge))}}return new wi(t,r)}function Ji(e,t){return new wi([new Pt(e,t||e)],0)}function Qi(e){return e.text?He(e.from.line+e.text.length-1,k(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(mt(e,t.from)<0)return e;if(mt(e,t.to)<=0)return Qi(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Qi(t).ch-t.to.ch),He(r,n)}function Ia(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var d=e.sel.ranges[n];r.push(new Pt(Ls(d.anchor,t),Ls(d.head,t)))}return ki(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?He(r.line,e.ch-t.ch+r.ch):He(r.line+(e.line-t.line),e.ch)}function cl(e,t,r){for(var n=[],d=He(e.first,0),I=d,G=0;G<t.length;G++){var Q=t[G],q=Is(Q.from,d,I),re=Is(Qi(Q),d,I);if(d=Q.to,I=re,r=="around"){var ge=e.sel.ranges[G],_e=mt(ge.head,ge.anchor)<0;n[G]=new Pt(_e?re:q,_e?q:re)}else n[G]=new Pt(q,q)}return new wi(n,e.sel.primIndex)}function Da(e){e.doc.mode=Zt(e.options,e.doc.modeOption),fr(e)}function fr(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,dr(e,100),e.state.modeGen++,e.curOp&&mi(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&k(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,r,n){function d(nt){return r?r[nt]:null}function I(nt,qe,st){ua(nt,qe,st,n),ni(nt,"change",nt,t)}function G(nt,qe){for(var st=[],pt=nt;pt<qe;++pt)st.push(new un(re[pt],d(pt),n));return st}var Q=t.from,q=t.to,re=t.text,ge=Ye(e,Q.line),_e=Ye(e,q.line),Oe=k(re),Ae=d(re.length-1),Fe=q.line-Q.line;if(t.full)e.insert(0,G(0,re.length)),e.remove(re.length,e.size-re.length);else if(Ds(e,t)){var je=G(0,re.length-1);I(_e,_e.text,Ae),Fe&&e.remove(Q.line,Fe),je.length&&e.insert(Q.line,je)}else if(ge==_e)if(re.length==1)I(ge,ge.text.slice(0,Q.ch)+Oe+ge.text.slice(q.ch),Ae);else{var ze=G(1,re.length-1);ze.push(new un(Oe+ge.text.slice(q.ch),Ae,n)),I(ge,ge.text.slice(0,Q.ch)+re[0],d(0)),e.insert(Q.line+1,ze)}else if(re.length==1)I(ge,ge.text.slice(0,Q.ch)+re[0]+_e.text.slice(q.ch),d(0)),e.remove(Q.line+1,Fe);else{I(ge,ge.text.slice(0,Q.ch)+re[0],d(0)),I(_e,Oe+_e.text.slice(q.ch),Ae);var Ze=G(1,re.length-1);Fe>1&&e.remove(Q.line+1,Fe-1),e.insert(Q.line+1,Ze)}ni(e,"change",e,t)}function Zi(e,t,r){function n(d,I,G){if(d.linked)for(var Q=0;Q<d.linked.length;++Q){var q=d.linked[Q];if(q.doc==I)continue;var re=G&&q.sharedHist;if(r&&!re)continue;t(q.doc,re),n(q.doc,d,re)}}n(e,null,!0)}function ks(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Da(e),Ms(e),e.options.lineWrapping||Nr(e),e.options.mode=t.modeOption,mi(e)}function Ms(e){(e.doc.direction=="rtl"?B:S)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){_i(e,function(){Ms(e),mi(e)})}function Vr(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var r={from:_n(t.from),to:Qi(t),text:wt(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),Zi(e,function(n){return Fs(n,r,t.from.line,t.to.line+1)},!0),r}function Ps(e){for(;e.length;){var t=k(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ps(e.done),k(e.done);if(e.done.length&&!k(e.done).ranges)return k(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),k(e.done)}function Ns(e,t,r,n){var d=e.history;d.undone.length=0;var I=+new Date,G,Q;if((d.lastOp==n||d.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&d.lastModTime>I-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(G=pl(d,d.lastOp==n)))Q=k(G.changes),mt(t.from,t.to)==0&&mt(t.from,Q.to)==0?Q.to=Qi(t):G.changes.push(Ma(e,t));else{var q=k(d.done);for((!q||!q.ranges)&&Xr(e.sel,d.done),G={changes:[Ma(e,t)],generation:d.generation},d.done.push(G);d.done.length>d.undoDepth;)d.done.shift(),d.done[0].ranges||d.done.shift()}d.done.push(r),d.generation=++d.maxGeneration,d.lastModTime=d.lastSelTime=I,d.lastOp=d.lastSelOp=n,d.lastOrigin=d.lastSelOrigin=t.origin,Q||le(e,"historyAdded")}function ml(e,t,r,n){var d=t.charAt(0);return d=="*"||d=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,n){var d=e.history,I=n&&n.origin;r==d.lastSelOp||I&&d.lastSelOrigin==I&&(d.lastModTime==d.lastSelTime&&d.lastOrigin==I||ml(e,I,k(d.done),t))?d.done[d.done.length-1]=t:Xr(t,d.done),d.lastSelTime=+new Date,d.lastSelOrigin=I,d.lastSelOp=r,n&&n.clearRedo!==!1&&Ps(d.undone)}function Xr(e,t){var r=k(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,n){var d=t["spans_"+e.id],I=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(G){G.markedSpans&&((d||(d=t["spans_"+e.id]={}))[I]=G.markedSpans),++I})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],d=0;d<t.text.length;++d)n.push(vl(r[d]));return n}function Us(e,t){var r=yl(e,t),n=wn(e,t);if(!r)return n;if(!n)return r;for(var d=0;d<r.length;++d){var I=r[d],G=n[d];if(I&&G){e:for(var Q=0;Q<G.length;++Q){for(var q=G[Q],re=0;re<I.length;++re)if(I[re].marker==q.marker)continue e;I.push(q)}}else G&&(r[d]=G)}return r}function Pn(e,t,r){for(var n=[],d=0;d<e.length;++d){var I=e[d];if(I.ranges){n.push(r?wi.prototype.deepCopy.call(I):I);continue}var G=I.changes,Q=[];n.push({changes:Q});for(var q=0;q<G.length;++q){var re=G[q],ge=void 0;if(Q.push({from:re.from,to:re.to,text:re.text}),t)for(var _e in re)(ge=_e.match(/^spans_(\d+)$/))&&(ce(t,Number(ge[1]))>-1&&(k(Q)[_e]=re[_e],delete re[_e]))}}return n}function Pa(e,t,r,n){if(n){var d=e.anchor;if(r){var I=mt(t,d)<0;I!=mt(r,d)<0?(d=t,t=r):I!=mt(t,r)<0&&(t=r)}return new Pt(d,t)}else return new Pt(r||t,t)}function Yr(e,t,r,n,d){d==null&&(d=e.cm&&(e.cm.display.shift||e.extend)),oi(e,new wi([Pa(e.sel.primary(),t,r,d)],0),n)}function Bs(e,t,r){for(var n=[],d=e.cm&&(e.cm.display.shift||e.extend),I=0;I<e.sel.ranges.length;I++)n[I]=Pa(e.sel.ranges[I],t[I],null,d);var G=ki(e.cm,n,e.sel.primIndex);oi(e,G,r)}function Na(e,t,r,n){var d=e.sel.ranges.slice(0);d[t]=r,oi(e,ki(e.cm,d,e.sel.primIndex),n)}function js(e,t,r,n){oi(e,Ji(t,r),n)}function bl(e,t,r){var n={ranges:t.ranges,update:function(d){this.ranges=[];for(var I=0;I<d.length;I++)this.ranges[I]=new Pt(bt(e,d[I].anchor),bt(e,d[I].head))},origin:r&&r.origin};return le(e,"beforeSelectionChange",e,n),e.cm&&le(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?ki(e.cm,n.ranges,n.ranges.length-1):t}function Hs(e,t,r){var n=e.history.done,d=k(n);d&&d.ranges?(n[n.length-1]=t,$r(e,t,r)):oi(e,t,r)}function oi(e,t,r){$r(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $r(e,t,r){(se(e,"beforeSelectionChange")||e.cm&&se(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var n=r&&r.bias||(mt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,Ks(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&kn(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ee(e.cm)),ni(e,"cursorActivity",e)}function Gs(e){Ws(e,Ks(e,e.sel,null,!1))}function Ks(e,t,r,n){for(var d,I=0;I<t.ranges.length;I++){var G=t.ranges[I],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[I],q=Jr(e,G.anchor,Q&&Q.anchor,r,n),re=Jr(e,G.head,Q&&Q.head,r,n);(d||q!=G.anchor||re!=G.head)&&(d||(d=t.ranges.slice(0,I)),d[I]=new Pt(q,re))}return d?ki(e.cm,d,t.primIndex):t}function Nn(e,t,r,n,d){var I=Ye(e,t.line);if(I.markedSpans)for(var G=0;G<I.markedSpans.length;++G){var Q=I.markedSpans[G],q=Q.marker,re="selectLeft"in q?!q.selectLeft:q.inclusiveLeft,ge="selectRight"in q?!q.selectRight:q.inclusiveRight;if((Q.from==null||(re?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(ge?Q.to>=t.ch:Q.to>t.ch))){if(d&&(le(q,"beforeCursorEnter"),q.explicitlyCleared))if(I.markedSpans){--G;continue}else break;if(!q.atomic)continue;if(r){var _e=q.find(n<0?1:-1),Oe=void 0;if((n<0?ge:re)&&(_e=zs(e,_e,-n,_e&&_e.line==t.line?I:null)),_e&&_e.line==t.line&&(Oe=mt(_e,r))&&(n<0?Oe<0:Oe>0))return Nn(e,_e,t,n,d)}var Ae=q.find(n<0?-1:1);return(n<0?re:ge)&&(Ae=zs(e,Ae,n,Ae.line==t.line?I:null)),Ae?Nn(e,Ae,t,n,d):null}}return t}function Jr(e,t,r,n,d){var I=n||1,G=Nn(e,t,r,I,d)||!d&&Nn(e,t,r,I,!0)||Nn(e,t,r,-I,d)||!d&&Nn(e,t,r,-I,!0);return G||(e.cantEdit=!0,He(e.first,0))}function zs(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?bt(e,He(t.line-1)):null:r>0&&t.ch==(n||Ye(e,t.line)).text.length?t.line<e.first+e.size-1?He(t.line+1,0):null:new He(t.line,t.ch+r)}function Vs(e){e.setSelection(He(e.firstLine(),0),He(e.lastLine()),we)}function Xs(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(d,I,G,Q){d&&(n.from=bt(e,d)),I&&(n.to=bt(e,I)),G&&(n.text=G),Q!==void 0&&(n.origin=Q)}),le(e,"beforeChange",e,n),e.cm&&le(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Fn(e,t,r){if(e.cm){if(!e.cm.curOp)return qt(e.cm,Fn)(e,t,r);if(e.cm.state.suppressEdits)return}if((se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var n=Qn&&!r&&kr(e,t.from,t.to);if(n)for(var d=n.length-1;d>=0;--d)Ys(e,{from:n[d].from,to:n[d].to,text:d?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&mt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),pr(e,t,r,wn(e,t));var n=[];Zi(e,function(d,I){!I&&ce(n,d.history)==-1&&(Zs(d.history,t),n.push(d.history)),pr(d,t,null,wn(d,t))})}function Qr(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var d=e.history,I,G=e.sel,Q=t=="undo"?d.done:d.undone,q=t=="undo"?d.undone:d.done,re=0;re<Q.length&&!(I=Q[re],r?I.ranges&&!I.equals(e.sel):!I.ranges);re++);if(re==Q.length)return;for(d.lastOrigin=d.lastSelOrigin=null;;)if(I=Q.pop(),I.ranges){if(Xr(I,q),r&&!I.equals(e.sel)){oi(e,I,{clearRedo:!1});return}G=I}else if(n){Q.push(I);return}else break;var ge=[];Xr(G,q),q.push({changes:ge,generation:d.generation}),d.generation=I.generation||++d.maxGeneration;for(var _e=se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"),Oe=function(je){var ze=I.changes[je];if(ze.origin=t,_e&&!Xs(e,ze,!1))return Q.length=0,{};ge.push(Ma(e,ze));var Ze=je?Ia(e,ze):k(Q);pr(e,ze,Ze,Us(e,ze)),!je&&e.cm&&e.cm.scrollIntoView({from:ze.from,to:Qi(ze)});var nt=[];Zi(e,function(qe,st){!st&&ce(nt,qe.history)==-1&&(Zs(qe.history,ze),nt.push(qe.history)),pr(qe,ze,null,Us(qe,ze))})},Ae=I.changes.length-1;Ae>=0;--Ae){var Fe=Oe(Ae);if(Fe)return Fe.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new wi(F(e.sel.ranges,function(d){return new Pt(He(d.anchor.line+t,d.anchor.ch),He(d.head.line+t,d.head.ch))}),e.sel.primIndex),e.cm){mi(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Yi(e.cm,n,"gutter")}}function pr(e,t,r,n){if(e.cm&&!e.cm.curOp)return qt(e.cm,pr)(e,t,r,n);if(t.to.line<e.first){$s(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 d=t.text.length-1-(e.first-t.from.line);$s(e,d),t={from:He(e.first,0),to:He(t.to.line+d,t.to.ch),text:[k(t.text)],origin:t.origin}}var I=e.lastLine();t.to.line>I&&(t={from:t.from,to:He(I,Ye(e,I).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wt(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?_l(e.cm,t,n):ka(e,t,n),$r(e,r,we),e.cantEdit&&Jr(e,He(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,r){var n=e.doc,d=e.display,I=t.from,G=t.to,Q=!1,q=I.line;e.options.lineWrapping||(q=vt(xi(Ye(n,I.line))),n.iter(q,G.line+1,function(Ae){if(Ae==d.maxLine)return Q=!0,!0})),n.sel.contains(t.from,t.to)>-1&&ee(e),ka(n,t,r,cs(e)),e.options.lineWrapping||(n.iter(q,I.line+t.text.length,function(Ae){var Fe=tr(Ae);Fe>d.maxLineLength&&(d.maxLine=Ae,d.maxLineLength=Fe,d.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),aa(n,I.line),dr(e,400);var re=t.text.length-(G.line-I.line)-1;t.full?mi(e):I.line==G.line&&t.text.length==1&&!Ds(e.doc,t)?Yi(e,I.line,"text"):mi(e,I.line,G.line+1,re);var ge=se(e,"changes"),_e=se(e,"change");if(_e||ge){var Oe={from:I,to:G,text:t.text,removed:t.removed,origin:t.origin};_e&&ni(e,"change",e,Oe),ge&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Oe)}e.display.selForContextMenu=null}function Un(e,t,r,n,d){var I;n||(n=r),mt(n,r)<0&&(I=[n,r],r=I[0],n=I[1]),typeof t=="string"&&(t=e.splitLines(t)),Fn(e,{from:r,to:n,text:t,origin:d})}function Js(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Qs(e,t,r,n){for(var d=0;d<e.length;++d){var I=e[d],G=!0;if(I.ranges){I.copied||(I=e[d]=I.deepCopy(),I.copied=!0);for(var Q=0;Q<I.ranges.length;Q++)Js(I.ranges[Q].anchor,t,r,n),Js(I.ranges[Q].head,t,r,n);continue}for(var q=0;q<I.changes.length;++q){var re=I.changes[q];if(r<re.from.line)re.from=He(re.from.line+n,re.from.ch),re.to=He(re.to.line+n,re.to.ch);else if(t<=re.to.line){G=!1;break}}G||(e.splice(0,d+1),d=0)}}function Zs(e,t){var r=t.from.line,n=t.to.line,d=t.text.length-(n-r)-1;Qs(e.done,r,n,d),Qs(e.undone,r,n,d)}function mr(e,t,r,n){var d=t,I=t;return typeof t=="number"?I=Ye(e,xn(e,t)):d=vt(t),d==null?null:(n(I,d)&&e.cm&&Yi(e.cm,d,r),I)}function gr(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}gr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var d=this.lines[r];this.height-=d.height,ot(d),ni(d,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function vr(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var d=e[n];t+=d.chunkSize(),r+=d.height,d.parent=this}this.size=t,this.height=r,this.parent=null}vr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],d=n.chunkSize();if(e<d){var I=Math.min(t,d-e),G=n.height;if(n.removeInner(e,I),this.height-=G-n.height,d==I&&(this.children.splice(r--,1),n.parent=null),(t-=I)==0)break;e=0}else e-=d}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gr))){var Q=[];this.collapse(Q),this.children=[new gr(Q)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var d=this.children[n],I=d.chunkSize();if(e<=I){if(d.insertInner(e,t,r),d.lines&&d.lines.length>50){for(var G=d.lines.length%25+25,Q=G;Q<d.lines.length;){var q=new gr(d.lines.slice(Q,Q+=25));d.height-=q.height,this.children.splice(++n,0,q),q.parent=this}d.lines=d.lines.slice(0,G),this.maybeSpill()}break}e-=I}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new vr(t);if(e.parent){e.size-=r.size,e.height-=r.height;var d=ce(e.parent.children,e);e.parent.children.splice(d+1,0,r)}else{var n=new vr(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var d=this.children[n],I=d.chunkSize();if(e<I){var G=Math.min(t,I-e);if(d.iterN(e,G,r))return!0;if((t-=G)==0)break;e=0}else e-=I}}};var yr=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};yr.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=vt(r);if(n==null||!t)return;for(var d=0;d<t.length;++d)t[d]==this&&t.splice(d--,1);t.length||(r.widgets=null);var I=rr(this);ut(r,Math.max(0,r.height-I)),e&&(_i(e,function(){qs(e,r,-I),Yi(e,n,"widget")}),ni(e,"lineWidgetCleared",e,this,n))},yr.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var d=rr(this)-t;if(!d)return;Pi(this.doc,n)||ut(n,n.height+d),r&&_i(r,function(){r.curOp.forceUpdate=!0,qs(r,n,d),ni(r,"lineWidgetChanged",r,e,vt(n))})},he(yr);function qs(e,t,r){Ii(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,n){var d=new yr(e,r,n),I=e.cm;return I&&d.noHScroll&&(I.display.alignWidgets=!0),mr(e,t,"widget",function(G){var Q=G.widgets||(G.widgets=[]);if(d.insertAt==null?Q.push(d):Q.splice(Math.min(Q.length-1,Math.max(0,d.insertAt)),0,d),d.line=G,I&&!Pi(e,G)){var q=Ii(G)<e.scrollTop;ut(G,G.height+rr(d)),q&&Sa(I,d.height),I.curOp.forceUpdate=!0}return!0}),I&&ni(I,"lineWidgetAdded",I,d,typeof t=="number"?t:vt(t)),d}var eo=0,qi=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};qi.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&gn(e),se(this,"clear")){var r=this.find();r&&ni(this,"clear",r.from,r.to)}for(var n=null,d=null,I=0;I<this.lines.length;++I){var G=this.lines[I],Q=Li(G.markedSpans,this);e&&!this.collapsed?Yi(e,vt(G),"text"):e&&(Q.to!=null&&(d=vt(G)),Q.from!=null&&(n=vt(G))),G.markedSpans=Zn(G.markedSpans,Q),Q.from==null&&this.collapsed&&!Pi(this.doc,G)&&e&&ut(G,Ln(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var q=0;q<this.lines.length;++q){var re=xi(this.lines[q]),ge=tr(re);ge>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=ge,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&mi(e,n,d+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&ni(e,"markerCleared",e,this,n,d),t&&vn(e),this.parent&&this.parent.clear()},qi.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,d=0;d<this.lines.length;++d){var I=this.lines[d],G=Li(I.markedSpans,this);if(G.from!=null&&(r=He(t?I:vt(I),G.from),e==-1))return r;if(G.to!=null&&(n=He(t?I:vt(I),G.to),e==1))return n}return r&&{from:r,to:n}},qi.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;_i(n,function(){var d=t.line,I=vt(t.line),G=fa(n,I);if(G&&(rs(G),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Pi(r.doc,d)&&r.height!=null){var Q=r.height;r.height=null;var q=rr(r)-Q;q&&ut(d,d.height+q)}ni(n,"markerChanged",n,e)})},qi.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ce(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},qi.prototype.detachLine=function(e){if(this.lines.splice(ce(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},he(qi);function Bn(e,t,r,n,d){if(n&&n.shared)return xl(e,t,r,n,d);if(e.cm&&!e.cm.curOp)return qt(e.cm,Bn)(e,t,r,n,d);var I=new qi(e,d),G=mt(t,r);if(n&&b(n,I,!1),G>0||G==0&&I.clearWhenEmpty!==!1)return I;if(I.replacedWith&&(I.collapsed=!0,I.widgetNode=x("span",[I.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||I.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(I.widgetNode.insertLeft=!0)),I.collapsed){if(Mr(e,t.line,t,r,I)||t.line!=r.line&&Mr(e,r.line,t,r,I))throw new Error("Inserting collapsed marker partially overlapping an existing one");sa()}I.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Q=t.line,q=e.cm,re;if(e.iter(Q,r.line+1,function(_e){q&&I.collapsed&&!q.options.lineWrapping&&xi(_e)==q.display.maxLine&&(re=!0),I.collapsed&&Q!=t.line&&ut(_e,0),oa(_e,new sn(I,Q==t.line?t.ch:null,Q==r.line?r.ch:null)),++Q}),I.collapsed&&e.iter(t.line,r.line+1,function(_e){Pi(e,_e)&&ut(_e,0)}),I.clearOnEnter&&Me(I,"beforeCursorEnter",function(){return I.clear()}),I.readOnly&&(Vi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),I.collapsed&&(I.id=++eo,I.atomic=!0),q){if(re&&(q.curOp.updateMaxLine=!0),I.collapsed)mi(q,t.line,r.line+1);else if(I.className||I.startStyle||I.endStyle||I.css||I.attributes||I.title)for(var ge=t.line;ge<=r.line;ge++)Yi(q,ge,"text");I.atomic&&Gs(q.doc),ni(q,"markerAdded",q,I)}return I}var br=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};br.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ni(this,"clear")},br.prototype.find=function(e,t){return this.primary.find(e,t)},he(br);function xl(e,t,r,n,d){n=b(n),n.shared=!1;var I=[Bn(e,t,r,n,d)],G=I[0],Q=n.widgetNode;return Zi(e,function(q){Q&&(n.widgetNode=Q.cloneNode(!0)),I.push(Bn(q,bt(q,t),bt(q,r),n,d));for(var re=0;re<q.linked.length;++re)if(q.linked[re].isParent)return;G=k(I)}),new br(I,G)}function to(e){return e.findMarks(He(e.first,0),e.clipPos(He(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var r=0;r<t.length;r++){var n=t[r],d=n.find(),I=e.clipPos(d.from),G=e.clipPos(d.to);if(mt(I,G)){var Q=Bn(e,I,G,n.primary,n.primary.type);n.markers.push(Q),Q.parent=n}}}function wl(e){for(var t=function(n){var d=e[n],I=[d.primary.doc];Zi(d.primary.doc,function(q){return I.push(q)});for(var G=0;G<d.markers.length;G++){var Q=d.markers[G];ce(I,Q.doc)==-1&&(Q.parent=null,d.markers.splice(G--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,gi=function(e,t,r,n,d){if(!(this instanceof gi))return new gi(e,t,r,n,d);r==null&&(r=0),vr.call(this,[new gr([new un("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var I=He(r,0);this.sel=Ji(I),this.history=new Vr(null),this.id=++Sl,this.modeOption=t,this.lineSep=n,this.direction=d=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:I,to:I,text:e}),oi(this,Ji(I),we)};gi.prototype=K(vr.prototype,{constructor:gi,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Tt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ei(function(e){var t=He(this.first,0),r=this.first+this.size-1;Fn(this,{from:t,to:He(r,Ye(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&or(this.cm,0,0),oi(this,Ji(t),we)}),replaceRange:function(e,t,r,n){t=bt(this,t),r=r?bt(this,r):t,Un(this,e,t,r,n)},getRange:function(e,t,r){var n=wt(this,bt(this,e),bt(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ai(this,e))return Ye(this,e)},getLineNumber:function(e){return vt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ye(this,e)),xi(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return bt(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ei(function(e,t,r){js(this,bt(this,typeof e=="number"?He(e,t||0):e),null,r)}),setSelection:ei(function(e,t,r){js(this,bt(this,e),bt(this,t||e),r)}),extendSelection:ei(function(e,t,r){Yr(this,bt(this,e),t&&bt(this,t),r)}),extendSelections:ei(function(e,t){Bs(this,Ke(this,e),t)}),extendSelectionsBy:ei(function(e,t){var r=F(this.sel.ranges,e);Bs(this,Ke(this,r),t)}),setSelections:ei(function(e,t,r){if(!e.length)return;for(var n=[],d=0;d<e.length;d++)n[d]=new Pt(bt(this,e[d].anchor),bt(this,e[d].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),oi(this,ki(this.cm,n,t),r)}),addSelection:ei(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Pt(bt(this,e),bt(this,t||e))),oi(this,ki(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var d=wt(this,t[n].from(),t[n].to());r=r?r.concat(d):d}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var d=wt(this,r[n].from(),r[n].to());e!==!1&&(d=d.join(e||this.lineSeparator())),t[n]=d}return t},replaceSelection:function(e,t,r){for(var n=[],d=0;d<this.sel.ranges.length;d++)n[d]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:ei(function(e,t,r){for(var n=[],d=this.sel,I=0;I<d.ranges.length;I++){var G=d.ranges[I];n[I]={from:G.from(),to:G.to(),text:this.splitLines(e[I]),origin:r}}for(var Q=t&&t!="end"&&cl(this,n,t),q=n.length-1;q>=0;q--)Fn(this,n[q]);Q?Hs(this,Q):this.cm&&kn(this.cm)}),undo:ei(function(){Qr(this,"undo")}),redo:ei(function(){Qr(this,"redo")}),undoSelection:ei(function(){Qr(this,"undo",!0)}),redoSelection:ei(function(){Qr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var d=0;d<e.undone.length;d++)e.undone[d].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Vr(this.history.maxGeneration),Zi(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:Pn(this.history.done),undone:Pn(this.history.undone)}},setHistory:function(e){var t=this.history=new Vr(this.history.maxGeneration);t.done=Pn(e.done.slice(0),null,!0),t.undone=Pn(e.undone.slice(0),null,!0)},setGutterMarker:ei(function(e,t,r){return mr(this,e,"gutter",function(n){var d=n.gutterMarkers||(n.gutterMarkers={});return d[t]=r,!r&&ue(d)&&(n.gutterMarkers=null),!0})}),clearGutter:ei(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&mr(t,r,"gutter",function(){return r.gutterMarkers[e]=null,ue(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ai(this,e))return null;if(t=e,e=Ye(this,e),!e)return null}else if(t=vt(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:ei(function(e,t,r){return mr(this,e,t=="gutter"?"gutter":"class",function(n){var d=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[d])n[d]=r;else{if(R(r).test(n[d]))return!1;n[d]+=" "+r}return!0})}),removeLineClass:ei(function(e,t,r){return mr(this,e,t=="gutter"?"gutter":"class",function(n){var d=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",I=n[d];if(I)if(r==null)n[d]=null;else{var G=I.match(R(r));if(!G)return!1;var Q=G.index+G[0].length;n[d]=I.slice(0,G.index)+(!G.index||Q==I.length?"":" ")+I.slice(Q)||null}else return!1;return!0})}),addLineWidget:ei(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Bn(this,bt(this,e),bt(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=bt(this,e),Bn(this,e,e,r,"bookmark")},findMarksAt:function(e){e=bt(this,e);var t=[],r=Ye(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var d=r[n];(d.from==null||d.from<=e.ch)&&(d.to==null||d.to>=e.ch)&&t.push(d.marker.parent||d.marker)}return t},findMarks:function(e,t,r){e=bt(this,e),t=bt(this,t);var n=[],d=e.line;return this.iter(e.line,t.line+1,function(I){var G=I.markedSpans;if(G)for(var Q=0;Q<G.length;Q++){var q=G[Q];!(q.to!=null&&d==e.line&&e.ch>=q.to||q.from==null&&d!=e.line||q.from!=null&&d==t.line&&q.from>=t.ch)&&(!r||r(q.marker))&&n.push(q.marker.parent||q.marker)}++d}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(d){var I=d.text.length+n;if(I>e)return t=e,!0;e-=I,++r}),bt(this,He(r,t))},indexFromPos:function(e){e=bt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+r}),t},copy:function(e){var t=new gi(Tt(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,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var n=new gi(Tt(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(n,to(this)),n},unlinkDoc:function(e){if(e instanceof Wt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var n=[e.id];Zi(e,function(d){return n.push(d.id)},!0),e.history=new Vr(null),e.history.done=Pn(this.history.done,n),e.history.undone=Pn(this.history.undone,n)}},iterLinkedDocs:function(e){Zi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):at(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:ei(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)})}),gi.prototype.eachLine=gi.prototype.iter;var io=0;function Cl(e){var t=this;if(no(t),Z(t,e)||Gi(t.display,e))return;ie(e),W&&(io=+new Date);var r=cn(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var d=n.length,I=Array(d),G=0,Q=function(){++G==d&&qt(t,function(){r=bt(t.doc,r);var Ae={from:r,to:r,text:t.doc.splitLines(I.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Fn(t.doc,Ae),Hs(t.doc,Ji(bt(t.doc,r),bt(t.doc,Qi(Ae))))})()},q=function(Ae,Fe){if(t.options.allowDropFileTypes&&ce(t.options.allowDropFileTypes,Ae.type)==-1){Q();return}var je=new FileReader;je.onerror=function(){return Q()},je.onload=function(){var ze=je.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ze)){Q();return}I[Fe]=ze,Q()},je.readAsText(Ae)},re=0;re<n.length;re++)q(n[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ge=e.dataTransfer.getData("Text");if(ge){var _e;if(t.state.draggingText&&!t.state.draggingText.copy&&(_e=t.listSelections()),$r(t.doc,Ji(r,r)),_e)for(var Oe=0;Oe<_e.length;++Oe)Un(t.doc,"",_e[Oe].anchor,_e[Oe].head,"drag");t.replaceSelection(ge,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-io<100)){fe(t);return}if(Z(e,t)||Gi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!m){var r=f("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),c&&r.parentNode.removeChild(r)}}function Rl(e,t){var r=cn(e,t);if(!r)return;var n=document.createDocumentFragment();ms(e,r,n),e.display.dragCursor||(e.display.dragCursor=f("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),E(e.display.dragCursor,n)}function no(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ro(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var d=t[n].CodeMirror;d&&r.push(d)}r.length&&r[0].operation(function(){for(var I=0;I<r.length;I++)e(r[I])})}var ao=!1;function Ol(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ro(Il)},100))}),Me(window,"blur",function(){return ro(Dn)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var en={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"},_r=0;_r<10;_r++)en[_r+48]=en[_r+96]=String(_r);for(var Zr=65;Zr<=90;Zr++)en[Zr]=String.fromCharCode(Zr);for(var Er=1;Er<=12;Er++)en[Er+111]=en[Er+63235]="F"+Er;var Ki={};Ki.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"},Ki.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"},Ki.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"},Ki.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"]},Ki.default=s?Ki.macDefault:Ki.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,d,I,G=0;G<t.length-1;G++){var Q=t[G];if(/^(cmd|meta|m)$/i.test(Q))I=!0;else if(/^a(lt)?$/i.test(Q))r=!0;else if(/^(c|ctrl|control)$/i.test(Q))n=!0;else if(/^s(hift)?$/i.test(Q))d=!0;else throw new Error("Unrecognized modifier name: "+Q)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),I&&(e="Cmd-"+e),d&&(e="Shift-"+e),e}function kl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var d=F(r.split(" "),Dl),I=0;I<d.length;I++){var G=void 0,Q=void 0;I==d.length-1?(Q=d.join(" "),G=n):(Q=d.slice(0,I+1).join(" "),G="...");var q=t[Q];if(!q)t[Q]=G;else if(q!=G)throw new Error("Inconsistent bindings for "+Q)}delete e[r]}for(var re in t)e[re]=t[re];return e}function jn(e,t,r,n){t=qr(t);var d=t.call?t.call(e,n):t[e];if(d===!1)return"nothing";if(d==="...")return"multi";if(d!=null&&r(d))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jn(e,t.fallthrough,r,n);for(var I=0;I<t.fallthrough.length;I++){var G=jn(e,t.fallthrough[I],r,n);if(G)return G}}}function so(e){var t=typeof e=="string"?e:en[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(T?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(T?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(c&&e.keyCode==34&&e.char)return!1;var r=en[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function qr(e){return typeof e=="string"?Ki[e]:e}function Hn(e,t){for(var r=e.doc.sel.ranges,n=[],d=0;d<r.length;d++){for(var I=t(r[d]);n.length&&mt(I.from,k(n).to)<=0;){var G=n.pop();if(mt(G.from,I.from)<0){I.from=G.from;break}}n.push(I)}_i(e,function(){for(var Q=n.length-1;Q>=0;Q--)Un(e.doc,"",n[Q].from,n[Q].to,"+delete");kn(e)})}function Fa(e,t,r){var n=Ce(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ua(e,t,r){var n=Fa(e,t.ch,r);return n==null?null:new He(t.line,n,r<0?"after":"before")}function Ba(e,t,r,n,d){if(e){t.doc.direction=="rtl"&&(d=-d);var I=Ve(r,t.doc.direction);if(I){var G=d<0?k(I):I[0],Q=d<0==(G.level==1),q=Q?"after":"before",re;if(G.level>0||t.doc.direction=="rtl"){var ge=On(t,r);re=d<0?r.text.length-1:0;var _e=Fi(t,ge,re).top;re=Ne(function(Oe){return Fi(t,ge,Oe).top==_e},d<0==(G.level==1)?G.from:G.to-1,re),q=="before"&&(re=Fa(r,re,1))}else re=d<0?G.to:G.from;return new He(n,re,q)}}return new He(n,d<0?r.text.length:0,d<0?"before":"after")}function Ml(e,t,r,n){var d=Ve(t,e.doc.direction);if(!d)return Ua(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var I=We(d,r.ch,r.sticky),G=d[I];if(e.doc.direction=="ltr"&&G.level%2==0&&(n>0?G.to>r.ch:G.from<r.ch))return Ua(t,r,n);var Q=function(Ze,nt){return Fa(t,Ze instanceof He?Ze.ch:Ze,nt)},q,re=function(Ze){return e.options.lineWrapping?(q=q||On(e,t),ds(e,t,q,Ze)):{begin:0,end:t.text.length}},ge=re(r.sticky=="before"?Q(r,-1):r.ch);if(e.doc.direction=="rtl"||G.level==1){var _e=G.level==1==n<0,Oe=Q(r,_e?1:-1);if(Oe!=null&&(_e?Oe<=G.to&&Oe<=ge.end:Oe>=G.from&&Oe>=ge.begin)){var Ae=_e?"before":"after";return new He(r.line,Oe,Ae)}}var Fe=function(Ze,nt,qe){for(var st=function(jt,ti){return ti?new He(r.line,Q(jt,1),"before"):new He(r.line,jt,"after")};Ze>=0&&Ze<d.length;Ze+=nt){var pt=d[Ze],ht=nt>0==(pt.level!=1),St=ht?qe.begin:Q(qe.end,-1);if(pt.from<=St&&St<pt.to)return st(St,ht);if(St=ht?pt.from:Q(pt.to,-1),qe.begin<=St&&St<qe.end)return st(St,ht)}},je=Fe(I+n,n,ge);if(je)return je;var ze=n>0?ge.end:Q(ge.begin,-1);return ze!=null&&!(n>0&&ze==t.text.length)&&(je=Fe(n>0?0:d.length-1,n,re(ze)),je)?je:null}var xr={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),we)},killLine:function(e){return Hn(e,function(t){if(t.empty()){var r=Ye(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:He(t.head.line+1,0)}:{from:t.head,to:He(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Hn(e,function(t){return{from:He(t.from().line,0),to:bt(e.doc,He(t.to().line+1,0))}})},delLineLeft:function(e){return Hn(e,function(t){return{from:He(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Hn(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return Hn(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},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 uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Re)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Re)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?ho(e,t.head):n},Re)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,d=0;d<r.length;d++){var I=r[d].from(),G=V(e.getLine(I.line),I.ch,n);t.push(X(n-G%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return _i(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var d=t[n].head,I=Ye(e.doc,d.line).text;if(I){if(d.ch==I.length&&(d=new He(d.line,d.ch-1)),d.ch>0)d=new He(d.line,d.ch+1),e.replaceRange(I.charAt(d.ch-1)+I.charAt(d.ch-2),He(d.line,d.ch-2),d,"+transpose");else if(d.line>e.doc.first){var G=Ye(e.doc,d.line-1).text;G&&(d=new He(d.line,1),e.replaceRange(I.charAt(0)+e.doc.lineSeparator()+G.charAt(G.length-1),He(d.line-1,G.length-1),d,"+transpose"))}}r.push(new Pt(d,d))}e.setSelections(r)})},newlineAndIndent:function(e){return _i(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);kn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=Ye(e.doc,t),n=xi(r);return n!=r&&(t=vt(n)),Ba(!0,e,n,t,1)}function Pl(e,t){var r=Ye(e.doc,t),n=Pr(r);return n!=r&&(t=vt(n)),Ba(!0,e,r,t,-1)}function ho(e,t){var r=uo(e,t.line),n=Ye(e.doc,r.line),d=Ve(n,e.doc.direction);if(!d||d[0].level==0){var I=Math.max(r.ch,n.text.search(/\S/)),G=t.line==r.line&&t.ch<=I&&t.ch;return He(r.line,G?0:I,r.sticky)}return r}function ea(e,t,r){if(typeof t=="string"&&(t=xr[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,d=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),d=t(e)!=Ie}finally{e.display.shift=n,e.state.suppressEdits=!1}return d}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var d=jn(t,e.state.keyMaps[n],r,e);if(d)return d}return e.options.extraKeys&&jn(t,e.options.extraKeys,r,e)||jn(t,e.options.keyMap,r,e)}var Fl=new ne;function Tr(e,t,r,n){var d=e.state.keySeq;if(d){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==d&&(e.state.keySeq=null,e.display.input.reset())}),co(e,d+" "+t,r,n))return!0}return co(e,t,r,n)}function co(e,t,r,n){var d=Nl(e,t,n);return d=="multi"&&(e.state.keySeq=t),d=="handled"&&ni(e,"keyHandled",e,t,r),(d=="handled"||d=="multi")&&(ie(r),xa(e)),!!d}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?Tr(e,"Shift-"+r,t,function(n){return ea(e,n,!0)})||Tr(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return ea(e,n)}):Tr(e,r,t,function(n){return ea(e,n)}):!1}function Ul(e,t,r){return Tr(e,"'"+r+"'",t,function(n){return ea(e,n,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=U(),Z(t,e))return;W&&H<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=fo(t,e);c&&(ja=n?r:null,!n&&r==88&&!Lt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!s&&!n&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(S(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r))}Me(document,"keyup",r),Me(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Z(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Gi(t.display,e)||Z(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(c&&r==ja){ja=null,ie(e);return}if(c&&(!e.which||e.which<10)&&fo(t,e))return;var d=String.fromCharCode(n==null?r:n);if(d=="\b")return;if(Ul(t,e,d))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,r){this.time=e,this.pos=t,this.button=r};Ha.prototype.compare=function(e,t,r){return this.time+jl>e&&mt(t,this.pos)==0&&r==this.button};var wr,Sr;function Hl(e,t){var r=+new Date;return Sr&&Sr.compare(r,e,t)?(wr=Sr=null,"triple"):wr&&wr.compare(r,e,t)?(Sr=new Ha(r,e,t),wr=null,"double"):(wr=new Ha(r,e,t),Sr=null,"single")}function vo(e){var t=this,r=t.display;if(Z(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Gi(r,e)){i||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var n=cn(t,e),d=Se(e),I=n?Hl(n,d):"single";if(window.focus(),d==1&&t.state.selectingText&&t.state.selectingText(e),n&&Wl(t,d,n,I,e))return;d==1?n?Kl(t,n,I,e):be(e)==r.scroller&&ie(e):d==2?(n&&Yr(t.doc,n),setTimeout(function(){return r.input.focus()},20)):d==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,n,d){var I="Click";return n=="double"?I="Double"+I:n=="triple"&&(I="Triple"+I),I=(t==1?"Left":t==2?"Middle":"Right")+I,Tr(e,oo(I,d),d,function(G){if(typeof G=="string"&&(G=xr[G]),!G)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=G(e,r)!=Ie}finally{e.state.suppressEdits=!1}return Q})}function Gl(e,t,r){var n=e.getOption("configureMouse"),d=n?n(e,t,r):{};if(d.unit==null){var I=a?r.shiftKey&&r.metaKey:r.altKey;d.unit=I?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(d.extend==null||e.doc.extend)&&(d.extend=e.doc.extend||r.shiftKey),d.addNew==null&&(d.addNew=s?r.metaKey:r.ctrlKey),d.moveOnDrag==null&&(d.moveOnDrag=!(s?r.altKey:r.ctrlKey)),d}function Kl(e,t,r,n){W?setTimeout(P(gs,e),0):e.curOp.focus=U();var d=Gl(e,r,n),I=e.doc.sel,G;e.options.dragDrop&&Pe&&!e.isReadOnly()&&r=="single"&&(G=I.contains(t))>-1&&(mt((G=I.ranges[G]).from(),t)<0||t.xRel>0)&&(mt(G.to(),t)>0||t.xRel<0)?zl(e,n,t,d):Vl(e,n,t,d)}function zl(e,t,r,n){var d=e.display,I=!1,G=qt(e,function(re){i&&(d.scroller.draggable=!1),e.state.draggingText=!1,tt(d.wrapper.ownerDocument,"mouseup",G),tt(d.wrapper.ownerDocument,"mousemove",Q),tt(d.scroller,"dragstart",q),tt(d.scroller,"drop",G),I||(ie(re),n.addNew||Yr(e.doc,r,null,null,n.extend),i&&!m||W&&H==9?setTimeout(function(){d.wrapper.ownerDocument.body.focus({preventScroll:!0}),d.input.focus()},20):d.input.focus())}),Q=function(re){I=I||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},q=function(){return I=!0};i&&(d.scroller.draggable=!0),e.state.draggingText=G,G.copy=!n.moveOnDrag,d.scroller.dragDrop&&d.scroller.dragDrop(),Me(d.wrapper.ownerDocument,"mouseup",G),Me(d.wrapper.ownerDocument,"mousemove",Q),Me(d.scroller,"dragstart",q),Me(d.scroller,"drop",G),vs(e),setTimeout(function(){return d.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Pt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Pt(He(t.line,0),bt(e.doc,He(t.line+1,0)));var n=r(e,t);return new Pt(n.from,n.to)}function Vl(e,t,r,n){var d=e.display,I=e.doc;ie(t);var G,Q,q=I.sel,re=q.ranges;if(n.addNew&&!n.extend?(Q=I.sel.contains(r),Q>-1?G=re[Q]:G=new Pt(r,r)):(G=I.sel.primary(),Q=I.sel.primIndex),n.unit=="rectangle")n.addNew||(G=new Pt(r,r)),r=cn(e,t,!0,!0),Q=-1;else{var ge=yo(e,r,n.unit);n.extend?G=Pa(G,ge.anchor,ge.head,n.extend):G=ge}n.addNew?Q==-1?(Q=re.length,oi(I,ki(e,re.concat([G]),Q),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Q].empty()&&n.unit=="char"&&!n.extend?(oi(I,ki(e,re.slice(0,Q).concat(re.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),q=I.sel):Na(I,Q,G,Le):(Q=0,oi(I,new wi([G],0),Le),q=I.sel);var _e=r;function Oe(qe){if(mt(_e,qe)==0)return;if(_e=qe,n.unit=="rectangle"){for(var st=[],pt=e.options.tabSize,ht=V(Ye(I,r.line).text,r.ch,pt),St=V(Ye(I,qe.line).text,qe.ch,pt),jt=Math.min(ht,St),ti=Math.max(ht,St),Gt=Math.min(r.line,qe.line),Ei=Math.min(e.lastLine(),Math.max(r.line,qe.line));Gt<=Ei;Gt++){var vi=Ye(I,Gt).text,Xt=De(vi,jt,pt);jt==ti?st.push(new Pt(He(Gt,Xt),He(Gt,Xt))):vi.length>Xt&&st.push(new Pt(He(Gt,Xt),He(Gt,De(vi,ti,pt))))}st.length||st.push(new Pt(r,r)),oi(I,ki(e,q.ranges.slice(0,Q).concat(st),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(qe)}else{var yi=G,ri=yo(e,qe,n.unit),Jt=yi.anchor,Yt;mt(ri.anchor,Jt)>0?(Yt=ri.head,Jt=rn(yi.from(),ri.anchor)):(Yt=ri.anchor,Jt=En(yi.to(),ri.head));var zt=q.ranges.slice(0);zt[Q]=Xl(e,new Pt(bt(I,Jt),Yt)),oi(I,ki(e,zt,Q),Le)}}var Ae=d.wrapper.getBoundingClientRect(),Fe=0;function je(qe){var st=++Fe,pt=cn(e,qe,!0,n.unit=="rectangle");if(!pt)return;if(mt(pt,_e)!=0){e.curOp.focus=U(),Oe(pt);var ht=Wr(d,I);(pt.line>=ht.to||pt.line<ht.from)&&setTimeout(qt(e,function(){Fe==st&&je(qe)}),150)}else{var St=qe.clientY<Ae.top?-20:qe.clientY>Ae.bottom?20:0;St&&setTimeout(qt(e,function(){if(Fe!=st)return;d.scroller.scrollTop+=St,je(qe)}),50)}}function ze(qe){e.state.selectingText=!1,Fe=Infinity,qe&&(ie(qe),d.input.focus()),tt(d.wrapper.ownerDocument,"mousemove",Ze),tt(d.wrapper.ownerDocument,"mouseup",nt),I.history.lastSelOrigin=null}var Ze=qt(e,function(qe){qe.buttons===0||!Se(qe)?ze(qe):je(qe)}),nt=qt(e,ze);e.state.selectingText=nt,Me(d.wrapper.ownerDocument,"mousemove",Ze),Me(d.wrapper.ownerDocument,"mouseup",nt)}function Xl(e,t){var r=t.anchor,n=t.head,d=Ye(e.doc,r.line);if(mt(r,n)==0&&r.sticky==n.sticky)return t;var I=Ve(d);if(!I)return t;var G=We(I,r.ch,r.sticky),Q=I[G];if(Q.from!=r.ch&&Q.to!=r.ch)return t;var q=G+(Q.from==r.ch==(Q.level!=1)?0:1);if(q==0||q==I.length)return t;var re;if(n.line!=r.line)re=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ge=We(I,n.ch,n.sticky),_e=ge-G||(n.ch-r.ch)*(Q.level==1?-1:1);ge==q-1||ge==q?re=_e<0:re=_e>0}var Oe=I[q+(re?-1:0)],Ae=re==(Oe.level==1),Fe=Ae?Oe.from:Oe.to,je=Ae?"after":"before";return r.ch==Fe&&r.sticky==je?t:new Pt(new He(r.line,Fe,je),n)}function bo(e,t,r,n){var d,I;if(t.touches)d=t.touches[0].clientX,I=t.touches[0].clientY;else try{d=t.clientX,I=t.clientY}catch(Oe){return!1}if(d>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ie(t);var G=e.display,Q=G.lineDiv.getBoundingClientRect();if(I>Q.bottom||!se(e,r))return de(t);I-=Q.top-G.viewOffset;for(var q=0;q<e.display.gutterSpecs.length;++q){var re=G.gutters.childNodes[q];if(re&&re.getBoundingClientRect().right>=d){var ge=Rt(e.doc,I),_e=e.display.gutterSpecs[q];return le(e,r,e,ge,_e.className,t),de(t)}}}function Wa(e,t){return bo(e,t,"gutterClick",!0)}function _o(e,t){if(Gi(e.display,t)||Yl(e,t))return;if(Z(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return se(e,"gutterContextMenu")?bo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ar(e)}var Wn={toString:function(){return"CodeMirror.Init"}},xo={},ta={};function $l(e){var t=e.optionHandlers;function r(n,d,I,G){e.defaults[n]=d,I&&(t[n]=G?function(Q,q,re){re!=Wn&&I(Q,q,re)}:I)}e.defineOption=r,e.Init=Wn,r("value","",function(n,d){return n.setValue(d)},!0),r("mode",null,function(n,d){n.doc.modeOption=d,Da(n)},!0),r("indentUnit",2,Da,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){fr(n),ar(n),mi(n)},!0),r("lineSeparator",null,function(n,d){if(n.doc.lineSep=d,!d)return;var I=[],G=n.doc.first;n.doc.iter(function(q){for(var re=0;;){var ge=q.text.indexOf(d,re);if(ge==-1)break;re=ge+d.length,I.push(He(G,ge))}G++});for(var Q=I.length-1;Q>=0;Q--)Un(n.doc,d,I[Q],He(I[Q].line,I[Q].ch+d.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,d,I){n.state.specialChars=new RegExp(d.source+(d.test(" ")?"":"| "),"g"),I!=Wn&&n.refresh()}),r("specialCharPlaceholder",Bt,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",h?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,d){return n.getInputField().spellcheck=d},!0),r("autocorrect",!1,function(n,d){return n.getInputField().autocorrect=d},!0),r("autocapitalize",!1,function(n,d){return n.getInputField().autocapitalize=d},!0),r("rtlMoveVisually",!C),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Eo(n),cr(n)},!0),r("keyMap","default",function(n,d,I){var G=qr(d),Q=I!=Wn&&qr(I);Q&&Q.detach&&Q.detach(n,G),G.attach&&G.attach(n,Q||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,d){n.display.gutterSpecs=La(d,n.options.lineNumbers),cr(n)},!0),r("fixedGutter",!0,function(n,d){n.display.gutters.style.left=d?_a(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Mn(n)},!0),r("scrollbarStyle","native",function(n){Ts(n),Mn(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,d){n.display.gutterSpecs=La(n.options.gutters,d),cr(n)},!0),r("firstLineNumber",1,cr,!0),r("lineNumberFormatter",function(n){return n},cr,!0),r("showCursorWhenSelecting",!1,sr,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,d){d=="nocursor"&&(Dn(n),n.display.input.blur()),n.display.input.readOnlyChanged(d)}),r("screenReaderLabel",null,function(n,d){d=d===""?null:d,n.display.input.screenReaderLabelChanged(d)}),r("disableInput",!1,function(n,d){d||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,sr,!0),r("singleCursorHeightPerLine",!0,sr,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,fr,!0),r("addModeClass",!1,fr,!0),r("pollInterval",100),r("undoDepth",200,function(n,d){return n.doc.history.undoDepth=d}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,fr,!0),r("moveInputWithCursor",!0,function(n,d){d||n.display.input.resetPosition()}),r("tabindex",null,function(n,d){return n.display.input.getField().tabIndex=d||""}),r("autofocus",null),r("direction","ltr",function(n,d){return n.doc.setDirection(d)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Wn;if(!t!=!n){var d=e.display.dragFunctions,I=t?Me:tt;I(e.display.scroller,"dragstart",d.start),I(e.display.scroller,"dragenter",d.enter),I(e.display.scroller,"dragover",d.over),I(e.display.scroller,"dragleave",d.leave),I(e.display.scroller,"drop",d.drop)}}function Ql(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),Nr(e)),Ea(e),mi(e),ar(e),setTimeout(function(){return Mn(e)},100)}function Wt(e,t){var r=this;if(!(this instanceof Wt))return new Wt(e,t);this.options=t=t?b(t):{},b(xo,t,!1);var n=t.value;typeof n=="string"?n=new gi(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var d=new Wt.inputStyles[t.inputStyle](this),I=this.display=new hl(e,n,d,t);I.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(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 ne,keySeq:null,specialChars:null},t.autofocus&&!h&&I.input.focus(),W&&H<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ol(),gn(this),this.curOp.forceUpdate=!0,ks(this,n),t.autofocus&&!h||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ta(r)},20):Dn(this);for(var G in ta)ta.hasOwnProperty(G)&&ta[G](this,t[G],Wn);Cs(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Ga.length;++Q)Ga[Q](this);vn(this),i&&t.lineWrapping&&getComputedStyle(I.lineDiv).textRendering=="optimizelegibility"&&(I.lineDiv.style.textRendering="auto")}Wt.defaults=xo,Wt.optionHandlers=ta;function Zl(e){var t=e.display;Me(t.scroller,"mousedown",qt(e,vo)),W&&H<11?Me(t.scroller,"dblclick",qt(e,function(q){if(Z(e,q))return;var re=cn(e,q);if(!re||Wa(e,q)||Gi(e.display,q))return;ie(q);var ge=e.findWordAt(re);Yr(e.doc,ge.anchor,ge.head)})):Me(t.scroller,"dblclick",function(q){return Z(e,q)||ie(q)}),Me(t.scroller,"contextmenu",function(q){return _o(e,q)}),Me(t.input.getField(),"contextmenu",function(q){t.scroller.contains(q.target)||_o(e,q)});var r,n={end:0};function d(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function I(q){if(q.touches.length!=1)return!1;var re=q.touches[0];return re.radiusX<=1&&re.radiusY<=1}function G(q,re){if(re.left==null)return!0;var ge=re.left-q.left,_e=re.top-q.top;return ge*ge+_e*_e>20*20}Me(t.scroller,"touchstart",function(q){if(!Z(e,q)&&!I(q)&&!Wa(e,q)){t.input.ensurePolled(),clearTimeout(r);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-n.end<=300?n:null},q.touches.length==1&&(t.activeTouch.left=q.touches[0].pageX,t.activeTouch.top=q.touches[0].pageY)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(t.scroller,"touchend",function(q){var re=t.activeTouch;if(re&&!Gi(t,q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var ge=e.coordsChar(t.activeTouch,"page"),_e;!re.prev||G(re,re.prev)?_e=new Pt(ge,ge):!re.prev.prev||G(re,re.prev.prev)?_e=e.findWordAt(ge):_e=new Pt(He(ge.line,0),bt(e.doc,He(ge.line+1,0))),e.setSelection(_e.anchor,_e.head),e.focus(),ie(q)}d()}),Me(t.scroller,"touchcancel",d),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(lr(e,t.scroller.scrollTop),pn(e,t.scroller.scrollLeft,!0),le(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(q){return Os(e,q)}),Me(t.scroller,"DOMMouseScroll",function(q){return Os(e,q)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(q){Z(e,q)||fe(q)},over:function(q){Z(e,q)||(Rl(e,q),fe(q))},start:function(q){return Al(e,q)},drop:qt(e,Cl),leave:function(q){Z(e,q)||no(e)}};var Q=t.input.getField();Me(Q,"keyup",function(q){return mo.call(e,q)}),Me(Q,"keydown",qt(e,po)),Me(Q,"keypress",qt(e,go)),Me(Q,"focus",function(q){return Ta(e,q)}),Me(Q,"blur",function(q){return Dn(e,q)})}var Ga=[];Wt.defineInitHook=function(e){return Ga.push(e)};function Cr(e,t,r,n){var d=e.doc,I;r==null&&(r="add"),r=="smart"&&(d.mode.indent?I=Ai(e,t).state:r="prev");var G=e.options.tabSize,Q=Ye(d,t),q=V(Q.text,null,G);Q.stateAfter&&(Q.stateAfter=null);var re=Q.text.match(/^\s*/)[0],ge;if(!n&&!/\S/.test(Q.text))ge=0,r="not";else if(r=="smart"&&(ge=d.mode.indent(I,Q.text.slice(re.length),Q.text),ge==Ie||ge>150)){if(!n)return;r="prev"}r=="prev"?t>d.first?ge=V(Ye(d,t-1).text,null,G):ge=0:r=="add"?ge=q+e.options.indentUnit:r=="subtract"?ge=q-e.options.indentUnit:typeof r=="number"&&(ge=q+r),ge=Math.max(0,ge);var _e="",Oe=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(ge/G);Ae;--Ae)Oe+=G,_e+=" ";if(Oe<ge&&(_e+=X(ge-Oe)),_e!=re)return Un(d,_e,He(t,0),He(t,re.length),"+input"),Q.stateAfter=null,!0;for(var Fe=0;Fe<d.sel.ranges.length;Fe++){var je=d.sel.ranges[Fe];if(je.head.line==t&&je.head.ch<re.length){var ze=He(t,re.length);Na(d,Fe,new Pt(ze,ze));break}}}var Mi=null;function ia(e){Mi=e}function Ka(e,t,r,n,d){var I=e.doc;e.display.shift=!1,n||(n=I.sel);var G=+new Date-200,Q=d=="paste"||e.state.pasteIncoming>G,q=at(t),re=null;if(Q&&n.ranges.length>1)if(Mi&&Mi.text.join(`
|
|
`)==t){if(n.ranges.length%Mi.text.length==0){re=[];for(var ge=0;ge<Mi.text.length;ge++)re.push(I.splitLines(Mi.text[ge]))}}else q.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(re=F(q,function(Ze){return[Ze]}));for(var _e=e.curOp.updateInput,Oe=n.ranges.length-1;Oe>=0;Oe--){var Ae=n.ranges[Oe],Fe=Ae.from(),je=Ae.to();Ae.empty()&&(r&&r>0?Fe=He(Fe.line,Fe.ch-r):e.state.overwrite&&!Q?je=He(je.line,Math.min(Ye(I,je.line).text.length,je.ch+k(q).length)):Q&&Mi&&Mi.lineWise&&Mi.text.join(`
|
|
`)==q.join(`
|
|
`)&&(Fe=je=He(Fe.line,0)));var ze={from:Fe,to:je,text:re?re[Oe%re.length]:q,origin:d||(Q?"paste":e.state.cutIncoming>G?"cut":"+input")};Fn(e.doc,ze),ni(e,"inputRead",e,ze)}t&&!Q&&wo(e,t),kn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=_e),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&_i(t,function(){return Ka(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var d=r.ranges[n];if(d.head.ch>100||n&&r.ranges[n-1].head.line==d.head.line)continue;var I=e.getModeAt(d.head),G=!1;if(I.electricChars){for(var Q=0;Q<I.electricChars.length;Q++)if(t.indexOf(I.electricChars.charAt(Q))>-1){G=Cr(e,d.head.line,"smart");break}}else I.electricInput&&(I.electricInput.test(Ye(e.doc,d.head.line).text.slice(0,d.head.ch))&&(G=Cr(e,d.head.line,"smart")));G&&ni(e,"electricInput",e,d.head.line)}}function So(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var d=e.doc.sel.ranges[n].head.line,I={anchor:He(d,0),head:He(d+1,0)};r.push(I),t.push(e.getRange(I.anchor,I.head))}return{text:t,ranges:r}}function Co(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=f("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=f("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return i?e.style.width="1000px":e.setAttribute("wrap","off"),p&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,d){var I=this.options,G=I[n];if(I[n]==d&&n!="mode")return;I[n]=d,t.hasOwnProperty(n)&&qt(this,t[n])(this,d,G),le(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,d){this.state.keyMaps[d?"push":"unshift"](qr(n))},removeKeyMap:function(n){for(var d=this.state.keyMaps,I=0;I<d.length;++I)if(d[I]==n||d[I].name==n)return d.splice(I,1),!0},addOverlay:hi(function(n,d){var I=n.token?n:e.getMode(this.options,n);if(I.startState)throw new Error("Overlays may not be stateful.");$(this.state.overlays,{mode:I,modeSpec:n,opaque:d&&d.opaque,priority:d&&d.priority||0},function(G){return G.priority}),this.state.modeGen++,mi(this)}),removeOverlay:hi(function(n){for(var d=this.state.overlays,I=0;I<d.length;++I){var G=d[I].modeSpec;if(G==n||typeof n=="string"&&G.name==n){d.splice(I,1),this.state.modeGen++,mi(this);return}}}),indentLine:hi(function(n,d,I){typeof d!="string"&&typeof d!="number"&&(d==null?d=this.options.smartIndent?"smart":"prev":d=d?"add":"subtract"),ai(this.doc,n)&&Cr(this,n,d,I)}),indentSelection:hi(function(n){for(var d=this.doc.sel.ranges,I=-1,G=0;G<d.length;G++){var Q=d[G];if(Q.empty())Q.head.line>I&&(Cr(this,Q.head.line,n,!0),I=Q.head.line,G==this.doc.sel.primIndex&&kn(this));else{var q=Q.from(),re=Q.to(),ge=Math.max(I,q.line);I=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var _e=ge;_e<I;++_e)Cr(this,_e,n);var Oe=this.doc.sel.ranges;q.ch==0&&d.length==Oe.length&&Oe[G].from().ch>0&&Na(this.doc,G,new Pt(q,Oe[G].to()),we)}}}),getTokenAt:function(n,d){return Rr(this,n,d)},getLineTokens:function(n,d){return Rr(this,He(n),d,!0)},getTokenTypeAt:function(n){n=bt(this.doc,n);var d=an(this,Ye(this.doc,n.line)),I=0,G=(d.length-1)/2,Q=n.ch,q;if(Q==0)q=d[2];else for(;;){var re=I+G>>1;if((re?d[re*2-1]:0)>=Q)G=re;else if(d[re*2+1]<Q)I=re+1;else{q=d[re*2+2];break}}var ge=q?q.indexOf("overlay "):-1;return ge<0?q:ge==0?null:q.slice(0,ge-1)},getModeAt:function(n){var d=this.doc.mode;return d.innerMode?e.innerMode(d,this.getTokenAt(n).state).mode:d},getHelper:function(n,d){return this.getHelpers(n,d)[0]},getHelpers:function(n,d){var I=[];if(!r.hasOwnProperty(d))return I;var G=r[d],Q=this.getModeAt(n);if(typeof Q[d]=="string")G[Q[d]]&&I.push(G[Q[d]]);else if(Q[d])for(var q=0;q<Q[d].length;q++){var re=G[Q[d][q]];re&&I.push(re)}else Q.helperType&&G[Q.helperType]?I.push(G[Q.helperType]):G[Q.name]&&I.push(G[Q.name]);for(var ge=0;ge<G._global.length;ge++){var _e=G._global[ge];_e.pred(Q,this)&&ce(I,_e.val)==-1&&I.push(_e.val)}return I},getStateAfter:function(n,d){var I=this.doc;return n=xn(I,n==null?I.first+I.size-1:n),Ai(this,n+1,d).state},cursorCoords:function(n,d){var I,G=this.doc.sel.primary();return n==null?I=G.head:typeof n=="object"?I=bt(this.doc,n):I=n?G.from():G.to(),Di(this,I,d||"page")},charCoords:function(n,d){return ma(this,bt(this.doc,n),d||"page")},coordsChar:function(n,d){return n=ls(this,n,d||"page"),va(this,n.left,n.top)},lineAtHeight:function(n,d){return n=ls(this,{top:n,left:0},d||"page").top,Rt(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,d,I){var G=!1,Q;if(typeof n=="number"){var q=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>q&&(n=q,G=!0),Q=Ye(this.doc,n)}else Q=n;return Ur(this,Q,{top:0,left:0},d||"page",I||G).top+(G?this.doc.height-Ii(Q):0)},defaultTextHeight:function(){return Ln(this.display)},defaultCharWidth:function(){return In(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,d,I,G,Q){var q=this.display;n=Di(this,bt(this.doc,n));var re=n.bottom,ge=n.left;if(d.style.position="absolute",d.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(d),q.sizer.appendChild(d),G=="over")re=n.top;else if(G=="above"||G=="near"){var _e=Math.max(q.wrapper.clientHeight,this.doc.height),Oe=Math.max(q.sizer.clientWidth,q.lineSpace.clientWidth);(G=="above"||n.bottom+d.offsetHeight>_e)&&n.top>d.offsetHeight?re=n.top-d.offsetHeight:n.bottom+d.offsetHeight<=_e&&(re=n.bottom),ge+d.offsetWidth>Oe&&(ge=Oe-d.offsetWidth)}d.style.top=re+"px",d.style.left=d.style.right="",Q=="right"?(ge=q.sizer.clientWidth-d.offsetWidth,d.style.right="0px"):(Q=="left"?ge=0:Q=="middle"&&(ge=(q.sizer.clientWidth-d.offsetWidth)/2),d.style.left=ge+"px"),I&&Jo(this,{left:ge,top:re,right:ge+d.offsetWidth,bottom:re+d.offsetHeight})},triggerOnKeyDown:hi(po),triggerOnKeyPress:hi(go),triggerOnKeyUp:mo,triggerOnMouseDown:hi(vo),execCommand:function(n){if(xr.hasOwnProperty(n))return xr[n].call(null,this)},triggerElectric:hi(function(n){wo(this,n)}),findPosH:function(n,d,I,G){var Q=1;d<0&&(Q=-1,d=-d);for(var q=bt(this.doc,n),re=0;re<d&&!(q=za(this.doc,q,Q,I,G),q.hitSide);++re);return q},moveH:hi(function(n,d){var I=this;this.extendSelectionsBy(function(G){return I.display.shift||I.doc.extend||G.empty()?za(I.doc,G.head,n,d,I.options.rtlMoveVisually):n<0?G.from():G.to()},Re)}),deleteH:hi(function(n,d){var I=this.doc.sel,G=this.doc;I.somethingSelected()?G.replaceSelection("",null,"+delete"):Hn(this,function(Q){var q=za(G,Q.head,n,d,!1);return n<0?{from:q,to:Q.head}:{from:Q.head,to:q}})}),findPosV:function(n,d,I,G){var Q=1,q=G;d<0&&(Q=-1,d=-d);for(var re=bt(this.doc,n),ge=0;ge<d;++ge){var _e=Di(this,re,"div");if(q==null?q=_e.left:_e.left=q,re=Ro(this,_e,Q,I),re.hitSide)break}return re},moveV:hi(function(n,d){var I=this,G=this.doc,Q=[],q=!this.display.shift&&!G.extend&&G.sel.somethingSelected();if(G.extendSelectionsBy(function(ge){if(q)return n<0?ge.from():ge.to();var _e=Di(I,ge.head,"div");ge.goalColumn!=null&&(_e.left=ge.goalColumn),Q.push(_e.left);var Oe=Ro(I,_e,n,d);return d=="page"&&ge==G.sel.primary()&&Sa(I,ma(I,Oe,"div").top-_e.top),Oe},Re),Q.length)for(var re=0;re<G.sel.ranges.length;re++)G.sel.ranges[re].goalColumn=Q[re]}),findWordAt:function(n){var d=this.doc,I=Ye(d,n.line).text,G=n.ch,Q=n.ch;if(I){var q=this.getHelper(n,"wordChars");(n.sticky=="before"||Q==I.length)&&G?--G:++Q;for(var re=I.charAt(G),ge=ke(re,q)?function(_e){return ke(_e,q)}:/\s/.test(re)?function(_e){return/\s/.test(_e)}:function(_e){return!/\s/.test(_e)&&!ke(_e)};G>0&&ge(I.charAt(G-1));)--G;for(;Q<I.length&&ge(I.charAt(Q));)++Q}return new Pt(He(n.line,G),He(n.line,Q))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):S(this.display.cursorDiv,"CodeMirror-overwrite"),le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==U()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:hi(function(n,d){or(this,n,d)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-Ni(this)-this.display.barHeight,width:n.scrollWidth-Ni(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:hn(this)}},scrollIntoView:hi(function(n,d){n==null?(n={from:this.doc.sel.primary().head,to:null},d==null&&(d=this.options.cursorScrollMargin)):typeof n=="number"?n={from:He(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=d||0,n.from.line!=null?Qo(this,n):bs(this,n.from,n.to,n.margin)}),setSize:hi(function(n,d){var I=this,G=function(q){return typeof q=="number"||/^\d+$/.test(String(q))?q+"px":q};n!=null&&(this.display.wrapper.style.width=G(n)),d!=null&&(this.display.wrapper.style.height=G(d)),this.options.lineWrapping&&as(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(q){if(q.widgets){for(var re=0;re<q.widgets.length;re++)if(q.widgets[re].noHScroll){Yi(I,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,le(this,"refresh",this)}),operation:function(n){return _i(this,n)},startOperation:function(){return gn(this)},endOperation:function(){return vn(this)},refresh:hi(function(){var n=this.display.cachedTextHeight;mi(this),this.curOp.forceUpdate=!0,ar(this),or(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(n==null||Math.abs(n-Ln(this.display))>.5||this.options.lineWrapping)&&Ea(this),le(this,"refresh",this)}),swapDoc:hi(function(n){var d=this.doc;return d.cm=null,this.state.selectingText&&this.state.selectingText(),ks(this,n),ar(this),this.display.input.reset(),or(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,ni(this,"swapDoc",this,d),d}),phrase:function(n){var d=this.options.phrases;return d&&Object.prototype.hasOwnProperty.call(d,n)?d[n]:n},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}},he(e),e.registerHelper=function(n,d,I){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][d]=I},e.registerGlobalHelper=function(n,d,I,G){e.registerHelper(n,d,G),r[n]._global.push({pred:I,val:G})}}function za(e,t,r,n,d){var I=t,G=r,Q=Ye(e,t.line),q=d&&e.direction=="rtl"?-r:r;function re(){var nt=t.line+q;return nt<e.first||nt>=e.first+e.size?!1:(t=new He(nt,t.ch,t.sticky),Q=Ye(e,nt))}function ge(nt){var qe;if(n=="codepoint"){var st=Q.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(st)?qe=null:qe=new He(t.line,Math.max(0,Math.min(Q.text.length,t.ch+r*(st>=55296&&st<56320?2:1))),-r)}else d?qe=Ml(e.cm,Q,t,r):qe=Ua(Q,t,r);if(qe==null)if(!nt&&re())t=Ba(d,e.cm,Q,t.line,q);else return!1;else t=qe;return!0}if(n=="char"||n=="codepoint")ge();else if(n=="column")ge(!0);else if(n=="word"||n=="group")for(var _e=null,Oe=n=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(r<0&&!ge(!Fe));Fe=!1){var je=Q.text.charAt(t.ch)||`
|
|
`,ze=ke(je,Ae)?"w":Oe&&je==`
|
|
`?"n":!Oe||/\s/.test(je)?null:"p";if(Oe&&!Fe&&!ze&&(ze="s"),_e&&_e!=ze){r<0&&(r=1,ge(),t.sticky="after");break}if(ze&&(_e=ze),r>0&&!ge(!Fe))break}var Ze=Jr(e,t,I,G,!0);return nn(I,Ze)&&(Ze.hitSide=!0),Ze}function Ro(e,t,r,n){var d=e.doc,I=t.left,G;if(n=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),q=Math.max(Q-.5*Ln(e.display),3);G=(r>0?t.bottom:t.top)+r*q}else n=="line"&&(G=r>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,I,G),!re.outside);){if(r<0?G<=0:G>=d.height){re.hitSide=!0;break}G+=r*5}return re}var Ft=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ne,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ft.prototype.init=function(e){var t=this,r=this,n=r.cm,d=r.div=e.lineDiv;Co(d,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function I(Q){for(var q=Q.target;q;q=q.parentNode){if(q==d)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(q.className))break}return!1}Me(d,"paste",function(Q){if(!I(Q)||Z(n,Q)||To(Q,n))return;H<=11&&setTimeout(qt(n,function(){return t.updateFromDOM()}),20)}),Me(d,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Me(d,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Me(d,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(d,"touchstart",function(){return r.forceCompositionEnd()}),Me(d,"input",function(){t.composing||t.readFromDOMSoon()});function G(Q){if(!I(Q)||Z(n,Q))return;if(n.somethingSelected())ia({lineWise:!1,text:n.getSelections()}),Q.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var q=So(n);ia({lineWise:!0,text:q.text}),Q.type=="cut"&&n.operation(function(){n.setSelections(q.ranges,0,we),n.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var re=Mi.text.join(`
|
|
`);if(Q.clipboardData.setData("Text",re),Q.clipboardData.getData("Text")==re){Q.preventDefault();return}}var ge=Ao(),_e=ge.firstChild;n.display.lineSpace.insertBefore(ge,n.display.lineSpace.firstChild),_e.value=Mi.text.join(`
|
|
`);var Oe=document.activeElement;j(_e),setTimeout(function(){n.display.lineSpace.removeChild(ge),Oe.focus(),Oe==d&&r.showPrimarySelection()},50)}Me(d,"copy",G),Me(d,"cut",G)},Ft.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ft.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ft.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ft.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ft.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),d=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||d.line<t.display.viewFrom){e.removeAllRanges();return}var I=na(t,e.anchorNode,e.anchorOffset),G=na(t,e.focusNode,e.focusOffset);if(I&&!I.bad&&G&&!G.bad&&mt(rn(I,G),n)==0&&mt(En(I,G),d)==0)return;var Q=t.display.view,q=n.line>=t.display.viewFrom&&Oo(t,n)||{node:Q[0].measure.map[2],offset:0},re=d.line<t.display.viewTo&&Oo(t,d);if(!re){var ge=Q[Q.length-1].measure,_e=ge.maps?ge.maps[ge.maps.length-1]:ge.map;re={node:_e[_e.length-1],offset:_e[_e.length-2]-_e[_e.length-3]}}if(!q||!re){e.removeAllRanges();return}var Oe=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=v(q.node,q.offset,re.offset,re.node)}catch(Fe){}Ae&&(!D&&t.state.focused?(e.collapse(q.node,q.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),Oe&&e.anchorNode==null?e.addRange(Oe):D&&this.startGracePeriod()),this.rememberSelection()},Ft.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)},Ft.prototype.showMultipleSelections=function(e){E(this.cm.display.cursorDiv,e.cursors),E(this.cm.display.selectionDiv,e.selection)},Ft.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ft.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},Ft.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ft.prototype.blur=function(){this.div.blur()},Ft.prototype.getField=function(){return this.div},Ft.prototype.supportsTouch=function(){return!0},Ft.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():_i(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)},Ft.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ft.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&g&&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 r=na(t,e.anchorNode,e.anchorOffset),n=na(t,e.focusNode,e.focusOffset);r&&n&&_i(t,function(){oi(t.doc,Ji(r,n),we),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},Ft.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),d=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=He(n.line-1,Ye(e.doc,n.line-1).length)),d.ch==Ye(e.doc,d.line).text.length&&d.line<e.lastLine()&&(d=He(d.line+1,0)),n.line<t.viewFrom||d.line>t.viewTo-1)return!1;var I,G,Q;n.line==t.viewFrom||(I=fn(e,n.line))==0?(G=vt(t.view[0].line),Q=t.view[0].node):(G=vt(t.view[I].line),Q=t.view[I-1].node.nextSibling);var q=fn(e,d.line),re,ge;if(q==t.view.length-1?(re=t.viewTo-1,ge=t.lineDiv.lastChild):(re=vt(t.view[q+1].line)-1,ge=t.view[q+1].node.previousSibling),!Q)return!1;for(var _e=e.doc.splitLines(tu(e,Q,ge,G,re)),Oe=wt(e.doc,He(G,0),He(re,Ye(e.doc,re).text.length));_e.length>1&&Oe.length>1;)if(k(_e)==k(Oe))_e.pop(),Oe.pop(),re--;else if(_e[0]==Oe[0])_e.shift(),Oe.shift(),G++;else break;for(var Ae=0,Fe=0,je=_e[0],ze=Oe[0],Ze=Math.min(je.length,ze.length);Ae<Ze&&je.charCodeAt(Ae)==ze.charCodeAt(Ae);)++Ae;for(var nt=k(_e),qe=k(Oe),st=Math.min(nt.length-(_e.length==1?Ae:0),qe.length-(Oe.length==1?Ae:0));Fe<st&&nt.charCodeAt(nt.length-Fe-1)==qe.charCodeAt(qe.length-Fe-1);)++Fe;if(_e.length==1&&Oe.length==1&&G==n.line)for(;Ae&&Ae>n.ch&&nt.charCodeAt(nt.length-Fe-1)==qe.charCodeAt(qe.length-Fe-1);)Ae--,Fe++;_e[_e.length-1]=nt.slice(0,nt.length-Fe).replace(/^\u200b+/,""),_e[0]=_e[0].slice(Ae).replace(/\u200b+$/,"");var pt=He(G,Ae),ht=He(re,Oe.length?k(Oe).length-Fe:0);if(_e.length>1||_e[0]||mt(pt,ht))return Un(e.doc,_e,pt,ht,"+input"),!0},Ft.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ft.prototype.reset=function(){this.forceCompositionEnd()},Ft.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ft.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)},Ft.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&_i(this.cm,function(){return mi(e.cm)})},Ft.prototype.setUneditable=function(e){e.contentEditable="false"},Ft.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||qt(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ft.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ft.prototype.onContextMenu=function(){},Ft.prototype.resetPosition=function(){},Ft.prototype.needsContentAttribute=!0;function Oo(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var n=Ye(e.doc,t.line),d=es(r,n,t.line),I=Ve(n,e.doc.direction),G="left";if(I){var Q=We(I,t.ch);G=Q%2?"right":"left"}var q=ns(d.map,t.ch,G);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 Gn(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,d){var I="",G=!1,Q=e.doc.lineSeparator(),q=!1;function re(Ae){return function(Fe){return Fe.id==Ae}}function ge(){G&&(I+=Q,q&&(I+=Q),G=q=!1)}function _e(Ae){Ae&&(ge(),I+=Ae)}function Oe(Ae){if(Ae.nodeType==1){var Fe=Ae.getAttribute("cm-text");if(Fe){_e(Fe);return}var je=Ae.getAttribute("cm-marker"),ze;if(je){var Ze=e.findMarks(He(n,0),He(d+1,0),re(+je));Ze.length&&(ze=Ze[0].find(0))&&_e(wt(e.doc,ze.from,ze.to).join(Q));return}if(Ae.getAttribute("contenteditable")=="false")return;var nt=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;nt&&ge();for(var qe=0;qe<Ae.childNodes.length;qe++)Oe(Ae.childNodes[qe]);/^(pre|p)$/i.test(Ae.nodeName)&&(q=!0),nt&&(G=!0)}else Ae.nodeType==3&&_e(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Oe(t),t==r);)t=t.nextSibling,q=!1;return I}function na(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Gn(e.clipPos(He(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var d=0;d<e.display.view.length;d++){var I=e.display.view[d];if(I.node==n)return iu(I,t,r)}}function iu(e,t,r){var n=e.text.firstChild,d=!1;if(!t||!y(n,t))return Gn(He(vt(e.line),0),!0);if(t==n&&(d=!0,t=n.childNodes[r],r=0,!t)){var I=e.rest?k(e.rest):e.line;return Gn(He(vt(I),I.text.length),d)}var G=t.nodeType==3?t:null,Q=t;for(!G&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(G=t.firstChild,r&&(r=G.nodeValue.length));Q.parentNode!=n;)Q=Q.parentNode;var q=e.measure,re=q.maps;function ge(ze,Ze,nt){for(var qe=-1;qe<(re?re.length:0);qe++)for(var st=qe<0?q.map:re[qe],pt=0;pt<st.length;pt+=3){var ht=st[pt+2];if(ht==ze||ht==Ze){var St=vt(qe<0?e.line:e.rest[qe]),jt=st[pt]+nt;return(nt<0||ht!=ze)&&(jt=st[pt+(nt?1:0)]),He(St,jt)}}}var _e=ge(G,Q,r);if(_e)return Gn(_e,d);for(var Oe=Q.nextSibling,Ae=G?G.nodeValue.length-r:0;Oe;Oe=Oe.nextSibling){if(_e=ge(Oe,Oe.firstChild,0),_e)return Gn(He(_e.line,_e.ch-Ae),d);Ae+=Oe.textContent.length}for(var Fe=Q.previousSibling,je=r;Fe;Fe=Fe.previousSibling){if(_e=ge(Fe,Fe.firstChild,-1),_e)return Gn(He(_e.line,_e.ch+je),d);je+=Fe.textContent.length}}var Vt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ne,this.hasSelection=!1,this.composing=null};Vt.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var d=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),p&&(d.style.width="0px"),Me(d,"input",function(){W&&H>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Me(d,"paste",function(G){if(Z(n,G)||To(G,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function I(G){if(Z(n,G))return;if(n.somethingSelected())ia({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var Q=So(n);ia({lineWise:!0,text:Q.text}),G.type=="cut"?n.setSelections(Q.ranges,null,we):(r.prevInput="",d.value=Q.text.join(`
|
|
`),j(d))}else return;G.type=="cut"&&(n.state.cutIncoming=+new Date)}Me(d,"cut",I),Me(d,"copy",I),Me(e.scroller,"paste",function(G){if(Gi(e,G)||Z(n,G))return;if(!d.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var Q=new Event("paste");Q.clipboardData=G.clipboardData,d.dispatchEvent(Q)}),Me(e.lineSpace,"selectstart",function(G){Gi(e,G)||ie(G)}),Me(d,"compositionstart",function(){var G=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:G,range:n.markText(G,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Me(d,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Vt.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},Vt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Vt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=ps(e);if(e.options.moveInputWithCursor){var d=Di(e,r.sel.primary().head,"div"),I=t.wrapper.getBoundingClientRect(),G=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,d.top+G.top-I.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,d.left+G.left-I.left))}return n},Vt.prototype.showSelection=function(e){var t=this.cm,r=t.display;E(r.cursorDiv,e.cursors),E(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Vt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&j(this.textarea),W&&H>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",W&&H>=9&&(this.hasSelection=null))},Vt.prototype.getField=function(){return this.textarea},Vt.prototype.supportsTouch=function(){return!1},Vt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!h||U()!=this.textarea))try{this.textarea.focus()}catch(e){}},Vt.prototype.blur=function(){this.textarea.blur()},Vt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Vt.prototype.receivedFocus=function(){this.slowPoll()},Vt.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()})},Vt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Vt.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var d=r.value;if(d==n&&!t.somethingSelected())return!1;if(W&&H>=9&&this.hasSelection===d||s&&/[\uf700-\uf7ff]/.test(d))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var I=d.charCodeAt(0);if(I==8203&&!n&&(n="\u200B"),I==8666)return this.reset(),this.cm.execCommand("undo")}for(var G=0,Q=Math.min(n.length,d.length);G<Q&&n.charCodeAt(G)==d.charCodeAt(G);)++G;return _i(t,function(){Ka(t,d.slice(G),n.length-G,null,e.composing?"*compose":null),d.length>1e3||d.indexOf(`
|
|
`)>-1?r.value=e.prevInput="":e.prevInput=d,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Vt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Vt.prototype.onKeyPress=function(){W&&H>=9&&(this.hasSelection=null),this.fastPoll()},Vt.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,d=t.textarea;t.contextMenuPending&&t.contextMenuPending();var I=cn(r,e),G=n.scroller.scrollTop;if(!I||c)return;var Q=r.options.resetSelectionOnContextMenu;Q&&r.doc.sel.contains(I)==-1&&qt(r,oi)(r.doc,Ji(I),we);var q=d.style.cssText,re=t.wrapper.style.cssText,ge=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",d.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ge.top-5)+"px; left: "+(e.clientX-ge.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var _e;i&&(_e=window.scrollY),n.input.focus(),i&&window.scrollTo(null,_e),n.input.reset(),r.somethingSelected()||(d.value=t.prevInput=" "),t.contextMenuPending=Ae,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Oe(){if(d.selectionStart!=null){var je=r.somethingSelected(),ze="\u200B"+(je?d.value:"");d.value="\u21DA",d.value=ze,t.prevInput=je?"":"\u200B",d.selectionStart=1,d.selectionEnd=ze.length,n.selForContextMenu=r.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,d.style.cssText=q,W&&H<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=G),d.selectionStart!=null){(!W||W&&H<9)&&Oe();var je=0,ze=function(){n.selForContextMenu==r.doc.sel&&d.selectionStart==0&&d.selectionEnd>0&&t.prevInput=="\u200B"?qt(r,Vs)(r):je++<10?n.detectingSelectAll=setTimeout(ze,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(ze,200)}}if(W&&H>=9&&Oe(),O){fe(e);var Fe=function(){tt(window,"mouseup",Fe),setTimeout(Ae,20)};Me(window,"mouseup",Fe)}else setTimeout(Ae,50)},Vt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Vt.prototype.setUneditable=function(){},Vt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?b(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 r=U();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=Q.getValue()}var d;if(e.form&&(Me(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var I=e.form;d=I.submit;try{var G=I.submit=function(){n(),I.submit=d,I.submit(),I.submit=G}}catch(q){}}t.finishInit=function(q){q.save=n,q.getTextArea=function(){return e},q.toTextArea=function(){q.toTextArea=isNaN,n(),e.parentNode.removeChild(q.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=d))}},e.style.display="none";var Q=Wt(function(q){return e.parentNode.insertBefore(q,e.nextSibling)},t);return Q}function ru(e){e.off=tt,e.on=Me,e.wheelEventPixels=dl,e.Doc=gi,e.splitLines=at,e.countColumn=V,e.findColumn=De,e.isWordChar=Te,e.Pass=Ie,e.signal=le,e.Line=un,e.changeEnd=Qi,e.scrollbarModel=xs,e.Pos=He,e.cmpPos=mt,e.modes=Ut,e.mimeModes=Ct,e.resolveMode=Kt,e.getMode=Zt,e.modeExtensions=ft,e.extendMode=_t,e.copyState=xt,e.startState=It,e.innerMode=Et,e.commands=xr,e.keyMap=Ki,e.keyName=lo,e.isModifierKey=so,e.lookupKey=jn,e.normalizeKeyMap=kl,e.StringStream=gt,e.SharedTextMarker=br,e.TextMarker=qi,e.LineWidget=yr,e.e_preventDefault=ie,e.e_stopPropagation=ae,e.e_stop=fe,e.addClass=B,e.contains=y,e.rmClass=S,e.keyNames=en}$l(Wt),ql(Wt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ra in gi.prototype)gi.prototype.hasOwnProperty(ra)&&ce(au,ra)<0&&(Wt.prototype[ra]=function(e){return function(){return e.apply(this.doc,arguments)}}(gi.prototype[ra]));return he(gi),Wt.inputStyles={textarea:Vt,contenteditable:Ft},Wt.defineMode=function(e){!Wt.defaults.mode&&e!="null"&&(Wt.defaults.mode=e),Qt.apply(this,arguments)},Wt.defineMIME=ci,Wt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Wt.defineMIME("text/plain","null"),Wt.defineExtension=function(e,t){Wt.prototype[e]=t},Wt.defineDocExtension=function(e,t){gi.prototype[e]=t},Wt.fromTextArea=nu,ru(Wt),Wt.version="5.58.2",Wt})},Y1PL:function(et,Ee,J){"use strict";J.r(Ee),J.d(Ee,"ResizableTextArea",function(){return ce});var oe=J("wx14"),Y=J("1OyB"),D=J("vuIU"),z=J("Ji7U"),N=J("LK+K"),M=J("q1tI"),W=J("VTBJ"),H=J("rePB"),i=J("Zm9Q"),L=J("Kwbf"),g=J("c+Xe"),c=J("m+aA"),m=J("bdgK"),u=new Map;function o(we){we.forEach(function(Le){var Re,De=Le.target;(Re=u.get(De))===null||Re===void 0||Re.forEach(function(ye){return ye(De)})})}var p=new m.default(o),l=null,h=null;function s(we,Le){u.has(we)||(u.set(we,new Set),p.observe(we)),u.get(we).add(Le)}function a(we,Le){u.has(we)&&(u.get(we).delete(Le),u.get(we).size||(p.unobserve(we),u.delete(we)))}var C=function(we){Object(z.a)(Re,we);var Le=Object(N.a)(Re);function Re(){return Object(Y.a)(this,Re),Le.apply(this,arguments)}return Object(D.a)(Re,[{key:"render",value:function(){return this.props.children}}]),Re}(M.Component),_=M.createContext(null);function T(we){var Le=we.children,Re=we.onBatchResize,De=M.useRef(0),ye=M.useRef([]),X=M.useContext(_),k=M.useCallback(function(F,$,te){De.current+=1;var K=De.current;ye.current.push({size:F,element:$,data:te}),Promise.resolve().then(function(){K===De.current&&(Re==null||Re(ye.current),ye.current=[])}),X==null||X(F,$,te)},[Re,X]);return M.createElement(_.Provider,{value:k},Le)}function O(we){var Le=we.children,Re=we.disabled,De=M.useRef(null),ye=M.useRef(null),X=M.useContext(_),k=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),F=M.isValidElement(Le)&&Object(g.c)(Le),$=F?Le.ref:null,te=M.useMemo(function(){return Object(g.a)($,De)},[$,De]),K=M.useRef(we);K.current=we;var pe=M.useCallback(function(Te){var ke=K.current,ue=ke.onResize,ve=ke.data,xe=Te.getBoundingClientRect(),Ce=xe.width,Ne=xe.height,Ue=Te.offsetWidth,Ge=Te.offsetHeight,We=Math.floor(Ce),it=Math.floor(Ne);if(k.current.width!==We||k.current.height!==it||k.current.offsetWidth!==Ue||k.current.offsetHeight!==Ge){var Ve={width:We,height:it,offsetWidth:Ue,offsetHeight:Ge};k.current=Ve;var Xe=Ue===Math.round(Ce)?Ce:Ue,Me=Ge===Math.round(Ne)?Ne:Ge,rt=Object(W.a)(Object(W.a)({},Ve),{},{offsetWidth:Xe,offsetHeight:Me});X==null||X(rt,Te,ve),ue&&Promise.resolve().then(function(){ue(rt,Te)})}},[]);return M.useEffect(function(){var Te=Object(c.a)(De.current)||Object(c.a)(ye.current);return Te&&!Re&&s(Te,pe),function(){return a(Te,pe)}},[De.current,Re]),M.createElement(C,{ref:ye},F?M.cloneElement(Le,{ref:te}):Le)}var R="rc-observer-key";function S(we){var Le=we.children,Re=Object(i.a)(Le);return Re.map(function(De,ye){var X=(De==null?void 0:De.key)||"".concat(R,"-").concat(ye);return M.createElement(O,Object(oe.a)({},we,{key:X}),De)})}S.Collection=T;var w=S,E=J("bT9E"),f=J("TSYQ"),x=J.n(f),v=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],U={},B;function A(we){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=we.getAttribute("id")||we.getAttribute("data-reactid")||we.getAttribute("name");if(Le&&U[Re])return U[Re];var De=window.getComputedStyle(we),ye=De.getPropertyValue("box-sizing")||De.getPropertyValue("-moz-box-sizing")||De.getPropertyValue("-webkit-box-sizing"),X=parseFloat(De.getPropertyValue("padding-bottom"))+parseFloat(De.getPropertyValue("padding-top")),k=parseFloat(De.getPropertyValue("border-bottom-width"))+parseFloat(De.getPropertyValue("border-top-width")),F=y.map(function(te){return"".concat(te,":").concat(De.getPropertyValue(te))}).join(";"),$={sizingStyle:F,paddingSize:X,borderSize:k,boxSizing:ye};return Le&&Re&&(U[Re]=$),$}function j(we){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,De=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)),we.getAttribute("wrap")?B.setAttribute("wrap",we.getAttribute("wrap")):B.removeAttribute("wrap");var ye=A(we,Le),X=ye.paddingSize,k=ye.borderSize,F=ye.boxSizing,$=ye.sizingStyle;B.setAttribute("style","".concat($,";").concat(v)),B.value=we.value||we.placeholder||"";var te=Number.MIN_SAFE_INTEGER,K=Number.MAX_SAFE_INTEGER,pe=B.scrollHeight,Te;if(F==="border-box"?pe+=k:F==="content-box"&&(pe-=X),Re!==null||De!==null){B.value=" ";var ke=B.scrollHeight-X;Re!==null&&(te=ke*Re,F==="border-box"&&(te=te+X+k),pe=Math.max(te,pe)),De!==null&&(K=ke*De,F==="border-box"&&(K=K+X+k),Te=pe>K?"":"hidden",pe=Math.min(K,pe))}return{height:pe,minHeight:te,maxHeight:K,overflowY:Te,resize:"none"}}var P=J("Gytx"),b=J.n(P),V;(function(we){we[we.NONE=0]="NONE",we[we.RESIZING=1]="RESIZING",we[we.RESIZED=2]="RESIZED"})(V||(V={}));var ne=function(we){Object(z.a)(Re,we);var Le=Object(N.a)(Re);function Re(De){var ye;return Object(Y.a)(this,Re),ye=Le.call(this,De),ye.nextFrameActionId=void 0,ye.resizeFrameId=void 0,ye.textArea=void 0,ye.saveTextArea=function(X){ye.textArea=X},ye.handleResize=function(X){var k=ye.state.resizeStatus,F=ye.props,$=F.autoSize,te=F.onResize;if(k!==V.NONE)return;typeof te=="function"&&te(X),$&&ye.resizeOnNextFrame()},ye.resizeOnNextFrame=function(){cancelAnimationFrame(ye.nextFrameActionId),ye.nextFrameActionId=requestAnimationFrame(ye.resizeTextarea)},ye.resizeTextarea=function(){var X=ye.props.autoSize;if(!X||!ye.textArea)return;var k=X.minRows,F=X.maxRows,$=j(ye.textArea,!1,k,F);ye.setState({textareaStyles:$,resizeStatus:V.RESIZING},function(){cancelAnimationFrame(ye.resizeFrameId),ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:V.RESIZED},function(){ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:V.NONE}),ye.fixFirefoxAutoScroll()})})})})},ye.renderTextArea=function(){var X=ye.props,k=X.prefixCls,F=k===void 0?"rc-textarea":k,$=X.autoSize,te=X.onResize,K=X.className,pe=X.disabled,Te=ye.state,ke=Te.textareaStyles,ue=Te.resizeStatus,ve=Object(E.a)(ye.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),xe=x()(F,K,Object(H.a)({},"".concat(F,"-disabled"),pe));"value"in ve&&(ve.value=ve.value||"");var Ce=Object(W.a)(Object(W.a)(Object(W.a)({},ye.props.style),ke),ue===V.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(w,{onResize:ye.handleResize,disabled:!($||te)},M.createElement("textarea",Object(oe.a)({},ve,{className:xe,style:Ce,ref:ye.saveTextArea})))},ye.state={textareaStyles:{},resizeStatus:V.NONE},ye}return Object(D.a)(Re,[{key:"componentDidUpdate",value:function(ye){(ye.value!==this.props.value||!b()(ye.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 ye=this.textArea.selectionStart,X=this.textArea.selectionEnd;this.textArea.setSelectionRange(ye,X)}}catch(k){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Re}(M.Component),ce=ne,me=function(we){Object(z.a)(Re,we);var Le=Object(N.a)(Re);function Re(De){var ye;Object(Y.a)(this,Re),ye=Le.call(this,De),ye.resizableTextArea=void 0,ye.focus=function(){ye.resizableTextArea.textArea.focus()},ye.saveTextArea=function(k){ye.resizableTextArea=k},ye.handleChange=function(k){var F=ye.props.onChange;ye.setValue(k.target.value,function(){ye.resizableTextArea.resizeTextarea()}),F&&F(k)},ye.handleKeyDown=function(k){var F=ye.props,$=F.onPressEnter,te=F.onKeyDown;k.keyCode===13&&$&&$(k),te&&te(k)};var X=typeof De.value=="undefined"||De.value===null?De.defaultValue:De.value;return ye.state={value:X},ye}return Object(D.a)(Re,[{key:"setValue",value:function(ye,X){"value"in this.props||this.setState({value:ye},X)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(ce,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ye){return"value"in ye?{value:ye.value}:null}}]),Re}(M.Component),Ie=Ee.default=me},ZW9T:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return P});var oe=J("k1fw"),Y=J("oBTY"),D=J("miYZ"),z=J("tsqr"),N=J("rAM+"),M=J("tJVT"),W=J("PpiC"),H=J("q1tI"),i=J.n(H),L=J("bdgK"),g=J("9og8"),c=J("WmNS"),m=J.n(c),u={keywords:["print","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"]},o={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},p={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"if",content:["if () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
|
|
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
|
|
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
|
|
`)},{label:"include <map>",content:["#include <map>"].join(`
|
|
`)},{label:"include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},h=J("5VLF"),s=J.n(h),a={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},C=function(V,ne){return ne.map(function(ce){return{label:ce,kind:V.languages.CompletionItemKind.Keyword,insertText:ce}})},_=function(V){return Object.keys(a.tables).map(function(ne){return{label:ne,kind:V.languages.CompletionItemKind.Variable,insertText:ne}})},T=function(V,ne){var ce=a.tables[V];return ce?ce.map(function(me){return{label:me,kind:ne.languages.CompletionItemKind.Field,insertText:me}}):[]};function O(b,V,ne,ce,me){var Ie=V.getWordUntilPosition(ne),we={startLineNumber:ne.lineNumber,endLineNumber:ne.lineNumber,startColumn:Ie.startColumn,endColumn:Ie.endColumn},Le=ce.map(function(Re){return{label:Re,kind:b.languages.CompletionItemKind.Keyword,insertText:Re,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:we}});return me.map(function(Re){Le.push(Object(oe.a)(Object(oe.a)({},Re),{},{range:we}))}),Le}var R=function(b){a.languages.map(function(me){return b.languages.registerDocumentFormattingEditProvider(me,{provideDocumentFormattingEdits:function(we,Le,Re){return Object(g.a)(m.a.mark(function De(){var ye;return m.a.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return ye=s()(we.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),k.abrupt("return",[{range:we.getFullModelRange(),text:ye}]);case 2:case"end":return k.stop()}},De)}))()}}),me});var V=p.quickKey.map(function(me){return{label:me.label,kind:b.languages.CompletionItemKind.Method,insertText:me.content,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),ne=l.quickKey.map(function(me){return{label:me.label,kind:b.languages.CompletionItemKind.Method,insertText:me.content,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),ce=o.quickKey.map(function(me){return{label:me.label,kind:b.languages.CompletionItemKind.Method,insertText:me.content,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}});b.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(Ie,we){var Le=Ie.getWordUntilPosition(we),Re={startLineNumber:we.lineNumber,endLineNumber:we.lineNumber,startColumn:Le.startColumn,endColumn:Le.endColumn},De=Ie.getLineContent(we.lineNumber).substring(Le.startColumn-2,Le.endColumn);return{suggestions:[].concat(Object(Y.a)(p.keywords.map(function(ye){return{label:ye,kind:b.languages.CompletionItemKind.Function,documentation:ye,insertText:ye,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}})),Object(Y.a)(p.quickKey.map(function(ye){return{label:ye.label,kind:b.languages.CompletionItemKind.Function,documentation:ye.content,insertText:De.startsWith("#")?ye.content.replace(/#/,""):ye.content,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}})))}}}),b.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(Ie,we){var Le=Ie.getWordUntilPosition(we),Re={startLineNumber:we.lineNumber,endLineNumber:we.lineNumber,startColumn:Le.startColumn,endColumn:Le.endColumn};return{suggestions:Object(Y.a)(u.keywords.map(function(De){return{label:De,kind:b.languages.CompletionItemKind.Function,documentation:De,insertText:De,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}}))}}}),b.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(Ie,we){var Le=Ie.getWordUntilPosition(we),Re={startLineNumber:we.lineNumber,endLineNumber:we.lineNumber,startColumn:Le.startColumn,endColumn:Le.endColumn},De=Ie.getLineContent(we.lineNumber).substring(Le.startColumn-2,Le.endColumn);return{suggestions:[].concat(Object(Y.a)(o.keywords.map(function(ye){return{label:ye,kind:b.languages.CompletionItemKind.Function,documentation:ye,insertText:ye,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}})),Object(Y.a)(o.quickKey.map(function(ye){return{label:ye.label,kind:b.languages.CompletionItemKind.Function,documentation:ye.content,insertText:De.startsWith("#")?ye.content.replace(/#/,""):ye.content,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}})))}}}),b.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(Ie,we){var Le=Ie.getWordUntilPosition(we),Re={startLineNumber:we.lineNumber,endLineNumber:we.lineNumber,startColumn:Le.startColumn,endColumn:Le.endColumn},De=Ie.getLineContent(we.lineNumber).substring(Le.startColumn-2,Le.endColumn);return{suggestions:[].concat(Object(Y.a)(l.keywords.map(function(ye){return{label:ye,kind:b.languages.CompletionItemKind.Function,documentation:ye,insertText:ye,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}})),Object(Y.a)(l.quickKey.map(function(ye){return{label:ye.label,kind:b.languages.CompletionItemKind.Function,documentation:ye.content,insertText:De.startsWith("#")?ye.content.replace(/#/,""):ye.content,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}})))}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",w=J("fjLI"),E=J("LvDl"),f=J("+ua5");function x(b){return/^\d+$/.test(b)?"".concat(b,"px"):b}function v(){}var y=!1,U={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function B(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],V=b;if(Array.isArray(b)){for(var ne=0;ne<b.length;ne++){var ce=U[b[ne]];if(ce)return ce}return V[0]}return U[V]||V}var A=null,j=Ee.b=function(b){var V=b.width,ne=V===void 0?"100%":V,ce=b.height,me=ce===void 0?"100%":ce,Ie=b.value,we=b.language,Le=we===void 0?"javascript":we,Re=b.style,De=Re===void 0?{}:Re,ye=b.options,X=ye===void 0?{}:ye,k=b.overrideServices,F=k===void 0?{}:k,$=b.theme,te=$===void 0?"vs-dark":$,K=b.onEditBlur,pe=b.onSave,Te=b.autoHeight,ke=Te===void 0?!1:Te,ue=b.forbidCopy,ve=ue===void 0?!1:ue,xe=b.onChange,Ce=xe===void 0?v:xe,Ne=b.editorDidMount,Ue=Ne===void 0?v:Ne,Ge=b.onFocus,We=Ge===void 0?v:Ge,it=b.filename,Ve=it===void 0?"educoder.txt":it,Xe=b.errorLine,Me=b.errorContent,rt=Me===void 0?"":Me,tt=Object(W.a)(b,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),le=Object(H.useRef)(),Z=Object(H.useRef)({}),ee=Object(H.useRef)(),se=Object(H.useRef)(),he=Object(H.useRef)(!1),ie=Object(H.useRef)(),ae=Object(H.useState)(!1),de=Object(M.a)(ae,2),fe=de[0],be=de[1];function Se(){var ft;return le.current&&(ft=new L.default(function(_t){var xt=Object(N.a)(_t),Et;try{for(xt.s();!(Et=xt.n()).done;){var It=Et.value;(It.target.offsetHeight>0||It.target.offsetWidth>0)&&Z.current.instance.layout()}}catch(gt){xt.e(gt)}finally{xt.f()}}),ft.observe(le.current)),ft}function Pe(){z.b.warn(decodeURIComponent(S))}var Be=function(){var _t=Z.current.instance;if(Ie!=null&&_t&&fe){var xt=_t.getModel();xt&&Ie!==xt.getValue()&&(y=!0,xt.setValue(Ie),_t.layout(),y=!1)}};Object(H.useEffect)(function(){se.current&&clearTimeout(se.current),se.current=setTimeout(function(){Be()},500)},[Ie,fe,Z.current]),Object(H.useEffect)(function(){if(Xe&&Z.current&&Z.current.instance){var ft=Z.current.instance;ft.changeViewZones(function(xt){var Et=document.createElement("div");Et.style.padding="10px 20px",Et.style.width="calc(100% - 20px)",Et.className="my-error-line-wrp",Et.innerHTML=rt,xt.addZone({afterLineNumber:Xe||11,heightInLines:3,domNode:Et})});var _t={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}};ft.addOverlayWidget(_t),ft.revealPositionInCenter({lineNumber:20,column:1})}},[Xe,Z.current,fe]);function Je(){var ft=Z.current.instance;if(ft){var _t=ft.getSelection(),xt=Z.current.pastePos||{},Et=new A.Range(xt.startLineNumber||_t.endLineNumber,xt.startColumn||_t.endColumn,xt.endLineNumber||_t.endLineNumber,xt.endColumn||_t.endColumn);setTimeout(function(){ft.executeEdits("",[{range:Et,text:""}])},300)}}function $e(ft){(window.navigator.platform.match("Mac")?ft.metaKey:ft.ctrlKey)&&ft.keyCode==83&&(ft.preventDefault(),pe())}var lt=function(){if(ke&&Z.current.instance){var _t=Z.current.instance.getContentHeight();Kt(_t<me?me:_t)}else Kt(me)};function at(ft){var _t=document.createEvent("MouseEvents");_t.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ft.dispatchEvent(_t)}function Qe(ft,_t){var xt=window.URL||window.webkitURL||window,Et=new Blob([_t]),It=document.createElementNS("http://www.w3.org/1999/xhtml","a");It.href=xt.createObjectURL(Et),It.download=ft,at(It)}Object(H.useEffect)(function(){lt()},[lt]),Object(H.useEffect)(function(){le.current&&!fe&&Promise.all([J.e(18),J.e(29)]).then(J.t.bind(null,"M/lh",7)).then(function(ft){try{A=ft,Z.current.instance=A.editor.create(le.current,{value:Ie,language:B(Le),theme:te,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},F);var _t=Z.current.instance,xt=w.d._menuItems,Et=Object(Y.a)(xt).find(function(Tt){return Tt[0]._debugName=="EditorContext"}),It=Et[1],gt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Ye=function(ut,vt){var Rt=ut._first;do{var ai,Ht,He=vt.includes((ai=Rt.element)===null||ai===void 0||((Ht=ai.command)===null||Ht===void 0)?void 0:Ht.id);He&&ut._remove(Rt)}while(Rt=Rt.next)};if(Ue(_t,A),setTimeout(function(){lt(),Z.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Qe(Ve||"educoder.txt",_t.getValue())}}),_t.getDomNode().addEventListener("input",function(){ee.current.autoFormat&&_t.getAction("editor.action.formatDocument").run()})},500),Z.current.subscription=_t.onDidChangeModelContent(function(Tt){he.current?clearTimeout(ie.current):(lt(),Ce(_t.getValue(),Tt)),ie.current=setTimeout(function(){he.current=!1},500)}),window.Monaco||R(A,B(Le)),ve&&(Ye(It,gt),le.current.classList.add("noCopyPaste"),_t.onKeyDown(function(Tt){var ut=Tt.keyCode,vt=Tt.ctrlKey,Rt=Tt.metaKey;(ut===33||ut===52)&&(Rt||vt)&&(Pe(),Tt.preventDefault())})),window.Monaco=A,K&&_t.onDidBlurEditorWidget(function(){K(_t.getValue())}),We&&_t.onDidFocusEditorText(function(){We(_t.getValue())}),ve){_t.addCommand(A.KeyMod.CtrlCmd|A.KeyCode.KEY_V,function(){return Pe(),null}),_t.onDidPaste(function(Tt){Z.current.pastePos=Tt});try{window.addEventListener("paste",Je)}catch(Tt){}}var wt=Se();return be(!0),function(){var Tt=Z.current.instance;Tt.dispose();var ut=Tt.getModel();ut&&ut.dispose(),Z.current.subscription&&Z.current.subscription.dispose(),ve&&window.removeEventListener("paste",Je),wt.unobserve(le.current)}}catch(Tt){}})},[]),Object(H.useEffect)(function(){var ft=Z.current.instance;if(ft&&fe)return document.addEventListener("keydown",$e,!1),function(){document.removeEventListener("keydown",$e)}},[pe,fe]),Object(H.useEffect)(function(){var ft=Z.current.instance;if(ft&&fe){var _t=B(Le);A.editor.setModelLanguage(ft.getModel(),_t),console.log("language:",Le,ft.getModel(),_t)}},[Le,fe]),Object(H.useEffect)(function(){var ft=Z.current.instance;ft&&fe&&A.editor.setTheme(te)},[te,fe]),Object(H.useEffect)(function(){var ft=Z.current.instance;ee.current=X,ft&&fe&&(ft.updateOptions(Object(oe.a)({},X)),setTimeout(function(){ft.getModel().updateOptions(Object(oe.a)({},X))},200))},[JSON.stringify(X),fe]),Object(H.useEffect)(function(){var ft=Z.current.instance;ft&&fe&&ft.layout()},[ne,me,fe]);var Lt=Object(H.useState)(x(ne)),ct=Object(M.a)(Lt,2),Nt=ct[0],Ut=ct[1],Ct=Object(H.useState)(x(me)),Qt=Object(M.a)(Ct,2),ci=Qt[0],Kt=Qt[1],Zt=Object(oe.a)(Object(oe.a)({},De),{},{width:Nt,height:ci});return i.a.createElement("div",{className:"my-monaco-editor",ref:le,style:Zt})};function P(b){var V=b.width,ne=V===void 0?"100%":V,ce=b.height,me=ce===void 0?"100%":ce,Ie=b.original,we=b.modified,Le=b.language,Re=b.options,De=Re===void 0?{}:Re,ye=Object(H.useRef)(),X=Object(H.useState)(null),k=Object(M.a)(X,2),F=k[0],$=k[1];function te(ke){var ue;return ye.current&&(ue=new L.default(function(ve){var xe=Object(N.a)(ve),Ce;try{for(xe.s();!(Ce=xe.n()).done;){var Ne=Ce.value;(Ne.target.offsetHeight>0||Ne.target.offsetWidth>0)&&ke.layout()}}catch(Ue){xe.e(Ue)}finally{xe.f()}}),ue.observe(ye.current)),ue}Object(H.useEffect)(function(){ye.current&&Promise.all([J.e(18),J.e(29)]).then(J.t.bind(null,"M/lh",7)).then(function(ke){A=ke;var ue=A.editor.createDiffEditor(ye.current,Object(oe.a)(Object(oe.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},De),{},{wordWrap:!0}));$(ue);var ve=te(ue);return function(){ue.dispose();var xe=ue.getModel();xe&&xe.dispose(),ve.unobserve(ye.current)}})},[]),Object(H.useEffect)(function(){F&&F.setModel({original:A.editor.createModel(Ie,Le),modified:A.editor.createModel(we,Le)})},[Ie,we,Le,F]);var K=x(ne),pe=x(me),Te={width:K,height:pe};return i.a.createElement("div",{className:"my-diff-editor",ref:ye,style:Te})}},bT9E:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return Y});var oe=J("VTBJ");function Y(D,z){var N=Object(oe.a)({},D);return Array.isArray(z)&&z.forEach(function(M){delete N[M]}),N}},c5Ni:function(et,Ee,J){},dejd:function(et,Ee,J){},dmUQ:function(et,Ee,J){"use strict";var oe=J("Ff2n"),Y=J("rePB"),D=J("1OyB"),z=J("vuIU"),N=J("Ji7U"),M=J("md7G"),W=J("foSv"),H=J("q1tI"),i=J.n(H),L=J("TSYQ"),g=J.n(L),c=J("4IlW");function m(E,f){var x=Object.keys(E);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(E);f&&(v=v.filter(function(y){return Object.getOwnPropertyDescriptor(E,y).enumerable})),x.push.apply(x,v)}return x}function u(E){for(var f=1;f<arguments.length;f++){var x=arguments[f]!=null?arguments[f]:{};f%2?m(Object(x),!0).forEach(function(v){Object(Y.a)(E,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(x)):m(Object(x)).forEach(function(v){Object.defineProperty(E,v,Object.getOwnPropertyDescriptor(x,v))})}return E}function o(E){var f=p();return function(){var v=Object(W.a)(E),y;if(f){var U=Object(W.a)(this).constructor;y=Reflect.construct(v,arguments,U)}else y=v.apply(this,arguments);return Object(M.a)(this,y)}}function p(){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(E){return!1}}function l(){}function h(E){E.preventDefault()}var s=function(f){return f.replace(/[^\w.-]+/g,"")},a=200,C=600,_=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(f){return f!=null},O=function(f,x){return x===f||typeof x=="number"&&typeof f=="number"&&isNaN(x)&&isNaN(f)},R=function(E){Object(N.a)(x,E);var f=o(x);function x(v){var y;Object(D.a)(this,x),y=f.call(this,v),y.onKeyDown=function(A){var j=y.props,P=j.onKeyDown,b=j.onPressEnter;if(A.keyCode===c.a.UP){var V=y.getRatio(A);y.up(A,V,null),y.stop()}else if(A.keyCode===c.a.DOWN){var ne=y.getRatio(A);y.down(A,ne,null),y.stop()}else A.keyCode===c.a.ENTER&&b&&b(A);if(y.recordCursorPosition(),y.lastKeyCode=A.keyCode,P){for(var ce=arguments.length,me=new Array(ce>1?ce-1:0),Ie=1;Ie<ce;Ie++)me[Ie-1]=arguments[Ie];P.apply(void 0,[A].concat(me))}},y.onKeyUp=function(A){var j=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),j){for(var P=arguments.length,b=new Array(P>1?P-1:0),V=1;V<P;V++)b[V-1]=arguments[V];j.apply(void 0,[A].concat(b))}},y.onChange=function(A){var j=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(A)),y.setState({inputValue:y.rawInput}),j(y.toNumber(y.rawInput))},y.onMouseUp=function(){var A=y.props.onMouseUp;y.recordCursorPosition(),A&&A.apply(void 0,arguments)},y.onFocus=function(){var A;y.setState({focused:!0}),(A=y.props).onFocus.apply(A,arguments)},y.onBlur=function(){var A=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var j=y.getCurrentValidValue(y.state.inputValue),P=y.setValue(j,l);if(A){var b=y.input.value,V=y.getInputDisplayValue({focus:!1,value:P});y.input.value=V&&Number(V),A.apply(void 0,arguments),y.input.value=b}},y.getRatio=function(A){var j=1;return A.metaKey||A.ctrlKey?j=.1:A.shiftKey&&(j=10),j},y.getFullNum=function(A){return isNaN(A)?A:/e/i.test(String(A))?Number(A).toFixed(18).replace(/\.?0+$/,""):A},y.getPrecision=function(A){if(T(y.props.precision))return y.props.precision;var j=String(A);if(j.indexOf("e-")>=0)return parseInt(j.slice(j.indexOf("e-")+2),10);var P=0;return j.indexOf(".")>=0&&(P=j.length-j.indexOf(".")-1),P},y.getInputDisplayValue=function(A){var j=A||y.state,P=j.focused,b=j.inputValue,V=j.value,ne;P?ne=b:ne=y.toPrecisionAsStep(V),ne==null&&(ne="");var ce=y.formatWrapper(ne);return T(y.props.decimalSeparator)&&(ce=ce.toString().replace(".",y.props.decimalSeparator)),ce},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(A){}},y.restoreByAfter=function(A){if(A===void 0)return!1;var j=y.input.value,P=j.lastIndexOf(A);if(P===-1)return!1;var b=y.cursorBefore.length;return y.lastKeyCode===c.a.DELETE&&y.cursorBefore.charAt(b-1)===A[0]?(y.fixCaret(b,b),!0):P+A.length===j.length?(y.fixCaret(P,P),!0):!1},y.partRestoreByAfter=function(A){return A===void 0?!1:Array.prototype.some.call(A,function(j,P){var b=A.substring(P);return y.restoreByAfter(b)})},y.isNotCompleteNumber=function(A){return isNaN(A)||A===""||A===null||A&&A.toString().indexOf(".")===A.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(A,j,P){y.pressingUpOrDown=!0,y.step("down",A,j,P)},y.up=function(A,j,P){y.pressingUpOrDown=!0,y.step("up",A,j,P)},y.saveInput=function(A){y.input=A};var U=v.value;U===void 0&&(U=v.defaultValue),y.state={focused:v.autoFocus};var B=y.getValidValue(y.toNumber(U));return y.state=u(u({},y.state),{},{inputValue:y.toPrecisionAsStep(B),value:B}),y}return Object(z.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var U=this.props,B=U.value,A=U.onChange,j=U.max,P=U.min,b=this.state.focused;if(y){if(!O(y.value,B)||!O(y.max,j)||!O(y.min,P)){var V=b?B:this.getValidValue(B),ne;this.pressingUpOrDown?ne=V:this.inputting?ne=this.rawInput:ne=this.toPrecisionAsStep(V),this.setState({value:V,inputValue:ne})}var ce="value"in this.props?B:this.state.value;"max"in this.props&&y.max!==j&&typeof ce=="number"&&ce>j&&A&&A(j),"min"in this.props&&y.min!==P&&typeof ce=="number"&&ce<P&&A&&A(P)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var me=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===c.a.BACKSPACE?me=this.cursorStart-1:this.lastKeyCode===c.a.DELETE&&(me=this.cursorStart):me=this.input.value.length,this.fixCaret(me,me)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case c.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case c.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ie){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(y){var U=y;return U===""?U="":this.isNotCompleteNumber(parseFloat(U))?U=this.state.value:U=this.getValidValue(U),this.toNumber(U)}},{key:"getValueFromEvent",value:function(y){var U=y.target.value.trim().replace(/。/g,".");return T(this.props.decimalSeparator)&&(U=U.replace(this.props.decimalSeparator,".")),U}},{key:"getValidValue",value:function(y){var U=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,A=parseFloat(y);return isNaN(A)?y:(A<U&&(A=U),A>B&&(A=B),A)}},{key:"setValue",value:function(y,U){var B=this.props.precision,A=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),j=this.state.value,P=j===void 0?null:j,b=this.state.inputValue,V=b===void 0?null:b,ne=typeof A=="number"?A.toFixed(B):"".concat(A),ce=A!==P||ne!=="".concat(V);return"value"in this.props?(V=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:V},U)):this.setState({value:A,inputValue:this.toPrecisionAsStep(y)},U),ce&&this.props.onChange(A),A}},{key:"getMaxPrecision",value:function(y){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,A=B.precision,j=B.step;if(T(A))return A;var P=this.getPrecision(U),b=this.getPrecision(j),V=this.getPrecision(y);return y?Math.max(V,P+b):P+b}},{key:"getPrecisionFactor",value:function(y){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(y,U);return Math.pow(10,B)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var U=Math.abs(this.getMaxPrecision(y));return isNaN(U)?y.toString():Number(y).toFixed(U)}},{key:"toNumber",value:function(y){var U=this.props.precision,B=this.state.focused,A=y&&y.length>16&&B;return this.isNotCompleteNumber(y)||A?y:T(U)?Math.round(y*Math.pow(10,U))/Math.pow(10,U):Number(y)}},{key:"upStep",value:function(y,U){var B=this.props.step,A=this.getPrecisionFactor(y,U),j=Math.abs(this.getMaxPrecision(y,U)),P=((A*y+A*B*U)/A).toFixed(j);return this.toNumber(P)}},{key:"downStep",value:function(y,U){var B=this.props.step,A=this.getPrecisionFactor(y,U),j=Math.abs(this.getMaxPrecision(y,U)),P=((A*y-A*B*U)/A).toFixed(j);return this.toNumber(P)}},{key:"step",value:function(y,U){var B=this,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=arguments.length>3?arguments[3]:void 0;this.stop(),U&&(U.persist(),U.preventDefault());var P=this.props;if(P.disabled)return;var b=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(b))return;var V=this["".concat(y,"Step")](b,A),ne=V>P.max||V<P.min;if(V>P.max?V=P.max:V<P.min&&(V=P.min),this.setValue(V,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),ne)return;this.autoStepTimer=setTimeout(function(){B[y](U,A,!0)},j?a:C)}},{key:"fixCaret",value:function(y,U){if(y===void 0||U===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,A=this.input.selectionEnd;(y!==B||U!==A)&&this.input.setSelectionRange(y,U)}catch(j){}}},{key:"render",value:function(){var y,U=this.props,B=U.prefixCls,A=U.disabled,j=U.readOnly,P=U.useTouch,b=U.autoComplete,V=U.upHandler,ne=U.downHandler,ce=U.className,me=U.max,Ie=U.min,we=U.style,Le=U.title,Re=U.onMouseEnter,De=U.onMouseLeave,ye=U.onMouseOver,X=U.onMouseOut,k=U.required,F=U.onClick,$=U.tabIndex,te=U.type,K=U.placeholder,pe=U.id,Te=U.inputMode,ke=U.pattern,ue=U.step,ve=U.maxLength,xe=U.autoFocus,Ce=U.name,Ne=U.onPaste,Ue=U.onInput,Ge=Object(oe.a)(U,["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"]),We=this.state,it=We.value,Ve=We.focused,Xe=g()(B,(y={},Object(Y.a)(y,ce,!!ce),Object(Y.a)(y,"".concat(B,"-disabled"),A),Object(Y.a)(y,"".concat(B,"-focused"),Ve),y)),Me={};Object.keys(Ge).forEach(function(fe){(fe.substr(0,5)==="data-"||fe.substr(0,5)==="aria-"||fe==="role")&&(Me[fe]=Ge[fe])});var rt=!j&&!A,tt=this.getInputDisplayValue(null),le=(it||it===0)&&(isNaN(it)||Number(it)>=me),Z=(it||it===0)&&(isNaN(it)||Number(it)<=Ie),ee=le||A||j,se=Z||A||j,he=g()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(Y.a)({},"".concat(B,"-handler-up-disabled"),ee)),ie=g()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(Y.a)({},"".concat(B,"-handler-down-disabled"),se)),ae=P?{onTouchStart:ee?l:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=P?{onTouchStart:se?l:this.down,onTouchEnd:this.stop}:{onMouseDown:se?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return i.a.createElement("div",{className:Xe,style:we,title:Le,onMouseEnter:Re,onMouseLeave:De,onMouseOver:ye,onMouseOut:X,onFocus:function(){return null},onBlur:function(){return null}},i.a.createElement("div",{className:"".concat(B,"-handler-wrap")},i.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:he}),V||i.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:h})),i.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":se,className:ie}),ne||i.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:h}))),i.a.createElement("div",{className:"".concat(B,"-input-wrap")},i.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ie,"aria-valuemax":me,"aria-valuenow":it,required:k,type:te,placeholder:K,onPaste:Ne,onClick:F,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:$,autoComplete:b,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:rt?this.onKeyDown:l,onKeyUp:rt?this.onKeyUp:l,autoFocus:xe,maxLength:ve,readOnly:j,disabled:A,max:me,min:Ie,step:ue,name:Ce,title:Le,id:pe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(tt),pattern:ke,inputMode:Te,onInput:Ue},Me))))}}]),x}(i.a.Component);R.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:_,min:-_,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var S=R,w=Ee.a=S},fB9n:function(et,Ee,J){"use strict";J.r(Ee);var oe=J("14J3"),Y=J("BMrR"),D=J("jCWc"),z=J("kPKH"),N=J("k1fw"),M=J("9og8"),W=J("tJVT"),H=J("PpiC"),i=J("WmNS"),L=J.n(i),g=J("q1tI"),c=J.n(g),m=J("55Ip"),u=J("9kvl"),o=J("T2oS"),p=J("W9HT"),l=J("oBTY"),h=J("B9cy"),s=J("Ol7k"),a=J("lUTK"),C=J("BvKs"),_=J("Ty5D"),T=J("wd/R"),O=J.n(T),R=J("RotF"),S=J.n(R),w=J("m3rI"),E=J("9Bee"),f=J("SbmS"),x=J.n(f),v=C.a.SubMenu,y=s.a.Sider,U=s.a.Content,B=function(Te){var ke=Te.messages,ue=Te.globalSetting,ve=Te.loading,xe=Te.user,Ce=Te.dispatch,Ne=Object(H.a)(Te,["messages","globalSetting","loading","user","dispatch"]),Ue=Object(_.i)(),Ge=Object(_.h)(),We=xe.userInfo,it=Object(g.useState)(!1),Ve=Object(W.a)(it,2),Xe=Ve[0],Me=Ve[1],rt=Object(g.useState)({per_page:20,page:1}),tt=Object(W.a)(rt,2),le=tt[0],Z=tt[1],ee=Object(g.useState)({per_page:20,page:1}),se=Object(W.a)(ee,2),he=se[0],ie=se[1],ae=Object(g.useState)([]),de=Object(W.a)(ae,2),fe=de[0],be=de[1];Object(g.useEffect)(function(){le.page=1,Pe()},[Ue.userId]);var Se=function(Je){var $e,lt;u.d.push("/messages/".concat(xe==null||(($e=xe.userInfo)===null||$e===void 0)?void 0:$e.login,"/message_detail?target_ids=").concat(Je==null||((lt=Je.target)===null||lt===void 0)?void 0:lt.id))},Pe=function(){var Be=Object(M.a)(L.a.mark(function Je(){var $e,lt;return L.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return Me(!1),Qe.next=3,Ce({type:"messages/getPrivateMessages",payload:Object(N.a)(Object(N.a)({},Ue),he)});case 3:$e=Qe.sent,$e!=null&&$e.private_messages&&(be([].concat(Object(l.a)(fe),Object(l.a)($e.private_messages))),((lt=$e.private_messages)===null||lt===void 0?void 0:lt.length)===20&&Me(!0));case 5:case"end":return Qe.stop()}},Je)}));return function(){return Be.apply(this,arguments)}}();return c.a.createElement("aside",{className:x.a.listRightMessage},c.a.createElement(S.a,{loadMore:function(){he.page++,Pe()},hasMore:Xe,useWindow:!1},c.a.createElement(p.a,{spinning:ve["messages/getPrivateMessages"]},c.a.createElement("div",{className:"minH500"},fe==null?void 0:fe.map(function(Be,Je){var $e,lt;return c.a.createElement("aside",{key:Je},c.a.createElement(Y.a,{onClick:function(){return Se(Be)}},c.a.createElement(z.a,{flex:"58px"},c.a.createElement("img",{src:w.a.IMG_SERVER+"/images/"+(Be==null||(($e=Be.target)===null||$e===void 0)?void 0:$e.image_url),alt:""})),c.a.createElement(z.a,{flex:"1"},c.a.createElement(Y.a,null,c.a.createElement(z.a,{span:24},c.a.createElement(Y.a,null,c.a.createElement(z.a,{flex:"1"},c.a.createElement("span",{className:x.a.userName},Be==null||((lt=Be.target)===null||lt===void 0)?void 0:lt.name)),c.a.createElement(z.a,null,c.a.createElement("span",{className:"ml15 c-grey-c"},O()(Be.send_time).fromNow())))),c.a.createElement(z.a,{span:24},c.a.createElement("div",{className:["mt15",x.a.content].join(" ")},c.a.createElement(E.a,{value:Be.content||""})))))))})))))},A=Object(u.a)(function(pe){var Te=pe.messages,ke=pe.loading,ue=pe.user,ve=pe.globalSetting;return{messages:Te,globalSetting:ve,user:ue,loading:ke.effects}})(B),j=J("+L6B"),P=J("2/Rp"),b=J("miYZ"),V=J("tsqr"),ne=J("y8nQ"),ce=J("Vl3Y"),me=J("kaH+"),Ie=J("1vsH"),we=J("5WQS"),Le=J("Ot1p"),Re=J("dhSg"),De=C.a.SubMenu,ye=s.a.Sider,X=s.a.Content,k=function(Te){var ke=Te.messages,ue=Te.globalSetting,ve=Te.loading,xe=Te.user,Ce=Te.dispatch,Ne=Object(H.a)(Te,["messages","globalSetting","loading","user","dispatch"]),Ue=Object(_.i)(),Ge=Object(_.h)(),We=Ge.query,it=Object(g.useState)({per_page:20,page:1}),Ve=Object(W.a)(it,2),Xe=Ve[0],Me=Ve[1],rt=Object(g.useState)([]),tt=Object(W.a)(rt,2),le=tt[0],Z=tt[1],ee=Object(g.useState)(!1),se=Object(W.a)(ee,2),he=se[0],ie=se[1],ae=Object(g.useState)(!1),de=Object(W.a)(ae,2),fe=de[0],be=de[1],Se=Object(g.useState)(""),Pe=Object(W.a)(Se,2),Be=Pe[0],Je=Pe[1],$e=Object(g.useRef)(),lt=ce.a.useForm(),at=Object(W.a)(lt,1),Qe=at[0],Lt=Object(g.useState)([]),ct=Object(W.a)(Lt,2),Nt=ct[0],Ut=ct[1],Ct=Object(g.useState)(!0),Qt=Object(W.a)(Ct,2),ci=Qt[0],Kt=Qt[1];Object(g.useEffect)(function(){Xe.page=1,Zt()},[We.target_ids]);var Zt=function(){var Et=Object(M.a)(L.a.mark(function It(){var gt,Ye;return L.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return ie(!1),Tt.next=3,Ce({type:"messages/getPrivateMessageDetails",payload:Object(N.a)(Object(N.a)({},Ue),{},{target_id:We==null?void 0:We.target_ids},Xe)});case 3:gt=Tt.sent,gt!=null&>.messages&&(Nt=gt==null?void 0:gt.messages,((Ye=Nt)===null||Ye===void 0?void 0:Ye.length)===20&&setTimeout(function(){ie(!0),Kt(!1)},500),Xe.page===1?Z(Object(l.a)(gt==null?void 0:gt.messages.reverse())):Z([].concat(Object(l.a)(le),Object(l.a)(gt==null?void 0:gt.messages.reverse()))));case 5:case"end":return Tt.stop()}},It)}));return function(){return Et.apply(this,arguments)}}();Object(g.useEffect)(function(){console.log("newData.length:",Xe,Nt.length,Nt),Xe.page===1&&ci&&($e.current.scrollTop=$e.current.scrollHeight)},[le]),Object(g.useEffect)(function(){$e.current.onclick=function(Et){Et.target.nodeName==="IMG"&&Et.target.alt!==""&&Re.a.publish("preview-image",Et.target.src)}},[]);var ft=function(){var Et=Object(M.a)(L.a.mark(function It(gt,Ye){var wt;return L.a.wrap(function(ut){for(;;)switch(ut.prev=ut.next){case 0:return ut.next=2,Object(we.a)(Object(N.a)(Object(N.a)({},Ue),{},{id:gt.id}));case 2:wt=ut.sent,wt.status===0&&(le.splice(Ye,1),Z(Object(l.a)(le)));case 4:case"end":return ut.stop()}},It)}));return function(gt,Ye){return Et.apply(this,arguments)}}(),_t=function(){var Et=Object(M.a)(L.a.mark(function It(){return L.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:if(!(Be==="")){Ye.next=3;break}return V.b.error("\u8BF7\u8F93\u5165\u60A8\u7684\u56DE\u590D"),Ye.abrupt("return",!1);case 3:return Je(""),be(!0),Ye.next=7,Object(we.g)(Object(N.a)(Object(N.a)({},Ue),{},{content:Be,target_id:We==null?void 0:We.target_ids}));case 7:be(!1),Xe.page=1,Qe.resetFields(),Zt();case 11:case"end":return Ye.stop()}},It)}));return function(){return Et.apply(this,arguments)}}(),xt=Object(g.useMemo)(function(){var Et=xe||{},It=Et.userInfo;return(It==null?void 0:It.is_teacher)&&(It==null?void 0:It.professional_certification)},[xe]);return c.a.createElement("section",null,c.a.createElement("aside",{className:x.a.listMessage,ref:$e},c.a.createElement(S.a,{isReverse:!0,loadMore:function(){Xe.page++,Zt()},hasMore:he,useWindow:!1},!he&&c.a.createElement("div",{className:"tc mt20 animated fadeIn"},c.a.createElement("span",{className:x.a.msgDate},"\u6CA1\u6709\u4FE1\u606F\u4E86\uFF5E\uFF5E")),c.a.createElement(p.a,{spinning:ve["messages/getPrivateMessageDetails"]},c.a.createElement("aside",{className:"minH500"},le==null?void 0:le.map(function(Et,It){var gt;return c.a.createElement("aside",{key:It},c.a.createElement(Y.a,{justify:"center"},c.a.createElement(z.a,{flex:"1",className:"tc"},c.a.createElement("span",{className:x.a.msgDate},O()(Et.send_time).format("YYYY-MM-DD")))),c.a.createElement(Y.a,{onClick:function(){return Object(Ie.J)(Et)}},c.a.createElement(z.a,{flex:"58px"},c.a.createElement("img",{src:w.a.IMG_SERVER+"/images/"+(Et==null||((gt=Et.sender)===null||gt===void 0)?void 0:gt.image_url),alt:""})),c.a.createElement(z.a,null,c.a.createElement("div",{className:x.a.msg},c.a.createElement(E.a,{value:Et.content||""}),c.a.createElement("span",{onClick:function(){return ft(Et,It)},className:["current",x.a.deleteMsg].join(" ")},"\u5220\u9664"))),c.a.createElement(z.a,null,c.a.createElement("span",{className:"c-grey-c ml10"},O()(Et.send_time).format("HH:mm")))))}))))),c.a.createElement("aside",{className:"pl30 pr30 mb30 mt30"},xt?c.a.createElement(ce.a,{form:Qe},c.a.createElement(ce.a.Item,{name:"content"},c.a.createElement(Le.a,{placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D",height:150,onChange:function(It){return Je(It)}})),c.a.createElement(Y.a,null,c.a.createElement(z.a,{flex:"1"},c.a.createElement("span",{className:"c-red font14"},"\u5728\u95EE\u9898\u53CD\u9988\u65F6\uFF0C\u8BF7\u540C\u65F6\u53D1\u9001\u95EE\u9898\u53D1\u751F\u9875\u7684\u7F51\u5740\u94FE\u63A5\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u9AD8\u6548\u7684\u4E3A\u60A8\u670D\u52A1")),c.a.createElement(z.a,null,c.a.createElement(P.a,{loading:fe,type:"primary",onClick:function(){return _t()}},"\u56DE\u590D")))):c.a.createElement("p",{className:"c-red font14",style:{textAlign:"center"}},"\u4EC5\u804C\u4E1A\u8BA4\u8BC1\u7684\u6559\u5E08\u53EF\u4EE5\u4F7F\u7528\u79C1\u4FE1\u529F\u80FD")),c.a.createElement(me.a,null))},F=Object(u.a)(function(pe){var Te=pe.messages,ke=pe.loading,ue=pe.user,ve=pe.globalSetting;return{messages:Te,globalSetting:ve,user:ue,loading:ke.effects}})(k),$=J("30zm"),te=function(Te){var ke,ue=Te.messages,ve=Te.globalSetting,xe=Te.loading,Ce=Te.user,Ne=Te.dispatch,Ue=Object(H.a)(Te,["messages","globalSetting","loading","user","dispatch"]),Ge=Ue.match.params,We=Ue.location.query,it=Ce.userInfo,Ve=ue.tidingsList,Xe=ue.privateMessageDetails,Me=Object(g.useState)({per_page:20,page:1}),rt=Object(W.a)(Me,2),tt=rt[0],le=rt[1],Z=Object(g.useState)({per_page:20,page:1}),ee=Object(W.a)(Z,2),se=ee[0],he=ee[1],ie=Object(g.useState)([]),ae=Object(W.a)(ie,2),de=ae[0],fe=ae[1],be=Object(g.useState)([]),Se=Object(W.a)(be,2),Pe=Se[0],Be=Se[1];Object(g.useEffect)(function(){tt.page=1},[Ge.userId]);var Je=function(){var lt=Object(M.a)(L.a.mark(function at(){var Qe;return L.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return ct.next=2,Ne({type:"messages/getPrivateMessageDetails",payload:Object(N.a)(Object(N.a)({},Ge),{},{target_id:We==null?void 0:We.target_ids})});case 2:Qe=ct.sent,Qe!=null&&Qe.messages&&fe(Qe.messages);case 4:case"end":return ct.stop()}},at)}));return function(){return lt.apply(this,arguments)}}(),$e=function(){var lt=Object(M.a)(L.a.mark(function at(){var Qe;return L.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return ct.next=2,Ne({type:"messages/getPrivateMessages",payload:Object(N.a)(Object(N.a)({},Ge),se)});case 2:Qe=ct.sent,Qe!=null&&Qe.private_messages&&Be(Qe.private_messages);case 4:case"end":return ct.stop()}},at)}));return function(){return lt.apply(this,arguments)}}();return c.a.createElement("section",{className:x.a.bg},c.a.createElement("section",{className:"edu-container mt20"},c.a.createElement(Y.a,{gutter:[20,20]},c.a.createElement($.a,null),c.a.createElement(z.a,{flex:"1"},c.a.createElement("aside",{className:"bg-white"},c.a.createElement("aside",{className:["font16",x.a.topBar].join(" ")},c.a.createElement(Y.a,null,c.a.createElement(z.a,{flex:"30px",className:"tc"},c.a.createElement(m.a,{to:"/messages/".concat(Ge.userId,"/private_messages"),className:"iconfont icon-zuojiantou c-black pl10"})),c.a.createElement(z.a,{flex:"1",className:"tc"},Xe==null||((ke=Xe.target)===null||ke===void 0)?void 0:ke.name,"\u4E0E\u4F60\u7684\u79C1\u4FE1"),c.a.createElement(z.a,{flex:"290px",className:"tl"},c.a.createElement("span",{className:"pl30"},"\u79C1\u4FE1\u5217\u8868")))),c.a.createElement(Y.a,null,c.a.createElement(z.a,{flex:"1"},c.a.createElement(F,null)),c.a.createElement(z.a,{flex:"290px"},c.a.createElement(A,null))))))))},K=Ee.default=Object(u.a)(function(pe){var Te=pe.messages,ke=pe.loading,ue=pe.user,ve=pe.globalSetting;return{messages:Te,globalSetting:ve,user:ue,loading:ke.effects}})(te)},fjLI:function(et,Ee,J){"use strict";J.d(Ee,"f",function(){return m}),J.d(Ee,"b",function(){return u}),J.d(Ee,"a",function(){return o}),J.d(Ee,"d",function(){return p}),J.d(Ee,"e",function(){return l}),J.d(Ee,"c",function(){return h});var oe=J("8HAY"),Y=J("Vhoy"),D=J("MI8n"),z=J("JYp7"),N=J("pmY6"),M=J("24hK"),W=J("nnTU"),H=J("T8No"),i=J("Cg/j"),L=J("t9D7"),g=function(s,a,C,_){var T=arguments.length,O=T<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,C):_,R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(s,a,C,_);else for(var S=s.length-1;S>=0;S--)(R=s[S])&&(O=(T<3?R(O):T>3?R(a,C,O):R(a,C))||O);return T>3&&O&&Object.defineProperty(a,C,O),O},c=function(s,a){return function(C,_){a(C,_,s)}};function m(s){return s.command!==void 0}class u{constructor(s){this.id=u._idPool++,this._debugName=s}}u._idPool=0,u.CommandPalette=new u("CommandPalette"),u.EditorContext=new u("EditorContext"),u.SimpleEditorContext=new u("SimpleEditorContext"),u.EditorContextCopy=new u("EditorContextCopy"),u.EditorContextPeek=new u("EditorContextPeek"),u.MenubarEditMenu=new u("MenubarEditMenu"),u.MenubarCopy=new u("MenubarCopy"),u.MenubarGoMenu=new u("MenubarGoMenu"),u.MenubarSelectionMenu=new u("MenubarSelectionMenu"),u.InlineCompletionsActions=new u("InlineCompletionsActions");const o=Object(i.c)("menuService"),p=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new D.b,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:s=>s===u.CommandPalette}}addCommand(s){return this.addCommands(z.a.single(s))}addCommands(s){for(const a of s)this._commands.set(a.id,a);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),Object(N.i)(()=>{let a=!1;for(const C of s)a=this._commands.delete(C.id)||a;a&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(s){return this._commands.get(s)}getCommands(){const s=new Map;return this._commands.forEach((a,C)=>s.set(C,a)),s}appendMenuItem(s,a){return this.appendMenuItems(z.a.single({id:s,item:a}))}appendMenuItems(s){const a=new Set,C=new M.a;for(const{id:_,item:T}of s){let O=this._menuItems.get(_);O||(O=new M.a,this._menuItems.set(_,O)),C.push(O.push(T)),a.add(_)}return this._onDidChangeMenu.fire(a),Object(N.i)(()=>{if(C.size>0){for(let _ of C)_();this._onDidChangeMenu.fire(a),C.clear()}})}getMenuItems(s){let a;return this._menuItems.has(s)?a=[...this._menuItems.get(s)]:a=[],s===u.CommandPalette&&this._appendImplicitItems(a),a}_appendImplicitItems(s){const a=new Set;for(const C of s)m(C)&&(a.add(C.command.id),C.alt&&a.add(C.alt.id));this._commands.forEach((C,_)=>{a.has(_)||s.push({command:C})})}};class l extends oe.e{constructor(s,a,C,_){super(`submenuitem.${s.submenu.id}`,typeof s.title=="string"?s.title:s.title.value,[],"submenu");this.item=s,this._menuService=a,this._contextKeyService=C,this._options=_}get actions(){const s=[],a=this._menuService.createMenu(this.item.submenu,this._contextKeyService),C=a.getActions(this._options);a.dispose();for(const[,_]of C)_.length>0&&(s.push(..._),s.push(new oe.d));return s.length&&s.pop(),s}}let h=class s{constructor(a,C,_,T,O){var R,S;if(this._commandService=O,this.id=a.id,this.label=(_==null?void 0:_.renderShortTitle)&&a.shortTitle?typeof a.shortTitle=="string"?a.shortTitle:a.shortTitle.value:typeof a.title=="string"?a.title:a.title.value,this.tooltip=(S=typeof a.tooltip=="string"?a.tooltip:(R=a.tooltip)===null||R===void 0?void 0:R.value)!==null&&S!==void 0?S:"",this.enabled=!a.precondition||T.contextMatchesRules(a.precondition),this.checked=void 0,a.toggled){const w=a.toggled.condition?a.toggled:{condition:a.toggled};this.checked=T.contextMatchesRules(w.condition),this.checked&&w.tooltip&&(this.tooltip=typeof w.tooltip=="string"?w.tooltip:w.tooltip.value),w.title&&(this.label=typeof w.title=="string"?w.title:w.title.value)}this.item=a,this.alt=C?new s(C,void 0,_,T,O):void 0,this._options=_,L.d.isThemeIcon(a.icon)&&(this.class=Y.a.asClassName(a.icon))}dispose(){}run(...a){var C,_;let T=[];return((C=this._options)===null||C===void 0?void 0:C.arg)&&(T=[...T,this._options.arg]),((_=this._options)===null||_===void 0?void 0:_.shouldForwardArgs)&&(T=[...T,...a]),this._commandService.executeCommand(this.id,...T)}};h=g([c(3,H.b),c(4,W.b)],h)},ic2d:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return z});var oe=J("FWmy"),Y=J("746U");class D{constructor(){this.data=new Map}add(N,M){oe.a(Y.l(N)),oe.a(Y.k(M)),oe.a(!this.data.has(N),"There is already an extension with this id"),this.data.set(N,M)}as(N){return this.data.get(N)||null}}const z=new D},kSUc:function(et,Ee,J){},"kaH+":function(et,Ee,J){"use strict";var oe=J("+L6B"),Y=J("2/Rp"),D=J("tJVT"),z=J("q1tI"),N=J.n(z),M=J("UZu5"),W=J.n(M),H=J("dhSg"),i=J("rLCj"),L=J("dF/Y"),g=J("4i/N");Ee.a=function(){var c=Object(z.useState)(""),m=Object(D.a)(c,2),u=m[0],o=m[1],p=Object(z.useState)(0),l=Object(D.a)(p,2),h=l[0],s=l[1],a=Object(z.useRef)("");Object(z.useEffect)(function(){var w=H.a.subscribe("preview-image",function(E){o(E),document.body.style.overflow="hidden"});return w},[]),Object(z.useEffect)(function(){return document.addEventListener("keydown",C),function(){document.removeEventListener("keydown",C)}},[]),Object(z.useEffect)(function(){a.current=u},[u]);function C(w){w.keyCode==27&&a.current&&_()}function _(){document.body.style.overflow="auto",o("")}function T(){s(h+90)}var O=Object(z.useRef)(),R=Object(z.useRef)(),S=function(E){(E.nativeEvent.target===O.current||E.nativeEvent.target===R.current)&&_()};return N.a.createElement(z.Fragment,null,u?N.a.createElement("div",{className:"image-preview-container",ref:O,onClick:S},N.a.createElement("div",{className:"button-group"},N.a.createElement(Y.a,{onClick:T},"\u65CB\u8F6C",N.a.createElement(i.a,null)),N.a.createElement(Y.a,{href:u},"\u4E0B\u8F7D",N.a.createElement(L.a,null)),N.a.createElement(Y.a,{onClick:_},"\u5173\u95ED",N.a.createElement(g.a,null))),N.a.createElement("div",{className:"preview-wrp-group",ref:R},N.a.createElement("img",{className:"image-preview",src:u,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(h,"deg)")}}))):null)}},kzJb:function(et,Ee,J){et.exports={flex_box_center:"flex_box_center___2qtoc",flex_space_between:"flex_space_between___NF1Yf",flex_box_vertical_center:"flex_box_vertical_center___2qH_j",flex_box_center_end:"flex_box_center_end___22P0N",flex_box_column:"flex_box_column___1IKP8",userInfo:"userInfo___2Dupy",navInfo:"navInfo___3fEvD",actived:"actived___3F322",newTip:"newTip___1Ta-b"}},lZu9:function(et,Ee,J){(function(oe){oe(J("VrN/"),J("1eCo"),J("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function(Y,D){var z=oe.getMode(Y,"text/html"),N=z.name=="null";function M(P){if(oe.findModeByName){var b=oe.findModeByName(P);b&&(P=b.mime||b.mimes[0])}var V=oe.getMode(Y,P);return V.name=="null"?null:V}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var W={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var H in W)W.hasOwnProperty(H)&&D.tokenTypeOverrides[H]&&(W[H]=D.tokenTypeOverrides[H]);var i=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,c=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,m=/^ {0,3}(?:\={1,}|-{2,})\s*$/,u=/^[^#!\[\]*_\\<>` "'(~:]+/,o=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,h=" ";function s(P,b,V){return b.f=b.inline=V,V(P,b)}function a(P,b,V){return b.f=b.block=V,V(P,b)}function C(P){return!P||!/\S/.test(P.string)}function _(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==O){var b=N;if(!b){var V=oe.innerMode(z,P.htmlState);b=V.mode.name=="xml"&&V.state.tagStart===null&&!V.state.context&&V.state.tokenize.isInText}b&&(P.f=E,P.block=T,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function T(P,b){var V=P.column()===b.indentation,ne=C(b.prevLine.stream),ce=b.indentedCode,me=b.prevLine.hr,Ie=b.list!==!1,we=(b.listStack[b.listStack.length-1]||0)+3;b.indentedCode=!1;var Le=b.indentation;if(b.indentationDiff===null&&(b.indentationDiff=b.indentation,Ie)){for(b.list=null;Le<b.listStack[b.listStack.length-1];)b.listStack.pop(),b.listStack.length?b.indentation=b.listStack[b.listStack.length-1]:b.list=!1;b.list!==!1&&(b.indentationDiff=Le-b.listStack[b.listStack.length-1])}var Re=!ne&&!me&&!b.prevLine.header&&(!Ie||!ce)&&!b.prevLine.fencedCodeEnd,De=(b.list===!1||me||ne)&&b.indentation<=we&&P.match(i),ye=null;if(b.indentationDiff>=4&&(ce||b.prevLine.fencedCodeEnd||b.prevLine.header||ne))return P.skipToEnd(),b.indentedCode=!0,W.code;if(P.eatSpace())return null;if(V&&b.indentation<=we&&(ye=P.match(c))&&ye[1].length<=6)return b.quote=0,b.header=ye[1].length,b.thisLine.header=!0,D.highlightFormatting&&(b.formatting="header"),b.f=b.inline,S(b);if(b.indentation<=we&&P.eat(">"))return b.quote=V?1:b.quote+1,D.highlightFormatting&&(b.formatting="quote"),P.eatSpace(),S(b);if(!De&&!b.setext&&V&&b.indentation<=we&&(ye=P.match(L))){var X=ye[1]?"ol":"ul";return b.indentation=Le+P.current().length,b.list=!0,b.quote=0,b.listStack.push(b.indentation),b.em=!1,b.strong=!1,b.code=!1,b.strikethrough=!1,D.taskLists&&P.match(g,!1)&&(b.taskList=!0),b.f=b.inline,D.highlightFormatting&&(b.formatting=["list","list-"+X]),S(b)}else{if(V&&b.indentation<=we&&(ye=P.match(o,!0)))return b.quote=0,b.fencedEndRE=new RegExp(ye[1]+"+ *$"),b.localMode=D.fencedCodeBlockHighlighting&&M(ye[2]||D.fencedCodeBlockDefaultMode),b.localMode&&(b.localState=oe.startState(b.localMode)),b.f=b.block=R,D.highlightFormatting&&(b.formatting="code-block"),b.code=-1,S(b);if(b.setext||(!Re||!Ie)&&!b.quote&&b.list===!1&&!b.code&&!De&&!p.test(P.string)&&(ye=P.lookAhead(1))&&(ye=ye.match(m)))return b.setext?(b.header=b.setext,b.setext=0,P.skipToEnd(),D.highlightFormatting&&(b.formatting="header")):(b.header=ye[0].charAt(0)=="="?1:2,b.setext=b.header),b.thisLine.header=!0,b.f=b.inline,S(b);if(De)return P.skipToEnd(),b.hr=!0,b.thisLine.hr=!0,W.hr;if(P.peek()==="[")return s(P,b,U)}return s(P,b,b.inline)}function O(P,b){var V=z.token(P,b.htmlState);if(!N){var ne=oe.innerMode(z,b.htmlState);(ne.mode.name=="xml"&&ne.state.tagStart===null&&!ne.state.context&&ne.state.tokenize.isInText||b.md_inside&&P.current().indexOf(">")>-1)&&(b.f=E,b.block=T,b.htmlState=null)}return V}function R(P,b){var V=b.listStack[b.listStack.length-1]||0,ne=b.indentation<V,ce=V+3;if(b.fencedEndRE&&b.indentation<=ce&&(ne||P.match(b.fencedEndRE))){D.highlightFormatting&&(b.formatting="code-block");var me;return ne||(me=S(b)),b.localMode=b.localState=null,b.block=T,b.f=E,b.fencedEndRE=null,b.code=0,b.thisLine.fencedCodeEnd=!0,ne?a(P,b,b.block):me}else return b.localMode?b.localMode.token(P,b.localState):(P.skipToEnd(),W.code)}function S(P){var b=[];if(P.formatting){b.push(W.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var V=0;V<P.formatting.length;V++)b.push(W.formatting+"-"+P.formatting[V]),P.formatting[V]==="header"&&b.push(W.formatting+"-"+P.formatting[V]+"-"+P.header),P.formatting[V]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?b.push(W.formatting+"-"+P.formatting[V]+"-"+P.quote):b.push("error"))}if(P.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(P.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(P.linkHref?b.push(W.linkHref,"url"):(P.strong&&b.push(W.strong),P.em&&b.push(W.em),P.strikethrough&&b.push(W.strikethrough),P.emoji&&b.push(W.emoji),P.linkText&&b.push(W.linkText),P.code&&b.push(W.code),P.image&&b.push(W.image),P.imageAltText&&b.push(W.imageAltText,"link"),P.imageMarker&&b.push(W.imageMarker)),P.header&&b.push(W.header,W.header+"-"+P.header),P.quote&&(b.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?b.push(W.quote+"-"+P.quote):b.push(W.quote+"-"+D.maxBlockquoteDepth)),P.list!==!1){var ne=(P.listStack.length-1)%3;ne?ne===1?b.push(W.list2):b.push(W.list3):b.push(W.list1)}return P.trailingSpaceNewLine?b.push("trailing-space-new-line"):P.trailingSpace&&b.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function w(P,b){return P.match(u,!0)?S(b):void 0}function E(P,b){var V=b.text(P,b);if(typeof V!="undefined")return V;if(b.list)return b.list=null,S(b);if(b.taskList){var ne=P.match(g,!0)[1]===" ";return ne?b.taskOpen=!0:b.taskClosed=!0,D.highlightFormatting&&(b.formatting="task"),b.taskList=!1,S(b)}if(b.taskOpen=!1,b.taskClosed=!1,b.header&&P.match(/^#+$/,!0))return D.highlightFormatting&&(b.formatting="header"),S(b);var ce=P.next();if(b.linkTitle){b.linkTitle=!1;var me=ce;ce==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ie="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(P.match(new RegExp(Ie),!0))return W.linkHref}if(ce==="`"){var we=b.formatting;D.highlightFormatting&&(b.formatting="code"),P.eatWhile("`");var Le=P.current().length;if(b.code==0&&(!b.quote||Le==1))return b.code=Le,S(b);if(Le==b.code){var Re=S(b);return b.code=0,Re}else return b.formatting=we,S(b)}else if(b.code)return S(b);if(ce==="\\"&&(P.next(),D.highlightFormatting)){var De=S(b),ye=W.formatting+"-escape";return De?De+" "+ye:ye}if(ce==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return b.imageMarker=!0,b.image=!0,D.highlightFormatting&&(b.formatting="image"),S(b);if(ce==="["&&b.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return b.imageMarker=!1,b.imageAltText=!0,D.highlightFormatting&&(b.formatting="image"),S(b);if(ce==="]"&&b.imageAltText){D.highlightFormatting&&(b.formatting="image");var De=S(b);return b.imageAltText=!1,b.image=!1,b.inline=b.f=x,De}if(ce==="["&&!b.image)return b.linkText&&P.match(/^.*?\]/)||(b.linkText=!0,D.highlightFormatting&&(b.formatting="link")),S(b);if(ce==="]"&&b.linkText){D.highlightFormatting&&(b.formatting="link");var De=S(b);return b.linkText=!1,b.inline=b.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?x:E,De}if(ce==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){b.f=b.inline=f,D.highlightFormatting&&(b.formatting="link");var De=S(b);return De?De+=" ":De="",De+W.linkInline}if(ce==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){b.f=b.inline=f,D.highlightFormatting&&(b.formatting="link");var De=S(b);return De?De+=" ":De="",De+W.linkEmail}if(D.xml&&ce==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var X=P.string.indexOf(">",P.pos);if(X!=-1){var k=P.string.substring(P.start,X);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(k)&&(b.md_inside=!0)}return P.backUp(1),b.htmlState=oe.startState(z),a(P,b,O)}if(D.xml&&ce==="<"&&P.match(/^\/\w*?>/))return b.md_inside=!1,"tag";if(ce==="*"||ce==="_"){for(var F=1,$=P.pos==1?" ":P.string.charAt(P.pos-2);F<3&&P.eat(ce);)F++;var te=P.peek()||" ",K=!/\s/.test(te)&&(!l.test(te)||/\s/.test($)||l.test($)),pe=!/\s/.test($)&&(!l.test($)||/\s/.test(te)||l.test(te)),Te=null,ke=null;if(F%2&&(!b.em&&K&&(ce==="*"||!pe||l.test($))?Te=!0:b.em==ce&&pe&&(ce==="*"||!K||l.test(te))&&(Te=!1)),F>1&&(!b.strong&&K&&(ce==="*"||!pe||l.test($))?ke=!0:b.strong==ce&&pe&&(ce==="*"||!K||l.test(te))&&(ke=!1)),ke!=null||Te!=null){D.highlightFormatting&&(b.formatting=Te==null?"strong":ke==null?"em":"strong em"),Te===!0&&(b.em=ce),ke===!0&&(b.strong=ce);var Re=S(b);return Te===!1&&(b.em=!1),ke===!1&&(b.strong=!1),Re}}else if(ce===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return S(b);P.backUp(1)}if(D.strikethrough){if(ce==="~"&&P.eatWhile(ce)){if(b.strikethrough){D.highlightFormatting&&(b.formatting="strikethrough");var Re=S(b);return b.strikethrough=!1,Re}else if(P.match(/^[^\s]/,!1))return b.strikethrough=!0,D.highlightFormatting&&(b.formatting="strikethrough"),S(b)}else if(ce===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return S(b);P.backUp(2)}}if(D.emoji&&ce===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){b.emoji=!0,D.highlightFormatting&&(b.formatting="emoji");var ue=S(b);return b.emoji=!1,ue}return ce===" "&&(P.match(/^ +$/,!1)?b.trailingSpace++:b.trailingSpace&&(b.trailingSpaceNewLine=!0)),S(b)}function f(P,b){var V=P.next();if(V===">"){b.f=b.inline=E,D.highlightFormatting&&(b.formatting="link");var ne=S(b);return ne?ne+=" ":ne="",ne+W.linkInline}return P.match(/^[^>]+/,!0),W.linkInline}function x(P,b){if(P.eatSpace())return null;var V=P.next();return V==="("||V==="["?(b.f=b.inline=y(V==="("?")":"]"),D.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,S(b)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(P){return function(b,V){var ne=b.next();if(ne===P){V.f=V.inline=E,D.highlightFormatting&&(V.formatting="link-string");var ce=S(V);return V.linkHref=!1,ce}return b.match(v[P]),V.linkHref=!0,S(V)}}function U(P,b){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(b.f=B,P.next(),D.highlightFormatting&&(b.formatting="link"),b.linkText=!0,S(b)):s(P,b,E)}function B(P,b){if(P.match(/^\]:/,!0)){b.f=b.inline=A,D.highlightFormatting&&(b.formatting="link");var V=S(b);return b.linkText=!1,V}return P.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function A(P,b){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?b.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=E,W.linkHref+" url")}var j={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:E,text:w,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(P){return{f:P.f,prevLine:P.prevLine,thisLine:P.thisLine,block:P.block,htmlState:P.htmlState&&oe.copyState(z,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?oe.copyState(P.localMode,P.localState):null,inline:P.inline,text:P.text,formatting:!1,linkText:P.linkText,linkTitle:P.linkTitle,linkHref:P.linkHref,code:P.code,em:P.em,strong:P.strong,strikethrough:P.strikethrough,emoji:P.emoji,header:P.header,setext:P.setext,hr:P.hr,taskList:P.taskList,list:P.list,listStack:P.listStack.slice(0),quote:P.quote,indentedCode:P.indentedCode,trailingSpace:P.trailingSpace,trailingSpaceNewLine:P.trailingSpaceNewLine,md_inside:P.md_inside,fencedEndRE:P.fencedEndRE}},token:function(P,b){if(b.formatting=!1,P!=b.thisLine.stream){if(b.header=0,b.hr=!1,P.match(/^\s*$/,!0))return _(b),null;if(b.prevLine=b.thisLine,b.thisLine={stream:P},b.taskList=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,!b.localState&&(b.f=b.block,b.f!=O)){var V=P.match(/^\s*/,!0)[0].replace(/\t/g,h).length;if(b.indentation=V,b.indentationDiff=null,V>0)return null}}return b.f(P,b)},innerMode:function(P){return P.block==O?{state:P.htmlState,mode:z}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:j}},indent:function(P,b,V){return P.block==O&&z.indent?z.indent(P.htmlState,b,V):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,b,V):oe.Pass},blankLine:_,getType:S,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return j},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},nEHx:function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return oe});var oe;(function(Y){Y.DARK="dark",Y.LIGHT="light",Y.HIGH_CONTRAST="hc"})(oe||(oe={}))},nnTU:function(et,Ee,J){"use strict";J.d(Ee,"b",function(){return W}),J.d(Ee,"a",function(){return H});var oe=J("MI8n"),Y=J("JYp7"),D=J("pmY6"),z=J("24hK"),N=J("746U"),M=J("Cg/j");const W=Object(M.c)("commandService"),H=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new oe.b,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(i,L){if(!i)throw new Error("invalid command");if(typeof i=="string"){if(!L)throw new Error("invalid command");return this.registerCommand({id:i,handler:L})}if(i.description){const o=[];for(let l of i.description.args)o.push(l.constraint);const p=i.handler;i.handler=function(l,...h){return Object(N.o)(h,o),p(l,...h)}}const{id:g}=i;let c=this._commands.get(g);c||(c=new z.a,this._commands.set(g,c));let m=c.unshift(i),u=Object(D.i)(()=>{m();const o=this._commands.get(g);(o==null?void 0:o.isEmpty())&&this._commands.delete(g)});return this._onDidRegisterCommand.fire(g),u}registerCommandAlias(i,L){return H.registerCommand(i,(g,...c)=>g.get(W).executeCommand(L,...c))}getCommand(i){const L=this._commands.get(i);return!L||L.isEmpty()?void 0:Y.a.first(L)}getCommands(){const i=new Map;for(const L of this._commands.keys()){const g=this.getCommand(L);g&&i.set(L,g)}return i}};H.registerCommand("noop",()=>{})},osHv:function(et,Ee,J){(function(oe){oe(J("VrN/"))})(function(oe){"use strict";var Y=oe.Pos;function D(l,h){return l.line-h.line||l.ch-h.ch}var z="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",N=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+z+"]["+N+"]*)","g");function W(l,h,s,a){this.line=h,this.ch=s,this.cm=l,this.text=l.getLine(h),this.min=a?Math.max(a.from,l.firstLine()):l.firstLine(),this.max=a?Math.min(a.to-1,l.lastLine()):l.lastLine()}function H(l,h){var s=l.cm.getTokenTypeAt(Y(l.line,h));return s&&/\btag\b/.test(s)}function i(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function L(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function g(l){for(;;){var h=l.text.indexOf(">",l.ch);if(h==-1){if(i(l))continue;return}if(!H(l,h+1)){l.ch=h+1;continue}var s=l.text.lastIndexOf("/",h),a=s>-1&&!/\S/.test(l.text.slice(s+1,h));return l.ch=h+1,a?"selfClose":"regular"}}function c(l){for(;;){var h=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(h==-1){if(L(l))continue;return}if(!H(l,h+1)){l.ch=h;continue}M.lastIndex=h,l.ch=h;var s=M.exec(l.text);if(s&&s.index==h)return s}}function m(l){for(;;){M.lastIndex=l.ch;var h=M.exec(l.text);if(!h){if(i(l))continue;return}if(!H(l,h.index+1)){l.ch=h.index+1;continue}return l.ch=h.index+h[0].length,h}}function u(l){for(;;){var h=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(h==-1){if(L(l))continue;return}if(!H(l,h+1)){l.ch=h;continue}var s=l.text.lastIndexOf("/",h),a=s>-1&&!/\S/.test(l.text.slice(s+1,h));return l.ch=h+1,a?"selfClose":"regular"}}function o(l,h){for(var s=[];;){var a=m(l),C,_=l.line,T=l.ch-(a?a[0].length:0);if(!a||!(C=g(l)))return;if(C=="selfClose")continue;if(a[1]){for(var O=s.length-1;O>=0;--O)if(s[O]==a[2]){s.length=O;break}if(O<0&&(!h||h==a[2]))return{tag:a[2],from:Y(_,T),to:Y(l.line,l.ch)}}else s.push(a[2])}}function p(l,h){for(var s=[];;){var a=u(l);if(!a)return;if(a=="selfClose"){c(l);continue}var C=l.line,_=l.ch,T=c(l);if(!T)return;if(T[1])s.push(T[2]);else{for(var O=s.length-1;O>=0;--O)if(s[O]==T[2]){s.length=O;break}if(O<0&&(!h||h==T[2]))return{tag:T[2],from:Y(l.line,l.ch),to:Y(C,_)}}}}oe.registerHelper("fold","xml",function(l,h){for(var s=new W(l,h.line,0);;){var a=m(s);if(!a||s.line!=h.line)return;var C=g(s);if(!C)return;if(!a[1]&&C!="selfClose"){var _=Y(s.line,s.ch),T=o(s,a[2]);return T&&D(T.from,_)>0?{from:_,to:T.from}:null}}}),oe.findMatchingTag=function(l,h,s){var a=new W(l,h.line,h.ch,s);if(a.text.indexOf(">")==-1&&a.text.indexOf("<")==-1)return;var C=g(a),_=C&&Y(a.line,a.ch),T=C&&c(a);if(!C||!T||D(a,h)>0)return;var O={from:Y(a.line,a.ch),to:_,tag:T[2]};return C=="selfClose"?{open:O,close:null,at:"open"}:T[1]?{open:p(a,T[2]),close:O,at:"close"}:(a=new W(l,_.line,_.ch,s),{open:O,close:o(a,T[2]),at:"open"})},oe.findEnclosingTag=function(l,h,s,a){for(var C=new W(l,h.line,h.ch,s);;){var _=p(C,a);if(!_)break;var T=new W(l,h.line,h.ch,s),O=o(T,_.tag);if(O)return{open:_,close:O}}},oe.scanForClosingTag=function(l,h,s,a){var C=new W(l,h.line,h.ch,a?{from:0,to:a}:null);return o(C,s)}})},p5ED:function(et,Ee,J){"use strict";var oe=J("+L6B"),Y=J("2/Rp"),D=J("5Dmo"),z=J("3S7+"),N=J("k1fw"),M=J("9og8"),W=J("tJVT"),H=J("WmNS"),i=J.n(H),L=J("q1tI"),g=J.n(L),c=J("vHTk"),m=J.n(c),u=J("yEEn"),o=J("ZW9T"),p=J("1vsH"),l=J("V0Rq"),h=J("m3rI");Ee.a=function(s){var a,C,_,T,O,R,S,w=s.editOffice,E=w===void 0?"view":w,f=s.data,x=s.theme,v=s.type,y=s.filename,U=s.monacoEditor,B=s.className,A=s.style,j=s.close,P=s.onClose,b=s.hasMask,V=s.disabledDownload,ne=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),ce=Object(W.a)(ne,2),me=ce[0],Ie=ce[1],we=Object(L.useState)(""),Le=Object(W.a)(we,2),Re=Le[0],De=Le[1],ye=Object(L.useState)(),X=Object(W.a)(ye,2),k=X[0],F=X[1],$=window.ENV==="build"?"/react/build":"",te=h.a.PROXY_SERVER||location.origin,K,pe=1024*1024,Te=10*pe,ke=Object(L.useRef)();(a=f)!==null&&a!==void 0&&a.startsWith("/api")&&v!=="txt"&&(f=(h.a.API_SERVER||location.origin)+f),v==="office"&&(K=Object(p.T)(f).filesize,K>Te&&(v="other")),y&&U&&(U.filename=y),Object(L.useEffect)(function(){var Ce,Ne,Ue=(Ce=document.cookie)===null||Ce===void 0||((Ne=Ce.replace(/\s/g,""))===null||Ne===void 0)?void 0:Ne.split(";");Ue==null||Ue.map(function(Ge){var We=Ge.split("=");We[0]==="_educoder_session"&&De(We[1])})},[]),Object(L.useEffect)(function(){v==="office"&&ue()},[v,f]);var ue=function(){var Ce=Object(M.a)(i.a.mark(function Ne(){var Ue,Ge,We;return i.a.wrap(function(Ve){for(;;)switch(Ve.prev=Ve.next){case 0:return console.log("data:",f),Ue=f,f.startsWith("http")||(Ue=location.origin+Ue),Ge=new URL(Ue).pathname.split("/").pop(),Ve.next=6,Object(l.V)({attachment_id:Ge});case 6:We=Ve.sent,F(We);case 8:case"end":return Ve.stop()}},Ne)}));return function(){return Ce.apply(this,arguments)}}(),ve=function(){if(f.startsWith("http")||f.startsWith("blob:")){xe();return}Object(p.z)(y||"educoder",f,y)},xe=function(){Object(p.x)(y||"educoder",decodeURIComponent(f))};return g.a.createElement("div",{style:Object(N.a)({},A||{}),className:"".concat(b&&m.a.bgBlack," ").concat(v?m.a.wrp:"hide")},j&&g.a.createElement("div",{className:m.a.close,ref:ke},!V&&g.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ke.current}},g.a.createElement("span",{onClick:xe},g.a.createElement("i",{className:"icon-quxiaozhiding"}))),g.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ke.current}},g.a.createElement("span",{className:"",onClick:P},g.a.createElement("i",{className:"icon-guanbi1"})))),g.a.createElement("div",{className:"".concat(m.a[B]," ").concat(B," ").concat(m.a.monaco," ").concat(v==="txt"?"show":"hide")},v==="txt"&&g.a.createElement(o.b,U)),v==="audio"&&g.a.createElement("audio",{src:"".concat(((C=f)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((_=f)===null||_===void 0?void 0:_.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(f),autoPlay:!0}),v==="video"&&g.a.createElement(g.a.Fragment,null,((T=f)===null||T===void 0?void 0:T.indexOf("http"))>-1?g.a.createElement("video",{controls:!0,src:"".concat(f),autoPlay:!0}):g.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(f),autoPlay:!0})),v==="office"&&k&&g.a.createElement("iframe",{src:"".concat($,"/office.html?key=").concat(k.key,"&url=").concat(te+k.url,"&callbackUrl=").concat(te+k.callbackUrl,"&fileType=").concat(k.fileType,"&title=").concat(k.title,"&model=").concat(E,"&officeServer=").concat(h.a.OFFICE_SERVER,"&disabledDownload=").concat(!!V)}),v==="html"&&g.a.createElement("iframe",{src:f+"&disposition=inline"}),v==="pdf"&&g.a.createElement("iframe",{src:"".concat($,"/js/pdfview/index.html?url=").concat(f,"&disabledDownload=").concat(!!V)}),v==="image"&&g.a.createElement("img",{src:"".concat(((O=f)===null||O===void 0?void 0:O.indexOf("http://"))>-1||((R=f)===null||R===void 0?void 0:R.indexOf("https://"))>-1||(S=f)!==null&&S!==void 0&&S.startsWith("/api")?"":"data:image/png;base64,").concat(f)}),v==="other"&&g.a.createElement("div",null,g.a.createElement(Y.a,{type:"primary",size:"large",onClick:ve},g.a.createElement(u.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),v==="download"&&g.a.createElement(Y.a,{type:"primary",size:"large",onClick:ve},g.a.createElement(u.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(et,Ee,J){},pmY6:function(et,Ee,J){"use strict";J.d(Ee,"h",function(){return L}),J.d(Ee,"g",function(){return c}),J.d(Ee,"f",function(){return m}),J.d(Ee,"e",function(){return u}),J.d(Ee,"i",function(){return o}),J.d(Ee,"b",function(){return p}),J.d(Ee,"a",function(){return l}),J.d(Ee,"d",function(){return h}),J.d(Ee,"c",function(){return s});var oe=J("C/vA"),Y=J("JYp7");const D=!1;let z=null;function N(a){z=a}if(D){const a="__is_disposable_tracked__";N(new class{trackDisposable(C){const _=new Error("Potentially leaked disposable").stack;setTimeout(()=>{C[a]||console.log(_)},3e3)}setParent(C,_){if(C&&C!==l.None)try{C[a]=!0}catch(T){}}markAsDisposed(C){if(C&&C!==l.None)try{C[a]=!0}catch(_){}}markAsSingleton(C){}})}function M(a){return z==null||z.trackDisposable(a),a}function W(a){z==null||z.markAsDisposed(a)}function H(a,C){z==null||z.setParent(a,C)}function i(a,C){if(!z)return;for(const _ of a)z.setParent(_,C)}function L(a){return z==null||z.markAsSingleton(a),a}class g extends Error{constructor(a){super(`Encountered errors while disposing of store. Errors: [${a.join(", ")}]`);this.errors=a}}function c(a){return typeof a.dispose=="function"&&a.dispose.length===0}function m(a){if(Y.a.is(a)){let C=[];for(const _ of a)if(_)try{_.dispose()}catch(T){C.push(T)}if(C.length===1)throw C[0];if(C.length>1)throw new g(C);return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function u(...a){const C=o(()=>m(a));return i(a,C),C}function o(a){const C=M({dispose:Object(oe.a)(()=>{W(C),a()})});return C}class p{constructor(){this._toDispose=new Set,this._isDisposed=!1,M(this)}dispose(){if(this._isDisposed)return;W(this),this._isDisposed=!0,this.clear()}clear(){try{m(this._toDispose.values())}finally{this._toDispose.clear()}}add(a){if(!a)return a;if(a===this)throw new Error("Cannot register a disposable on itself!");return H(a,this),this._isDisposed?p.DISABLE_DISPOSED_WARNING||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(a),a}}p.DISABLE_DISPOSED_WARNING=!1;class l{constructor(){this._store=new p,M(this),H(this._store,this)}dispose(){W(this),this._store.dispose()}_register(a){if(a===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(a)}}l.None=Object.freeze({dispose(){}});class h{constructor(){this._isDisposed=!1,M(this)}get value(){return this._isDisposed?void 0:this._value}set value(a){var C;if(this._isDisposed||a===this._value)return;(C=this._value)===null||C===void 0||C.dispose(),a&&H(a,this),this._value=a}clear(){this.value=void 0}dispose(){var a;this._isDisposed=!0,W(this),(a=this._value)===null||a===void 0||a.dispose(),this._value=void 0}clearAndLeak(){const a=this._value;return this._value=void 0,a&&H(a,null),a}}class s{constructor(a){this.object=a}dispose(){}}},psGv:function(et,Ee,J){var oe,Y;(function(){var D;(function(){"use strict";var W=[,,function(g){function c(o){this.__parent=o,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}c.prototype.clone_empty=function(){var o=new c(this.__parent);return o.set_indent(this.__indent_count,this.__alignment_count),o},c.prototype.item=function(o){return o<0?this.__items[this.__items.length+o]:this.__items[o]},c.prototype.has_match=function(o){for(var p=this.__items.length-1;p>=0;p--)if(this.__items[p].match(o))return!0;return!1},c.prototype.set_indent=function(o,p){this.is_empty()&&(this.__indent_count=o||0,this.__alignment_count=p||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},c.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},c.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},c.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var o=this.__parent.current_line;return o.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),o.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),o.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,o.__items[0]===" "&&(o.__items.splice(0,1),o.__character_count-=1),!0}return!1},c.prototype.is_empty=function(){return this.__items.length===0},c.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},c.prototype.push=function(o){this.__items.push(o);var p=o.lastIndexOf(`
|
|
`);p!==-1?this.__character_count=o.length-p:this.__character_count+=o.length},c.prototype.pop=function(){var o=null;return this.is_empty()||(o=this.__items.pop(),this.__character_count-=o.length),o},c.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},c.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},c.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},c.prototype.toString=function(){var o="";return this.is_empty()?this.__parent.indent_empty_lines&&(o=this.__parent.get_indent_string(this.__indent_count)):(o=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),o+=this.__items.join("")),o};function m(o,p){this.__cache=[""],this.__indent_size=o.indent_size,this.__indent_string=o.indent_char,o.indent_with_tabs||(this.__indent_string=new Array(o.indent_size+1).join(o.indent_char)),p=p||"",o.indent_level>0&&(p=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=p,this.__base_string_length=p.length}m.prototype.get_indent_size=function(o,p){var l=this.__base_string_length;return p=p||0,o<0&&(l=0),l+=o*this.__indent_size,l+=p,l},m.prototype.get_indent_string=function(o,p){var l=this.__base_string;return p=p||0,o<0&&(o=0,l=""),p+=o*this.__indent_size,this.__ensure_cache(p),l+=this.__cache[p],l},m.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var o=this.__cache.length,p=0,l="";this.__indent_size&&o>=this.__indent_size&&(p=Math.floor(o/this.__indent_size),o-=p*this.__indent_size,l=new Array(p+1).join(this.__indent_string)),o&&(l+=new Array(o+1).join(" ")),this.__cache.push(l)};function u(o,p){this.__indent_cache=new m(o,p),this.raw=!1,this._end_with_newline=o.end_with_newline,this.indent_size=o.indent_size,this.wrap_line_length=o.wrap_line_length,this.indent_empty_lines=o.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new c(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}u.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},u.prototype.get_line_number=function(){return this.__lines.length},u.prototype.get_indent_string=function(o,p){return this.__indent_cache.get_indent_string(o,p)},u.prototype.get_indent_size=function(o,p){return this.__indent_cache.get_indent_size(o,p)},u.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},u.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},u.prototype.get_code=function(o){this.trim(!0);var p=this.current_line.pop();p&&(p[p.length-1]===`
|
|
`&&(p=p.replace(/\n+$/g,"")),this.current_line.push(p)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
|
|
`);return o!==`
|
|
`&&(l=l.replace(/[\n]/g,o)),l},u.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},u.prototype.set_indent=function(o,p){return o=o||0,p=p||0,this.next_line.set_indent(o,p),this.__lines.length>1?(this.current_line.set_indent(o,p),!0):(this.current_line.set_indent(),!1)},u.prototype.add_raw_token=function(o){for(var p=0;p<o.newlines;p++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(o.whitespace_before),this.current_line.push(o.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},u.prototype.add_token=function(o){this.__add_space_before_token(),this.current_line.push(o),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},u.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},u.prototype.remove_indent=function(o){for(var p=this.__lines.length;o<p;)this.__lines[o]._remove_indent(),o++;this.current_line._remove_wrap_indent()},u.prototype.trim=function(o){for(o=o===void 0?!1:o,this.current_line.trim();o&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},u.prototype.just_added_newline=function(){return this.current_line.is_empty()},u.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},u.prototype.ensure_empty_line_above=function(o,p){for(var l=this.__lines.length-2;l>=0;){var h=this.__lines[l];if(h.is_empty())break;if(h.item(0).indexOf(o)!==0&&h.item(-1)!==p){this.__lines.splice(l+1,0,new c(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},g.exports.Output=u},function(g){function c(m,u,o,p){this.type=m,this.text=u,this.comments_before=null,this.newlines=o||0,this.whitespace_before=p||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=c},,,function(g){function c(o,p){this.raw_options=m(o,p),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}c.prototype._get_array=function(o,p){var l=this.raw_options[o],h=p||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(h=l.concat()):typeof l=="string"&&(h=l.split(/[^a-zA-Z0-9_\/\-]+/)),h},c.prototype._get_boolean=function(o,p){var l=this.raw_options[o],h=l===void 0?!!p:!!l;return h},c.prototype._get_characters=function(o,p){var l=this.raw_options[o],h=p||"";return typeof l=="string"&&(h=l.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),h},c.prototype._get_number=function(o,p){var l=this.raw_options[o];p=parseInt(p,10),isNaN(p)&&(p=0);var h=parseInt(l,10);return isNaN(h)&&(h=p),h},c.prototype._get_selection=function(o,p,l){var h=this._get_selection_list(o,p,l);if(h.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values:
|
|
`+p+`
|
|
You passed in: '`+this.raw_options[o]+"'");return h[0]},c.prototype._get_selection_list=function(o,p,l){if(!p||p.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[p[0]],!this._is_valid_selection(l,p))throw new Error("Invalid Default Value!");var h=this._get_array(o,l);if(!this._is_valid_selection(h,p))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values:
|
|
`+p+`
|
|
You passed in: '`+this.raw_options[o]+"'");return h},c.prototype._is_valid_selection=function(o,p){return o.length&&p.length&&!o.some(function(l){return p.indexOf(l)===-1})};function m(o,p){var l={};o=u(o);var h;for(h in o)h!==p&&(l[h]=o[h]);if(p&&o[p])for(h in o[p])l[h]=o[p][h];return l}function u(o){var p={},l;for(l in o){var h=l.replace(/-/g,"_");p[h]=o[l]}return p}g.exports.Options=c,g.exports.normalizeOpts=u,g.exports.mergeOpts=m},,function(g){var c=RegExp.prototype.hasOwnProperty("sticky");function m(u){this.__input=u||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var u=null;return this.hasNext()&&(u=this.__input.charAt(this.__position),this.__position+=1),u},m.prototype.peek=function(u){var o=null;return u=u||0,u+=this.__position,u>=0&&u<this.__input_length&&(o=this.__input.charAt(u)),o},m.prototype.__match=function(u,o){u.lastIndex=o;var p=u.exec(this.__input);return p&&!(c&&u.sticky)&&(p.index!==o&&(p=null)),p},m.prototype.test=function(u,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(u,o):!1},m.prototype.testChar=function(u,o){var p=this.peek(o);return u.lastIndex=0,p!==null&&u.test(p)},m.prototype.match=function(u){var o=this.__match(u,this.__position);return o?this.__position+=o[0].length:o=null,o},m.prototype.read=function(u,o,p){var l="",h;return u&&(h=this.match(u),h&&(l+=h[0])),o&&(h||!u)&&(l+=this.readUntil(o,p)),l},m.prototype.readUntil=function(u,o){var p="",l=this.__position;u.lastIndex=this.__position;var h=u.exec(this.__input);return h?(l=h.index,o&&(l+=h[0].length)):l=this.__input_length,p=this.__input.substring(this.__position,l),this.__position=l,p},m.prototype.readUntilAfter=function(u){return this.readUntil(u,!0)},m.prototype.get_regexp=function(u,o){var p=null,l="g";return o&&c&&(l="y"),typeof u=="string"&&u!==""?p=new RegExp(u,l):u&&(p=new RegExp(u.source,l)),p},m.prototype.get_literal_regexp=function(u){return RegExp(u.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(u){var o=this.__position,p=this.readUntilAfter(u);return this.__position=o,p},m.prototype.lookBack=function(u){var o=this.__position-1;return o>=u.length&&this.__input.substring(o-u.length,o).toLowerCase()===u},g.exports.InputScanner=m},function(g,c,m){var u=m(8).InputScanner,o=m(3).Token,p=m(10).TokenStream,l=m(11).WhitespacePattern,h={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(a,C){this._input=new u(a),this._options=C||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new p,this._reset();for(var a,C=new o(h.START,""),_=null,T=[],O=new p;C.type!==h.EOF;){for(a=this._get_next_token(C,_);this._is_comment(a);)O.add(a),a=this._get_next_token(C,_);O.isEmpty()||(a.comments_before=O,O=new p),a.parent=_,this._is_opening(a)?(T.push(_),_=a):_&&this._is_closing(a,_)&&(a.opened=_,_.closed=a,_=T.pop(),a.parent=_),a.previous=C,C.next=a,this.__tokens.add(a),C=a}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(a,C){this._readWhitespace();var _=this._input.read(/.+/g);return _?this._create_token(h.RAW,_):this._create_token(h.EOF,"")},s.prototype._is_comment=function(a){return!1},s.prototype._is_opening=function(a){return!1},s.prototype._is_closing=function(a,C){return!1},s.prototype._create_token=function(a,C){var _=new o(a,C,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return _},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=s,g.exports.TOKEN=h},function(g){function c(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}c.prototype.restart=function(){this.__position=0},c.prototype.isEmpty=function(){return this.__tokens_length===0},c.prototype.hasNext=function(){return this.__position<this.__tokens_length},c.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},c.prototype.peek=function(m){var u=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(u=this.__tokens[m]),u},c.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},g.exports.TokenStream=c},function(g,c,m){var u=m(12).Pattern;function o(p,l){u.call(this,p,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}o.prototype=new u,o.prototype.__set_whitespace_patterns=function(p,l){p+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+p+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},o.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var p=this._input.read(this._match_pattern);if(p===" ")this.whitespace_before_token=" ";else if(p){var l=this.__split(this._newline_regexp,p);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return p},o.prototype.matching=function(p,l){var h=this._create();return h.__set_whitespace_patterns(p,l),h._update(),h},o.prototype._create=function(){return new o(this._input,this)},o.prototype.__split=function(p,l){p.lastIndex=0;for(var h=0,s=[],a=p.exec(l);a;)s.push(l.substring(h,a.index)),h=a.index+a[0].length,a=p.exec(l);return h<l.length?s.push(l.substring(h,l.length)):s.push(""),s},g.exports.WhitespacePattern=o},function(g){function c(m,u){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,u&&(this._starting_pattern=this._input.get_regexp(u._starting_pattern,!0),this._match_pattern=this._input.get_regexp(u._match_pattern,!0),this._until_pattern=this._input.get_regexp(u._until_pattern),this._until_after=u._until_after)}c.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},c.prototype.read_match=function(){return this._input.match(this._match_pattern)},c.prototype.until_after=function(m){var u=this._create();return u._until_after=!0,u._until_pattern=this._input.get_regexp(m),u._update(),u},c.prototype.until=function(m){var u=this._create();return u._until_after=!1,u._until_pattern=this._input.get_regexp(m),u._update(),u},c.prototype.starting_with=function(m){var u=this._create();return u._starting_pattern=this._input.get_regexp(m,!0),u._update(),u},c.prototype.matching=function(m){var u=this._create();return u._match_pattern=this._input.get_regexp(m,!0),u._update(),u},c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){},g.exports.Pattern=c},function(g){function c(m,u){m=typeof m=="string"?m:m.source,u=typeof u=="string"?u:u.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+u,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+u,"g")}c.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var u={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(m);o;)u[o[1]]=o[2],o=this.__directive_pattern.exec(m);return u},c.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=c},function(g,c,m){var u=m(12).Pattern,o={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function p(l,h){u.call(this,l,h),this.__template_pattern=null,this._disabled=Object.assign({},o),this._excluded=Object.assign({},o),h&&(this.__template_pattern=this._input.get_regexp(h.__template_pattern),this._excluded=Object.assign(this._excluded,h._excluded),this._disabled=Object.assign(this._disabled,h._disabled));var s=new u(l);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}p.prototype=new u,p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){this.__set_templated_pattern()},p.prototype.disable=function(l){var h=this._create();return h._disabled[l]=!0,h._update(),h},p.prototype.read_options=function(l){var h=this._create();for(var s in o)h._disabled[s]=l.templating.indexOf(s)===-1;return h._update(),h},p.prototype.exclude=function(l){var h=this._create();return h._excluded[l]=!0,h._update(),h},p.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var h=this._read_template();h;)this._match_pattern?h+=this._input.read(this._match_pattern):h+=this._input.readUntil(this.__template_pattern),l+=h,h=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},p.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},p.prototype._read_template=function(){var l="",h=this._input.peek();if(h==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(l=l||this.__patterns.erb.read())}else h==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},g.exports.TemplatablePattern=p},,,,function(g,c,m){var u=m(19).Beautifier,o=m(20).Options;function p(l,h,s,a){var C=new u(l,h,s,a);return C.beautify()}g.exports=p,g.exports.defaultOptions=function(){return new o}},function(g,c,m){var u=m(20).Options,o=m(2).Output,p=m(21).Tokenizer,l=m(21).TOKEN,h=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,a=function(x,v){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=x.max_preserve_newlines,this.preserve_newlines=x.preserve_newlines,this._output=new o(x,v)};a.prototype.current_line_has_match=function(x){return this._output.current_line.has_match(x)},a.prototype.set_space_before_token=function(x,v){this._output.space_before_token=x,this._output.non_breaking_space=v},a.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},a.prototype.add_raw_token=function(x){this._output.add_raw_token(x)},a.prototype.print_preserved_newlines=function(x){var v=0;x.type!==l.TEXT&&x.previous.type!==l.TEXT&&(v=x.newlines?1:0),this.preserve_newlines&&(v=x.newlines<this.max_preserve_newlines+1?x.newlines:this.max_preserve_newlines+1);for(var y=0;y<v;y++)this.print_newline(y>0);return v!==0},a.prototype.traverse_whitespace=function(x){return x.whitespace_before||x.newlines?(this.print_preserved_newlines(x)||(this._output.space_before_token=!0),!0):!1},a.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},a.prototype.print_newline=function(x){this._output.add_new_line(x)},a.prototype.print_token=function(x){x.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(x.text))},a.prototype.indent=function(){this.indent_level++},a.prototype.get_full_indent=function(x){return x=this.indent_level+(x||0),x<1?"":this._output.get_indent_string(x)};var C=function(x){for(var v=null,y=x.next;y.type!==l.EOF&&x.closed!==y;){if(y.type===l.ATTRIBUTE&&y.text==="type"){y.next&&y.next.type===l.EQUALS&&y.next.next&&y.next.next.type===l.VALUE&&(v=y.next.next.text);break}y=y.next}return v},_=function(x,v){var y=null,U=null;return v.closed?(x==="script"?y="text/javascript":x==="style"&&(y="text/css"),y=C(v)||y,y.search("text/css")>-1?U="css":y.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?U="javascript":y.search(/(text|application|dojo)\/(x-)?(html)/)>-1?U="html":y.search(/test\/null/)>-1&&(U="null"),U):null};function T(x,v){return v.indexOf(x)!==-1}function O(x,v,y){this.parent=x||null,this.tag=v?v.tag_name:"",this.indent_level=y||0,this.parser_token=v||null}function R(x){this._printer=x,this._current_frame=null}R.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},R.prototype.record_tag=function(x){var v=new O(this._current_frame,x,this._printer.indent_level);this._current_frame=v},R.prototype._try_pop_frame=function(x){var v=null;return x&&(v=x.parser_token,this._printer.indent_level=x.indent_level,this._current_frame=x.parent),v},R.prototype._get_frame=function(x,v){for(var y=this._current_frame;y&&!(x.indexOf(y.tag)!==-1);){if(v&&v.indexOf(y.tag)!==-1){y=null;break}y=y.parent}return y},R.prototype.try_pop=function(x,v){var y=this._get_frame([x],v);return this._try_pop_frame(y)},R.prototype.indent_to_tag=function(x){var v=this._get_frame(x);v&&(this._printer.indent_level=v.indent_level)};function S(x,v,y,U){this._source_text=x||"",v=v||{},this._js_beautify=y,this._css_beautify=U,this._tag_stack=null;var B=new u(v,"html");this._options=B,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}S.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var x=this._source_text,v=this._options.eol;this._options.eol==="auto"&&(v=`
|
|
`,x&&h.test(x)&&(v=x.match(h)[0])),x=x.replace(s,`
|
|
`);var y=x.match(/^[\t ]*/)[0],U={text:"",type:""},B=new w,A=new a(this._options,y),j=new p(x,this._options).tokenize();this._tag_stack=new R(A);for(var P=null,b=j.next();b.type!==l.EOF;)b.type===l.TAG_OPEN||b.type===l.COMMENT?(P=this._handle_tag_open(A,b,B,U),B=P):b.type===l.ATTRIBUTE||b.type===l.EQUALS||b.type===l.VALUE||b.type===l.TEXT&&!B.tag_complete?P=this._handle_inside_tag(A,b,B,j):b.type===l.TAG_CLOSE?P=this._handle_tag_close(A,b,B):b.type===l.TEXT?P=this._handle_text(A,b,B):A.add_raw_token(b),U=P,b=j.next();var V=A._output.get_code(v);return V},S.prototype._handle_tag_close=function(x,v,y){var U={text:v.text,type:v.type};return x.alignment_size=0,y.tag_complete=!0,x.set_space_before_token(v.newlines||v.whitespace_before!=="",!0),y.is_unformatted?x.add_raw_token(v):(y.tag_start_char==="<"&&(x.set_space_before_token(v.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&y.has_wrapped_attrs&&x.print_newline(!1)),x.print_token(v)),y.indent_content&&!(y.is_unformatted||y.is_content_unformatted)&&(x.indent(),y.indent_content=!1),!y.is_inline_element&&!(y.is_unformatted||y.is_content_unformatted)&&x.set_wrap_point(),U},S.prototype._handle_inside_tag=function(x,v,y,U){var B=y.has_wrapped_attrs,A={text:v.text,type:v.type};if(x.set_space_before_token(v.newlines||v.whitespace_before!=="",!0),y.is_unformatted)x.add_raw_token(v);else if(y.tag_start_char==="{"&&v.type===l.TEXT)x.print_preserved_newlines(v)?(v.newlines=0,x.add_raw_token(v)):x.print_token(v);else{if(v.type===l.ATTRIBUTE?(x.set_space_before_token(!0),y.attr_count+=1):(v.type===l.EQUALS||v.type===l.VALUE&&v.previous.type===l.EQUALS)&&x.set_space_before_token(!1),v.type===l.ATTRIBUTE&&y.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(x.traverse_whitespace(v),B=B||v.newlines!==0),this._is_wrap_attributes_force)){var j=y.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&y.attr_count===1){var P=!0,b=0,V;do{if(V=U.peek(b),V.type===l.ATTRIBUTE){P=!1;break}b+=1}while(b<4&&V.type!==l.EOF&&V.type!==l.TAG_CLOSE);j=!P}j&&(x.print_newline(!1),B=!0)}x.print_token(v),B=B||x.previous_token_wrapped(),y.has_wrapped_attrs=B}return A},S.prototype._handle_text=function(x,v,y){var U={text:v.text,type:"TK_CONTENT"};return y.custom_beautifier_name?this._print_custom_beatifier_text(x,v,y):y.is_unformatted||y.is_content_unformatted?x.add_raw_token(v):(x.traverse_whitespace(v),x.print_token(v)),U},S.prototype._print_custom_beatifier_text=function(x,v,y){var U=this;if(v.text!==""){var B=v.text,A,j=1,P="",b="";y.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?A=this._js_beautify:y.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?A=this._css_beautify:y.custom_beautifier_name==="html"&&(A=function(we,Le){var Re=new S(we,Le,U._js_beautify,U._css_beautify);return Re.beautify()}),this._options.indent_scripts==="keep"?j=0:this._options.indent_scripts==="separate"&&(j=-x.indent_level);var V=x.get_full_indent(j);if(B=B.replace(/\n[ \t]*$/,""),y.custom_beautifier_name!=="html"&&B[0]==="<"&&B.match(/^(<!--|<!\[CDATA\[)/)){var ne=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(B);if(!ne){x.add_raw_token(v);return}P=V+ne[1]+`
|
|
`,B=ne[4],ne[5]&&(b=V+ne[5]),B=B.replace(/\n[ \t]*$/,""),(ne[2]||ne[3].indexOf(`
|
|
`)!==-1)&&(ne=ne[3].match(/[ \t]+$/),ne&&(v.whitespace_before=ne[0]))}if(B)if(A){var ce=function(){this.eol=`
|
|
`};ce.prototype=this._options.raw_options;var me=new ce;B=A(V+B,me)}else{var Ie=v.whitespace_before;Ie&&(B=B.replace(new RegExp(`
|
|
(`+Ie+")?","g"),`
|
|
`)),B=V+B.replace(/\n/g,`
|
|
`+V)}P&&(B?B=P+B+`
|
|
`+b:B=P+b),x.print_newline(!1),B&&(v.text=B,v.whitespace_before="",v.newlines=0,x.add_raw_token(v),x.print_newline(!0))}},S.prototype._handle_tag_open=function(x,v,y,U){var B=this._get_tag_open_token(v);return(y.is_unformatted||y.is_content_unformatted)&&!y.is_empty_element&&v.type===l.TAG_OPEN&&v.text.indexOf("</")===0?(x.add_raw_token(v),B.start_tag_token=this._tag_stack.try_pop(B.tag_name)):(x.traverse_whitespace(v),this._set_tag_position(x,v,B,y,U),B.is_inline_element||x.set_wrap_point(),x.print_token(v)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(B.alignment_size=v.text.length+1),!B.tag_complete&&!B.is_unformatted&&(x.alignment_size=B.alignment_size),B};var w=function(x,v){if(this.parent=x||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!v)this.tag_complete=!0;else{var y;this.tag_start_char=v.text[0],this.text=v.text,this.tag_start_char==="<"?(y=v.text.match(/^<([^\s>]*)/),this.tag_check=y?y[1]:""):(y=v.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=y?y[1]:"",(v.text.startsWith("{{#>")||v.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&v.next!==null?this.tag_check=v.next.text.split(" ")[0]:this.tag_check=v.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),v.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||v.closed&&v.closed.text==="/>";var U=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(U=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(U)))}};S.prototype._get_tag_open_token=function(x){var v=new w(this._tag_stack.get_parser_token(),x);return v.alignment_size=this._options.wrap_attributes_indent_size,v.is_end_tag=v.is_end_tag||T(v.tag_check,this._options.void_elements),v.is_empty_element=v.tag_complete||v.is_start_tag&&v.is_end_tag,v.is_unformatted=!v.tag_complete&&T(v.tag_check,this._options.unformatted),v.is_content_unformatted=!v.is_empty_element&&T(v.tag_check,this._options.content_unformatted),v.is_inline_element=T(v.tag_name,this._options.inline)||v.tag_name.includes("-")||v.tag_start_char==="{",v},S.prototype._set_tag_position=function(x,v,y,U,B){if(y.is_empty_element||(y.is_end_tag?y.start_tag_token=this._tag_stack.try_pop(y.tag_name):(this._do_optional_end_element(y)&&(y.is_inline_element||x.print_newline(!1)),this._tag_stack.record_tag(y),(y.tag_name==="script"||y.tag_name==="style")&&!(y.is_unformatted||y.is_content_unformatted)&&(y.custom_beautifier_name=_(y.tag_check,v)))),T(y.tag_check,this._options.extra_liners)&&(x.print_newline(!1),x._output.just_added_blankline()||x.print_newline(!0)),y.is_empty_element){if(y.tag_start_char==="{"&&y.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),y.indent_content=!0;var A=x.current_line_has_match(/{{#if/);A||x.print_newline(!1)}y.tag_name==="!--"&&B.type===l.TAG_CLOSE&&U.is_end_tag&&y.text.indexOf(`
|
|
`)===-1||(y.is_inline_element||y.is_unformatted||x.print_newline(!1),this._calcluate_parent_multiline(x,y))}else if(y.is_end_tag){var j=!1;j=y.start_tag_token&&y.start_tag_token.multiline_content,j=j||!y.is_inline_element&&!(U.is_inline_element||U.is_unformatted)&&!(B.type===l.TAG_CLOSE&&y.start_tag_token===U)&&B.type!=="TK_CONTENT",(y.is_content_unformatted||y.is_unformatted)&&(j=!1),j&&x.print_newline(!1)}else y.indent_content=!y.custom_beautifier_name,y.tag_start_char==="<"&&(y.tag_name==="html"?y.indent_content=this._options.indent_inner_html:y.tag_name==="head"?y.indent_content=this._options.indent_head_inner_html:y.tag_name==="body"&&(y.indent_content=this._options.indent_body_inner_html)),!(y.is_inline_element||y.is_unformatted)&&(B.type!=="TK_CONTENT"||y.is_content_unformatted)&&x.print_newline(!1),this._calcluate_parent_multiline(x,y)},S.prototype._calcluate_parent_multiline=function(x,v){v.parent&&x._output.just_added_newline()&&!((v.is_inline_element||v.is_unformatted)&&v.parent.is_inline_element)&&(v.parent.multiline_content=!0)};var E=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],f=["a","audio","del","ins","map","noscript","video"];S.prototype._do_optional_end_element=function(x){var v=null;if(x.is_empty_element||!x.is_start_tag||!x.parent)return;if(x.tag_name==="body")v=v||this._tag_stack.try_pop("head");else if(x.tag_name==="li")v=v||this._tag_stack.try_pop("li",["ol","ul"]);else if(x.tag_name==="dd"||x.tag_name==="dt")v=v||this._tag_stack.try_pop("dt",["dl"]),v=v||this._tag_stack.try_pop("dd",["dl"]);else if(x.parent.tag_name==="p"&&E.indexOf(x.tag_name)!==-1){var y=x.parent.parent;(!y||f.indexOf(y.tag_name)===-1)&&(v=v||this._tag_stack.try_pop("p"))}else x.tag_name==="rp"||x.tag_name==="rt"?(v=v||this._tag_stack.try_pop("rt",["ruby","rtc"]),v=v||this._tag_stack.try_pop("rp",["ruby","rtc"])):x.tag_name==="optgroup"?v=v||this._tag_stack.try_pop("optgroup",["select"]):x.tag_name==="option"?v=v||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):x.tag_name==="colgroup"?v=v||this._tag_stack.try_pop("caption",["table"]):x.tag_name==="thead"?(v=v||this._tag_stack.try_pop("caption",["table"]),v=v||this._tag_stack.try_pop("colgroup",["table"])):x.tag_name==="tbody"||x.tag_name==="tfoot"?(v=v||this._tag_stack.try_pop("caption",["table"]),v=v||this._tag_stack.try_pop("colgroup",["table"]),v=v||this._tag_stack.try_pop("thead",["table"]),v=v||this._tag_stack.try_pop("tbody",["table"])):x.tag_name==="tr"?(v=v||this._tag_stack.try_pop("caption",["table"]),v=v||this._tag_stack.try_pop("colgroup",["table"]),v=v||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(x.tag_name==="th"||x.tag_name==="td")&&(v=v||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),v=v||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return x.parent=this._tag_stack.get_parser_token(),v},g.exports.Beautifier=S},function(g,c,m){var u=m(6).Options;function o(p){u.call(this,p,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}o.prototype=new u,g.exports.Options=o},function(g,c,m){var u=m(9).Tokenizer,o=m(9).TOKEN,p=m(13).Directives,l=m(14).TemplatablePattern,h=m(12).Pattern,s={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:o.START,RAW:o.RAW,EOF:o.EOF},a=new p(/<\!--/,/-->/),C=function(_,T){u.call(this,_,T),this._current_tag_name="";var O=new l(this._input).read_options(this._options),R=new h(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:R.starting_with(/{{!--/).until_after(/--}}/),handlebars:R.starting_with(/{{/).until_after(/}}/),handlebars_open:R.until(/[\n\r\t }]/),handlebars_raw_close:R.until(/}}/),comment:R.starting_with(/<!--/).until_after(/-->/),cdata:R.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:R.starting_with(/<!\[/).until_after(/]>/),processing:R.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var S=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=R.matching(S).until_after(S)}};C.prototype=new u,C.prototype._is_comment=function(_){return!1},C.prototype._is_opening=function(_){return _.type===s.TAG_OPEN},C.prototype._is_closing=function(_,T){return _.type===s.TAG_CLOSE&&T&&((_.text===">"||_.text==="/>")&&T.text[0]==="<"||_.text==="}}"&&T.text[0]==="{"&&T.text[1]==="{")},C.prototype._reset=function(){this._current_tag_name=""},C.prototype._get_next_token=function(_,T){var O=null;this._readWhitespace();var R=this._input.peek();return R===null?this._create_token(s.EOF,""):(O=O||this._read_open_handlebars(R,T),O=O||this._read_attribute(R,_,T),O=O||this._read_close(R,T),O=O||this._read_raw_content(R,_,T),O=O||this._read_content_word(R),O=O||this._read_comment_or_cdata(R),O=O||this._read_processing(R),O=O||this._read_open(R,T),O=O||this._create_token(s.UNKNOWN,this._input.next()),O)},C.prototype._read_comment_or_cdata=function(_){var T=null,O=null,R=null;if(_==="<"){var S=this._input.peek(1);S==="!"&&(O=this.__patterns.comment.read(),O?(R=a.get_directives(O),R&&R.ignore==="start"&&(O+=a.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(T=this._create_token(s.COMMENT,O),T.directives=R)}return T},C.prototype._read_processing=function(_){var T=null,O=null,R=null;if(_==="<"){var S=this._input.peek(1);(S==="!"||S==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(T=this._create_token(s.COMMENT,O),T.directives=R)}return T},C.prototype._read_open=function(_,T){var O=null,R=null;return T||_==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),R=this._create_token(s.TAG_OPEN,O)),R},C.prototype._read_open_handlebars=function(_,T){var O=null,R=null;return T||this._options.indent_handlebars&&_==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),R=this._create_token(s.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),R=this._create_token(s.TAG_OPEN,O))),R},C.prototype._read_close=function(_,T){var O=null,R=null;return T&&(T.text[0]==="<"&&(_===">"||_==="/"&&this._input.peek(1)===">")?(O=this._input.next(),_==="/"&&(O+=this._input.next()),R=this._create_token(s.TAG_CLOSE,O)):T.text[0]==="{"&&_==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),R=this._create_token(s.TAG_CLOSE,"}}"))),R},C.prototype._read_attribute=function(_,T,O){var R=null,S="";if(O&&O.text[0]==="<")if(_==="=")R=this._create_token(s.EQUALS,this._input.next());else if(_==='"'||_==="'"){var w=this._input.next();_==='"'?w+=this.__patterns.double_quote.read():w+=this.__patterns.single_quote.read(),R=this._create_token(s.VALUE,w)}else S=this.__patterns.attribute.read(),S&&(T.type===s.EQUALS?R=this._create_token(s.VALUE,S):R=this._create_token(s.ATTRIBUTE,S));return R},C.prototype._is_content_unformatted=function(_){return this._options.void_elements.indexOf(_)===-1&&(this._options.content_unformatted.indexOf(_)!==-1||this._options.unformatted.indexOf(_)!==-1)},C.prototype._read_raw_content=function(_,T,O){var R="";if(O&&O.text[0]==="{")R=this.__patterns.handlebars_raw_close.read();else if(T.type===s.TAG_CLOSE&&T.opened.text[0]==="<"&&T.text[0]!=="/"){var S=T.opened.text.substr(1).toLowerCase();if(S==="script"||S==="style"){var w=this._read_comment_or_cdata(_);if(w)return w.type=s.TEXT,w;R=this._input.readUntil(new RegExp("</"+S+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(S)&&(R=this._input.readUntil(new RegExp("</"+S+"[\\n\\r\\t ]*?>","ig")))}return R?this._create_token(s.TEXT,R):null},C.prototype._read_content_word=function(_){var T="";if(this._options.unformatted_content_delimiter&&(_===this._options.unformatted_content_delimiter[0]&&(T=this.__patterns.unformatted_content_delimiter.read())),T||(T=this.__patterns.word.read()),T)return this._create_token(s.TEXT,T)},g.exports.Tokenizer=C,g.exports.TOKEN=s}],H={};function i(g){var c=H[g];if(c!==void 0)return c.exports;var m=H[g]={exports:{}};return W[g](m,m.exports,i),m.exports}var L=i(18);D=L})();var z=D;if(!0)!(oe=[J,J("6UM0"),J("TXwP")],Y=function(W){var H=J("6UM0"),i=J("TXwP");return{html_beautify:function(L,g){return z(L,g,H.js_beautify,i.css_beautify)}}}.apply(Ee,oe),Y!==void 0&&(et.exports=Y));else var N,M})()},"rAM+":function(et,Ee,J){"use strict";J.d(Ee,"a",function(){return Y});var oe=J("Qw5x");function Y(D,z){var N;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(N=Object(oe.a)(D))||z&&D&&typeof D.length=="number"){N&&(D=N);var M=0,W=function(){};return{s:W,n:function(){return M>=D.length?{done:!0}:{done:!1,value:D[M++]}},e:function(c){throw c},f:W}}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 H=!0,i=!1,L;return{s:function(){N=D[Symbol.iterator]()},n:function(){var c=N.next();return H=c.done,c},e:function(c){i=!0,L=c},f:function(){try{!H&&N.return!=null&&N.return()}finally{if(i)throw L}}}}},rUJ1:function(et,Ee){const J=/[&<>"']/,oe=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},N=R=>z[R];function M(R,S){if(S){if(J.test(R))return R.replace(oe,N)}else if(Y.test(R))return R.replace(D,N);return R}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(R){return R.replace(W,(S,w)=>(w=w.toLowerCase(),w==="colon"?":":w.charAt(0)==="#"?w.charAt(1)==="x"?String.fromCharCode(parseInt(w.substring(2),16)):String.fromCharCode(+w.substring(1)):""))}const i=/(^|[^\[])\^/g;function L(R,S){R=R.source||R,S=S||"";const w={replace:(E,f)=>(f=f.source||f,f=f.replace(i,"$1"),R=R.replace(E,f),w),getRegex:()=>new RegExp(R,S)};return w}const g=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(R,S,w){if(R){let E;try{E=decodeURIComponent(H(w)).replace(g,"").toLowerCase()}catch(f){return null}if(E.indexOf("javascript:")===0||E.indexOf("vbscript:")===0||E.indexOf("data:")===0)return null}S&&!c.test(w)&&(w=h(S,w));try{w=encodeURI(w).replace(/%25/g,"%")}catch(E){return null}return w}const u={},o=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function h(R,S){u[" "+R]||(o.test(R)?u[" "+R]=R+"/":u[" "+R]=_(R,"/",!0)),R=u[" "+R];const w=R.indexOf(":")===-1;return S.substring(0,2)==="//"?w?S:R.replace(p,"$1")+S:S.charAt(0)==="/"?w?S:R.replace(l,"$1")+S:R+S}const s={exec:function(){}};function a(R){let S=1,w,E;for(;S<arguments.length;S++){w=arguments[S];for(E in w)Object.prototype.hasOwnProperty.call(w,E)&&(R[E]=w[E])}return R}function C(R,S){const w=R.replace(/\|/g,(x,v,y)=>{let U=!1,B=v;for(;--B>=0&&y[B]==="\\";)U=!U;return U?"|":" |"}),E=w.split(/ \|/);let f=0;if(E.length>S)E.splice(S);else for(;E.length<S;)E.push("");for(;f<E.length;f++)E[f]=E[f].trim().replace(/\\\|/g,"|");return E}function _(R,S,w){const E=R.length;if(E===0)return"";let f=0;for(;f<E;){const x=R.charAt(E-f-1);if(x===S&&!w)f++;else if(x!==S&&w)f++;else break}return R.substr(0,E-f)}function T(R,S){if(R.indexOf(S[1])===-1)return-1;const w=R.length;let E=0,f=0;for(;f<w;f++)if(R[f]==="\\")f++;else if(R[f]===S[0])E++;else if(R[f]===S[1]&&(E--,E<0))return f;return-1}function O(R){R&&R.sanitize&&!R.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")}et.exports={escape:M,unescape:H,edit:L,cleanUrl:m,resolveUrl:h,noopTest:s,merge:a,splitCells:C,rtrim:_,findClosingBracket:T,checkSanitizeDeprecation:O}},t9D7:function(et,Ee,J){"use strict";J.d(Ee,"b",function(){return W}),J.d(Ee,"g",function(){return i}),J.d(Ee,"d",function(){return L}),J.d(Ee,"e",function(){return g}),J.d(Ee,"a",function(){return c}),J.d(Ee,"f",function(){return o}),J.d(Ee,"c",function(){return p});var oe=J("Vhoy"),Y=J("MI8n"),D=J("pmY6"),z=J("Cg/j"),N=J("ic2d"),M=J("nEHx");const W=Object(z.c)("themeService");var H;(function(l){function h(s){return s&&typeof s=="object"&&typeof s.id=="string"}l.isThemeColor=h})(H||(H={}));function i(l){return{id:l}}var L;(function(l){function h(O){return O&&typeof O=="object"&&typeof O.id=="string"&&(typeof O.color=="undefined"||H.isThemeColor(O.color))}l.isThemeIcon=h;const s=new RegExp(`^\\$\\((${oe.a.iconNameExpression}(?:${oe.a.iconModifierExpression})?)\\)$`);function a(O){const R=s.exec(O);if(!R)return;let[,S]=R;return{id:S}}l.fromString=a;function C(O,R){let S=O.id;const w=S.lastIndexOf("~");return w!==-1&&(S=S.substring(0,w)),R&&(S=`${S}~${R}`),{id:S}}l.modify=C;function _(O,R){var S,w;return O.id===R.id&&((S=O.color)===null||S===void 0?void 0:S.id)===((w=R.color)===null||w===void 0?void 0:w.id)}l.isEqual=_;function T(O,R){return{id:O.id,color:R?i(R):void 0}}l.asThemeIcon=T,l.asClassNameArray=oe.a.asClassNameArray,l.asClassName=oe.a.asClassName,l.asCSSSelector=oe.a.asCSSSelector})(L||(L={}));function g(l){switch(l){case M.a.DARK:return"vs-dark";case M.a.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const c={ThemingContribution:"base.contributions.theming"};class m{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new Y.b}onColorThemeChange(l){return this.themingParticipants.push(l),this.onThemingParticipantAddedEmitter.fire(l),Object(D.i)(()=>{const h=this.themingParticipants.indexOf(l);this.themingParticipants.splice(h,1)})}getThemingParticipants(){return this.themingParticipants}}let u=new m;N.a.add(c.ThemingContribution,u);function o(l){return u.onColorThemeChange(l)}class p extends D.a{constructor(l){super();this.themeService=l,this.theme=l.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(h=>this.onThemeChange(h)))}onThemeChange(l){this.theme=l,this.updateStyles()}updateStyles(){}}},ulZh:function(et,Ee,J){typeof window!="undefined"&&function(Y,D){et.exports=D()}(this,function(){return function(oe){var Y={};function D(z){if(Y[z])return Y[z].exports;var N=Y[z]={i:z,l:!1,exports:{}};return oe[z].call(N.exports,N,N.exports,D),N.l=!0,N.exports}return D.m=oe,D.c=Y,D.d=function(z,N,M){D.o(z,N)||Object.defineProperty(z,N,{enumerable:!0,get:M})},D.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},D.t=function(z,N){if(N&1&&(z=D(z)),N&8)return z;if(N&4&&typeof z=="object"&&z&&z.__esModule)return z;var M=Object.create(null);if(D.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:z}),N&2&&typeof z!="string")for(var W in z)D.d(M,W,function(H){return z[H]}.bind(null,W));return M},D.n=function(z){var N=z&&z.__esModule?function(){return z.default}:function(){return z};return D.d(N,"a",N),N},D.o=function(z,N){return Object.prototype.hasOwnProperty.call(z,N)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,Y,D){"use strict";var z=Object.prototype.hasOwnProperty,N="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(N=!1));function W(g,c,m){this.fn=g,this.context=c,this.once=m||!1}function H(g,c,m,u,o){if(typeof m!="function")throw new TypeError("The listener must be a function");var p=new W(m,u||g,o),l=N?N+c:c;return g._events[l]?g._events[l].fn?g._events[l]=[g._events[l],p]:g._events[l].push(p):(g._events[l]=p,g._eventsCount++),g}function i(g,c){--g._eventsCount===0?g._events=new M:delete g._events[c]}function L(){this._events=new M,this._eventsCount=0}L.prototype.eventNames=function(){var c=[],m,u;if(this._eventsCount===0)return c;for(u in m=this._events)z.call(m,u)&&c.push(N?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(m)):c},L.prototype.listeners=function(c){var m=N?N+c:c,u=this._events[m];if(!u)return[];if(u.fn)return[u.fn];for(var o=0,p=u.length,l=new Array(p);o<p;o++)l[o]=u[o].fn;return l},L.prototype.listenerCount=function(c){var m=N?N+c:c,u=this._events[m];return u?u.fn?1:u.length:0},L.prototype.emit=function(c,m,u,o,p,l){var h=N?N+c:c;if(!this._events[h])return!1;var s=this._events[h],a=arguments.length,C,_;if(s.fn){s.once&&this.removeListener(c,s.fn,void 0,!0);switch(a){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,m),!0;case 3:return s.fn.call(s.context,m,u),!0;case 4:return s.fn.call(s.context,m,u,o),!0;case 5:return s.fn.call(s.context,m,u,o,p),!0;case 6:return s.fn.call(s.context,m,u,o,p,l),!0}for(_=1,C=new Array(a-1);_<a;_++)C[_-1]=arguments[_];s.fn.apply(s.context,C)}else{var T=s.length,O;for(_=0;_<T;_++){s[_].once&&this.removeListener(c,s[_].fn,void 0,!0);switch(a){case 1:s[_].fn.call(s[_].context);break;case 2:s[_].fn.call(s[_].context,m);break;case 3:s[_].fn.call(s[_].context,m,u);break;case 4:s[_].fn.call(s[_].context,m,u,o);break;default:if(!C)for(O=1,C=new Array(a-1);O<a;O++)C[O-1]=arguments[O];s[_].fn.apply(s[_].context,C)}}}return!0},L.prototype.on=function(c,m,u){return H(this,c,m,u,!1)},L.prototype.once=function(c,m,u){return H(this,c,m,u,!0)},L.prototype.removeListener=function(c,m,u,o){var p=N?N+c:c;if(!this._events[p])return this;if(!m)return i(this,p),this;var l=this._events[p];if(l.fn)l.fn===m&&(!o||l.once)&&(!u||l.context===u)&&i(this,p);else{for(var h=0,s=[],a=l.length;h<a;h++)(l[h].fn!==m||o&&!l[h].once||u&&l[h].context!==u)&&s.push(l[h]);s.length?this._events[p]=s.length===1?s[0]:s:i(this,p)}return this},L.prototype.removeAllListeners=function(c){var m;return c?(m=N?N+c:c,this._events[m]&&i(this,m)):(this._events=new M,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=N,L.EventEmitter=L,oe.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,Y,D){(function(z){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,i={buildAbsoluteURL:function(L,g,c){if(c=c||{},L=L.trim(),g=g.trim(),!g){if(!c.alwaysNormalize)return L;var m=i.parseURL(L);if(!m)throw new Error("Error trying to parse base URL.");return m.path=i.normalizePath(m.path),i.buildURLFromParts(m)}var u=i.parseURL(g);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=i.normalizePath(u.path),i.buildURLFromParts(u)):g;var o=i.parseURL(L);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&o.path[0]!=="/"){var p=M.exec(o.path);o.netLoc=p[1],o.path=p[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(l.netLoc=o.netLoc,u.path[0]!=="/"))if(!u.path)l.path=o.path,u.params||(l.params=o.params,u.query||(l.query=o.query));else{var h=o.path,s=h.substring(0,h.lastIndexOf("/")+1)+u.path;l.path=i.normalizePath(s)}return l.path===null&&(l.path=c.alwaysNormalize?i.normalizePath(u.path):u.path),i.buildURLFromParts(l)},parseURL:function(L){var g=N.exec(L);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(W,"");L.length!==(L=L.replace(H,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};oe.exports=i})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,Y,D){function z(c){var m={};function u(p){if(m[p])return m[p].exports;var l=m[p]={i:p,l:!1,exports:{}};return c[p].call(l.exports,l,l.exports,u),l.l=!0,l.exports}u.m=c,u.c=m,u.i=function(p){return p},u.d=function(p,l,h){u.o(p,l)||Object.defineProperty(p,l,{configurable:!1,enumerable:!0,get:h})},u.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},u.n=function(p){var l=p&&p.__esModule?function(){return p.default}:function(){return p};return u.d(l,"a",l),l},u.o=function(p,l){return Object.prototype.hasOwnProperty.call(p,l)},u.p="/",u.oe=function(p){throw console.error(p),p};var o=u(u.s=ENTRY_MODULE);return o.default||o}var N="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function W(c){return(c+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(c){return!isNaN(1*c)}function i(c,m,u){var o={};o[u]=[];var p=m.toString(),l=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return o;for(var h=l[1],s=new RegExp("(\\\\n|\\W)"+W(h)+M,"g"),a;a=s.exec(p);){if(a[3]==="dll-reference")continue;o[u].push(a[3])}for(s=new RegExp("\\("+W(h)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+M,"g");a=s.exec(p);)c[a[2]]||(o[u].push(a[1]),c[a[2]]=D(a[1]).m),o[a[2]]=o[a[2]]||[],o[a[2]].push(a[4]);for(var C=Object.keys(o),_=0;_<C.length;_++)for(var T=0;T<o[C[_]].length;T++)H(o[C[_]][T])&&(o[C[_]][T]=1*o[C[_]][T]);return o}function L(c){var m=Object.keys(c);return m.reduce(function(u,o){return u||c[o].length>0},!1)}function g(c,m){for(var u={main:[m]},o={main:[]},p={main:{}};L(u);)for(var l=Object.keys(u),h=0;h<l.length;h++){var s=l[h],a=u[s],C=a.pop();if(p[s]=p[s]||{},p[s][C]||!c[s][C])continue;p[s][C]=!0,o[s]=o[s]||[],o[s].push(C);for(var _=i(c,c[s][C],s),T=Object.keys(_),O=0;O<T.length;O++)u[T[O]]=u[T[O]]||[],u[T[O]]=u[T[O]].concat(_[T[O]])}return o}oe.exports=function(c,m){m=m||{};var u={main:D.m},o=m.all?{main:Object.keys(u.main)}:g(u,c),p="";Object.keys(o).filter(function(C){return C!=="main"}).forEach(function(C){for(var _=0;o[C][_];)_++;o[C].push(_),u[C][_]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+C+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(_))+")({"+o[C].map(function(T){return""+JSON.stringify(T)+": "+u[C][T].toString()}).join(",")+`});
|
|
`}),p=p+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+o.main.map(function(C){return""+JSON.stringify(C)+": "+u.main[C].toString()}).join(",")+"}))(self);";var l=new window.Blob([p],{type:"text/javascript"});if(m.bare)return l;var h=window.URL||window.webkitURL||window.mozURL||window.msURL,s=h.createObjectURL(l),a=new window.Worker(s);return a.objectURL=s,a}},"./src/config.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"hlsDefaultConfig",function(){return O}),D.d(Y,"mergeConfig",function(){return S}),D.d(Y,"enableStreamingMode",function(){return w});var z=D("./src/controller/abr-controller.ts"),N=D("./src/controller/audio-stream-controller.ts"),M=D("./src/controller/audio-track-controller.ts"),W=D("./src/controller/subtitle-stream-controller.ts"),H=D("./src/controller/subtitle-track-controller.ts"),i=D("./src/controller/buffer-controller.ts"),L=D("./src/controller/timeline-controller.ts"),g=D("./src/controller/cap-level-controller.ts"),c=D("./src/controller/fps-controller.ts"),m=D("./src/controller/eme-controller.ts"),u=D("./src/controller/cmcd-controller.ts"),o=D("./src/utils/xhr-loader.ts"),p=D("./src/utils/fetch-loader.ts"),l=D("./src/utils/cues.ts"),h=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function a(){return a=Object.assign||function(E){for(var f=1;f<arguments.length;f++){var x=arguments[f];for(var v in x)Object.prototype.hasOwnProperty.call(x,v)&&(E[v]=x[v])}return E},a.apply(this,arguments)}function C(E,f){var x=Object.keys(E);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(E);f&&(v=v.filter(function(y){return Object.getOwnPropertyDescriptor(E,y).enumerable})),x.push.apply(x,v)}return x}function _(E){for(var f=1;f<arguments.length;f++){var x=arguments[f]!=null?arguments[f]:{};f%2?C(Object(x),!0).forEach(function(v){T(E,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(x)):C(Object(x)).forEach(function(v){Object.defineProperty(E,v,Object.getOwnPropertyDescriptor(x,v))})}return E}function T(E,f,x){return f in E?Object.defineProperty(E,f,{value:x,enumerable:!0,configurable:!0,writable:!0}):E[f]=x,E}var O=_(_({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:o.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:i.default,capLevelController:g.default,fpsController:c.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:h.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},R()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:H.default,timelineController:L.TimelineController,audioStreamController:N.default,audioTrackController:M.default,emeController:m.default,cmcdController:u.default});function R(){return{cueHandler:l.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 S(E,f){if((f.liveSyncDurationCount||f.liveMaxLatencyDurationCount)&&(f.liveSyncDuration||f.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(f.liveMaxLatencyDurationCount!==void 0&&(f.liveSyncDurationCount===void 0||f.liveMaxLatencyDurationCount<=f.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(f.liveMaxLatencyDuration!==void 0&&(f.liveSyncDuration===void 0||f.liveMaxLatencyDuration<=f.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return a({},E,f)}function w(E){var f=E.loader;if(f!==p.default&&f!==o.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),E.progressive=!1;else{var x=Object(p.fetchSupported)();x&&(E.loader=p.default,E.progressive=!0,E.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/polyfills/number.ts"),N=D("./src/utils/ewma-bandwidth-estimator.ts"),M=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),H=D("./src/errors.ts"),i=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts");function g(u,o){for(var p=0;p<o.length;p++){var l=o[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,l.key,l)}}function c(u,o,p){return o&&g(u.prototype,o),p&&g(u,p),u}var m=function(){function u(p){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=p;var l=p.config;this.bwEstimator=new N.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var o=u.prototype;return o.registerListeners=function(){var l=this.hls;l.on(M.Events.FRAG_LOADING,this.onFragLoading,this),l.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(M.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var l=this.hls;l.off(M.Events.FRAG_LOADING,this.onFragLoading,this),l.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(M.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},o.onFragLoading=function(l,h){var s=h.frag;if(s.type===i.PlaylistLevelType.MAIN&&!this.timer){var a;this.fragCurrent=s,this.partCurrent=(a=h.part)!=null?a:null,this.timer=self.setInterval(this.onCheck,100)}},o.onLevelLoaded=function(l,h){var s=this.hls.config;h.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},o._abandonRulesCheck=function(){var l=this.fragCurrent,h=this.partCurrent,s=this.hls,a=s.autoLevelEnabled,C=s.config,_=s.media;if(!l||!_)return;var T=h?h.stats:l.stats,O=h?h.duration:l.duration;if(T.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!a||_.paused||!_.playbackRate||!_.readyState)return;var R=performance.now()-T.loading.start,S=Math.abs(_.playbackRate);if(R<=500*O/S)return;var w=s.levels,E=s.minAutoLevel,f=w[l.level],x=T.total||Math.max(T.loaded,Math.round(O*f.maxBitrate/8)),v=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/R),y=(x-T.loaded)/v,U=_.currentTime,B=(W.BufferHelper.bufferInfo(_,U,C.maxBufferHole).end-U)/S;if(B>=2*O/S||y<=B)return;var A=Number.POSITIVE_INFINITY,j;for(j=l.level-1;j>E;j--){var P=w[j].maxBitrate;if(A=O*P/(8*.8*v),A<B)break}if(A>=y)return;var b=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+l.sn+(h?" part "+h.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(b)?(b/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+A.toFixed(3)+` s
|
|
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=j,this.bwEstimator.sample(R,T.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:h,stats:T})},o.onFragLoaded=function(l,h){var s=h.frag,a=h.part;if(s.type===i.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(s.sn)){var C=a?a.stats:s.stats,_=a?a.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[s.level],O=(T.loaded?T.loaded.bytes:0)+C.loaded,R=(T.loaded?T.loaded.duration:0)+_;T.loaded={bytes:O,duration:R},T.realBitrate=Math.round(8*O/R)}if(s.bitrateTest){var S={stats:C,frag:s,part:a,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,S),s.bitrateTest=!1}}},o.onFragBuffered=function(l,h){var s=h.frag,a=h.part,C=a?a.stats:s.stats;if(C.aborted)return;if(s.type!==i.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var _=C.parsing.end-C.loading.start;this.bwEstimator.sample(_,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=_/1e3:this.bitrateTestDelay=0},o.onError=function(l,h){switch(h.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},o.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},o.getNextABRAutoLevel=function(){var l=this.fragCurrent,h=this.partCurrent,s=this.hls,a=s.maxAutoLevel,C=s.config,_=s.minAutoLevel,T=s.media,O=h?h.duration:l?l.duration:0,R=T?T.currentTime:0,S=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,w=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,E=(W.BufferHelper.bufferInfo(T,R,C.maxBufferHole).end-R)/S,f=this.findBestLevel(w,_,a,E,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(f>=0)return f;L.logger.trace((E?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=O?Math.min(O,C.maxStarvationDelay):C.maxStarvationDelay,v=C.abrBandWidthFactor,y=C.abrBandWidthUpFactor;if(!E){var U=this.bitrateTestDelay;if(U){var B=O?Math.min(O,C.maxLoadingDelay):C.maxLoadingDelay;x=B-U,L.logger.trace("bitrate test took "+Math.round(1e3*U)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),v=y=1}}return f=this.findBestLevel(w,_,a,E+x,v,y),Math.max(f,0)},o.findBestLevel=function(l,h,s,a,C,_){for(var T,O=this.fragCurrent,R=this.partCurrent,S=this.lastLoadedFragLevel,w=this.hls.levels,E=w[S],f=!!(E!=null&&(T=E.details)!==null&&T!==void 0&&T.live),x=E==null?void 0:E.codecSet,v=R?R.duration:O?O.duration:0,y=s;y>=h;y--){var U=w[y];if(!U||x&&U.codecSet!==x)continue;var B=U.details,A=(R?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||v,j=void 0;y<=S?j=C*l:j=_*l;var P=w[y].maxBitrate,b=P*A/j;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(j)+"/"+P+"/"+A+"/"+a+"/"+b),j>P&&(!b||f&&!this.bitrateTestDelay||b<a))return y}return-1},c(u,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,h=this.bwEstimator;if(l!==-1&&(!h||!h.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),u}();Y.default=m},"./src/controller/audio-stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/polyfills/number.ts"),N=D("./src/controller/base-stream-controller.ts"),M=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),H=D("./src/controller/fragment-tracker.ts"),i=D("./src/types/level.ts"),L=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),c=D("./src/demux/chunk-cache.ts"),m=D("./src/demux/transmuxer-interface.ts"),u=D("./src/types/transmuxer.ts"),o=D("./src/controller/fragment-finders.ts"),p=D("./src/utils/discontinuities.ts"),l=D("./src/errors.ts"),h=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(O){for(var R=1;R<arguments.length;R++){var S=arguments[R];for(var w in S)Object.prototype.hasOwnProperty.call(S,w)&&(O[w]=S[w])}return O},s.apply(this,arguments)}function a(O,R){O.prototype=Object.create(R.prototype),O.prototype.constructor=O,C(O,R)}function C(O,R){return C=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},C(O,R)}var _=100,T=function(O){a(R,O);function R(w,E){var f;return f=O.call(this,w,E,"[audio-stream-controller]")||this,f.videoBuffer=null,f.videoTrackCC=-1,f.waitingVideoCC=-1,f.audioSwitch=!1,f.trackId=-1,f.waitingData=null,f.mainDetails=null,f.bufferFlushed=!1,f._registerListeners(),f}var S=R.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var E=this.hls;E.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),E.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),E.on(M.Events.ERROR,this.onError,this),E.on(M.Events.BUFFER_RESET,this.onBufferReset,this),E.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),E.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var E=this.hls;E.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),E.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),E.off(M.Events.ERROR,this.onError,this),E.off(M.Events.BUFFER_RESET,this.onBufferReset,this),E.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),E.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onInitPtsFound=function(E,f){var x=f.frag,v=f.id,y=f.initPTS;if(v==="main"){var U=x.cc;this.initPTS[x.cc]=y,this.log("InitPTS for cc: "+U+" found from main: "+y),this.videoTrackCC=U,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},S.startLoad=function(E){if(!this.levels){this.startPosition=E,this.state=N.State.STOPPED;return}var f=this.lastCurrentTime;this.stopLoad(),this.setInterval(_),this.fragLoadError=0,f>0&&E===-1?(this.log("Override startPosition with lastCurrentTime @"+f.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()},S.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var E,f=this.levels,x=this.trackId,v=f==null||((E=f[x])===null||E===void 0)?void 0:E.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var y,U=performance.now(),B=this.retryDate;(!B||U>=B||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var A=this.waitingData;if(A){var j=A.frag,P=A.part,b=A.cache,V=A.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var ne=b.flush(),ce={frag:j,part:P,payload:ne,networkDetails:null};this._handleFragmentLoadProgress(ce),V&&O.prototype._handleFragmentLoadComplete.call(this,ce)}else if(this.videoTrackCC!==this.waitingVideoCC)h.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var me=this.getLoadPosition(),Ie=W.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),we=Object(o.fragmentWithinToleranceTest)(Ie.end,this.config.maxFragLookUpTolerance,j);we<0&&(h.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+Ie.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},S.clearWaitingFragment=function(){var E=this.waitingData;E&&(this.fragmentTracker.removeFragment(E.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},S.onTickEnd=function(){var E=this.media;if(!E||!E.readyState)return;var f=this.mediaBuffer?this.mediaBuffer:E,x=f.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=E.currentTime},S.doTickIdle=function(){var E,f,x=this.hls,v=this.levels,y=this.media,U=this.trackId,B=x.config;if(!v||!v[U])return;if(!y&&(this.startFragRequested||!B.startFragPrefetch))return;var A=v[U],j=A.details;if(!j||j.live&&this.levelLastLoaded!==U||this.waitForCdnTuneIn(j)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(P===null)return;var b=P.len,V=this.getMaxBufferLength(),ne=this.audioSwitch;if(b>=V&&!ne)return;if(!ne&&this._streamEnded(P,j)){x.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var ce=j.fragments,me=ce[0].start,Ie=P.end;if(ne){var we=this.getLoadPosition();Ie=we,j.PTSKnown&&we<me&&((P.end>me||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=me+.05))}var Le=this.getNextFragment(Ie,j);if(!Le){this.bufferFlushed=!0;return}((E=Le.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((f=Le.decryptdata)!==null&&f!==void 0&&f.key)?this.loadKey(Le,j):this.loadFragment(Le,j,Ie)},S.getMaxBufferLength=function(){var E=O.prototype.getMaxBufferLength.call(this),f=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return f===null?E:Math.max(E,f.len)},S.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},S.onAudioTracksUpdated=function(E,f){var x=f.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(v){return new i.Level(v)})},S.onAudioTrackSwitching=function(E,f){var x=!!f.url;this.trackId=f.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(_):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},S.onLevelLoaded=function(E,f){this.mainDetails=f.details},S.onAudioTrackLoaded=function(E,f){var x,v=this.levels,y=f.details,U=f.id;if(!v){this.warn("Audio tracks were reset while loading level "+U);return}this.log("Track "+U+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var B=v[U],A=0;if(y.live||(x=B.details)!==null&&x!==void 0&&x.live){var j=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!j)return;!B.details&&y.hasProgramDateTime&&j.hasProgramDateTime?(Object(p.alignMediaPlaylistByPDT)(y,j),A=y.fragments[0].start):A=this.alignPlaylists(y,B.details)}B.details=y,this.levelLastLoaded=U,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(B.details,A),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=N.State.IDLE),this.tick()},S._handleFragmentLoadProgress=function(E){var f,x=E.frag,v=E.part,y=E.payload,U=this.config,B=this.trackId,A=this.levels;if(!A){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var j=A[B];console.assert(j,"Audio track is defined on fragment load progress");var P=j.details;console.assert(P,"Audio track details are defined on fragment load progress");var b=U.defaultAudioCodec||j.audioCodec||"mp4a.40.2",V=this.transmuxer;V||(V=this.transmuxer=new m.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ne=this.initPTS[x.cc],ce=(f=x.initSegment)===null||f===void 0?void 0:f.data;if(ne!==void 0){var me=!1,Ie=v?v.index:-1,we=Ie!==-1,Le=new u.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,y.byteLength,Ie,we);V.push(y,ce,b,"",x,v,P.totalduration,me,Le,ne)}else{h.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+B);var Re=this.waitingData=this.waitingData||{frag:x,part:v,cache:new c.default,complete:!1},De=Re.cache;De.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},S._handleFragmentLoadComplete=function(E){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,E)},S.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},S.onBufferCreated=function(E,f){var x=f.tracks.audio;x&&(this.mediaBuffer=x.buffer),f.tracks.video&&(this.videoBuffer=f.tracks.video.buffer)},S.onFragBuffered=function(E,f){var x=f.frag,v=f.part;if(x.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(v?" p: "+v.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,v)},S.onError=function(E,f){switch(f.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,f);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=f.fatal?N.State.ERROR:N.State.IDLE,this.warn(f.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(f.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var x=!0,v=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);v&&v.len>.5&&(x=!this.reduceMaxBufferLength(v.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},S.onBufferFlushed=function(E,f){var x=f.type;x===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},S._handleTransmuxComplete=function(E){var f,x="audio",v=this.hls,y=E.remuxResult,U=E.chunkMeta,B=this.getCurrentContext(U);if(!B){this.warn("The loading context changed while buffering fragment "+U.sn+" of level "+U.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(U.level);return}var A=B.frag,j=B.part,P=y.audio,b=y.text,V=y.id3,ne=y.initSegment;if(this.fragContextChanged(A))return;if(this.state=N.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),ne!=null&&ne.tracks&&(this._bufferInitSegment(ne.tracks,A,U),v.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:A,id:x,tracks:ne.tracks})),P){var ce=P.startPTS,me=P.endPTS,Ie=P.startDTS,we=P.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ce,endPTS:me,startDTS:Ie,endDTS:we}),A.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ce,me,Ie,we),this.bufferFragmentData(P,A,j,U)}if(V!=null&&(f=V.samples)!==null&&f!==void 0&&f.length){var Le=s({frag:A,id:x},V);v.trigger(M.Events.FRAG_PARSING_METADATA,Le)}if(b){var Re=s({frag:A,id:x},b);v.trigger(M.Events.FRAG_PARSING_USERDATA,Re)}},S._bufferInitSegment=function(E,f,x){if(this.state!==N.State.PARSING)return;E.video&&delete E.video;var v=E.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,E);var y=v.initSegment;if(y!=null&&y.byteLength){var U={type:"audio",frag:f,part:null,chunkMeta:x,parent:f.type,data:y};this.hls.trigger(M.Events.BUFFER_APPENDING,U)}this.tick()},S.loadFragment=function(E,f,x){var v=this.fragmentTracker.getState(E);this.fragCurrent=E,(this.audioSwitch||v===H.FragmentState.NOT_LOADED||v===H.FragmentState.PARTIAL)&&(E.sn==="initSegment"?this._loadInitSegment(E):f.live&&!Object(z.isFiniteNumber)(this.initPTS[E.cc])?(this.log("Waiting for video PTS in continuity counter "+E.cc+" of live stream before loading audio fragment "+E.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,E,f,x)))},S.completeAudioSwitch=function(){var E=this.hls,f=this.media,x=this.trackId;f&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,E.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:x})},R}(N.default);Y.default=T},"./src/controller/audio-track-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function H(m,u){for(var o=0;o<u.length;o++){var p=u[o];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(m,p.key,p)}}function i(m,u,o){return u&&H(m.prototype,u),o&&H(m,o),m}function L(m,u){m.prototype=Object.create(u.prototype),m.prototype.constructor=m,g(m,u)}function g(m,u){return g=Object.setPrototypeOf||function(p,l){return p.__proto__=l,p},g(m,u)}var c=function(m){L(u,m);function u(p){var l;return l=m.call(this,p,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var o=u.prototype;return o.registerListeners=function(){var l=this.hls;l.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(z.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var l=this.hls;l.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(z.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,m.prototype.destroy.call(this)},o.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},o.onManifestParsed=function(l,h){this.tracks=h.audioTracks||[]},o.onAudioTrackLoaded=function(l,h){var s=h.id,a=h.details,C=this.tracksInGroup[s];if(!C){this.warn("Invalid audio track id "+s);return}var _=C.details;C.details=h.details,this.log("audioTrack "+s+" loaded ["+a.startSN+"-"+a.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,h,_))},o.onLevelLoading=function(l,h){this.switchLevel(h.level)},o.onLevelSwitching=function(l,h){this.switchLevel(h.level)},o.switchLevel=function(l){var h=this.hls.levels[l];if(!(h!=null&&h.audioGroupIds))return;var s=h.audioGroupIds[h.urlId];if(this.groupId!==s){this.groupId=s;var a=this.tracks.filter(function(_){return!s||_.groupId===s});this.selectDefaultTrack&&!a.some(function(_){return _.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=a;var C={audioTracks:a};this.log("Updating audio tracks, "+a.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},o.onError=function(l,h){if(m.prototype.onError.call(this,l,h),h.fatal||!h.context)return;h.context.type===W.PlaylistContextType.AUDIO_TRACK&&h.context.id===this.trackId&&h.context.groupId===this.groupId&&this.retryLoadingOrFail(h)},o.setAudioTrack=function(l){var h=this.tracksInGroup;if(l<0||l>=h.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=h[this.trackId];this.log("Now switching to audio-track index "+l);var a=h[l],C=a.id,_=a.groupId,T=_===void 0?"":_,O=a.name,R=a.type,S=a.url;if(this.trackId=l,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:T,name:O,type:R,url:S}),a.details&&!a.details.live)return;var w=this.switchParams(a.url,s==null?void 0:s.details);this.loadPlaylist(w)},o.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var h=this.trackName,s=this.findTrackId(h)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},o.findTrackId=function(l){for(var h=this.tracksInGroup,s=0;s<h.length;s++){var a=h[s];if((!this.selectDefaultTrack||a.default)&&(!l||l===a.name))return a.id}return-1},o.loadPlaylist=function(l){var h=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(h)){var s=h.id,a=h.groupId,C=h.url;if(l)try{C=l.addDirectives(C)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:C,id:s,groupId:a,deliveryDirectives:l||null})}},i(u,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),u}(M.default);Y.default=c},"./src/controller/base-playlist-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return i});var z=D("./src/polyfills/number.ts"),N=D("./src/types/level.ts"),M=D("./src/controller/level-helper.ts"),W=D("./src/utils/logger.ts"),H=D("./src/errors.ts"),i=function(){function L(c,m){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,m+":"),this.warn=W.logger.warn.bind(W.logger,m+":"),this.hls=c}var g=L.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(m,u){u.fatal&&u.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(m,u){var o=u==null?void 0:u.renditionReports;if(o)for(var p=0;p<o.length;p++){var l=o[p],h=""+l.URI;if(h===m.substr(-h.length)){var s=parseInt(l["LAST-MSN"]),a=parseInt(l["LAST-PART"]);if(u&&this.hls.config.lowLatencyMode){var C=Math.min(u.age-u.partTarget,u.targetduration);a!==void 0&&C>u.partTarget&&(a+=1)}if(Object(z.isFiniteNumber)(s))return new N.HlsUrlParameters(s,Object(z.isFiniteNumber)(a)?a:void 0,N.HlsSkip.No)}}},g.loadPlaylist=function(m){},g.shouldLoadTrack=function(m){return this.canLoad&&m&&!!m.url&&(!m.details||m.details.live)},g.playlistLoaded=function(m,u,o){var p=this,l=u.details,h=u.stats,s=h.loading.end?Math.max(0,self.performance.now()-h.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||o!=null&&o.live){if(l.reloaded(o),o&&this.log("live playlist "+m+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),o&&l.fragments.length>0&&Object(M.mergeDetails)(o,l),!this.canLoad||!l.live)return;var a,C=void 0,_=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var T=this.hls.config.lowLatencyMode,O=l.lastPartSn,R=l.endSN,S=l.lastPartIndex,w=S!==-1,E=O===R,f=T?0:S;w?(C=E?R+1:O,_=E?f:S+1):C=R+1;var x=l.age,v=x+l.ageHeader,y=Math.min(v-l.partTarget,l.targetduration*1.5);if(y>0){if(o&&y>o.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+o.tuneInGoal+" to: "+y+" with playlist age: "+l.age),y=0;else{var U=Math.floor(y/l.targetduration);if(C+=U,_!==void 0){var B=Math.round(y%l.targetduration/l.partTarget);_+=B}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+y+" skip sn "+U+" to part "+_)}l.tuneInGoal=y}if(a=this.getDeliveryDirectives(l,u.deliveryDirectives,C,_),T||!E){this.loadPlaylist(a);return}}else a=this.getDeliveryDirectives(l,u.deliveryDirectives,C,_);var A=Object(M.computeReloadInterval)(l,h);C!==void 0&&l.canBlockReload&&(A-=l.partTarget||1),this.log("reload live playlist "+m+" in "+Math.round(A)+" ms"),this.timer=self.setTimeout(function(){return p.loadPlaylist(a)},A)}else this.clearTimer()},g.getDeliveryDirectives=function(m,u,o,p){var l=Object(N.getSkipValue)(m,o);return u!=null&&u.skip&&m.deltaUpdateFailed&&(o=u.msn,p=u.part,l=N.HlsSkip.No),new N.HlsUrlParameters(o,p,l)},g.retryLoadingOrFail=function(m){var u=this,o=this.hls.config,p=this.retryCount<o.levelLoadingMaxRetry;if(p){var l;if(this.retryCount++,m.details.indexOf("LoadTimeOut")>-1&&(l=m.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+m.details+'"'),this.loadPlaylist();else{var h=Math.min(Math.pow(2,this.retryCount)*o.levelLoadingRetryDelay,o.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return u.loadPlaylist()},h),this.warn("retry playlist loading #"+this.retryCount+" in "+h+' ms after "'+m.details+'"')}}else this.warn('cannot recover from error "'+m.details+'"'),this.clearTimer(),m.fatal=!0;return p},L}()},"./src/controller/base-stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"State",function(){return R}),D.d(Y,"default",function(){return S});var z=D("./src/polyfills/number.ts"),N=D("./src/task-loop.ts"),M=D("./src/controller/fragment-tracker.ts"),W=D("./src/utils/buffer-helper.ts"),H=D("./src/utils/logger.ts"),i=D("./src/events.ts"),L=D("./src/errors.ts"),g=D("./src/types/transmuxer.ts"),c=D("./src/utils/mp4-tools.ts"),m=D("./src/utils/discontinuities.ts"),u=D("./src/controller/fragment-finders.ts"),o=D("./src/controller/level-helper.ts"),p=D("./src/loader/fragment-loader.ts"),l=D("./src/crypt/decrypter.ts"),h=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function a(w,E){for(var f=0;f<E.length;f++){var x=E[f];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(w,x.key,x)}}function C(w,E,f){return E&&a(w.prototype,E),f&&a(w,f),w}function _(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function T(w,E){w.prototype=Object.create(E.prototype),w.prototype.constructor=w,O(w,E)}function O(w,E){return O=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},O(w,E)}var R={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"},S=function(w){T(E,w);function E(x,v,y){var U;return U=w.call(this)||this,U.hls=void 0,U.fragPrevious=null,U.fragCurrent=null,U.fragmentTracker=void 0,U.transmuxer=null,U._state=R.STOPPED,U.media=void 0,U.mediaBuffer=void 0,U.config=void 0,U.bitrateTest=!1,U.lastCurrentTime=0,U.nextLoadPosition=0,U.startPosition=0,U.loadedmetadata=!1,U.fragLoadError=0,U.retryDate=0,U.levels=null,U.fragmentLoader=void 0,U.levelLastLoaded=null,U.startFragRequested=!1,U.decrypter=void 0,U.initPTS=[],U.onvseeking=null,U.onvended=null,U.logPrefix="",U.log=void 0,U.warn=void 0,U.logPrefix=y,U.log=H.logger.log.bind(H.logger,y+":"),U.warn=H.logger.warn.bind(H.logger,y+":"),U.hls=x,U.fragmentLoader=new p.default(x.config),U.fragmentTracker=v,U.config=x.config,U.decrypter=new l.default(x,x.config),x.on(i.Events.KEY_LOADED,U.onKeyLoaded,_(U)),U}var f=E.prototype;return f.doTick=function(){this.onTickEnd()},f.onTickEnd=function(){},f.startLoad=function(v){},f.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=R.STOPPED},f._streamEnded=function(v,y){var U=this.fragCurrent,B=this.fragmentTracker;if(!y.live&&U&&U.sn===y.endSN&&!v.nextStart){var A=B.getState(U);return A===M.FragmentState.PARTIAL||A===M.FragmentState.OK}return!1},f.onMediaAttached=function(v,y){var U=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),U.addEventListener("seeking",this.onvseeking),U.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===R.STOPPED&&this.startLoad(B.startPosition)},f.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},f.onMediaSeeking=function(){var v=this.config,y=this.fragCurrent,U=this.media,B=this.mediaBuffer,A=this.state,j=U?U.currentTime:0,P=W.BufferHelper.bufferInfo(B||U,j,v.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+A),A===R.ENDED)this.resetLoadingState();else if(y&&!P.len){var b=v.maxFragLookUpTolerance,V=y.start-b,ne=y.start+y.duration+b,ce=j>ne;(j<V||ce)&&(ce&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}U&&(this.lastCurrentTime=j),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},f.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},f.onKeyLoaded=function(v,y){if(this.state!==R.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=R.IDLE;var U=this.levels[y.frag.level].details;U&&this.loadFragment(y.frag,U,y.frag.start)},f.onHandlerDestroying=function(){this.stopLoad(),w.prototype.onHandlerDestroying.call(this)},f.onHandlerDestroyed=function(){this.state=R.STOPPED,this.hls.off(i.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,w.prototype.onHandlerDestroyed.call(this)},f.loadKey=function(v,y){this.log("Loading key for "+v.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=R.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(i.Events.KEY_LOADING,{frag:v})},f.loadFragment=function(v,y,U){this._loadFragForPlayback(v,y,U)},f._loadFragForPlayback=function(v,y,U){var B=this,A=function(P){if(B.fragContextChanged(v)){B.warn("Fragment "+v.sn+(P.part?" p: "+P.part.index:"")+" of level "+v.level+" was dropped during download."),B.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,B._handleFragmentLoadProgress(P)};this._doFragLoad(v,y,U,A).then(function(j){if(!j)return;B.fragLoadError=0;var P=B.state;if(B.fragContextChanged(v)){(P===R.FRAG_LOADING||P===R.BACKTRACKING||!B.fragCurrent&&P===R.PARSING)&&(B.fragmentTracker.removeFragment(v),B.state=R.IDLE);return}if("payload"in j&&(B.log("Loaded fragment "+v.sn+" of level "+v.level),B.hls.trigger(i.Events.FRAG_LOADED,j),B.state===R.BACKTRACKING)){B.fragmentTracker.backtrack(v,j),B.resetFragmentLoading(v);return}B._handleFragmentLoadComplete(j)}).catch(function(j){B.warn(j),B.resetFragmentLoading(v)})},f.flushMainBuffer=function(v,y,U){if(U===void 0&&(U=null),!(v-y))return;var B={startOffset:v,endOffset:y,type:U};this.fragLoadError=0,this.hls.trigger(i.Events.BUFFER_FLUSHING,B)},f._loadInitSegment=function(v){var y=this;this._doFragLoad(v).then(function(U){if(!U||y.fragContextChanged(v)||!y.levels)throw new Error("init load aborted");return U}).then(function(U){var B=y.hls,A=U.payload,j=v.decryptdata;if(A&&A.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var P=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(A),j.key.buffer,j.iv.buffer).then(function(b){var V=self.performance.now();return B.trigger(i.Events.FRAG_DECRYPTED,{frag:v,payload:b,stats:{tstart:P,tdecrypt:V}}),U.payload=b,U})}return U}).then(function(U){var B=y.fragCurrent,A=y.hls,j=y.levels;if(!j)throw new Error("init load aborted, missing levels");var P=j[v.level].details;console.assert(P,"Level details are defined when init segment is loaded");var b=v.stats;y.state=R.IDLE,y.fragLoadError=0,v.data=new Uint8Array(U.payload),b.parsing.start=b.buffering.start=self.performance.now(),b.parsing.end=b.buffering.end=self.performance.now(),U.frag===B&&A.trigger(i.Events.FRAG_BUFFERED,{stats:b,frag:B,part:null,id:v.type}),y.tick()}).catch(function(U){y.warn(U),y.resetFragmentLoading(v)})},f.fragContextChanged=function(v){var y=this.fragCurrent;return!v||!y||v.level!==y.level||v.sn!==y.sn||v.urlId!==y.urlId},f.fragBufferedComplete=function(v,y){var U=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+h.default.toString(W.BufferHelper.getBuffered(U))),this.state=R.IDLE,this.tick()},f._handleFragmentLoadComplete=function(v){var y=this.transmuxer;if(!y)return;var U=v.frag,B=v.part,A=v.partsLoaded,j=!A||A.length===0||A.some(function(b){return!b}),P=new g.ChunkMetadata(U.level,U.sn,U.stats.chunkCount+1,0,B?B.index:-1,!j);y.flush(P)},f._handleFragmentLoadProgress=function(v){},f._doFragLoad=function(v,y,U,B){var A=this;if(U===void 0&&(U=null),!this.levels)throw new Error("frag load aborted, missing levels");if(U=Math.max(v.start,U||0),this.config.lowLatencyMode&&y){var j=y.partList;if(j&&B){U>v.end&&y.fragmentHint&&(v=y.fragmentHint);var P=this.getNextPart(j,v,U);if(P>-1){var b=j[P];return this.log("Loading part sn: "+v.sn+" p: "+b.index+" cc: "+v.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+P+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(U.toFixed(3))),this.nextLoadPosition=b.start+b.duration,this.state=R.FRAG_LOADING,this.hls.trigger(i.Events.FRAG_LOADING,{frag:v,part:j[P],targetBufferTime:U}),this.doFragPartsLoad(v,j,P,B).catch(function(V){return A.handleFragLoadError(V)})}else if(!v.url||this.loadedEndOfParts(j,U))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(U.toFixed(3))),Object(z.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=R.FRAG_LOADING,this.hls.trigger(i.Events.FRAG_LOADING,{frag:v,targetBufferTime:U}),this.fragmentLoader.load(v,B).catch(function(V){return A.handleFragLoadError(V)})},f.doFragPartsLoad=function(v,y,U,B){var A=this;return new Promise(function(j,P){var b=[],V=function ne(ce){var me=y[ce];A.fragmentLoader.loadPart(v,me,B).then(function(Ie){b[me.index]=Ie;var we=Ie.part;A.hls.trigger(i.Events.FRAG_LOADED,Ie);var Le=y[ce+1];if(Le&&Le.fragment===v)ne(ce+1);else return j({frag:v,part:we,partsLoaded:b})}).catch(P)};V(U)})},f.handleFragLoadError=function(v){var y=v.data;return y&&y.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(i.Events.ERROR,y),null},f._handleTransmuxerFlush=function(v){var y=this.getCurrentContext(v);if(!y||this.state!==R.PARSING){this.fragCurrent||(this.state=R.IDLE);return}var U=y.frag,B=y.part,A=y.level,j=self.performance.now();U.stats.parsing.end=j,B&&(B.stats.parsing.end=j),this.updateLevelTiming(U,B,A,v.partial)},f.getCurrentContext=function(v){var y=this.levels,U=v.level,B=v.sn,A=v.part;if(!y||!y[U])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+U+". The current chunk will not be buffered."),null;var j=y[U],P=A>-1?Object(o.getPartWith)(j,B,A):null,b=P?P.fragment:Object(o.getFragmentWithSN)(j,B,this.fragCurrent);return b?{frag:b,part:P,level:j}:null},f.bufferFragmentData=function(v,y,U,B){if(!v||this.state!==R.PARSING)return;var A=v.data1,j=v.data2,P=A;if(A&&j&&(P=Object(c.appendUint8Array)(A,j)),!P||!P.length)return;var b={type:v.type,frag:y,part:U,chunkMeta:B,parent:y.type,data:P};this.hls.trigger(i.Events.BUFFER_APPENDING,b),v.dropped&&v.independent&&!U&&this.flushBufferGap(y)},f.flushBufferGap=function(v){var y=this.media;if(!y)return;if(!W.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,v.start);return}var U=y.currentTime,B=W.BufferHelper.bufferInfo(y,U,0),A=v.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,A*.25),P=Math.max(Math.min(v.start-j,B.end-j),U+j);v.start-P>j&&this.flushMainBuffer(P,v.start)},f.getFwdBufferInfo=function(v,y){var U=this.config,B=this.getLoadPosition();if(!Object(z.isFiniteNumber)(B))return null;var A=W.BufferHelper.bufferInfo(v,B,U.maxBufferHole);if(A.len===0&&A.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(B,y);if(j&&A.nextStart<j.end)return W.BufferHelper.bufferInfo(v,B,Math.max(A.nextStart,U.maxBufferHole))}return A},f.getMaxBufferLength=function(v){var y=this.config,U;return v?U=Math.max(8*y.maxBufferSize/v,y.maxBufferLength):U=y.maxBufferLength,Math.min(U,y.maxMaxBufferLength)},f.reduceMaxBufferLength=function(v){var y=this.config,U=v||y.maxBufferLength;return y.maxMaxBufferLength>=U?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},f.getNextFragment=function(v,y){var U,B,A=y.fragments,j=A.length;if(!j)return null;var P=this.config,b=A[0].start,V;if(y.live){var ne=P.initialLiveManifestSize;if(j<ne)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+ne+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(V=this.getInitialLiveFragment(y,A),this.startPosition=V?this.hls.liveSyncPosition||V.start:v)}else v<=b&&(V=A[0]);if(!V){var ce=P.lowLatencyMode?y.partEnd:y.fragmentEnd;V=this.getFragmentAtPosition(v,ce,y)}return(U=V)!==null&&U!==void 0&&U.initSegment&&!((B=V)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(V=V.initSegment),V},f.getNextPart=function(v,y,U){for(var B=-1,A=!1,j=!0,P=0,b=v.length;P<b;P++){var V=v[P];if(j=j&&!V.independent,B>-1&&U<V.start)break;var ne=V.loaded;!ne&&(A||V.independent||j)&&V.fragment===y&&(B=P),A=ne}return B},f.loadedEndOfParts=function(v,y){var U=v[v.length-1];return U&&y>U.start&&U.loaded},f.getInitialLiveFragment=function(v,y){var U=this.fragPrevious,B=null;if(U){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+U.programDateTime),B=Object(u.findFragmentByPDT)(y,U.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var A=U.sn+1;if(A>=v.startSN&&A<=v.endSN){var j=y[A-v.startSN];U.cc===j.cc&&(B=j,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(u.findFragWithCC)(y,U.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(B=this.getFragmentAtPosition(P,this.bitrateTest?v.fragmentEnd:v.edge,v))}return B},f.getFragmentAtPosition=function(v,y,U){var B=this.config,A=this.fragPrevious,j=U.fragments,P=U.endSN,b=U.fragmentHint,V=B.maxFragLookUpTolerance,ne=!!(B.lowLatencyMode&&U.partList&&b);ne&&b&&!this.bitrateTest&&(j=j.concat(b),P=b.sn);var ce;if(v<y){var me=v>y-V?0:V;ce=Object(u.findFragmentByPTS)(A,j,v,me)}else ce=j[j.length-1];if(ce){var Ie=ce.sn-U.startSN,we=A&&ce.level===A.level,Le=j[Ie+1],Re=this.fragmentTracker.getState(ce);if(Re===M.FragmentState.BACKTRACKED){ce=null;for(var De=Ie;j[De]&&this.fragmentTracker.getState(j[De])===M.FragmentState.BACKTRACKED;)A?ce=j[De--]:ce=j[--De];ce||(ce=Le)}else A&&ce.sn===A.sn&&!ne&&(we&&(ce.sn<P&&this.fragmentTracker.getState(Le)!==M.FragmentState.OK?(this.log("SN "+ce.sn+" just loaded, load next one: "+Le.sn),ce=Le):ce=null))}return ce},f.synchronizeToLiveEdge=function(v){var y=this.config,U=this.media;if(!U)return;var B=this.hls.liveSyncPosition,A=U.currentTime,j=v.fragments[0].start,P=v.edge,b=A>=j-y.maxFragLookUpTolerance&&A<=P;if(B!==null&&U.duration>B&&(A<B||!b)){var V=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*v.targetduration;(!b&&U.readyState<4||A<P-V)&&(this.loadedmetadata||(this.nextLoadPosition=B),U.readyState&&(this.warn("Playback: "+A.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+B.toFixed(3)),U.currentTime=B))}},f.alignPlaylists=function(v,y){var U=this.levels,B=this.levelLastLoaded,A=this.fragPrevious,j=B!==null?U[B]:null,P=v.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var b=v.fragments[0].start,V=!y,ne=v.alignedSliding&&Object(z.isFiniteNumber)(b);if(V||!ne&&!b){Object(m.alignStream)(A,j,v);var ce=v.fragments[0].start;return this.log("Live playlist sliding: "+ce.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+v.startSN+" prev-sn: "+(A?A.sn:"na")+" fragments: "+P),ce}return b},f.waitForCdnTuneIn=function(v){var y=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*y)},f.setStartPosition=function(v,y){var U=this.startPosition;if(U<y&&(U=-1),U===-1||this.lastCurrentTime===-1){var B=v.startTimeOffset;Object(z.isFiniteNumber)(B)?(U=y+B,B<0&&(U+=v.totalduration),U=Math.min(Math.max(y,U),y+v.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+U),this.startPosition=U):v.live?U=this.hls.liveSyncPosition||y:this.startPosition=U=0,this.lastCurrentTime=U}this.nextLoadPosition=U},f.getLoadPosition=function(){var v=this.media,y=0;return this.loadedmetadata&&v?y=v.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},f.handleFragLoadAborted=function(v,y){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(y?" part"+y.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},f.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=R.IDLE)},f.onFragmentOrKeyLoadError=function(v,y){if(y.fatal)return;var U=y.frag;if(!U||U.type!==v)return;var B=this.fragCurrent;console.assert(B&&U.sn===B.sn&&U.level===B.level&&U.urlId===B.urlId,"Frag load error must match current frag to retry");var A=this.config;if(this.fragLoadError+1<=A.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(U.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*A.fragLoadingRetryDelay,A.fragLoadingMaxRetryTimeout);this.warn("Fragment "+U.sn+" of "+v+" "+U.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=R.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(v===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=R.IDLE):(H.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=R.ERROR)},f.afterBufferFlushed=function(v,y,U){if(!v)return;var B=W.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(y,B,U),this.state===R.ENDED&&this.resetLoadingState()},f.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=R.IDLE},f.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[v].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},f.updateLevelTiming=function(v,y,U,B){var A=this,j=U.details;console.assert(!!j,"level.details must be defined");var P=Object.keys(v.elementaryStreams).reduce(function(b,V){var ne=v.elementaryStreams[V];if(ne){var ce=ne.endPTS-ne.startPTS;if(ce<=0)return A.warn("Could not parse fragment "+v.sn+" "+V+" duration reliably ("+ce+") resetting transmuxer to fallback to playlist timing"),A.resetTransmuxer(),b||!1;var me=B?0:Object(o.updateFragPTSDTS)(j,v,ne.startPTS,ne.endPTS,ne.startDTS,ne.endDTS);return A.hls.trigger(i.Events.LEVEL_PTS_UPDATED,{details:j,level:U,drift:me,type:V,frag:v,start:ne.startPTS,end:ne.endPTS}),!0}return b},!1);P?(this.state=R.PARSED,this.hls.trigger(i.Events.FRAG_PARSED,{frag:v,part:y})):this.resetLoadingState()},f.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(E,[{key:"state",get:function(){return this._state},set:function(v){var y=this._state;y!==v&&(this._state=v,this.log(y+"->"+v))}}]),E}(N.default)},"./src/controller/buffer-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return u});var z=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),M=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),H=D("./src/utils/buffer-helper.ts"),i=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),g=D("./src/controller/buffer-operation-queue.ts"),c=Object(i.getMediaSource)(),m=/([ha]vc.)(?:\.[^.,]+)+/,u=function(){function o(l){var h=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=h.hls,a=h.media,C=h.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),a&&(h.updateMediaElementDuration(),s.trigger(N.Events.MEDIA_ATTACHED,{media:a})),C&&C.removeEventListener("sourceopen",h._onMediaSourceOpen),h.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=l,this._initSourceBuffer(),this.registerListeners()}var p=o.prototype;return p.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},p.destroy=function(){this.unregisterListeners(),this.details=null},p.registerListeners=function(){var h=this.hls;h.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(N.Events.BUFFER_RESET,this.onBufferReset,this),h.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),h.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.on(N.Events.BUFFER_EOS,this.onBufferEos,this),h.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),h.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),h.on(N.Events.FRAG_PARSED,this.onFragParsed,this),h.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},p.unregisterListeners=function(){var h=this.hls;h.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(N.Events.BUFFER_RESET,this.onBufferReset,this),h.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),h.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.off(N.Events.BUFFER_EOS,this.onBufferEos,this),h.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),h.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),h.off(N.Events.FRAG_PARSED,this.onFragParsed,this),h.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},p._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},p.onManifestParsed=function(h,s){var a=2;(s.audio&&!s.video||!s.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},p.onMediaAttaching=function(h,s){var a=this.media=s.media;if(a&&c){var C=this.mediaSource=new c;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),a.src=self.URL.createObjectURL(C),this._objectUrl=a.src}},p.onMediaDetaching=function(){var h=this.media,s=this.mediaSource,a=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(C){M.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),h&&(a&&self.URL.revokeObjectURL(a),h.src===a?(h.removeAttribute("src"),h.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(N.Events.MEDIA_DETACHED,void 0)},p.onBufferReset=function(){var h=this;this.getSourceBufferTypes().forEach(function(s){var a=h.sourceBuffer[s];try{a&&(h.removeBufferListeners(s),h.mediaSource&&h.mediaSource.removeSourceBuffer(a),h.sourceBuffer[s]=void 0)}catch(C){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",C)}}),this._initSourceBuffer()},p.onBufferCodecs=function(h,s){var a=this,C=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(_){if(C){var T=a.tracks[_];if(T&&typeof T.buffer.changeType=="function"){var O=s[_],R=O.codec,S=O.levelCodec,w=O.container,E=(T.levelCodec||T.codec).replace(m,"$1"),f=(S||R).replace(m,"$1");if(E!==f){var x=w+";codecs="+(S||R);a.appendChangeType(_,x)}}}else a.pendingTracks[_]=s[_]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},p.appendChangeType=function(h,s){var a=this,C=this.operationQueue,_={execute:function(){var O=a.sourceBuffer[h];O&&(M.logger.log("[buffer-controller]: changing "+h+" sourceBuffer type to "+s),O.changeType(s)),C.shiftAndExecuteNext(h)},onStart:function(){},onComplete:function(){},onError:function(O){M.logger.warn("[buffer-controller]: Failed to change "+h+" SourceBuffer type",O)}};C.append(_,h)},p.onBufferAppending=function(h,s){var a=this,C=this.hls,_=this.operationQueue,T=this.tracks,O=s.data,R=s.type,S=s.frag,w=s.part,E=s.chunkMeta,f=E.buffering[R],x=self.performance.now();f.start=x;var v=S.stats.buffering,y=w?w.stats.buffering:null;v.start===0&&(v.start=x),y&&y.start===0&&(y.start=x);var U=T.audio,B=R==="audio"&&E.id===1&&(U==null?void 0:U.container)==="audio/mpeg",A={execute:function(){if(f.executeStart=self.performance.now(),B){var P=a.sourceBuffer[R];if(P){var b=S.start-P.timestampOffset;Math.abs(b)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+S.start+" (delta: "+b+") sn: "+S.sn+")"),P.timestampOffset=S.start)}}a.appendExecutor(O,R)},onStart:function(){},onComplete:function(){var P=self.performance.now();f.executeEnd=f.end=P,v.first===0&&(v.first=P),y&&y.first===0&&(y.first=P);var b=a.sourceBuffer,V={};for(var ne in b)V[ne]=H.BufferHelper.getBuffered(b[ne]);a.appendError=0,a.hls.trigger(N.Events.BUFFER_APPENDED,{type:R,frag:S,part:w,chunkMeta:E,parent:S.type,timeRanges:V})},onError:function(P){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+R+" SourceBuffer",P);var b={type:W.ErrorTypes.MEDIA_ERROR,parent:S.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?b.details=W.ErrorDetails.BUFFER_FULL_ERROR:(a.appendError++,b.details=W.ErrorDetails.BUFFER_APPEND_ERROR,a.appendError>C.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),b.fatal=!0)),C.trigger(N.Events.ERROR,b)}};_.append(A,R)},p.onBufferFlushing=function(h,s){var a=this,C=this.operationQueue,_=function(O){return{execute:a.removeExecutor.bind(a,O,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){a.hls.trigger(N.Events.BUFFER_FLUSHED,{type:O})},onError:function(S){M.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",S)}}};s.type?C.append(_(s.type),s.type):this.getSourceBufferTypes().forEach(function(T){C.append(_(T),T)})},p.onFragParsed=function(h,s){var a=this,C=s.frag,_=s.part,T=[],O=_?_.elementaryStreams:C.elementaryStreams;O[L.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(O[L.ElementaryStreamTypes.AUDIO]&&T.push("audio"),O[L.ElementaryStreamTypes.VIDEO]&&T.push("video"));var R=function(){var w=self.performance.now();C.stats.buffering.end=w,_&&(_.stats.buffering.end=w);var E=_?_.stats:C.stats;a.hls.trigger(N.Events.FRAG_BUFFERED,{frag:C,part:_,stats:E,id:C.type})};T.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(R,T)},p.onFragChanged=function(h,s){this.flushBackBuffer()},p.onBufferEos=function(h,s){var a=this,C=this.getSourceBufferTypes().reduce(function(_,T){var O=a.sourceBuffer[T];return(!s.type||s.type===T)&&(O&&!O.ended&&(O.ended=!0,M.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),_&&!!(!O||O.ended)},!0);C&&this.blockBuffers(function(){var _=a.mediaSource;if(!_||_.readyState!=="open")return;_.endOfStream()})},p.onLevelUpdated=function(h,s){var a=s.details;if(!a.fragments.length)return;this.details=a,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},p.flushBackBuffer=function(){var h=this.hls,s=this.details,a=this.media,C=this.sourceBuffer;if(!a||s===null)return;var _=this.getSourceBufferTypes();if(!_.length)return;var T=s.live&&h.config.liveBackBufferLength!==null?h.config.liveBackBufferLength:h.config.backBufferLength;if(!Object(z.isFiniteNumber)(T)||T<0)return;var O=a.currentTime,R=s.levelTargetDuration,S=Math.max(T,R),w=Math.floor(O/R)*R-S;_.forEach(function(E){var f=C[E];if(f){var x=H.BufferHelper.getBuffered(f);x.length>0&&w>x.start(0)&&(h.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:w}),s.live&&h.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:w}),h.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:w,type:E}))}})},p.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var h=this.details,s=this.hls,a=this.media,C=this.mediaSource,_=h.fragments[0].start+h.totalduration,T=a.duration,O=Object(z.isFiniteNumber)(C.duration)?C.duration:0;h.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(h)):(_>O&&_>T||!Object(z.isFiniteNumber)(T))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+_.toFixed(3)),C.duration=_)},p.updateSeekableRange=function(h){var s=this.mediaSource,a=h.fragments,C=a.length;if(C&&h.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var _=Math.max(0,a[0].start),T=Math.max(_,_+h.totalduration);s.setLiveSeekableRange(_,T)}},p.checkPendingTracks=function(){var h=this.bufferCodecEventsExpected,s=this.operationQueue,a=this.pendingTracks,C=Object.keys(a).length;if(C&&!h||C===2){this.createSourceBuffers(a),this.pendingTracks={};var _=this.getSourceBufferTypes();if(_.length===0){this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}_.forEach(function(T){s.executeNext(T)})}},p.createSourceBuffers=function(h){var s=this.sourceBuffer,a=this.mediaSource;if(!a)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var _ in h)if(!s[_]){var T=h[_];if(!T)throw Error("source buffer exists for track "+_+", however track does not");var O=T.levelCodec||T.codec,R=T.container+";codecs="+O;M.logger.log("[buffer-controller]: creating sourceBuffer("+R+")");try{var S=s[_]=a.addSourceBuffer(R),w=_;this.addBufferListener(w,"updatestart",this._onSBUpdateStart),this.addBufferListener(w,"updateend",this._onSBUpdateEnd),this.addBufferListener(w,"error",this._onSBUpdateError),this.tracks[_]={buffer:S,codec:O,container:T.container,levelCodec:T.levelCodec,id:T.id},C++}catch(E){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+E.message),this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:E,mimeType:R})}}C&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},p._onSBUpdateStart=function(h){var s=this.operationQueue,a=s.current(h);a.onStart()},p._onSBUpdateEnd=function(h){var s=this.operationQueue,a=s.current(h);a.onComplete(),s.shiftAndExecuteNext(h)},p._onSBUpdateError=function(h,s){M.logger.error("[buffer-controller]: "+h+" SourceBuffer error",s),this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var a=this.operationQueue.current(h);a&&a.onError(s)},p.removeExecutor=function(h,s,a){var C=this.media,_=this.mediaSource,T=this.operationQueue,O=this.sourceBuffer,R=O[h];if(!C||!_||!R){M.logger.warn("[buffer-controller]: Attempting to remove from the "+h+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(h);return}var S=Object(z.isFiniteNumber)(C.duration)?C.duration:Infinity,w=Object(z.isFiniteNumber)(_.duration)?_.duration:Infinity,E=Math.max(0,s),f=Math.min(a,S,w);f>E?(M.logger.log("[buffer-controller]: Removing ["+E+","+f+"] from the "+h+" SourceBuffer"),console.assert(!R.updating,h+" sourceBuffer must not be updating"),R.remove(E,f)):T.shiftAndExecuteNext(h)},p.appendExecutor=function(h,s){var a=this.operationQueue,C=this.sourceBuffer,_=C[s];if(!_){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),a.shiftAndExecuteNext(s);return}_.ended=!1,console.assert(!_.updating,s+" sourceBuffer must not be updating"),_.appendBuffer(h)},p.blockBuffers=function(h,s){var a=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(h);return}var C=this.operationQueue,_=s.map(function(T){return C.appendBlocker(T)});Promise.all(_).then(function(){h(),s.forEach(function(T){var O=a.sourceBuffer[T];(!O||!O.updating)&&C.shiftAndExecuteNext(T)})})},p.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},p.addBufferListener=function(h,s,a){var C=this.sourceBuffer[h];if(!C)return;var _=a.bind(this,h);this.listeners[h].push({event:s,listener:_}),C.addEventListener(s,_)},p.removeBufferListeners=function(h){var s=this.sourceBuffer[h];if(!s)return;this.listeners[h].forEach(function(a){s.removeEventListener(a.event,a.listener)})},o}()},"./src/controller/buffer-operation-queue.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return N});var z=D("./src/utils/logger.ts"),N=function(){function M(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var W=M.prototype;return W.append=function(i,L){var g=this.queues[L];g.push(i),g.length===1&&this.buffers[L]&&this.executeNext(L)},W.insertAbort=function(i,L){var g=this.queues[L];g.unshift(i),this.executeNext(L)},W.appendBlocker=function(i){var L,g=new Promise(function(m){L=m}),c={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(c,i),g},W.executeNext=function(i){var L=this.buffers,g=this.queues,c=L[i],m=g[i];if(m.length){var u=m[0];try{u.execute()}catch(o){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(o),(!c||!c.updating)&&(m.shift(),this.executeNext(i))}}},W.shiftAndExecuteNext=function(i){this.queues[i].shift(),this.executeNext(i)},W.current=function(i){return this.queues[i][0]},M}()},"./src/controller/cap-level-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/events.ts");function N(H,i){for(var L=0;L<i.length;L++){var g=i[L];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(H,g.key,g)}}function M(H,i,L){return i&&N(H.prototype,i),L&&N(H,L),H}var W=function(){function H(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 i=H.prototype;return i.setStreamController=function(g){this.streamController=g},i.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},i.registerListeners=function(){var g=this.hls;g.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.unregisterListener=function(){var g=this.hls;g.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.onFpsDropLevelCapping=function(g,c){H.isLevelAllowed(c.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(c.droppedLevel)},i.onMediaAttaching=function(g,c){this.media=c.media instanceof HTMLVideoElement?c.media:null},i.onManifestParsed=function(g,c){var m=this.hls;this.restrictedLevels=[],this.firstLevel=c.firstLevel,m.config.capLevelToPlayerSize&&c.video&&this.startCapping()},i.onBufferCodecs=function(g,c){var m=this.hls;m.config.capLevelToPlayerSize&&c.video&&this.startCapping()},i.onMediaDetaching=function(){this.stopCapping()},i.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var c=this.hls;c.autoLevelCapping=this.getMaxLevel(g.length-1),c.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=c.autoLevelCapping}}},i.getMaxLevel=function(g){var c=this,m=this.hls.levels;if(!m.length)return-1;var u=m.filter(function(o,p){return H.isLevelAllowed(p,c.restrictedLevels)&&p<=g});return this.clientRect=null,H.getMaxLevelByMediaSize(u,this.mediaWidth,this.mediaHeight)},i.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()},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,c={width:0,height:0};if(g){var m=g.getBoundingClientRect();c.width=m.width,c.height=m.height,!c.width&&!c.height&&(c.width=m.right-m.left||g.width||0,c.height=m.bottom-m.top||g.height||0)}return this.clientRect=c,c},H.isLevelAllowed=function(g,c){return c===void 0&&(c=[]),c.indexOf(g)===-1},H.getMaxLevelByMediaSize=function(g,c,m){if(!g||!g.length)return-1;for(var u=function(s,a){return a?s.width!==a.width||s.height!==a.height:!0},o=g.length-1,p=0;p<g.length;p+=1){var l=g[p];if((l.width>=c||l.height>=m)&&u(l,g[p+1])){o=p;break}}return o},M(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(c){}return g}}]),H}();Y.default=W},"./src/controller/cmcd-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return u});var z=D("./src/events.ts"),N=D("./src/types/cmcd.ts"),M=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts");function H(o,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(o,h.key,h)}}function i(o,p,l){return p&&H(o.prototype,p),l&&H(o,l),o}function L(o,p){var l=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(l)return(l=l.call(o)).next.bind(l);if(Array.isArray(o)||(l=g(o))||p&&o&&typeof o.length=="number"){l&&(o=l);var h=0;return function(){return h>=o.length?{done:!0}:{done:!1,value:o[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.`)}function g(o,p){if(!o)return;if(typeof o=="string")return c(o,p);var l=Object.prototype.toString.call(o).slice(8,-1);if(l==="Object"&&o.constructor&&(l=o.constructor.name),l==="Map"||l==="Set")return Array.from(o);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return c(o,p)}function c(o,p){(p==null||p>o.length)&&(p=o.length);for(var l=0,h=new Array(p);l<p;l++)h[l]=o[l];return h}function m(){return m=Object.assign||function(o){for(var p=1;p<arguments.length;p++){var l=arguments[p];for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(o[h]=l[h])}return o},m.apply(this,arguments)}var u=function(){function o(l){var h=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(){h.initialized&&(h.starved=!0),h.buffering=!0},this.onPlaying=function(){h.initialized||(h.initialized=!0),h.buffering=!1},this.applyPlaylistData=function(C){try{h.apply(C,{ot:N.CMCDObjectType.MANIFEST,su:!h.initialized})}catch(_){W.logger.warn("Could not generate manifest CMCD data.",_)}},this.applyFragmentData=function(C){try{var _=C.frag,T=h.hls.levels[_.level],O=h.getObjectType(_),R={d:_.duration*1e3,ot:O};(O===N.CMCDObjectType.VIDEO||O===N.CMCDObjectType.AUDIO||O==N.CMCDObjectType.MUXED)&&(R.br=T.bitrate/1e3,R.tb=h.getTopBandwidth(O),R.bl=h.getBufferLength(O)),h.apply(C,R)}catch(S){W.logger.warn("Could not generate segment CMCD data.",S)}},this.hls=l;var s=this.config=l.config,a=s.cmcd;a!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||o.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var p=o.prototype;return p.registerListeners=function(){var h=this.hls;h.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),h.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},p.unregisterListeners=function(){var h=this.hls;h.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),h.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},p.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},p.onMediaAttached=function(h,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},p.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},p.onBufferCreated=function(h,s){var a,C;this.audioBuffer=(a=s.tracks.audio)===null||a===void 0?void 0:a.buffer,this.videoBuffer=(C=s.tracks.video)===null||C===void 0?void 0:C.buffer},p.createData=function(){var h;return{v:N.CMCDVersion,sf:N.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(h=this.media)===null||h===void 0?void 0:h.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},p.apply=function(h,s){s===void 0&&(s={}),m(s,this.createData());var a=s.ot===N.CMCDObjectType.INIT||s.ot===N.CMCDObjectType.VIDEO||s.ot===N.CMCDObjectType.MUXED;if(this.starved&&a&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var C=o.toHeaders(s);if(!Object.keys(C).length)return;h.headers||(h.headers={}),m(h.headers,C)}else{var _=o.toQuery(s);if(!_)return;h.url=o.appendQueryToUri(h.url,_)}},p.getObjectType=function(h){var s=h.type;return s==="subtitle"?N.CMCDObjectType.TIMED_TEXT:h.sn==="initSegment"?N.CMCDObjectType.INIT:s==="audio"?N.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED:void 0},p.getTopBandwidth=function(h){for(var s=0,a=h===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=L(a),_;!(_=C()).done;){var T=_.value;T.bitrate>s&&(s=T.bitrate)}return s>0?s:NaN},p.getBufferLength=function(h){var s=this.hls.media,a=h===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!a||!s)return NaN;var C=M.BufferHelper.bufferInfo(a,s.currentTime,this.config.maxBufferHole);return C.len*1e3},p.createPlaylistLoader=function(){var h=this.config.pLoader,s=this.applyPlaylistData,a=h||this.config.loader;return function(){function C(T){this.loader=void 0,this.loader=new a(T)}var _=C.prototype;return _.destroy=function(){this.loader.destroy()},_.abort=function(){this.loader.abort()},_.load=function(O,R,S){s(O),this.loader.load(O,R,S)},i(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},p.createFragmentLoader=function(){var h=this.config.fLoader,s=this.applyFragmentData,a=h||this.config.loader;return function(){function C(T){this.loader=void 0,this.loader=new a(T)}var _=C.prototype;return _.destroy=function(){this.loader.destroy()},_.abort=function(){this.loader.abort()},_.load=function(O,R,S){s(O),this.loader.load(O,R,S)},i(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},o.uuid=function(){var h=URL.createObjectURL(new Blob),s=h.toString();return URL.revokeObjectURL(h),s.substr(s.lastIndexOf("/")+1)},o.serialize=function(h){for(var s=[],a=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},C=function(B){return Math.round(B)},_=function(B){return C(B/100)*100},T=function(B){return encodeURIComponent(B)},O={br:C,d:C,bl:_,dl:_,mtp:_,nor:T,rtp:_,tb:C},R=Object.keys(h||{}).sort(),S=L(R),w;!(w=S()).done;){var E=w.value,f=h[E];if(!a(f))continue;if(E==="v"&&f===1)continue;if(E=="pr"&&f===1)continue;var x=O[E];x&&(f=x(f));var v=typeof f,y=void 0;E==="ot"||E==="sf"||E==="st"?y=E+"="+f:v==="boolean"?y=E:v==="number"?y=E+"="+f:y=E+"="+JSON.stringify(f),s.push(y)}return s.join(",")},o.toHeaders=function(h){for(var s=Object.keys(h),a={},C=["Object","Request","Session","Status"],_=[{},{},{},{}],T={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},O=0,R=s;O<R.length;O++){var S=R[O],w=T[S]!=null?T[S]:1;_[w][S]=h[S]}for(var E=0;E<_.length;E++){var f=o.serialize(_[E]);f&&(a["CMCD-"+C[E]]=f)}return a},o.toQuery=function(h){return"CMCD="+encodeURIComponent(o.serialize(h))},o.appendQueryToUri=function(h,s){if(!s)return h;var a=h.includes("?")?"&":"?";return""+h+a+s},o}()},"./src/controller/eme-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),W=D("./src/utils/mediakeys-helper.ts");function H(u,o){for(var p=0;p<o.length;p++){var l=o[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,l.key,l)}}function i(u,o,p){return o&&H(u.prototype,o),p&&H(u,p),u}var L=3,g=function(o,p,l){var h={audioCapabilities:[],videoCapabilities:[]};return o.forEach(function(s){h.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),p.forEach(function(s){h.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[h]},c=function(o,p,l,h){switch(o){case W.KeySystems.WIDEVINE:return g(p,l,h);default:throw new Error("Unknown key-system: "+o)}},m=function(){function u(p){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=p,this._config=p.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 o=u.prototype;return o.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},o._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},o._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},o.getLicenseServerUrl=function(l){switch(l){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},o._attemptKeySystemAccess=function(l,h,s){var a=this,C=c(l,h,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var _=this.requestMediaKeySystemAccess(l,C);this.mediaKeysPromise=_.then(function(T){return a._onMediaKeySystemAccessObtained(l,T)}),_.catch(function(T){M.logger.error('Failed to obtain key-system "'+l+'" access:',T)})},o._onMediaKeySystemAccessObtained=function(l,h){var s=this;M.logger.log('Access for key-system "'+l+'" obtained');var a={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:h,mediaKeySystemDomain:l};this._mediaKeysList.push(a);var C=Promise.resolve().then(function(){return h.createMediaKeys()}).then(function(_){return a.mediaKeys=_,M.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),_});return C.catch(function(_){M.logger.error("Failed to create media-keys:",_)}),C},o._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(h){h.mediaKeysSession||(h.mediaKeysSession=h.mediaKeys.createSession(),l._onNewMediaKeySession(h.mediaKeysSession))})},o._onNewMediaKeySession=function(l){var h=this;M.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){h._onKeySessionMessage(l,s.message)},!1)},o._onKeySessionMessage=function(l,h){M.logger.log("Got EME message event, creating license request"),this._requestLicense(h,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},o.onMediaEncrypted=function(l){var h=this;if(M.logger.log('Media is encrypted using "'+l.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(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(C){if(!h._media)return;h._attemptSetMediaKeys(C),h._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},o._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var h=this._mediaKeysList[0];if(!h||!h.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(h.mediaKeys),this._hasSetMediaKeys=!0}},o._generateRequestWithPreferredKeySession=function(l,h){var s=this,a=this._mediaKeysList[0];if(!a){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(a.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var C=a.mediaKeysSession;if(!C){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!h){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+l+'" init data type'),a.mediaKeysSessionInitialized=!0,C.generateRequest(l,h).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(_){M.logger.error("Error generating key-session request:",_),s.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},o._createLicenseXhr=function(l,h,s){var a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,a,l,h,s);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,a,l),C=void 0}catch(_){M.logger.error(_)}try{a.readyState||a.open("POST",l,!0),C&&C.call(this.hls,a,l)}catch(_){throw new Error("issue setting up KeySystem license XHR "+_)}return a},o._onLicenseRequestReadyStageChange=function(l,h,s,a){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var C=l.response,_=this._licenseResponseCallback;if(_)try{C=_.call(this.hls,l,h)}catch(O){M.logger.error(O)}a(C)}else{if(M.logger.error("License Request XHR failed ("+h+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=L-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(s,a)}break}},o._generateLicenseRequestChallenge=function(l,h){switch(l.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return h}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},o._requestLicense=function(l,h){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(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var a=this.getLicenseServerUrl(s.mediaKeySystemDomain),C=this._createLicenseXhr(a,l,h);M.logger.log("Sending license request to URL: "+a);var _=this._generateLicenseRequestChallenge(s,l);C.send(_)}catch(T){M.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},o.onMediaAttached=function(l,h){if(!this._emeEnabled)return;var s=h.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},o.onMediaDetached=function(){var l=this._media,h=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(h.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},o.onManifestParsed=function(l,h){if(!this._emeEnabled)return;var s=h.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),a=h.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,a)},i(u,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),u}();Y.default=m},"./src/controller/fps-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/events.ts"),N=D("./src/utils/logger.ts"),M=function(){function W(i){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=i,this.registerListeners()}var H=W.prototype;return H.setStreamController=function(L){this.streamController=L},H.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(L,g){var c=this.hls.config;if(c.capLevelOnFPSDrop){var m=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=m,m&&typeof m.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),c.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(L,g,c){var m=performance.now();if(g){if(this.lastTime){var u=m-this.lastTime,o=c-this.lastDroppedFrames,p=g-this.lastDecodedFrames,l=1e3*o/u,h=this.hls;if(h.trigger(z.Events.FPS_DROP,{currentDropped:o,currentDecoded:p,totalDroppedFrames:c}),l>0&&o>h.config.fpsDroppedMonitoringThreshold*p){var s=h.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=s)&&(s=s-1,h.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:h.currentLevel}),h.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=m,this.lastDroppedFrames=c,this.lastDecodedFrames=g}},H.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var g=L.getVideoPlaybackQuality();this.checkFPS(L,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},W}();Y.default=M},"./src/controller/fragment-finders.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"findFragmentByPDT",function(){return M}),D.d(Y,"findFragmentByPTS",function(){return W}),D.d(Y,"fragmentWithinToleranceTest",function(){return H}),D.d(Y,"pdtWithinToleranceTest",function(){return i}),D.d(Y,"findFragWithCC",function(){return L});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/binary-search.ts");function M(g,c,m){if(c===null||!Array.isArray(g)||!g.length||!Object(z.isFiniteNumber)(c))return null;var u=g[0].programDateTime;if(c<(u||0))return null;var o=g[g.length-1].endProgramDateTime;if(c>=(o||0))return null;m=m||0;for(var p=0;p<g.length;++p){var l=g[p];if(i(c,m,l))return l}return null}function W(g,c,m,u){m===void 0&&(m=0),u===void 0&&(u=0);var o=null;if(g?o=c[g.sn-c[0].sn+1]||null:m===0&&c[0].start===0&&(o=c[0]),o&&H(m,u,o)===0)return o;var p=N.default.search(c,H.bind(null,m,u));return p||o}function H(g,c,m){g===void 0&&(g=0),c===void 0&&(c=0);var u=Math.min(c,m.duration+(m.deltaPTS?m.deltaPTS:0));return m.start+m.duration-u<=g?1:m.start-u>g&&m.start?-1:0}function i(g,c,m){var u=Math.min(c,m.duration+(m.deltaPTS?m.deltaPTS:0))*1e3,o=m.endProgramDateTime||0;return o-u>g}function L(g,c){return N.default.search(g,function(m){return m.cc<c?1:m.cc>c?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"FragmentState",function(){return M}),D.d(Y,"FragmentTracker",function(){return W});var z=D("./src/events.ts"),N=D("./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 W=function(){function L(c){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=c,this._registerListeners()}var g=L.prototype;return g._registerListeners=function(){var m=this.hls;m.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),m.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),m.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var m=this.hls;m.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),m.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),m.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(m,u){if(u===N.PlaylistLevelType.MAIN){var o=this.activeFragment,p=this.activeParts;if(!o)return null;if(p)for(var l=p.length;l--;){var h=p[l],s=h?h.end:o.appendedPTS;if(h.start<=m&&s!==void 0&&m<=s)return l>9&&(this.activeParts=p.slice(l-9)),h}else if(o.start<=m&&o.appendedPTS!==void 0&&m<=o.appendedPTS)return o}return this.getBufferedFrag(m,u)},g.getBufferedFrag=function(m,u){for(var o=this.fragments,p=Object.keys(o),l=p.length;l--;){var h=o[p[l]];if((h==null?void 0:h.body.type)===u&&h.buffered){var s=h.body;if(s.start<=m&&m<=s.end)return s}}return null},g.detectEvictedFragments=function(m,u,o){var p=this;Object.keys(this.fragments).forEach(function(l){var h=p.fragments[l];if(!h)return;if(!h.buffered){h.body.type===o&&p.removeFragment(h.body);return}var s=h.range[m];if(!s)return;s.time.some(function(a){var C=!p.isTimeBuffered(a.startPTS,a.endPTS,u);return C&&p.removeFragment(h.body),C})})},g.detectPartialFragments=function(m){var u=this,o=this.timeRanges,p=m.frag,l=m.part;if(!o||p.sn==="initSegment")return;var h=i(p),s=this.fragments[h];if(!s)return;Object.keys(o).forEach(function(a){var C=p.elementaryStreams[a];if(!C)return;var _=o[a],T=l!==null||C.partial===!0;s.range[a]=u.getBufferedTimes(p,l,T,_)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},g.fragBuffered=function(m){var u=i(m),o=this.fragments[u];o&&(o.backtrack=o.loaded=null,o.buffered=!0)},g.getBufferedTimes=function(m,u,o,p){for(var l={time:[],partial:o},h=u?u.start:m.start,s=u?u.end:m.end,a=m.minEndPTS||s,C=m.maxStartPTS||h,_=0;_<p.length;_++){var T=p.start(_)-this.bufferPadding,O=p.end(_)+this.bufferPadding;if(C>=T&&a<=O){l.time.push({startPTS:Math.max(h,p.start(_)),endPTS:Math.min(s,p.end(_))});break}else if(h<O&&s>T)l.partial=!0,l.time.push({startPTS:Math.max(h,p.start(_)),endPTS:Math.min(s,p.end(_))});else if(s<=T)break}return l},g.getPartialFragment=function(m){var u=null,o,p,l,h=0,s=this.bufferPadding,a=this.fragments;return Object.keys(a).forEach(function(C){var _=a[C];if(!_)return;H(_)&&(p=_.body.start-s,l=_.body.end+s,m>=p&&m<=l&&(o=Math.min(m-p,l-m),h<=o&&(u=_.body,h=o)))}),u},g.getState=function(m){var u=i(m),o=this.fragments[u];return o?o.buffered?H(o)?M.PARTIAL:M.OK:o.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},g.backtrack=function(m,u){var o=i(m),p=this.fragments[o];if(!p||p.backtrack)return null;var l=p.backtrack=u||p.loaded;return p.loaded=null,l},g.getBacktrackData=function(m){var u=i(m),o=this.fragments[u];if(o){var p,l=o.backtrack;if(l!=null&&(p=l.payload)!==null&&p!==void 0&&p.byteLength)return l;this.removeFragment(m)}return null},g.isTimeBuffered=function(m,u,o){for(var p,l,h=0;h<o.length;h++){if(p=o.start(h)-this.bufferPadding,l=o.end(h)+this.bufferPadding,m>=p&&u<=l)return!0;if(u<=p)return!1}return!1},g.onFragLoaded=function(m,u){var o=u.frag,p=u.part;if(o.sn==="initSegment"||o.bitrateTest||p)return;var l=i(o);this.fragments[l]={body:o,loaded:u,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(m,u){var o=this,p=u.frag,l=u.part,h=u.timeRanges;if(p.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=p,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=h,Object.keys(h).forEach(function(a){var C=h[a];if(o.detectEvictedFragments(a,C),!l)for(var _=0;_<C.length;_++)p.appendedPTS=Math.max(C.end(_),p.appendedPTS||0)})},g.onFragBuffered=function(m,u){this.detectPartialFragments(u)},g.hasFragment=function(m){var u=i(m);return!!this.fragments[u]},g.removeFragmentsInRange=function(m,u,o){var p=this;Object.keys(this.fragments).forEach(function(l){var h=p.fragments[l];if(!h)return;if(h.buffered){var s=h.body;s.type===o&&s.start<u&&s.end>m&&p.removeFragment(s)}})},g.removeFragment=function(m){var u=i(m);m.stats.loaded=0,m.clearElementaryStreamInfo(),delete this.fragments[u]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function H(L){var g,c;return L.buffered&&(((g=L.range.video)===null||g===void 0?void 0:g.partial)||((c=L.range.audio)===null||c===void 0?void 0:c.partial))}function i(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return H}),D.d(Y,"MAX_START_GAP_JUMP",function(){return i}),D.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d(Y,"SKIP_BUFFER_RANGE_START",function(){return g}),D.d(Y,"default",function(){return c});var z=D("./src/utils/buffer-helper.ts"),N=D("./src/errors.ts"),M=D("./src/events.ts"),W=D("./src/utils/logger.ts"),H=250,i=2,L=.1,g=.05,c=function(){function m(o,p,l,h){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=o,this.media=p,this.fragmentTracker=l,this.hls=h}var u=m.prototype;return u.destroy=function(){this.hls=this.fragmentTracker=this.media=null},u.poll=function(p){var l=this.config,h=this.media,s=this.stalled,a=h.currentTime,C=h.seeking,_=this.seeking&&!C,T=!this.seeking&&C;if(this.seeking=C,a!==p){if(this.moved=!0,s!==null){if(this.stallReported){var O=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||_)&&(this.stalled=null),h.paused||h.ended||h.playbackRate===0||!z.BufferHelper.getBuffered(h).length)return;var R=z.BufferHelper.bufferInfo(h,a,0),S=R.len>0,w=R.nextStart||0;if(!S&&!w)return;if(C){var E=R.len>i,f=!w||w-a>i&&!this.fragmentTracker.getPartialFragment(a);if(E||f)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,v=Math.max(w,R.start||0)-a,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=y==null||((x=y.details)===null||x===void 0)?void 0:x.live,B=U?y.details.targetduration*2:i;if(v>0&&v<=B){this._trySkipBufferHole(null);return}}var A=self.performance.now();if(s===null){this.stalled=A;return}var j=A-s;!C&&j>=H&&this._reportStall(R.len);var P=z.BufferHelper.bufferInfo(h,a,l.maxBufferHole);this._tryFixBufferStall(P,j)},u._tryFixBufferStall=function(p,l){var h=this.config,s=this.fragmentTracker,a=this.media,C=a.currentTime,_=s.getPartialFragment(C);if(_){var T=this._trySkipBufferHole(_);if(T)return}p.len>h.maxBufferHole&&l>h.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},u._reportStall=function(p){var l=this.hls,h=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+h.currentTime+" due to low buffer (buffer="+p+")"),l.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:p}))},u._trySkipBufferHole=function(p){for(var l=this.config,h=this.hls,s=this.media,a=s.currentTime,C=0,_=z.BufferHelper.getBuffered(s),T=0;T<_.length;T++){var O=_.start(T);if(a+l.maxBufferHole>=C&&a<O){var R=Math.max(O+g,s.currentTime+L);return W.logger.warn("skipping hole, adjusting currentTime from "+a+" to "+R),this.moved=!0,this.stalled=null,s.currentTime=R,p&&h.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+a+" to "+R,frag:p}),R}C=_.end(T)}return 0},u._tryNudgeBuffer=function(){var p=this.config,l=this.hls,h=this.media,s=h.currentTime,a=(this.nudgeRetry||0)+1;if(this.nudgeRetry=a,a<p.nudgeMaxRetry){var C=s+a*p.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+C),h.currentTime=C,l.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+p.nudgeMaxRetry+" nudges"),l.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},m}()},"./src/controller/id3-track-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/events.ts"),N=D("./src/utils/texttrack-utils.ts"),M=D("./src/demux/id3.ts"),W=.25,H=function(){function i(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var L=i.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var c=this.hls;c.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),c.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var c=this.hls;c.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),c.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(c,m){this.media=m.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(c){if(!this.media)return;for(var m=0;m<c.length;m++){var u=c[m];if(u.kind==="metadata"&&u.label==="id3")return Object(N.sendAddTrackEvent)(u,this.media),u}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(c,m){if(!this.media)return;var u=m.frag,o=m.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var p=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<o.length;l++){var h=M.getID3Frames(o[l].data);if(h){var s=o[l].pts,a=l<o.length-1?o[l+1].pts:u.end,C=a-s;C<=0&&(a=s+W);for(var _=0;_<h.length;_++){var T=h[_];if(!M.isTimeStampFrame(T)){var O=new p(s,a,"");O.value=T,this.id3Track.addCue(O)}}}}},L.onBufferFlushing=function(c,m){var u=m.startOffset,o=m.endOffset,p=m.type;if(!p||p==="audio"){var l=this.id3Track;l&&Object(N.removeCuesInRange)(l,u,o)}},i}();Y.default=H},"./src/controller/latency-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return i});var z=D("./src/errors.ts"),N=D("./src/events.ts"),M=D("./src/utils/logger.ts");function W(L,g){for(var c=0;c<g.length;c++){var m=g[c];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(L,m.key,m)}}function H(L,g,c){return g&&W(L.prototype,g),c&&W(L,c),L}var i=function(){function L(c){var m=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return m.timeupdate()},this.hls=c,this.config=c.config,this.registerListeners()}var g=L.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.Events.ERROR,this.onError)},g.onMediaAttached=function(m,u){this.media=u.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(m,u){var o=u.details;this.levelDetails=o,o.advanced&&this.timeupdate(),!o.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(m,u){if(u.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var m=this.media,u=this.levelDetails;if(!m||!u)return;this.currentTime=m.currentTime;var o=this.computeLatency();if(o===null)return;this._latency=o;var p=this.config,l=p.lowLatencyMode,h=p.maxLiveSyncPlaybackRate;if(!l||h===1)return;var s=this.targetLatency;if(s===null)return;var a=o-s,C=Math.min(this.maxLatency,s+u.targetduration),_=a<C;if(u.live&&_&&a>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,h)),O=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;m.playbackRate=Math.min(T,Math.max(1,O))}else m.playbackRate!==1&&m.playbackRate!==0&&(m.playbackRate=1)},g.estimateLiveEdge=function(){var m=this.levelDetails;return m===null?null:m.edge+m.age},g.computeLatency=function(){var m=this.estimateLiveEdge();return m===null?null:m-this.currentTime},H(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var m=this.config,u=this.levelDetails;return m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:u?m.liveMaxLatencyDurationCount*u.targetduration:0}},{key:"targetLatency",get:function(){var m=this.levelDetails;if(m===null)return null;var u=m.holdBack,o=m.partHoldBack,p=m.targetduration,l=this.config,h=l.liveSyncDuration,s=l.liveSyncDurationCount,a=l.lowLatencyMode,C=this.hls.userConfig,_=a&&o||u;(C.liveSyncDuration||C.liveSyncDurationCount||_===0)&&(_=h!==void 0?h:s*p);var T=p,O=1;return _+Math.min(this.stallCount*O,T)}},{key:"liveSyncPosition",get:function(){var m=this.estimateLiveEdge(),u=this.targetLatency,o=this.levelDetails;if(m===null||u===null||o===null)return null;var p=o.edge,l=m-u-this.edgeStalled,h=p-o.totalduration,s=p-(this.config.lowLatencyMode&&o.partTarget||o.targetduration);return Math.min(Math.max(h,l),s)}},{key:"drift",get:function(){var m=this.levelDetails;return m===null?1:m.drift}},{key:"edgeStalled",get:function(){var m=this.levelDetails;if(m===null)return 0;var u=(this.config.lowLatencyMode&&m.partTarget||m.targetduration)*3;return Math.max(m.age-u,0)}},{key:"forwardBufferLength",get:function(){var m=this.media,u=this.levelDetails;if(!m||!u)return 0;var o=m.buffered.length;return o?m.buffered.end(o-1):u.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return l});var z=D("./src/types/level.ts"),N=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),H=D("./src/controller/level-helper.ts"),i=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function g(){return g=Object.assign||function(h){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var C in a)Object.prototype.hasOwnProperty.call(a,C)&&(h[C]=a[C])}return h},g.apply(this,arguments)}function c(h,s){for(var a=0;a<s.length;a++){var C=s[a];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(h,C.key,C)}}function m(h,s,a){return s&&c(h.prototype,s),a&&c(h,a),h}function u(h,s){h.prototype=Object.create(s.prototype),h.prototype.constructor=h,o(h,s)}function o(h,s){return o=Object.setPrototypeOf||function(C,_){return C.__proto__=_,C},o(h,s)}var p=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(h){u(s,h);function s(C){var _;return _=h.call(this,C,"[level-controller]")||this,_._levels=[],_._firstLevel=-1,_._startLevel=void 0,_.currentLevelIndex=-1,_.manualLevelIndex=-1,_.onParsedComplete=void 0,_._registerListeners(),_}var a=s.prototype;return a._registerListeners=function(){var _=this.hls;_.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),_.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),_.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),_.on(N.Events.ERROR,this.onError,this)},a._unregisterListeners=function(){var _=this.hls;_.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),_.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),_.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),_.off(N.Events.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,h.prototype.destroy.call(this)},a.startLoad=function(){var _=this._levels;_.forEach(function(T){T.loadError=0}),h.prototype.startLoad.call(this)},a.onManifestLoaded=function(_,T){var O=[],R=[],S=[],w,E={},f,x=!1,v=!1,y=!1;if(T.levels.forEach(function(j){var P=j.attrs;x=x||!!(j.width&&j.height),v=v||!!j.videoCodec,y=y||!!j.audioCodec,p&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var b=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;f=E[b],f?f.url.push(j.url):(f=new z.Level(j),E[b]=f,O.push(f)),P&&(P.AUDIO&&Object(H.addGroupId)(f,"audio",P.AUDIO),P.SUBTITLES&&Object(H.addGroupId)(f,"text",P.SUBTITLES))}),(x||v)&&y&&(O=O.filter(function(j){var P=j.videoCodec,b=j.width,V=j.height;return!!P||!!(b&&V)})),O=O.filter(function(j){var P=j.audioCodec,b=j.videoCodec;return(!P||Object(W.isCodecSupportedInMp4)(P,"audio"))&&(!b||Object(W.isCodecSupportedInMp4)(b,"video"))}),T.audioTracks&&(R=T.audioTracks.filter(function(j){return!j.audioCodec||Object(W.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(R)),T.subtitles&&(S=T.subtitles,Object(H.assignTrackIdsByGroup)(S)),O.length>0){w=O[0].bitrate,O.sort(function(j,P){return j.bitrate-P.bitrate}),this._levels=O;for(var U=0;U<O.length;U++)if(O[U].bitrate===w){this._firstLevel=U,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+w);break}var B=y&&!v,A={levels:O,audioTracks:R,subtitleTracks:S,firstLevel:this._firstLevel,stats:T.stats,audio:y,video:v,altAudio:!B&&R.some(function(j){return!!j.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,A),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:T.url,reason:"no level with compatible codecs found in manifest"})},a.onError=function(_,T){if(h.prototype.onError.call(this,_,T),T.fatal)return;var O=T.context,R=this._levels[this.currentLevelIndex];if(O&&(O.type===L.PlaylistContextType.AUDIO_TRACK&&R.audioGroupIds&&O.groupId===R.audioGroupIds[R.urlId]||O.type===L.PlaylistContextType.SUBTITLE_TRACK&&R.textGroupIds&&O.groupId===R.textGroupIds[R.urlId])){this.redundantFailover(this.currentLevelIndex);return}var S=!1,w=!0,E;switch(T.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(T.frag){var f=this._levels[T.frag.level];f?(f.fragmentError++,f.fragmentError>this.hls.config.fragLoadingMaxRetry&&(E=T.frag.level)):E=T.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(w=!1),E=O.level),S=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:E=T.level,S=!0;break}E!==void 0&&this.recoverLevel(T,E,S,w)},a.recoverLevel=function(_,T,O,R){var S=_.details,w=this._levels[T];if(w.loadError++,O){var E=this.retryLoadingOrFail(_);if(E)_.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(R){var f=w.url.length;if(f>1&&w.loadError<f)_.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var x=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(S+": switch to "+x),_.levelRetry=!0,this.hls.nextAutoLevel=x)}}},a.redundantFailover=function(_){var T=this._levels[_],O=T.url.length;if(O>1){var R=(T.urlId+1)%O;this.warn("Switching to redundant URL-id "+R),this._levels.forEach(function(S){S.urlId=R}),this.level=_}},a.onFragLoaded=function(_,T){var O=T.frag;if(O!==void 0&&O.type===L.PlaylistLevelType.MAIN){var R=this._levels[O.level];R!==void 0&&(R.fragmentError=0,R.loadError=0)}},a.onLevelLoaded=function(_,T){var O,R=T.level,S=T.details,w=this._levels[R];if(!w){var E;this.warn("Invalid level index "+R),(E=T.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(S.deltaUpdateFailed=!0);return}R===this.currentLevelIndex?(w.fragmentError===0&&(w.loadError=0,this.retryCount=0),this.playlistLoaded(R,T,w.details)):(O=T.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(S.deltaUpdateFailed=!0)},a.onAudioTrackSwitched=function(_,T){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var R=-1,S=this.hls.audioTracks[T.id].groupId,w=0;w<O.audioGroupIds.length;w++)if(O.audioGroupIds[w]===S){R=w;break}R!==O.urlId&&(O.urlId=R,this.startLoad())}},a.loadPlaylist=function(_){var T=this.currentLevelIndex,O=this._levels[T];if(this.canLoad&&O&&O.url.length>0){var R=O.urlId,S=O.url[R];if(_)try{S=_.addDirectives(S)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("Attempt loading level index "+T+(_?" at sn "+_.msn+" part "+_.part:"")+" with URL-id "+R+" "+S),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:S,level:T,id:R,deliveryDirectives:_||null})}},a.removeLevel=function(_,T){var O=function(w,E){return E!==T},R=this._levels.filter(function(S,w){return w!==_?!0:S.url.length>1&&T!==void 0?(S.url=S.url.filter(O),S.audioGroupIds&&(S.audioGroupIds=S.audioGroupIds.filter(O)),S.textGroupIds&&(S.textGroupIds=S.textGroupIds.filter(O)),S.urlId=0,!0):!1}).map(function(S,w){var E=S.details;return E!=null&&E.fragments&&E.fragments.forEach(function(f){f.level=w}),S});this._levels=R,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:R})},m(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(_){var T,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===_&&(T=O[_])!==null&&T!==void 0&&T.details)return;if(_<0||_>=O.length){var R=_<0;if(this.hls.trigger(N.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:_,fatal:R,reason:"invalid level idx"}),R)return;_=Math.min(_,O.length-1)}this.clearTimer();var S=this.currentLevelIndex,w=O[S],E=O[_];this.log("switching to level "+_+" from "+S),this.currentLevelIndex=_;var f=g({},E,{level:_,maxBitrate:E.maxBitrate,uri:E.uri,urlId:E.urlId});delete f._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,f);var x=E.details;if(!x||x.live){var v=this.switchParams(E.uri,w==null?void 0:w.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(_){this.manualLevelIndex=_,this._startLevel===void 0&&(this._startLevel=_),_!==-1&&(this.level=_)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(_){this._firstLevel=_}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var _=this.hls.config.startLevel;return _!==void 0?_:this._firstLevel}else return this._startLevel},set:function(_){this._startLevel=_}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(_){this.level=_,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=_)}}]),s}(i.default)},"./src/controller/level-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"addGroupId",function(){return M}),D.d(Y,"assignTrackIdsByGroup",function(){return W}),D.d(Y,"updatePTS",function(){return H}),D.d(Y,"updateFragPTSDTS",function(){return L}),D.d(Y,"mergeDetails",function(){return g}),D.d(Y,"mapPartIntersection",function(){return c}),D.d(Y,"mapFragmentIntersection",function(){return m}),D.d(Y,"adjustSliding",function(){return u}),D.d(Y,"addSliding",function(){return o}),D.d(Y,"computeReloadInterval",function(){return p}),D.d(Y,"getFragmentWithSN",function(){return l}),D.d(Y,"getPartWith",function(){return h});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts");function M(s,a,C){switch(a){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(C);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(C);break}}function W(s){var a={};s.forEach(function(C){var _=C.groupId||"";C.id=a[_]=a[_]||0,a[_]++})}function H(s,a,C){var _=s[a],T=s[C];i(_,T)}function i(s,a){var C=a.startPTS;if(Object(z.isFiniteNumber)(C)){var _=0,T;a.sn>s.sn?(_=C-s.start,T=s):(_=s.start-C,T=a),T.duration!==_&&(T.duration=_)}else if(a.sn>s.sn){var O=s.cc===a.cc;O&&s.minEndPTS?a.start=s.start+(s.minEndPTS-s.start):a.start=s.start+s.duration}else a.start=Math.max(s.start-a.duration,0)}function L(s,a,C,_,T,O){var R=_-C;R<=0&&(N.logger.warn("Fragment should have a positive duration",a),_=C+a.duration,O=T+a.duration);var S=C,w=_,E=a.startPTS,f=a.endPTS;if(Object(z.isFiniteNumber)(E)){var x=Math.abs(E-C);Object(z.isFiniteNumber)(a.deltaPTS)?a.deltaPTS=Math.max(x,a.deltaPTS):a.deltaPTS=x,S=Math.max(C,E),C=Math.min(C,E),T=Math.min(T,a.startDTS),w=Math.min(_,f),_=Math.max(_,f),O=Math.max(O,a.endDTS)}a.duration=_-C;var v=C-a.start;a.appendedPTS=_,a.start=a.startPTS=C,a.maxStartPTS=S,a.startDTS=T,a.endPTS=_,a.minEndPTS=w,a.endDTS=O;var y=a.sn;if(!s||y<s.startSN||y>s.endSN)return 0;var U,B=y-s.startSN,A=s.fragments;for(A[B]=a,U=B;U>0;U--)i(A[U],A[U-1]);for(U=B;U<A.length-1;U++)i(A[U],A[U+1]);return s.fragmentHint&&i(A[A.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,v}function g(s,a){for(var C=null,_=s.fragments,T=_.length-1;T>=0;T--){var O=_[T].initSegment;if(O){C=O;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var R=0,S;if(m(s,a,function(U,B){U.relurl&&(R=U.cc-B.cc),Object(z.isFiniteNumber)(U.startPTS)&&Object(z.isFiniteNumber)(U.endPTS)&&(B.start=B.startPTS=U.startPTS,B.startDTS=U.startDTS,B.appendedPTS=U.appendedPTS,B.maxStartPTS=U.maxStartPTS,B.endPTS=U.endPTS,B.endDTS=U.endDTS,B.minEndPTS=U.minEndPTS,B.duration=U.endPTS-U.startPTS,B.duration&&(S=B),a.PTSKnown=a.alignedSliding=!0),B.elementaryStreams=U.elementaryStreams,B.loader=U.loader,B.stats=U.stats,B.urlId=U.urlId,U.initSegment&&(B.initSegment=U.initSegment,C=U.initSegment)}),C){var w=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;w.forEach(function(U){var B;(!U.initSegment||U.initSegment.relurl===((B=C)===null||B===void 0?void 0:B.relurl))&&(U.initSegment=C)})}if(a.skippedSegments&&(a.deltaUpdateFailed=a.fragments.some(function(U){return!U}),a.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var E=a.skippedSegments;E--;)a.fragments.shift();a.startSN=a.fragments[0].sn,a.startCC=a.fragments[0].cc}var f=a.fragments;if(R){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<f.length;x++)f[x].cc+=R}a.skippedSegments&&(a.startCC=a.fragments[0].cc),c(s.partList,a.partList,function(U,B){B.elementaryStreams=U.elementaryStreams,B.stats=U.stats}),S?L(a,S,S.startPTS,S.endPTS,S.startDTS,S.endDTS):u(s,a),f.length&&(a.totalduration=a.edge-f[0].start),a.driftStartTime=s.driftStartTime,a.driftStart=s.driftStart;var v=a.advancedDateTime;if(a.advanced&&v){var y=a.edge;a.driftStart||(a.driftStartTime=v,a.driftStart=y),a.driftEndTime=v,a.driftEnd=y}else a.driftEndTime=s.driftEndTime,a.driftEnd=s.driftEnd,a.advancedDateTime=s.advancedDateTime}function c(s,a,C){if(s&&a)for(var _=0,T=0,O=s.length;T<=O;T++){var R=s[T],S=a[T+_];R&&S&&R.index===S.index&&R.fragment.sn===S.fragment.sn?C(R,S):_--}}function m(s,a,C){for(var _=a.skippedSegments,T=Math.max(s.startSN,a.startSN)-a.startSN,O=(s.fragmentHint?1:0)+(_?a.endSN:Math.min(s.endSN,a.endSN))-a.startSN,R=a.startSN-s.startSN,S=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments,w=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,E=T;E<=O;E++){var f=w[R+E],x=S[E];_&&!x&&E<_&&(x=a.fragments[E]=f),f&&x&&C(f,x)}}function u(s,a){var C=a.startSN+a.skippedSegments-s.startSN,_=s.fragments;if(C<0||C>=_.length)return;o(a,_[C].start)}function o(s,a){if(a){for(var C=s.fragments,_=s.skippedSegments;_<C.length;_++)C[_].start+=a;s.fragmentHint&&(s.fragmentHint.start+=a)}}function p(s,a){var C=1e3*s.levelTargetDuration,_=C/2,T=s.age,O=T>0&&T<C*3,R=a.loading.end-a.loading.start,S,w=s.availabilityDelay;if(s.updated===!1)if(O){var E=333*s.misses;S=Math.max(Math.min(_,R*2),E),s.availabilityDelay=(s.availabilityDelay||0)+S}else S=_;else O?(w=Math.min(w||C/2,T),s.availabilityDelay=w,S=w+C-T):S=C-R;return Math.round(S)}function l(s,a,C){if(!s||!s.details)return null;var _=s.details,T=_.fragments[a-_.startSN];return T||(T=_.fragmentHint,T&&T.sn===a?T:a<_.startSN&&C&&C.sn===a?C:null)}function h(s,a,C){if(!s||!s.details)return null;var _=s.details.partList;if(_)for(var T=_.length;T--;){var O=_[T];if(O.index===C&&O.fragment.sn===a)return O}return null}},"./src/controller/stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return _});var z=D("./src/polyfills/number.ts"),N=D("./src/controller/base-stream-controller.ts"),M=D("./src/is-supported.ts"),W=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),i=D("./src/controller/fragment-tracker.ts"),L=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),c=D("./src/demux/transmuxer-interface.ts"),m=D("./src/types/transmuxer.ts"),u=D("./src/controller/gap-controller.ts"),o=D("./src/errors.ts"),p=D("./src/utils/logger.ts");function l(T,O){for(var R=0;R<O.length;R++){var S=O[R];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function h(T,O,R){return O&&l(T.prototype,O),R&&l(T,R),T}function s(T,O){T.prototype=Object.create(O.prototype),T.prototype.constructor=T,a(T,O)}function a(T,O){return a=Object.setPrototypeOf||function(S,w){return S.__proto__=w,S},a(T,O)}var C=100,_=function(T){s(O,T);function O(S,w){var E;return E=T.call(this,S,w,"[stream-controller]")||this,E.audioCodecSwap=!1,E.gapController=null,E.level=-1,E._forceStartLoad=!1,E.altAudio=!1,E.audioOnly=!1,E.fragPlaying=null,E.onvplaying=null,E.onvseeked=null,E.fragLastKbps=0,E.stalled=!1,E.couldBacktrack=!1,E.audioCodecSwitch=!1,E.videoBuffer=null,E._registerListeners(),E}var R=O.prototype;return R._registerListeners=function(){var w=this.hls;w.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),w.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.on(W.Events.ERROR,this.onError,this),w.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),w.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R._unregisterListeners=function(){var w=this.hls;w.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.off(W.Events.ERROR,this.onError,this),w.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),w.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},R.startLoad=function(w){if(this.levels){var E=this.lastCurrentTime,f=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=f.startLevel;x===-1&&(f.config.testBandwidth?(x=0,this.bitrateTest=!0):x=f.nextAutoLevel),this.level=f.nextLoadLevel=x,this.loadedmetadata=!1}E>0&&w===-1&&(this.log("Override startPosition with lastCurrentTime @"+E.toFixed(3)),w=E),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=w,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},R.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},R.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var w,E=this.levels,f=this.level,x=E==null||((w=E[f])===null||w===void 0)?void 0:w.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var v,y=self.performance.now(),U=this.retryDate;(!U||y>=U||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},R.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},R.doTickIdle=function(){var w,E,f=this.hls,x=this.levelLastLoaded,v=this.levels,y=this.media,U=f.config,B=f.nextLoadLevel;if(x===null||!y&&(this.startFragRequested||!U.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[B])return;var A=v[B];this.level=f.nextLoadLevel=B;var j=A.details;if(!j||this.state===N.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==B){this.state=N.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,L.PlaylistLevelType.MAIN);if(P===null)return;var b=P.len,V=this.getMaxBufferLength(A.maxBitrate);if(b>=V)return;if(this._streamEnded(P,j)){var ne={};this.altAudio&&(ne.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ne),this.state=N.State.ENDED;return}var ce=P.end,me=this.getNextFragment(ce,j);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"){var Ie=me.sn-j.startSN;Ie>1&&(me=j.fragments[Ie-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===i.FragmentState.OK&&this.nextLoadPosition>ce){var we=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,we,L.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,j)}if(!me)return;me.initSegment&&!me.initSegment.data&&!this.bitrateTest&&(me=me.initSegment),((w=me.decryptdata)===null||w===void 0?void 0:w.keyFormat)==="identity"&&!((E=me.decryptdata)!==null&&E!==void 0&&E.key)?this.loadKey(me,j):this.loadFragment(me,j,ce)},R.loadFragment=function(w,E,f){var x,v=this.fragmentTracker.getState(w);if(this.fragCurrent=w,v===i.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(w);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else v=i.FragmentState.NOT_LOADED}v===i.FragmentState.NOT_LOADED||v===i.FragmentState.PARTIAL?w.sn==="initSegment"?this._loadInitSegment(w):this.bitrateTest?(w.bitrateTest=!0,this.log("Fragment "+w.sn+" of level "+w.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(w)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,w,E,f)):v===i.FragmentState.APPENDING?this.reduceMaxBufferLength(w.duration)&&this.fragmentTracker.removeFragment(w):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},R.getAppendedFrag=function(w){var E=this.fragmentTracker.getAppendedFrag(w,L.PlaylistLevelType.MAIN);return E&&"fragment"in E?E.fragment:E},R.getBufferedFrag=function(w){return this.fragmentTracker.getBufferedFrag(w,L.PlaylistLevelType.MAIN)},R.followingBufferedFrag=function(w){return w?this.getBufferedFrag(w.end+.5):null},R.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},R.nextLevelSwitch=function(){var w=this.levels,E=this.media;if(E!=null&&E.readyState){var f,x=this.getAppendedFrag(E.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!E.paused&&w){var v=this.hls.nextLoadLevel,y=w[v],U=this.fragLastKbps;U&&this.fragCurrent?f=this.fragCurrent.duration*y.maxBitrate/(1e3*U)+1:f=0}else f=0;var B=this.getBufferedFrag(E.currentTime+f);if(B){var A=this.followingBufferedFrag(B);if(A){this.abortCurrentFrag();var j=A.maxStartPTS?A.maxStartPTS:A.start,P=A.duration,b=Math.max(B.end,j+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(b,Number.POSITIVE_INFINITY)}}}},R.abortCurrentFrag=function(){var w=this.fragCurrent;this.fragCurrent=null,w!=null&&w.loader&&w.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},R.flushMainBuffer=function(w,E){T.prototype.flushMainBuffer.call(this,w,E,this.altAudio?"video":null)},R.onMediaAttached=function(w,E){T.prototype.onMediaAttached.call(this,w,E);var f=E.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),f.addEventListener("playing",this.onvplaying),f.addEventListener("seeked",this.onvseeked),this.gapController=new u.default(this.config,f,this.fragmentTracker,this.hls)},R.onMediaDetaching=function(){var w=this.media;w&&(w.removeEventListener("playing",this.onvplaying),w.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},R.onMediaPlaying=function(){this.tick()},R.onMediaSeeked=function(){var w=this.media,E=w?w.currentTime:null;Object(z.isFiniteNumber)(E)&&this.log("Media seeked to "+E.toFixed(3)),this.tick()},R.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},R.onManifestParsed=function(w,E){var f=!1,x=!1,v;E.levels.forEach(function(y){v=y.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(f=!0),v.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=f&&x&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=E.levels,this.startFragRequested=!1},R.onLevelLoading=function(w,E){var f=this.levels;if(!f||this.state!==N.State.IDLE)return;var x=f[E.level];(!x.details||x.details.live&&this.levelLastLoaded!==E.level||this.waitForCdnTuneIn(x.details))&&(this.state=N.State.WAITING_LEVEL)},R.onLevelLoaded=function(w,E){var f,x=this.levels,v=E.level,y=E.details,U=y.totalduration;if(!x){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+U);var B=this.fragCurrent;B&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==E.level&&B.loader&&(this.state=N.State.IDLE,B.loader.abort()));var A=x[v],j=0;if(y.live||(f=A.details)!==null&&f!==void 0&&f.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;j=this.alignPlaylists(y,A.details)}if(A.details=y,this.levelLastLoaded=v,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:y,level:v}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=N.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,j),this.tick()},R._handleFragmentLoadProgress=function(w){var E,f=w.frag,x=w.part,v=w.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+f.sn+" of level "+f.level+" will not be buffered");return}var U=y[f.level],B=U.details;if(!B){this.warn("Dropping fragment "+f.sn+" of level "+f.level+" after level details were reset");return}var A=U.videoCodec,j=B.PTSKnown||!B.live,P=(E=f.initSegment)===null||E===void 0?void 0:E.data,b=this._getAudioCodec(U),V=this.transmuxer=this.transmuxer||new c.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ne=x?x.index:-1,ce=ne!==-1,me=new m.ChunkMetadata(f.level,f.sn,f.stats.chunkCount,v.byteLength,ne,ce),Ie=this.initPTS[f.cc];V.push(v,P,b,A,f,x,B.totalduration,j,me,Ie)},R.onAudioTrackSwitching=function(w,E){var f=this.altAudio,x=!!E.url,v=E.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var U=this.hls;f&&U.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),U.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:v})}},R.onAudioTrackSwitched=function(w,E){var f=E.id,x=!!this.hls.audioTracks[f].url;if(x){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=x,this.tick()},R.onBufferCreated=function(w,E){var f=E.tracks,x,v,y=!1;for(var U in f){var B=f[U];if(B.id==="main"){if(v=U,x=B,U==="video"){var A=f[U];A&&(this.videoBuffer=A.buffer)}}else y=!0}y&&x?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},R.onFragBuffered=function(w,E){var f=E.frag,x=E.part;if(f&&f.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(f)){this.warn("Fragment "+f.sn+(x?" p: "+x.index:"")+" of level "+f.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var v=x?x.stats:f.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),f.sn!=="initSegment"&&(this.fragPrevious=f),this.fragBufferedComplete(f,x)},R.onError=function(w,E){switch(E.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,E);break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(E.fatal?(this.warn(""+E.details),this.state=N.State.ERROR):!E.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(E.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var f=!0,x=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);x&&x.len>.5&&(f=!this.reduceMaxBufferLength(x.len)),f&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},R.checkBuffer=function(){var w=this.media,E=this.gapController;if(!w||!E||!w.readyState)return;var f=H.BufferHelper.getBuffered(w);!this.loadedmetadata&&f.length?(this.loadedmetadata=!0,this.seekToStartPos()):E.poll(this.lastCurrentTime),this.lastCurrentTime=w.currentTime},R.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},R.onBufferFlushed=function(w,E){var f=E.type;if(f!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(f===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,f,L.PlaylistLevelType.MAIN)}},R.onLevelsUpdated=function(w,E){this.levels=E.levels},R.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},R.seekToStartPos=function(){var w=this.media,E=w.currentTime,f=this.startPosition;if(f>=0&&E<f){if(w.seeking){p.logger.log("could not seek to "+f+", already seeking at "+E);return}var x=H.BufferHelper.getBuffered(w),v=x.length?x.start(0):0,y=v-f;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(p.logger.log("adjusting start position by "+y+" to match buffer start"),f+=y,this.startPosition=f),this.log("seek to target start position "+f+" from current time "+E),w.currentTime=f}},R._getAudioCodec=function(w){var E=this.config.defaultAudioCodec||w.audioCodec;return this.audioCodecSwap&&E&&(this.log("Swapping audio codec"),E.indexOf("mp4a.40.5")!==-1?E="mp4a.40.2":E="mp4a.40.5"),E},R._loadBitrateTestFrag=function(w){var E=this;this._doFragLoad(w).then(function(f){var x=E.hls;if(!f||x.nextLoadLevel||E.fragContextChanged(w))return;E.fragLoadError=0,E.state=N.State.IDLE,E.startFragRequested=!1,E.bitrateTest=!1;var v=w.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),x.trigger(W.Events.FRAG_LOADED,f)})},R._handleTransmuxComplete=function(w){var E,f="main",x=this.hls,v=w.remuxResult,y=w.chunkMeta,U=this.getCurrentContext(y);if(!U){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var B=U.frag,A=U.part,j=U.level,P=v.video,b=v.text,V=v.id3,ne=v.initSegment,ce=this.altAudio?void 0:v.audio;if(this.fragContextChanged(B))return;if(this.state=N.State.PARSING,ne){ne.tracks&&(this._bufferInitSegment(j,ne.tracks,B,y),x.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:f,tracks:ne.tracks}));var me=ne.initPTS,Ie=ne.timescale;Object(z.isFiniteNumber)(me)&&(this.initPTS[B.cc]=me,x.trigger(W.Events.INIT_PTS_FOUND,{frag:B,id:f,initPTS:me,timescale:Ie}))}if(P&&v.independent!==!1){if(j.details){var we=P.startPTS,Le=P.endPTS,Re=P.startDTS,De=P.endDTS;if(A)A.elementaryStreams[P.type]={startPTS:we,endPTS:Le,startDTS:Re,endDTS:De};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var ye=this.getLoadPosition()+this.config.maxBufferHole;if(ye<we){this.backtrack(B);return}B.setElementaryStreamInfo(P.type,B.start,Le,B.start,De,!0)}B.setElementaryStreamInfo(P.type,we,Le,Re,De),this.bufferFragmentData(P,B,A,y)}}else if(v.independent===!1){this.backtrack(B);return}if(ce){var X=ce.startPTS,k=ce.endPTS,F=ce.startDTS,$=ce.endDTS;A&&(A.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:X,endPTS:k,startDTS:F,endDTS:$}),B.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,X,k,F,$),this.bufferFragmentData(ce,B,A,y)}if(V!=null&&(E=V.samples)!==null&&E!==void 0&&E.length){var te={frag:B,id:f,samples:V.samples};x.trigger(W.Events.FRAG_PARSING_METADATA,te)}if(b){var K={frag:B,id:f,samples:b.samples};x.trigger(W.Events.FRAG_PARSING_USERDATA,K)}},R._bufferInitSegment=function(w,E,f,x){var v=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!E.audio&&!E.video,this.altAudio&&!this.audioOnly&&delete E.audio;var y=E.audio,U=E.video,B=E.audiovideo;if(y){var A=w.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),y.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(A="mp4a.40.5")),j.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log("Android: force audio codec to "+A)),w.audioCodec&&w.audioCodec!==A&&this.log('Swapping manifest audio codec "'+w.audioCodec+'" for "'+A+'"'),y.levelCodec=A,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(A||"")+"/"+(w.audioCodec||"")+"/"+y.codec+"]")}U&&(U.levelCodec=w.videoCodec,U.id="main",this.log("Init video buffer, container:"+U.container+", codecs[level/parsed]=["+(w.videoCodec||"")+"/"+U.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(w.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,E),Object.keys(E).forEach(function(P){var b=E[P],V=b.initSegment;V!=null&&V.byteLength&&v.hls.trigger(W.Events.BUFFER_APPENDING,{type:P,data:V,frag:f,part:null,chunkMeta:x,parent:f.type})}),this.tick()},R.backtrack=function(w){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(w);var E=this.fragmentTracker.backtrack(w);this.fragPrevious=null,this.nextLoadPosition=w.start,E?this.resetFragmentLoading(w):this.state=N.State.BACKTRACKING},R.checkFragmentChanged=function(){var w=this.media,E=null;if(w&&w.readyState>1&&w.seeking===!1){var f=w.currentTime;if(H.BufferHelper.isBuffered(w,f)?E=this.getAppendedFrag(f):H.BufferHelper.isBuffered(w,f+.1)&&(E=this.getAppendedFrag(f+.1)),E){var x=this.fragPlaying,v=E.level;(!x||E.sn!==x.sn||x.level!==v||E.urlId!==x.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:E}),(!x||x.level!==v)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=E)}}},h(O,[{key:"nextLevel",get:function(){var w=this.nextBufferedFrag;return w?w.level:-1}},{key:"currentLevel",get:function(){var w=this.media;if(w){var E=this.getAppendedFrag(w.currentTime);if(E)return E.level}return-1}},{key:"nextBufferedFrag",get:function(){var w=this.media;if(w){var E=this.getAppendedFrag(w.currentTime);return this.followingBufferedFrag(E)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"SubtitleStreamController",function(){return s});var z=D("./src/events.ts"),N=D("./src/utils/logger.ts"),M=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-finders.ts"),H=D("./src/utils/discontinuities.ts"),i=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),g=D("./src/controller/base-stream-controller.ts"),c=D("./src/types/loader.ts"),m=D("./src/types/level.ts");function u(a,C){for(var _=0;_<C.length;_++){var T=C[_];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(a,T.key,T)}}function o(a,C,_){return C&&u(a.prototype,C),_&&u(a,_),a}function p(a,C){a.prototype=Object.create(C.prototype),a.prototype.constructor=a,l(a,C)}function l(a,C){return l=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},l(a,C)}var h=500,s=function(a){p(C,a);function C(T,O){var R;return R=a.call(this,T,O,"[subtitle-stream-controller]")||this,R.levels=[],R.currentTrackId=-1,R.tracksBuffered=[],R.mainDetails=null,R._registerListeners(),R}var _=C.prototype;return _.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},_._registerListeners=function(){var O=this.hls;O.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(z.Events.ERROR,this.onError,this),O.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var O=this.hls;O.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(z.Events.ERROR,this.onError,this),O.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(h),this.tick()},_.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},_.onLevelLoaded=function(O,R){this.mainDetails=R.details},_.onSubtitleFragProcessed=function(O,R){var S=R.frag,w=R.success;if(this.fragPrevious=S,this.state=g.State.IDLE,!w)return;var E=this.tracksBuffered[this.currentTrackId];if(!E)return;for(var f,x=S.start,v=0;v<E.length;v++)if(x>=E[v].start&&x<=E[v].end){f=E[v];break}var y=S.start+S.duration;f?f.end=y:(f={start:x,end:y},E.push(f)),this.fragmentTracker.fragBuffered(S)},_.onBufferFlushing=function(O,R){var S=R.startOffset,w=R.endOffset;if(S===0&&w!==Number.POSITIVE_INFINITY){var E=this.currentTrackId,f=this.levels;if(!f.length||!f[E]||!f[E].details)return;var x=f[E].details,v=x.targetduration,y=w-v;if(y<=0)return;R.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(U){for(var B=0;B<U.length;){if(U[B].end<=y){U.shift();continue}else if(U[B].start<y)U[B].start=y;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(S,y,c.PlaylistLevelType.SUBTITLE)}},_.onError=function(O,R){var S,w=R.frag;if(!w||w.type!==c.PlaylistLevelType.SUBTITLE)return;(S=this.fragCurrent)!==null&&S!==void 0&&S.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},_.onSubtitleTracksUpdated=function(O,R){var S=this,w=R.subtitleTracks;this.tracksBuffered=[],this.levels=w.map(function(E){return new m.Level(E)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(E){S.tracksBuffered[E.id]=[]}),this.mediaBuffer=null},_.onSubtitleTrackSwitch=function(O,R){if(this.currentTrackId=R.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var S=this.levels[this.currentTrackId];S!=null&&S.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,S&&this.setInterval(h)},_.onSubtitleTrackLoaded=function(O,R){var S,w=R.details,E=R.id,f=this.currentTrackId,x=this.levels;if(!x.length)return;var v=x[f];if(E>=x.length||E!==f||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,w.live||(S=v.details)!==null&&S!==void 0&&S.live){var y=this.mainDetails;if(w.deltaUpdateFailed||!y)return;var U=y.fragments[0];if(!v.details)w.hasProgramDateTime&&y.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(w,y):U&&Object(i.addSliding)(w,U.start);else{var B=this.alignPlaylists(w,v.details);B===0&&U&&Object(i.addSliding)(w,U.start)}}if(v.details=w,this.levelLastLoaded=E,this.tick(),w.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var A=Object(W.findFragmentByPTS)(null,w.fragments,this.media.currentTime,0);A||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},_._handleFragmentLoadComplete=function(O){var R=O.frag,S=O.payload,w=R.decryptdata,E=this.hls;if(this.fragContextChanged(R))return;if(S&&S.byteLength>0&&w&&w.key&&w.iv&&w.method==="AES-128"){var f=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(S),w.key.buffer,w.iv.buffer).then(function(x){var v=performance.now();E.trigger(z.Events.FRAG_DECRYPTED,{frag:R,payload:x,stats:{tstart:f,tdecrypt:v}})})}},_.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var O,R=this.currentTrackId,S=this.levels;if(!S.length||!S[R]||!S[R].details)return;var w=S[R].details,E=w.targetduration,f=this.config,x=this.media,v=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-E,f.maxBufferHole),y=v.end,U=v.len,B=this.getMaxBufferLength()+E;if(U>B)return;console.assert(w,"Subtitle track details are defined on idle subtitle stream controller tick");var A=w.fragments,j=A.length,P=w.edge,b,V=this.fragPrevious;if(y<P){var ne=f.maxFragLookUpTolerance;V&&w.hasProgramDateTime&&(b=Object(W.findFragmentByPDT)(A,V.endProgramDateTime,ne)),b||(b=Object(W.findFragmentByPTS)(V,A,y,ne),!b&&V&&V.start<A[0].start&&(b=A[0]))}else b=A[j-1];(O=b)!==null&&O!==void 0&&O.encrypted?(N.logger.log("Loading key for "+b.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:b})):b&&this.fragmentTracker.getState(b)===L.FragmentState.NOT_LOADED&&this.loadFragment(b,w,y)}},_.loadFragment=function(O,R,S){this.fragCurrent=O,a.prototype.loadFragment.call(this,O,R,S)},o(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(g.default)},"./src/controller/subtitle-track-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/events.ts"),N=D("./src/utils/texttrack-utils.ts"),M=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function H(u,o){for(var p=0;p<o.length;p++){var l=o[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,l.key,l)}}function i(u,o,p){return o&&H(u.prototype,o),p&&H(u,p),u}function L(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,g(u,o)}function g(u,o){return g=Object.setPrototypeOf||function(l,h){return l.__proto__=h,l},g(u,o)}var c=function(u){L(o,u);function o(l){var h;return h=u.call(this,l,"[subtitle-track-controller]")||this,h.media=null,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.selectDefaultTrack=!0,h.queuedDefaultTrack=-1,h.trackChangeListener=function(){return h.onTextTracksChanged()},h.asyncPollTrackChange=function(){return h.pollTrackChange(0)},h.useTextTrackPolling=!1,h.subtitlePollingInterval=-1,h.subtitleDisplay=!0,h.registerListeners(),h}var p=o.prototype;return p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,u.prototype.destroy.call(this)},p.registerListeners=function(){var h=this.hls;h.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),h.on(z.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var h=this.hls;h.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),h.off(z.Events.ERROR,this.onError,this)},p.onMediaAttached=function(h,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)},p.pollTrackChange=function(h){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,h)},p.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 h=m(this.media.textTracks);h.forEach(function(s){Object(N.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},p.onManifestParsed=function(h,s){this.tracks=s.subtitleTracks},p.onSubtitleTrackLoaded=function(h,s){var a=s.id,C=s.details,_=this.trackId,T=this.tracksInGroup[_];if(!T){this.warn("Invalid subtitle track id "+a);return}var O=T.details;T.details=s.details,this.log("subtitle track "+a+" loaded ["+C.startSN+"-"+C.endSN+"]"),a===this.trackId&&(this.retryCount=0,this.playlistLoaded(a,s,O))},p.onLevelLoading=function(h,s){this.switchLevel(s.level)},p.onLevelSwitching=function(h,s){this.switchLevel(s.level)},p.switchLevel=function(h){var s=this.hls.levels[h];if(!(s!=null&&s.textGroupIds))return;var a=s.textGroupIds[s.urlId];if(this.groupId!==a){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,_=this.tracks.filter(function(R){return!a||R.groupId===a});this.tracksInGroup=_;var T=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=a;var O={subtitleTracks:_};this.log("Updating subtitle tracks, "+_.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,O),T!==-1&&this.setSubtitleTrack(T,C)}},p.findTrackId=function(h){for(var s=this.tracksInGroup,a=0;a<s.length;a++){var C=s[a];if((!this.selectDefaultTrack||C.default)&&(!h||h===C.name))return C.id}return-1},p.onError=function(h,s){if(u.prototype.onError.call(this,h,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},p.loadPlaylist=function(h){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var a=s.id,C=s.groupId,_=s.url;if(h)try{_=h.addDirectives(_)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:_,id:a,groupId:C,deliveryDirectives:h||null})}},p.toggleTrackModes=function(h){var s=this,a=this.media,C=this.subtitleDisplay,_=this.trackId;if(!a)return;var T=m(a.textTracks),O=T.filter(function(w){return w.groupId===s.groupId});if(h===-1)[].slice.call(T).forEach(function(w){w.mode="disabled"});else{var R=O[_];R&&(R.mode="disabled")}var S=O[h];S&&(S.mode=C?"showing":"hidden")},p.setSubtitleTrack=function(h,s){var a,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=h;return}if(this.trackId!==h&&this.toggleTrackModes(h),this.trackId===h&&(h===-1||(a=C[h])!==null&&a!==void 0&&a.details)||h<-1||h>=C.length)return;this.clearTimer();var _=C[h];if(this.log("Switching to subtitle track "+h),this.trackId=h,_){var T=_.id,O=_.groupId,R=O===void 0?"":O,S=_.name,w=_.type,E=_.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:R,name:S,type:w,url:E});var f=this.switchParams(_.url,s==null?void 0:s.details);this.loadPlaylist(f)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:h})},p.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var h=-1,s=m(this.media.textTracks),a=0;a<s.length;a++)if(s[a].mode==="hidden")h=a;else if(s[a].mode==="showing"){h=a;break}this.subtitleTrack!==h&&(this.subtitleTrack=h)},i(o,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(h,s)}}]),o}(M.default);function m(u){for(var o=[],p=0;p<u.length;p++){var l=u[p];l.kind==="subtitles"&&l.label&&o.push(u[p])}return o}Y.default=c},"./src/controller/timeline-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"TimelineController",function(){return m});var z=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),M=D("./src/utils/cea-608-parser.ts"),W=D("./src/utils/output-filter.ts"),H=D("./src/utils/webvtt-parser.ts"),i=D("./src/utils/texttrack-utils.ts"),L=D("./src/utils/imsc1-ttml-parser.ts"),g=D("./src/types/loader.ts"),c=D("./src/utils/logger.ts"),m=function(){function l(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=p(),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 a=new W.default(this,"textTrack1"),C=new W.default(this,"textTrack2"),_=new W.default(this,"textTrack3"),T=new W.default(this,"textTrack4");this.cea608Parser1=new M.default(1,a,C),this.cea608Parser2=new M.default(3,_,T)}s.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(N.Events.FRAG_LOADING,this.onFragLoading,this),s.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var h=l.prototype;return h.destroy=function(){var a=this.hls;a.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),a.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.off(N.Events.FRAG_LOADING,this.onFragLoading,this),a.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),a.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},h.addCues=function(a,C,_,T,O){for(var R=!1,S=O.length;S--;){var w=O[S],E=o(w[0],w[1],C,_);if(E>=0&&(w[0]=Math.min(w[0],C),w[1]=Math.max(w[1],_),R=!0,E/(_-C)>.5))return}if(R||O.push([C,_]),this.config.renderTextTracksNatively){var f=this.captionsTracks[a];this.Cues.newCue(f,C,_,T)}else{var x=this.Cues.newCue(null,C,_,T);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:x,track:a})}},h.onInitPtsFound=function(a,C){var _=this,T=C.frag,O=C.id,R=C.initPTS,S=C.timescale,w=this.unparsedVttFrags;O==="main"&&(this.initPTS[T.cc]=R,this.timescale[T.cc]=S),w.length&&(this.unparsedVttFrags=[],w.forEach(function(E){_.onFragLoaded(N.Events.FRAG_LOADED,E)}))},h.getExistingTrack=function(a){var C=this.media;if(C)for(var _=0;_<C.textTracks.length;_++){var T=C.textTracks[_];if(T[a])return T}return null},h.createCaptionsTrack=function(a){this.config.renderTextTracksNatively?this.createNativeTrack(a):this.createNonNativeTrack(a)},h.createNativeTrack=function(a){if(this.captionsTracks[a])return;var C=this.captionsProperties,_=this.captionsTracks,T=this.media,O=C[a],R=O.label,S=O.languageCode,w=this.getExistingTrack(a);if(w)_[a]=w,Object(i.clearCurrentCues)(_[a]),Object(i.sendAddTrackEvent)(_[a],T);else{var E=this.createTextTrack("captions",R,S);E&&(E[a]=!0,_[a]=E)}},h.createNonNativeTrack=function(a){if(this.nonNativeCaptionsTracks[a])return;var C=this.captionsProperties[a];if(!C)return;var _=C.label,T={_id:a,label:_,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[a]=T,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},h.createTextTrack=function(a,C,_){var T=this.media;return T?T.addTextTrack(a,C,_):void 0},h.onMediaAttaching=function(a,C){this.media=C.media,this._cleanTracks()},h.onMediaDetaching=function(){var a=this.captionsTracks;Object.keys(a).forEach(function(C){Object(i.clearCurrentCues)(a[C]),delete a[C]}),this.nonNativeCaptionsTracks={}},h.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),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())},h._cleanTracks=function(){var a=this.media;if(!a)return;var C=a.textTracks;if(C)for(var _=0;_<C.length;_++)Object(i.clearCurrentCues)(C[_])},h.onSubtitleTracksUpdated=function(a,C){var _=this;this.textTracks=[];var T=C.subtitleTracks||[],O=T.some(function(E){return E.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var R=this.tracks&&T&&this.tracks.length===T.length;if(this.tracks=T||[],this.config.renderTextTracksNatively){var S=this.media?this.media.textTracks:[];this.tracks.forEach(function(E,f){var x;if(f<S.length){for(var v=null,y=0;y<S.length;y++)if(u(S[y],E)){v=S[y];break}v&&(x=v)}x?Object(i.clearCurrentCues)(x):(x=_.createTextTrack("subtitles",E.name,E.lang),x&&(x.mode="disabled")),x&&(x.groupId=E.groupId,_.textTracks.push(x))})}else if(!R&&this.tracks&&this.tracks.length){var w=this.tracks.map(function(E){return{label:E.name,kind:E.type.toLowerCase(),default:E.default,subtitleTrack:E}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:w})}}},h.onManifestLoaded=function(a,C){var _=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(T){var O=/(?:CC|SERVICE)([1-4])/.exec(T.instreamId);if(!O)return;var R="textTrack"+O[1],S=_.captionsProperties[R];if(!S)return;S.label=T.name,T.lang&&(S.languageCode=T.lang),S.media=T})},h.onFragLoading=function(a,C){var _=this.cea608Parser1,T=this.cea608Parser2,O=this.lastSn,R=this.lastPartIndex;if(!this.enabled||!(_&&T))return;if(C.frag.type===g.PlaylistLevelType.MAIN){var S,w,E=C.frag.sn,f=(S=C==null||((w=C.part)===null||w===void 0)?void 0:w.index)!=null?S:-1;E===O+1||E===O&&f===R+1||(_.reset(),T.reset()),this.lastSn=E,this.lastPartIndex=f}},h.onFragLoaded=function(a,C){var _=C.frag,T=C.payload,O=this.initPTS,R=this.unparsedVttFrags;if(_.type===g.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object(z.isFiniteNumber)(O[_.cc])){R.push(C),O.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:_,error:new Error("Missing initial subtitle PTS")});return}var S=_.decryptdata;if(S==null||S.key==null||S.method!=="AES-128"){var w=this.tracks[_.level],E=this.vttCCs;E[_.cc]||(E[_.cc]={start:_.start,prevCC:this.prevCC,new:!0},this.prevCC=_.cc),w&&w.textCodec===L.IMSC1_CODEC?this._parseIMSC1(_,T):this._parseVTTs(_,T,E)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:_,error:new Error("Empty subtitle payload")})},h._parseIMSC1=function(a,C){var _=this,T=this.hls;Object(L.parseIMSC1)(C,this.initPTS[a.cc],this.timescale[a.cc],function(O){_._appendCues(O,a.level),T.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(O){c.logger.log("Failed to parse IMSC1: "+O),T.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:O})})},h._parseVTTs=function(a,C,_){var T=this,O=this.hls;Object(H.parseWebVTT)(C,this.initPTS[a.cc],this.timescale[a.cc],_,a.cc,a.start,function(R){T._appendCues(R,a.level),O.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(R){T._fallbackToIMSC1(a,C),c.logger.log("Failed to parse VTT cue: "+R),O.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:R})})},h._fallbackToIMSC1=function(a,C){var _=this,T=this.tracks[a.level];T.textCodec||Object(L.parseIMSC1)(C,this.initPTS[a.cc],this.timescale[a.cc],function(){T.textCodec=L.IMSC1_CODEC,_._parseIMSC1(a,C)},function(){T.textCodec="wvtt"})},h._appendCues=function(a,C){var _=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[C];if(T.mode==="disabled")return;a.forEach(function(S){return Object(i.addCueToTrack)(T,S)})}else{var O=this.tracks[C],R=O.default?"default":"subtitles"+C;_.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:a,track:R})}},h.onFragDecrypted=function(a,C){var _=C.frag;if(_.type===g.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[_.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(N.Events.FRAG_LOADED,C)}},h.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},h.onFragParsingUserdata=function(a,C){var _=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(_&&T))return;for(var O=0;O<C.samples.length;O++){var R=C.samples[O].bytes;if(R){var S=this.extractCea608Data(R);_.addData(C.samples[O].pts,S[0]),T.addData(C.samples[O].pts,S[1])}}},h.onBufferFlushing=function(a,C){var _=C.startOffset,T=C.endOffset,O=C.endOffsetSubtitles,R=C.type,S=this.media;if(!S||S.currentTime<T)return;if(!R||R==="video"){var w=this.captionsTracks;Object.keys(w).forEach(function(f){return Object(i.removeCuesInRange)(w[f],_,T)})}if(this.config.renderTextTracksNatively&&(_===0&&O!==void 0)){var E=this.textTracks;Object.keys(E).forEach(function(f){return Object(i.removeCuesInRange)(E[f],_,O)})}},h.extractCea608Data=function(a){for(var C=a[0]&31,_=2,T=[[],[]],O=0;O<C;O++){var R=a[_++],S=127&a[_++],w=127&a[_++],E=(4&R)!==0,f=3&R;if(S===0&&w===0)continue;E&&((f===0||f===1)&&(T[f].push(S),T[f].push(w)))}return T},l}();function u(l,h){return l&&l.label===h.name&&!(l.textTrack1||l.textTrack2)}function o(l,h,s,a){return Math.min(h,a)-Math.max(l,s)}function p(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return z});var z=function(){function N(W,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=H}var M=N.prototype;return M.decrypt=function(H,i){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},i,H)},N}()},"./src/crypt/aes-decryptor.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"removePadding",function(){return N}),D.d(Y,"default",function(){return M});var z=D("./src/utils/typed-array.ts");function N(W){var H=W.byteLength,i=H&&new DataView(W.buffer).getUint8(H-1);return i?Object(z.sliceUint8)(W,0,H-i):W}var M=function(){function W(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var H=W.prototype;return H.uint8ArrayToUint32Array_=function(L){for(var g=new DataView(L),c=new Uint32Array(4),m=0;m<4;m++)c[m]=g.getUint32(m*4);return c},H.initTable=function(){var L=this.sBox,g=this.invSBox,c=this.subMix,m=c[0],u=c[1],o=c[2],p=c[3],l=this.invSubMix,h=l[0],s=l[1],a=l[2],C=l[3],_=new Uint32Array(256),T=0,O=0,R=0;for(R=0;R<256;R++)R<128?_[R]=R<<1:_[R]=R<<1^283;for(R=0;R<256;R++){var S=O^O<<1^O<<2^O<<3^O<<4;S=S>>>8^S&255^99,L[T]=S,g[S]=T;var w=_[T],E=_[w],f=_[E],x=_[S]*257^S*16843008;m[T]=x<<24|x>>>8,u[T]=x<<16|x>>>16,o[T]=x<<8|x>>>24,p[T]=x,x=f*16843009^E*65537^w*257^T*16843008,h[S]=x<<24|x>>>8,s[S]=x<<16|x>>>16,a[S]=x<<8|x>>>24,C[S]=x,T?(T=w^_[_[_[f^w]]],O^=_[_[O]]):T=O=1}},H.expandKey=function(L){for(var g=this.uint8ArrayToUint32Array_(L),c=!0,m=0;m<g.length&&c;)c=g[m]===this.key[m],m++;if(c)return;this.key=g;var u=this.keySize=g.length;if(u!==4&&u!==6&&u!==8)throw new Error("Invalid aes key size="+u);var o=this.ksRows=(u+6+1)*4,p,l,h=this.keySchedule=new Uint32Array(o),s=this.invKeySchedule=new Uint32Array(o),a=this.sBox,C=this.rcon,_=this.invSubMix,T=_[0],O=_[1],R=_[2],S=_[3],w,E;for(p=0;p<o;p++){if(p<u){w=h[p]=g[p];continue}E=w,p%u===0?(E=E<<8|E>>>24,E=a[E>>>24]<<24|a[E>>>16&255]<<16|a[E>>>8&255]<<8|a[E&255],E^=C[p/u|0]<<24):u>6&&p%u===4&&(E=a[E>>>24]<<24|a[E>>>16&255]<<16|a[E>>>8&255]<<8|a[E&255]),h[p]=w=(h[p-u]^E)>>>0}for(l=0;l<o;l++)p=o-l,l&3?E=h[p]:E=h[p-4],l<4||p<=4?s[l]=E:s[l]=T[a[E>>>24]]^O[a[E>>>16&255]]^R[a[E>>>8&255]]^S[a[E&255]],s[l]=s[l]>>>0},H.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},H.decrypt=function(L,g,c){for(var m=this.keySize+6,u=this.invKeySchedule,o=this.invSBox,p=this.invSubMix,l=p[0],h=p[1],s=p[2],a=p[3],C=this.uint8ArrayToUint32Array_(c),_=C[0],T=C[1],O=C[2],R=C[3],S=new Int32Array(L),w=new Int32Array(S.length),E,f,x,v,y,U,B,A,j,P,b,V,ne,ce,me=this.networkToHostOrderSwap;g<S.length;){for(j=me(S[g]),P=me(S[g+1]),b=me(S[g+2]),V=me(S[g+3]),y=j^u[0],U=V^u[1],B=b^u[2],A=P^u[3],ne=4,ce=1;ce<m;ce++)E=l[y>>>24]^h[U>>16&255]^s[B>>8&255]^a[A&255]^u[ne],f=l[U>>>24]^h[B>>16&255]^s[A>>8&255]^a[y&255]^u[ne+1],x=l[B>>>24]^h[A>>16&255]^s[y>>8&255]^a[U&255]^u[ne+2],v=l[A>>>24]^h[y>>16&255]^s[U>>8&255]^a[B&255]^u[ne+3],y=E,U=f,B=x,A=v,ne=ne+4;E=o[y>>>24]<<24^o[U>>16&255]<<16^o[B>>8&255]<<8^o[A&255]^u[ne],f=o[U>>>24]<<24^o[B>>16&255]<<16^o[A>>8&255]<<8^o[y&255]^u[ne+1],x=o[B>>>24]<<24^o[A>>16&255]<<16^o[y>>8&255]<<8^o[U&255]^u[ne+2],v=o[A>>>24]<<24^o[y>>16&255]<<16^o[U>>8&255]<<8^o[B&255]^u[ne+3],w[g]=me(E^_),w[g+1]=me(v^T),w[g+2]=me(x^O),w[g+3]=me(f^R),_=j,T=P,O=b,R=V,g=g+4}return w.buffer},W}()},"./src/crypt/decrypter.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return g});var z=D("./src/crypt/aes-crypto.ts"),N=D("./src/crypt/fast-aes-key.ts"),M=D("./src/crypt/aes-decryptor.ts"),W=D("./src/utils/logger.ts"),H=D("./src/utils/mp4-tools.ts"),i=D("./src/utils/typed-array.ts"),L=16,g=function(){function c(u,o,p){var l=p===void 0?{}:p,h=l.removePKCS7Padding,s=h===void 0?!0:h;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=u,this.config=o,this.removePKCS7Padding=s,s)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var m=c.prototype;return m.destroy=function(){this.observer=null},m.isSync=function(){return this.config.enableSoftwareAES},m.flush=function(){var o=this.currentResult;if(!o){this.reset();return}var p=new Uint8Array(o);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(p):p},m.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},m.decrypt=function(o,p,l,h){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(o),p,l);var s=this.flush();s&&h(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(o),p,l).then(h)},m.softwareDecrypt=function(o,p,l){var h=this.currentIV,s=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(o=Object(H.appendUint8Array)(a,o),this.remainderData=null);var C=this.getValidChunk(o);if(!C.length)return null;h&&(l=h);var _=this.softwareDecrypter;_||(_=this.softwareDecrypter=new M.default),_.expandKey(p);var T=s;return this.currentResult=_.decrypt(C.buffer,0,l),this.currentIV=Object(i.sliceUint8)(C,-16).buffer,T||null},m.webCryptoDecrypt=function(o,p,l){var h=this,s=this.subtle;return(this.key!==p||!this.fastAesKey)&&(this.key=p,this.fastAesKey=new N.default(s,p)),this.fastAesKey.expandKey().then(function(a){if(!s)return Promise.reject(new Error("web crypto not initialized"));var C=new z.default(s,l);return C.decrypt(o.buffer,a)}).catch(function(a){return h.onWebCryptoError(a,o,p,l)})},m.onWebCryptoError=function(o,p,l,h){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",o),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(p,l,h)},m.getValidChunk=function(o){var p=o,l=o.length-o.length%L;return l!==o.length&&(p=Object(i.sliceUint8)(o,0,l),this.remainderData=Object(i.sliceUint8)(o,l)),p},m.logOnce=function(o){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+o),this.logEnabled=!1},c}()},"./src/crypt/fast-aes-key.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return z});var z=function(){function N(W,H){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=H}var M=N.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/demux/base-audio-demuxer.ts"),N=D("./src/demux/adts.ts"),M=D("./src/utils/logger.ts"),W=D("./src/demux/id3.ts");function H(g,c){g.prototype=Object.create(c.prototype),g.prototype.constructor=g,i(g,c)}function i(g,c){return i=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},i(g,c)}var L=function(g){H(c,g);function c(u,o){var p;return p=g.call(this)||this,p.observer=void 0,p.config=void 0,p.observer=u,p.config=o,p}var m=c.prototype;return m.resetInitSegment=function(o,p,l){g.prototype.resetInitSegment.call(this,o,p,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:o,duration:l,inputTimeScale:9e4,dropped:0}},c.probe=function(o){if(!o)return!1;for(var p=W.getID3Data(o,0)||[],l=p.length,h=o.length;l<h;l++)if(N.probe(o,l))return M.logger.log("ADTS sync word found !"),!0;return!1},m.canParse=function(o,p){return N.canParse(o,p)},m.appendFrame=function(o,p,l){N.initTrackConfig(o,this.observer,p,l,o.manifestCodec);var h=N.appendFrame(o,p,l,this.initPTS,this.frameIndex);if(h&&h.missing===0)return h},c}(z.default);L.minProbeByteLength=9,Y.default=L},"./src/demux/adts.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"getAudioConfig",function(){return W}),D.d(Y,"isHeaderPattern",function(){return H}),D.d(Y,"getHeaderLength",function(){return i}),D.d(Y,"getFullFrameLength",function(){return L}),D.d(Y,"canGetFrameLength",function(){return g}),D.d(Y,"isHeader",function(){return c}),D.d(Y,"canParse",function(){return m}),D.d(Y,"probe",function(){return u}),D.d(Y,"initTrackConfig",function(){return o}),D.d(Y,"getFrameDuration",function(){return p}),D.d(Y,"parseFrameHeader",function(){return l}),D.d(Y,"appendFrame",function(){return h});var z=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),M=D("./src/events.ts");function W(s,a,C,_){var T,O,R,S,w=navigator.userAgent.toLowerCase(),E=_,f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((a[C+2]&192)>>>6)+1;var x=(a[C+2]&60)>>>2;if(x>f.length-1){s.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return R=(a[C+2]&1)<<2,R|=(a[C+3]&192)>>>6,z.logger.log("manifest codec:"+_+", ADTS type:"+T+", samplingIndex:"+x),/firefox/i.test(w)?x>=6?(T=5,S=new Array(4),O=x-3):(T=2,S=new Array(2),O=x):w.indexOf("android")!==-1?(T=2,S=new Array(2),O=x):(T=5,S=new Array(4),_&&(_.indexOf("mp4a.40.29")!==-1||_.indexOf("mp4a.40.5")!==-1)||!_&&x>=6?O=x-3:((_&&_.indexOf("mp4a.40.2")!==-1&&(x>=6&&R===1||/vivaldi/i.test(w))||!_&&R===1)&&(T=2,S=new Array(2)),O=x)),S[0]=T<<3,S[0]|=(x&14)>>1,S[1]|=(x&1)<<7,S[1]|=R<<3,T===5&&(S[1]|=(O&14)>>1,S[2]=(O&1)<<7,S[2]|=2<<2,S[3]=0),{config:S,samplerate:f[x],channelCount:R,codec:"mp4a.40."+T,manifestCodec:E}}function H(s,a){return s[a]===255&&(s[a+1]&246)===240}function i(s,a){return s[a+1]&1?7:9}function L(s,a){return(s[a+3]&3)<<11|s[a+4]<<3|(s[a+5]&224)>>>5}function g(s,a){return a+5<s.length}function c(s,a){return a+1<s.length&&H(s,a)}function m(s,a){return g(s,a)&&H(s,a)&&L(s,a)<=s.length-a}function u(s,a){if(c(s,a)){var C=i(s,a);if(a+C>=s.length)return!1;var _=L(s,a);if(_<=C)return!1;var T=a+_;return T===s.length||c(s,T)}return!1}function o(s,a,C,_,T){if(!s.samplerate){var O=W(a,C,_,T);if(!O)return;s.config=O.config,s.samplerate=O.samplerate,s.channelCount=O.channelCount,s.codec=O.codec,s.manifestCodec=O.manifestCodec,z.logger.log("parsed codec:"+s.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function p(s){return 1024*9e4/s}function l(s,a,C,_,T){var O=i(s,a),R=L(s,a);if(R-=O,R>0){var S=C+_*T;return{headerLength:O,frameLength:R,stamp:S}}}function h(s,a,C,_,T){var O=p(s.samplerate),R=l(a,C,_,T,O);if(R){var S=R.frameLength,w=R.headerLength,E=R.stamp,f=w+S,x=Math.max(0,C+f-a.length),v;x?(v=new Uint8Array(f-w),v.set(a.subarray(C+w,a.length),0)):v=a.subarray(C+w,C+f);var y={unit:v,pts:E};return x||s.samples.push(y),{sample:y,length:f,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"initPTSFn",function(){return L});var z=D("./src/polyfills/number.ts"),N=D("./src/demux/id3.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),W=D("./src/utils/mp4-tools.ts"),H=D("./src/utils/typed-array.ts"),i=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var c=g.prototype;return c.resetInitSegment=function(u,o,p){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},c.resetTimeStamp=function(){},c.resetContiguity=function(){},c.canParse=function(u,o){return!1},c.appendFrame=function(u,o,p){},c.demux=function(u,o){this.cachedData&&(u=Object(W.appendUint8Array)(this.cachedData,u),this.cachedData=null);var p=N.getID3Data(u,0),l=p?p.length:0,h,s,a=this._audioTrack,C=this._id3Track,_=p?N.getTimeStamp(p):void 0,T=u.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(_,o)),p&&p.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:p}),s=this.initPTS;l<T;){if(this.canParse(u,l)){var O=this.appendFrame(a,u,l);O?(this.frameIndex++,s=O.sample.pts,l+=O.length,h=l):l=T}else N.canParse(u,l)?(p=N.getID3Data(u,l),C.samples.push({pts:s,dts:s,data:p}),l+=p.length,h=l):l++;if(l===T&&h!==T){var R=Object(H.sliceUint8)(u,h);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,R):this.cachedData=R}}return{audioTrack:a,avcTrack:Object(M.dummyTrack)(),id3Track:C,textTrack:Object(M.dummyTrack)()}},c.demuxSampleAes=function(u,o,p){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},c.flush=function(u){var o=this.cachedData;return o&&(this.cachedData=null,this.demux(o,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},c.destroy=function(){},g}(),L=function(c,m){return Object(z.isFiniteNumber)(c)?c*90:m*9e4};Y.default=i},"./src/demux/chunk-cache.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return z});var z=function(){function M(){this.chunks=[],this.dataLength=0}var W=M.prototype;return W.push=function(i){this.chunks.push(i),this.dataLength+=i.length},W.flush=function(){var i=this.chunks,L=this.dataLength,g;if(i.length)i.length===1?g=i[0]:g=N(i,L);else return new Uint8Array(0);return this.reset(),g},W.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function N(M,W){for(var H=new Uint8Array(W),i=0,L=0;L<M.length;L++){var g=M[L];H.set(g,i),i+=g.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/utils/logger.ts"),N=function(){function M(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var W=M.prototype;return W.loadWord=function(){var i=this.data,L=this.bytesAvailable,g=i.byteLength-L,c=new Uint8Array(4),m=Math.min(4,L);if(m===0)throw new Error("no bytes available");c.set(i.subarray(g,g+m)),this.word=new DataView(c.buffer).getUint32(0),this.bitsAvailable=m*8,this.bytesAvailable-=m},W.skipBits=function(i){var L;this.bitsAvailable>i?(this.word<<=i,this.bitsAvailable-=i):(i-=this.bitsAvailable,L=i>>3,i-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=i,this.bitsAvailable-=i)},W.readBits=function(i){var L=Math.min(this.bitsAvailable,i),g=this.word>>>32-L;return i>32&&z.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=i-L,L>0&&this.bitsAvailable?g<<L|this.readBits(L):g},W.skipLZ=function(){var i;for(i=0;i<this.bitsAvailable;++i)if((this.word&2147483648>>>i)!==0)return this.word<<=i,this.bitsAvailable-=i,i;return this.loadWord(),i+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var i=this.skipLZ();return this.readBits(i+1)-1},W.readEG=function(){var i=this.readUEG();return 1&i?1+i>>>1:-1*(i>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(i){for(var L=8,g=8,c,m=0;m<i;m++)g!==0&&(c=this.readEG(),g=(L+c+256)%256),L=g===0?L:g},W.readSPS=function(){var i=0,L=0,g=0,c=0,m,u,o,p=this.readUByte.bind(this),l=this.readBits.bind(this),h=this.readUEG.bind(this),s=this.readBoolean.bind(this),a=this.skipBits.bind(this),C=this.skipEG.bind(this),_=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);p();var O=p();if(l(5),a(3),p(),_(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var R=h();if(R===3&&a(1),_(),_(),a(1),s())for(u=R!==3?8:12,o=0;o<u;o++)s()&&(o<6?T(16):T(64))}_();var S=h();if(S===0)h();else if(S===1)for(a(1),C(),C(),m=h(),o=0;o<m;o++)C();_(),a(1);var w=h(),E=h(),f=l(1);f===0&&a(1),a(1),s()&&(i=h(),L=h(),g=h(),c=h());var x=[1,1];if(s()&&s()){var v=p();switch(v){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[p()<<8|p(),p()<<8|p()];break}}}return{width:Math.ceil((w+1)*16-i*2-L*2),height:(2-f)*(E+1)*16-(f?2:4)*(g+c),pixelRatio:x}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();Y.default=N},"./src/demux/id3.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isHeader",function(){return z}),D.d(Y,"isFooter",function(){return N}),D.d(Y,"getID3Data",function(){return M}),D.d(Y,"canParse",function(){return H}),D.d(Y,"getTimeStamp",function(){return i}),D.d(Y,"isTimeStampFrame",function(){return L}),D.d(Y,"getID3Frames",function(){return c}),D.d(Y,"decodeFrame",function(){return m}),D.d(Y,"utf8ArrayToStr",function(){return h}),D.d(Y,"testables",function(){return s});var z=function(T,O){return O+10<=T.length&&(T[O]===73&&T[O+1]===68&&T[O+2]===51&&(T[O+3]<255&&T[O+4]<255&&(T[O+6]<128&&T[O+7]<128&&T[O+8]<128&&T[O+9]<128)))},N=function(T,O){return O+10<=T.length&&(T[O]===51&&T[O+1]===68&&T[O+2]===73&&(T[O+3]<255&&T[O+4]<255&&(T[O+6]<128&&T[O+7]<128&&T[O+8]<128&&T[O+9]<128)))},M=function(T,O){for(var R=O,S=0;z(T,O);){S+=10;var w=W(T,O+6);S+=w,N(T,O+10)&&(S+=10),O+=S}return S>0?T.subarray(R,R+S):void 0},W=function(T,O){var R=0;return R=(T[O]&127)<<21,R|=(T[O+1]&127)<<14,R|=(T[O+2]&127)<<7,R|=T[O+3]&127,R},H=function(T,O){return z(T,O)&&W(T,O+6)+10<=T.length-O},i=function(T){for(var O=c(T),R=0;R<O.length;R++){var S=O[R];if(L(S))return l(S)}return},L=function(T){return T&&T.key==="PRIV"&&T.info==="com.apple.streaming.transportStreamTimestamp"},g=function(T){var O=String.fromCharCode(T[0],T[1],T[2],T[3]),R=W(T,4),S=10;return{type:O,size:R,data:T.subarray(S,S+R)}},c=function(T){for(var O=0,R=[];z(T,O);){var S=W(T,O+6);O+=10;for(var w=O+S;O+8<w;){var E=g(T.subarray(O)),f=m(E);f&&R.push(f),O+=E.size+10}N(T,O)&&(O+=10)}return R},m=function(T){return T.type==="PRIV"?u(T):T.type[0]==="W"?p(T):o(T)},u=function(T){if(T.size<2)return;var O=h(T.data,!0),R=new Uint8Array(T.data.subarray(O.length+1));return{key:T.type,info:O,data:R.buffer}},o=function(T){if(T.size<2)return;if(T.type==="TXXX"){var O=1,R=h(T.data.subarray(O),!0);O+=R.length+1;var S=h(T.data.subarray(O));return{key:T.type,info:R,data:S}}var w=h(T.data.subarray(1));return{key:T.type,data:w}},p=function(T){if(T.type==="WXXX"){if(T.size<2)return;var O=1,R=h(T.data.subarray(O),!0);O+=R.length+1;var S=h(T.data.subarray(O));return{key:T.type,info:R,data:S}}var w=h(T.data);return{key:T.type,data:w}},l=function(T){if(T.data.byteLength===8){var O=new Uint8Array(T.data),R=O[3]&1,S=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return S/=45,R&&(S+=4772185884e-2),Math.round(S)}return},h=function(T,O){O===void 0&&(O=!1);var R=C();if(R){var S=R.decode(T);if(O){var w=S.indexOf("\0");return w!==-1?S.substring(0,w):S}return S.replace(/\0/g,"")}for(var E=T.length,f,x,v,y="",U=0;U<E;){if(f=T[U++],f===0&&O)return y;if(f===0||f===3)continue;switch(f>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(f);break;case 12:case 13:x=T[U++],y+=String.fromCharCode((f&31)<<6|x&63);break;case 14:x=T[U++],v=T[U++],y+=String.fromCharCode((f&15)<<12|(x&63)<<6|(v&63)<<0);break;default:}}return y},s={decodeTextFrame:o},a;function C(){return!a&&typeof self.TextDecoder!="undefined"&&(a=new self.TextDecoder("utf-8")),a}},"./src/demux/mp3demuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/demux/base-audio-demuxer.ts"),N=D("./src/demux/id3.ts"),M=D("./src/utils/logger.ts"),W=D("./src/demux/mpegaudio.ts");function H(g,c){g.prototype=Object.create(c.prototype),g.prototype.constructor=g,i(g,c)}function i(g,c){return i=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},i(g,c)}var L=function(g){H(c,g);function c(){return g.apply(this,arguments)||this}var m=c.prototype;return m.resetInitSegment=function(o,p,l){g.prototype.resetInitSegment.call(this,o,p,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:o,duration:l,inputTimeScale:9e4,dropped:0}},c.probe=function(o){if(!o)return!1;for(var p=N.getID3Data(o,0)||[],l=p.length,h=o.length;l<h;l++)if(W.probe(o,l))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},m.canParse=function(o,p){return W.canParse(o,p)},m.appendFrame=function(o,p,l){return this.initPTS===null?void 0:W.appendFrame(o,p,l,this.initPTS,this.frameIndex)},c}(z.default);L.minProbeByteLength=4,Y.default=L},"./src/demux/mp4demuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/utils/mp4-tools.ts"),N=D("./src/demux/dummy-demuxed-track.ts"),M=function(){function W(i,L){this.remainderData=null,this.config=void 0,this.config=L}var H=W.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},W.probe=function(L){return Object(z.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},H.demux=function(L){var g=L,c=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(z.appendUint8Array)(this.remainderData,L));var m=Object(z.segmentValidRange)(g);this.remainderData=m.remainder,c.samples=m.valid||new Uint8Array}else c.samples=g;return{audioTrack:Object(N.dummyTrack)(),avcTrack:c,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},H.flush=function(){var L=Object(N.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:L,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},H.demuxSampleAes=function(L,g,c){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},W}();M.minProbeByteLength=1024,Y.default=M},"./src/demux/mpegaudio.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"appendFrame",function(){return i}),D.d(Y,"parseHeader",function(){return L}),D.d(Y,"isHeaderPattern",function(){return g}),D.d(Y,"isHeader",function(){return c}),D.d(Y,"canParse",function(){return m}),D.d(Y,"probe",function(){return u});var z=null,N=[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],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function i(o,p,l,h,s){if(l+24>p.length)return;var a=L(p,l);if(a&&l+a.frameLength<=p.length){var C=a.samplesPerFrame*9e4/a.sampleRate,_=h+s*C,T={unit:p.subarray(l,l+a.frameLength),pts:_,dts:_};return o.config=[],o.channelCount=a.channelCount,o.samplerate=a.sampleRate,o.samples.push(T),{sample:T,length:a.frameLength,missing:0}}}function L(o,p){var l=o[p+1]>>3&3,h=o[p+1]>>1&3,s=o[p+2]>>4&15,a=o[p+2]>>2&3;if(l!==1&&s!==0&&s!==15&&a!==3){var C=o[p+2]>>1&1,_=o[p+3]>>6,T=l===3?3-h:h===3?3:4,O=N[T*14+s-1]*1e3,R=l===3?0:l===2?1:2,S=M[R*3+a],w=_===3?1:2,E=W[l][h],f=H[h],x=E*8*f,v=Math.floor(E*O/S+C)*f;if(z===null){var y=navigator.userAgent||"",U=y.match(/Chrome\/(\d+)/i);z=U?parseInt(U[1]):0}var B=!!z&&z<=87;return B&&h===2&&O>=224e3&&_===0&&(o[p+3]=o[p+3]|128),{sampleRate:S,channelCount:w,frameLength:v,samplesPerFrame:x}}}function g(o,p){return o[p]===255&&(o[p+1]&224)===224&&(o[p+1]&6)!==0}function c(o,p){return p+1<o.length&&g(o,p)}function m(o,p){var l=4;return g(o,p)&&l<=o.length-p}function u(o,p){if(p+1<o.length&&g(o,p)){var l=4,h=L(o,p),s=l;h!=null&&h.frameLength&&(s=h.frameLength);var a=p+s;return a===o.length||c(o,a)}return!1}},"./src/demux/sample-aes.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/crypt/decrypter.ts"),N=D("./src/demux/tsdemuxer.ts"),M=function(){function W(i,L,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new z.default(i,L,{removePKCS7Padding:!1})}var H=W.prototype;return H.decryptBuffer=function(L,g){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,g)},H.decryptAacSample=function(L,g,c,m){var u=L[g].unit,o=u.subarray(16,u.length-u.length%16),p=o.buffer.slice(o.byteOffset,o.byteOffset+o.length),l=this;this.decryptBuffer(p,function(h){var s=new Uint8Array(h);u.set(s,16),m||l.decryptAacSamples(L,g+1,c)})},H.decryptAacSamples=function(L,g,c){for(;;g++){if(g>=L.length){c();return}if(L[g].unit.length<32)continue;var m=this.decrypter.isSync();if(this.decryptAacSample(L,g,c,m),!m)return}},H.getAvcEncryptedData=function(L){for(var g=Math.floor((L.length-48)/160)*16+16,c=new Int8Array(g),m=0,u=32;u<=L.length-16;u+=160,m+=16)c.set(L.subarray(u,u+16),m);return c},H.getAvcDecryptedUnit=function(L,g){for(var c=new Uint8Array(g),m=0,u=32;u<=L.length-16;u+=160,m+=16)L.set(c.subarray(m,m+16),u);return L},H.decryptAvcSample=function(L,g,c,m,u,o){var p=Object(N.discardEPB)(u.data),l=this.getAvcEncryptedData(p),h=this;this.decryptBuffer(l.buffer,function(s){u.data=h.getAvcDecryptedUnit(p,s),o||h.decryptAvcSamples(L,g,c+1,m)})},H.decryptAvcSamples=function(L,g,c,m){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,c=0){if(g>=L.length){m();return}for(var u=L[g].units;!(c>=u.length);c++){var o=u[c];if(o.data.length<=48||o.type!==1&&o.type!==5)continue;var p=this.decrypter.isSync();if(this.decryptAvcSample(L,g,c,m,o,p),!p)return}}},W}();Y.default=M},"./src/demux/transmuxer-interface.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return u});var z=D("./node_modules/webworkify-webpack/index.js"),N=D.n(z),M=D("./src/events.ts"),W=D("./src/demux/transmuxer.ts"),H=D("./src/utils/logger.ts"),i=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),g=D("./node_modules/eventemitter3/index.js"),c=D.n(g),m=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},u=function(){function o(l,h,s,a){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=h,this.onTransmuxComplete=s,this.onFlush=a;var _=l.config,T=function(E,f){f=f||{},f.frag=C.frag,f.id=C.id,l.trigger(E,f)};this.observer=new g.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,T),this.observer.on(M.Events.ERROR,T);var O={mp4:m.isTypeSupported("video/mp4"),mpeg:m.isTypeSupported("audio/mpeg"),mp3:m.isTypeSupported('audio/mp4; codecs="mp3"')},R=navigator.vendor;if(_.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var S;try{S=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),S.addEventListener("message",this.onwmsg),S.onerror=function(w){l.trigger(M.Events.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(w.message+" ("+w.filename+":"+w.lineno+")")})},S.postMessage({cmd:"init",typeSupported:O,vendor:R,id:h,config:JSON.stringify(_)})}catch(w){H.logger.warn("Error in worker:",w),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),S&&self.URL.revokeObjectURL(S.objectURL),this.transmuxer=new W.default(this.observer,O,_,R,h),this.worker=null}}else this.transmuxer=new W.default(this.observer,O,_,R,h)}var p=o.prototype;return p.destroy=function(){var h=this.worker;if(h)h.removeEventListener("message",this.onwmsg),h.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var a=this.observer;a&&a.removeAllListeners(),this.observer=null},p.push=function(h,s,a,C,_,T,O,R,S,w){var E=this;S.transmuxing.start=self.performance.now();var f=this.transmuxer,x=this.worker,v=T?T.start:_.start,y=_.decryptdata,U=this.frag,B=!(U&&_.cc===U.cc),A=!(U&&S.level===U.level),j=U?S.sn-U.sn:-1,P=this.part?S.part-this.part.index:1,b=!A&&(j===1||j===0&&P===1),V=self.performance.now();(A||j||_.stats.parsing.start===0)&&(_.stats.parsing.start=V),T&&(P||!b)&&(T.stats.parsing.start=V);var ne=new W.TransmuxState(B,b,R,A,v);if(!b||B){H.logger.log("[transmuxer-interface, "+_.type+"]: Starting new transmux session for sn: "+S.sn+" p: "+S.part+" level: "+S.level+" id: "+S.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+A+`
|
|
contiguous: `+b+`
|
|
accurateTimeOffset: `+R+`
|
|
timeOffset: `+v);var ce=new W.TransmuxConfig(a,C,s,O,w);this.configureTransmuxer(ce)}if(this.frag=_,this.part=T,x)x.postMessage({cmd:"demux",data:h,decryptdata:y,chunkMeta:S,state:ne},h instanceof ArrayBuffer?[h]:[]);else if(f){var me=f.push(h,y,S,ne);Object(W.isPromise)(me)?me.then(function(Ie){E.handleTransmuxComplete(Ie)}):this.handleTransmuxComplete(me)}},p.flush=function(h){var s=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:h});else if(a){var _=a.flush(h);Object(W.isPromise)(_)?_.then(function(T){s.handleFlushResult(T,h)}):this.handleFlushResult(_,h)}},p.handleFlushResult=function(h,s){var a=this;h.forEach(function(C){a.handleTransmuxComplete(C)}),this.onFlush(s)},p.onWorkerMessage=function(h){var s=h.data,a=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,a.trigger(s.event,s.data);break}}},p.configureTransmuxer=function(h){var s=this.worker,a=this.transmuxer;s?s.postMessage({cmd:"configure",config:h}):a&&a.configure(h)},p.handleTransmuxComplete=function(h){h.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(h)},o}()},"./src/demux/transmuxer-worker.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return i});var z=D("./src/demux/transmuxer.ts"),N=D("./src/events.ts"),M=D("./src/utils/logger.ts"),W=D("./node_modules/eventemitter3/index.js"),H=D.n(W);function i(u){var o=new W.EventEmitter,p=function(h,s){u.postMessage({event:h,data:s})};o.on(N.Events.FRAG_DECRYPTED,p),o.on(N.Events.ERROR,p),u.addEventListener("message",function(l){var h=l.data;switch(h.cmd){case"init":{var s=JSON.parse(h.config);u.transmuxer=new z.default(o,h.typeSupported,s,h.vendor,h.id),Object(M.enableLogs)(s.debug),p("init",null);break}case"configure":{u.transmuxer.configure(h.config);break}case"demux":{var a=u.transmuxer.push(h.data,h.decryptdata,h.chunkMeta,h.state);Object(z.isPromise)(a)?a.then(function(T){L(u,T)}):L(u,a);break}case"flush":{var C=h.chunkMeta,_=u.transmuxer.flush(C);Object(z.isPromise)(_)?_.then(function(T){c(u,T,C)}):c(u,_,C);break}default:break}})}function L(u,o){if(m(o.remuxResult))return;var p=[],l=o.remuxResult,h=l.audio,s=l.video;h&&g(p,h),s&&g(p,s),u.postMessage({event:"transmuxComplete",data:o},p)}function g(u,o){o.data1&&u.push(o.data1.buffer),o.data2&&u.push(o.data2.buffer)}function c(u,o,p){o.forEach(function(l){L(u,l)}),u.postMessage({event:"flush",data:p})}function m(u){return!u.audio&&!u.video&&!u.text&&!u.id3&&!u.initSegment}},"./src/demux/transmuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return s}),D.d(Y,"isPromise",function(){return _}),D.d(Y,"TransmuxConfig",function(){return T}),D.d(Y,"TransmuxState",function(){return O});var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),H=D("./src/demux/mp4demuxer.ts"),i=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),g=D("./src/remux/mp4-remuxer.ts"),c=D("./src/remux/passthrough-remuxer.ts"),m=D("./src/demux/chunk-cache.ts"),u=D("./src/utils/mp4-tools.ts"),o=D("./src/utils/logger.ts"),p;try{p=self.performance.now.bind(self.performance)}catch(R){o.logger.debug("Unable to use Performance API on this environment"),p=self.Date.now}var l=[{demux:i.default,remux:g.default},{demux:H.default,remux:c.default},{demux:W.default,remux:g.default},{demux:L.default,remux:g.default}],h=1024;l.forEach(function(R){var S=R.demux;h=Math.max(h,S.minProbeByteLength)});var s=function(){function R(w,E,f,x,v){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new m.default,this.observer=w,this.typeSupported=E,this.config=f,this.vendor=x,this.id=v}var S=R.prototype;return S.configure=function(E){this.transmuxConfig=E,this.decrypter&&this.decrypter.reset()},S.push=function(E,f,x,v){var y=this,U=x.transmuxing;U.executeStart=p();var B=new Uint8Array(E),A=this.cache,j=this.config,P=this.currentTransmuxState,b=this.transmuxConfig;v&&(this.currentTransmuxState=v);var V=a(B,f);if(V&&V.method==="AES-128"){var ne=this.getDecrypter();if(j.enableSoftwareAES){var ce=ne.softwareDecrypt(B,V.key.buffer,V.iv.buffer);if(!ce)return U.executeEnd=p(),C(x);B=new Uint8Array(ce)}else return this.decryptionPromise=ne.webCryptoDecrypt(B,V.key.buffer,V.iv.buffer).then(function(Te){var ke=y.push(Te,null,x);return y.decryptionPromise=null,ke}),this.decryptionPromise}var me=v||P,Ie=me.contiguous,we=me.discontinuity,Le=me.trackSwitch,Re=me.accurateTimeOffset,De=me.timeOffset,ye=b.audioCodec,X=b.videoCodec,k=b.defaultInitPts,F=b.duration,$=b.initSegmentData;if((we||Le)&&this.resetInitSegment($,ye,X,F),we&&this.resetInitialTimestamp(k),Ie||this.resetContiguity(),this.needsProbing(B,we,Le)){if(A.dataLength){var te=A.flush();B=Object(u.appendUint8Array)(te,B)}this.configureTransmuxer(B,b)}var K=this.transmux(B,V,De,Re,x),pe=this.currentTransmuxState;return pe.contiguous=!0,pe.discontinuity=!1,pe.trackSwitch=!1,U.executeEnd=p(),K},S.flush=function(E){var f=this,x=E.transmuxing;x.executeStart=p();var v=this.decrypter,y=this.cache,U=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return f.flush(E)});var A=[],j=U.timeOffset;if(v){var P=v.flush();P&&A.push(this.push(P,null,E))}var b=y.dataLength;y.reset();var V=this.demuxer,ne=this.remuxer;if(!V||!ne)return b>=h&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=p(),[C(E)];var ce=V.flush(j);return _(ce)?ce.then(function(me){return f.flushRemux(A,me,E),A}):(this.flushRemux(A,ce,E),A)},S.flushRemux=function(E,f,x){var v=f.audioTrack,y=f.avcTrack,U=f.id3Track,B=f.textTrack,A=this.currentTransmuxState,j=A.accurateTimeOffset,P=A.timeOffset;o.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var b=this.remuxer.remux(v,y,U,B,P,j,!0,this.id);E.push({remuxResult:b,chunkMeta:x}),x.transmuxing.executeEnd=p()},S.resetInitialTimestamp=function(E){var f=this.demuxer,x=this.remuxer;if(!f||!x)return;f.resetTimeStamp(E),x.resetTimeStamp(E)},S.resetContiguity=function(){var E=this.demuxer,f=this.remuxer;if(!E||!f)return;E.resetContiguity(),f.resetNextTimestamp()},S.resetInitSegment=function(E,f,x,v){var y=this.demuxer,U=this.remuxer;if(!y||!U)return;y.resetInitSegment(f,x,v),U.resetInitSegment(E,f,x)},S.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},S.transmux=function(E,f,x,v,y){var U;return f&&f.method==="SAMPLE-AES"?U=this.transmuxSampleAes(E,f,x,v,y):U=this.transmuxUnencrypted(E,x,v,y),U},S.transmuxUnencrypted=function(E,f,x,v){var y=this.demuxer.demux(E,f,!1,!this.config.progressive),U=y.audioTrack,B=y.avcTrack,A=y.id3Track,j=y.textTrack,P=this.remuxer.remux(U,B,A,j,f,x,!1,this.id);return{remuxResult:P,chunkMeta:v}},S.transmuxSampleAes=function(E,f,x,v,y){var U=this;return this.demuxer.demuxSampleAes(E,f,x).then(function(B){var A=U.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,x,v,!1,U.id);return{remuxResult:A,chunkMeta:y}})},S.configureTransmuxer=function(E,f){for(var x=this.config,v=this.observer,y=this.typeSupported,U=this.vendor,B=f.audioCodec,A=f.defaultInitPts,j=f.duration,P=f.initSegmentData,b=f.videoCodec,V,ne=0,ce=l.length;ne<ce;ne++)if(l[ne].demux.probe(E)){V=l[ne];break}V||(o.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),V={demux:H.default,remux:c.default});var me=this.demuxer,Ie=this.remuxer,we=V.remux,Le=V.demux;(!Ie||!(Ie instanceof we))&&(this.remuxer=new we(v,x,y,U)),(!me||!(me instanceof Le))&&(this.demuxer=new Le(v,x,y),this.probe=Le.probe),this.resetInitSegment(P,B,b,j),this.resetInitialTimestamp(A)},S.needsProbing=function(E,f,x){return!this.demuxer||!this.remuxer||f||x},S.getDecrypter=function(){var E=this.decrypter;return E||(E=this.decrypter=new M.default(this.observer,this.config)),E},R}();function a(R,S){var w=null;return R.byteLength>0&&S!=null&&S.key!=null&&S.iv!==null&&S.method!=null&&(w=S),w}var C=function(S){return{remuxResult:{},chunkMeta:S}};function _(R){return"then"in R&&R.then instanceof Function}var T=function(S,w,E,f,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=S,this.videoCodec=w,this.initSegmentData=E,this.duration=f,this.defaultInitPts=x},O=function(S,w,E,f,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=S,this.contiguous=w,this.accurateTimeOffset=E,this.trackSwitch=f,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"discardEPB",function(){return C});var z=D("./src/demux/adts.ts"),N=D("./src/demux/mpegaudio.ts"),M=D("./src/demux/exp-golomb.ts"),W=D("./src/demux/id3.ts"),H=D("./src/demux/sample-aes.ts"),i=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),g=D("./src/utils/logger.ts"),c=D("./src/errors.ts"),m={video:1,audio:2,id3:3,text:4},u=function(){function _(O,R,S){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=O,this.config=R,this.typeSupported=S}_.probe=function(R){var S=_.syncOffset(R);return S<0?!1:(S&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+S+", junk ahead ?"),!0)},_.syncOffset=function(R){for(var S=Math.min(1e3,R.length-3*188),w=0;w<S;){if(R[w]===71&&R[w+188]===71&&R[w+2*188]===71)return w;w++}return-1},_.createTrack=function(R,S){return{container:R==="video"||R==="audio"?"video/mp2t":void 0,type:R,id:m[R],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:R==="audio"?S:void 0}};var T=_.prototype;return T.resetInitSegment=function(R,S,w){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=_.createTrack("video",w),this._audioTrack=_.createTrack("audio",w),this._id3Track=_.createTrack("id3",w),this._txtTrack=_.createTrack("text",w),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=R,this.videoCodec=S,this._duration=w},T.resetTimeStamp=function(){},T.resetContiguity=function(){var R=this._audioTrack,S=this._avcTrack,w=this._id3Track;R&&(R.pesData=null),S&&(S.pesData=null),w&&(w.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(R,S,w,E){w===void 0&&(w=!1),E===void 0&&(E=!1),w||(this.sampleAes=null);var f,x=this._avcTrack,v=this._audioTrack,y=this._id3Track,U=x.pid,B=x.pesData,A=v.pid,j=y.pid,P=v.pesData,b=y.pesData,V=!1,ne=this.pmtParsed,ce=this._pmtId,me=R.length;if(this.remainderData&&(R=Object(L.appendUint8Array)(this.remainderData,R),me=R.length,this.remainderData=null),me<188&&!E)return this.remainderData=R,{audioTrack:v,avcTrack:x,id3Track:y,textTrack:this._txtTrack};var Ie=Math.max(0,_.syncOffset(R));me-=(me+Ie)%188,me<R.byteLength&&!E&&(this.remainderData=new Uint8Array(R.buffer,me,R.buffer.byteLength-me));for(var we=Ie;we<me;we+=188)if(R[we]===71){var Le=!!(R[we+1]&64),Re=((R[we+1]&31)<<8)+R[we+2],De=(R[we+3]&48)>>4,ye=void 0;if(De>1){if(ye=we+5+R[we+4],ye===we+188)continue}else ye=we+4;switch(Re){case U:Le&&(B&&(f=h(B))&&this.parseAVCPES(f,!1),B={data:[],size:0}),B&&(B.data.push(R.subarray(ye,we+188)),B.size+=we+188-ye);break;case A:Le&&(P&&(f=h(P))&&(v.isAAC?this.parseAACPES(f):this.parseMPEGPES(f)),P={data:[],size:0}),P&&(P.data.push(R.subarray(ye,we+188)),P.size+=we+188-ye);break;case j:Le&&(b&&(f=h(b))&&this.parseID3PES(f),b={data:[],size:0}),b&&(b.data.push(R.subarray(ye,we+188)),b.size+=we+188-ye);break;case 0:Le&&(ye+=R[ye]+1),ce=this._pmtId=p(R,ye);break;case ce:{Le&&(ye+=R[ye]+1);var X=l(R,ye,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,w);U=X.avc,U>0&&(x.pid=U),A=X.audio,A>0&&(v.pid=A,v.isAAC=X.isAAC),j=X.id3,j>0&&(y.pid=j),V&&!ne&&(g.logger.log("reparse from beginning"),V=!1,we=Ie-188),ne=this.pmtParsed=!0;break}case 17:case 8191:break;default:V=!0;break}}else this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=B,v.pesData=P,y.pesData=b;var k={audioTrack:v,avcTrack:x,id3Track:y,textTrack:this._txtTrack};return E&&this.extractRemainingSamples(k),k},T.flush=function(){var R=this.remainderData;this.remainderData=null;var S;return R?S=this.demux(R,-1,!1,!0):S={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(S),this.sampleAes?this.decrypt(S,this.sampleAes):S},T.extractRemainingSamples=function(R){var S=R.audioTrack,w=R.avcTrack,E=R.id3Track,f=w.pesData,x=S.pesData,v=E.pesData,y;f&&(y=h(f))?(this.parseAVCPES(y,!0),w.pesData=null):w.pesData=f,x&&(y=h(x))?(S.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),S.pesData=null):(x!=null&&x.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),S.pesData=x),v&&(y=h(v))?(this.parseID3PES(y),E.pesData=null):E.pesData=v},T.demuxSampleAes=function(R,S,w){var E=this.demux(R,w,!0,!this.config.progressive),f=this.sampleAes=new H.default(this.observer,this.config,S);return this.decrypt(E,f)},T.decrypt=function(R,S){return new Promise(function(w){var E=R.audioTrack,f=R.avcTrack;E.samples&&E.isAAC?S.decryptAacSamples(E.samples,0,function(){f.samples?S.decryptAvcSamples(f.samples,0,0,function(){w(R)}):w(R)}):f.samples&&S.decryptAvcSamples(f.samples,0,0,function(){w(R)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(R,S){var w=this,E=this._avcTrack,f=this.parseAVCNALu(R.data),x=!1,v=this.avcSample,y,U=!1;R.data=null,v&&f.length&&!E.audFound&&(s(v,E),v=this.avcSample=o(!1,R.pts,R.dts,"")),f.forEach(function(B){switch(B.type){case 1:{y=!0,v||(v=w.avcSample=o(!0,R.pts,R.dts,"")),x&&(v.debug+="NDR "),v.frame=!0;var A=B.data;if(U&&A.length>4){var j=new M.default(A).readSliceType();(j===2||j===4||j===7||j===9)&&(v.key=!0)}break}case 5:y=!0,v||(v=w.avcSample=o(!0,R.pts,R.dts,"")),x&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{y=!0,x&&v&&(v.debug+="SEI ");var P=new M.default(C(B.data));P.readUByte();for(var b=0,V=0,ne=!1,ce=0;!ne&&P.bytesAvailable>1;){b=0;do ce=P.readUByte(),b+=ce;while(ce===255);V=0;do ce=P.readUByte(),V+=ce;while(ce===255);if(b===4&&P.bytesAvailable!==0){ne=!0;var me=P.readUByte();if(me===181){var Ie=P.readUShort();if(Ie===49){var we=P.readUInt();if(we===1195456820){var Le=P.readUByte();if(Le===3){for(var Re=P.readUByte(),De=P.readUByte(),ye=31&Re,X=[Re,De],k=0;k<ye;k++)X.push(P.readUByte()),X.push(P.readUByte()),X.push(P.readUByte());a(w._txtTrack.samples,{type:3,pts:R.pts,bytes:X})}}}}}else if(b===5&&P.bytesAvailable!==0){if(ne=!0,V>16){for(var F=[],$=0;$<16;$++)F.push(P.readUByte().toString(16)),($===3||$===5||$===7||$===9)&&F.push("-");for(var te=V-16,K=new Uint8Array(te),pe=0;pe<te;pe++)K[pe]=P.readUByte();a(w._txtTrack.samples,{pts:R.pts,payloadType:b,uuid:F.join(""),userData:Object(W.utf8ArrayToStr)(K),userDataBytes:K})}}else if(V<P.bytesAvailable)for(var Te=0;Te<V;Te++)P.readUByte()}break}case 7:if(y=!0,U=!0,x&&v&&(v.debug+="SPS "),!E.sps){var ke=new M.default(B.data),ue=ke.readSPS();E.width=ue.width,E.height=ue.height,E.pixelRatio=ue.pixelRatio,E.sps=[B.data],E.duration=w._duration;for(var ve=B.data.subarray(1,4),xe="avc1.",Ce=0;Ce<3;Ce++){var Ne=ve[Ce].toString(16);Ne.length<2&&(Ne="0"+Ne),xe+=Ne}E.codec=xe}break;case 8:y=!0,x&&v&&(v.debug+="PPS "),E.pps||(E.pps=[B.data]);break;case 9:y=!1,E.audFound=!0,v&&s(v,E),v=w.avcSample=o(!1,R.pts,R.dts,x?"AUD ":"");break;case 12:y=!1;break;default:y=!1,v&&(v.debug+="unknown NAL "+B.type+" ");break}if(v&&y){var Ue=v.units;Ue.push(B)}}),S&&v&&(s(v,E),this.avcSample=null)},T.getLastNalUnit=function(){var R,S=this.avcSample,w;if(!S||S.units.length===0){var E=this._avcTrack.samples;S=E[E.length-1]}if((R=S)!==null&&R!==void 0&&R.units){var f=S.units;w=f[f.length-1]}return w},T.parseAVCNALu=function(R){var S=R.byteLength,w=this._avcTrack,E=w.naluState||0,f=E,x=[],v=0,y,U,B,A=-1,j=0;for(E===-1&&(A=0,j=R[0]&31,E=0,v=1);v<S;){if(y=R[v++],!E){E=y?0:1;continue}if(E===1){E=y?0:2;continue}if(!y)E=3;else if(y===1){if(A>=0){var P={data:R.subarray(A,v-E-1),type:j};x.push(P)}else{var b=this.getLastNalUnit();if(b&&(f&&v<=4-f&&(b.state&&(b.data=b.data.subarray(0,b.data.byteLength-f))),U=v-E-1,U>0)){var V=new Uint8Array(b.data.byteLength+U);V.set(b.data,0),V.set(R.subarray(0,U),b.data.byteLength),b.data=V,b.state=0}}v<S?(B=R[v]&31,A=v,j=B,E=0):E=-1}else E=0}if(A>=0&&E>=0){var ne={data:R.subarray(A,S),type:j,state:E};x.push(ne)}if(x.length===0){var ce=this.getLastNalUnit();if(ce){var me=new Uint8Array(ce.data.byteLength+R.byteLength);me.set(ce.data,0),me.set(R,ce.data.byteLength),ce.data=me}}return w.naluState=E,x},T.parseAACPES=function(R){var S=0,w=this._audioTrack,E=this.aacOverFlow,f=R.data;if(E){this.aacOverFlow=null;var x=E.sample.unit.byteLength,v=Math.min(E.missing,x),y=x-v;E.sample.unit.set(f.subarray(0,v),y),w.samples.push(E.sample),S=E.missing}var U,B;for(U=S,B=f.length;U<B-1&&!z.isHeader(f,U);U++);if(U!==S){var A,j;if(U<B-1?(A="AAC PES did not start with ADTS header,offset:"+U,j=!1):(A="no ADTS header found in AAC PES",j=!0),g.logger.warn("parsing error:"+A),this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:A}),j)return}z.initTrackConfig(w,this.observer,f,U,this.audioCodec);var P;if(R.pts!==void 0)P=R.pts;else if(E){var b=z.getFrameDuration(w.samplerate);P=E.sample.pts+b}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var V=0;U<B;)if(z.isHeader(f,U)){if(U+5<B){var ne=z.appendFrame(w,f,U,P,V);if(ne)if(ne.missing)this.aacOverFlow=ne;else{U+=ne.length,V++;continue}}break}else U++},T.parseMPEGPES=function(R){var S=R.data,w=S.length,E=0,f=0,x=R.pts;if(x===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;f<w;)if(N.isHeader(S,f)){var v=N.appendFrame(this._audioTrack,S,f,x,E);if(v)f+=v.length,E++;else break}else f++},T.parseID3PES=function(R){if(R.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(R)},_}();u.minProbeByteLength=188;function o(_,T,O,R){return{key:_,frame:!1,pts:T,dts:O,units:[],debug:R,length:0}}function p(_,T){return(_[T+10]&31)<<8|_[T+11]}function l(_,T,O,R){var S={audio:-1,avc:-1,id3:-1,isAAC:!0},w=(_[T+1]&15)<<8|_[T+2],E=T+3+w-4,f=(_[T+10]&15)<<8|_[T+11];for(T+=12+f;T<E;){var x=(_[T+1]&31)<<8|_[T+2];switch(_[T]){case 207:if(!R){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:S.audio===-1&&(S.audio=x);break;case 21:S.id3===-1&&(S.id3=x);break;case 219:if(!R){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:S.avc===-1&&(S.avc=x);break;case 3:case 4:O?S.audio===-1&&(S.audio=x,S.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}T+=((_[T+3]&15)<<8|_[T+4])+5}return S}function h(_){var T=0,O,R,S,w,E,f=_.data;if(!_||_.size===0)return null;for(;f[0].length<19&&f.length>1;){var x=new Uint8Array(f[0].length+f[1].length);x.set(f[0]),x.set(f[1],f[0].length),f[0]=x,f.splice(1,1)}O=f[0];var v=(O[0]<<16)+(O[1]<<8)+O[2];if(v===1){if(R=(O[4]<<8)+O[5],R&&R>_.size-6)return null;var y=O[7];y&192&&(w=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,y&64?(E=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,w-E>60*9e4&&(g.logger.warn(Math.round((w-E)/9e4)+"s delta between PTS and DTS, align them"),w=E)):E=w),S=O[8];var U=S+9;if(_.size<=U)return null;_.size-=U;for(var B=new Uint8Array(_.size),A=0,j=f.length;A<j;A++){O=f[A];var P=O.byteLength;if(U)if(U>P){U-=P;continue}else O=O.subarray(U),P-=U,U=0;B.set(O,T),T+=P}return R&&(R-=S+3),{data:B,pts:w,dts:E,len:R}}return null}function s(_,T){if(_.units.length&&_.frame){if(_.pts===void 0){var O=T.samples,R=O.length;if(R){var S=O[R-1];_.pts=S.pts,_.dts=S.dts}else{T.dropped++;return}}T.samples.push(_)}_.debug.length&&g.logger.log(_.pts+"/"+_.dts+":"+_.debug)}function a(_,T){var O=_.length;if(O>0){if(T.pts>=_[O-1].pts)_.push(T);else for(var R=O-1;R>=0;R--)if(T.pts<_[R].pts){_.splice(R,0,T);break}}else _.push(T)}function C(_){for(var T=_.byteLength,O=[],R=1;R<T-2;)_[R]===0&&_[R+1]===0&&_[R+2]===3?(O.push(R+2),R+=2):R++;if(O.length===0)return _;var S=T-O.length,w=new Uint8Array(S),E=0;for(R=0;R<S;E++,R++)E===O[0]&&(E++,O.shift()),w[R]=_[E];return w}Y.default=u},"./src/errors.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"ErrorTypes",function(){return z}),D.d(Y,"ErrorDetails",function(){return N});var z;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(z||(z={}));var N;(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"})(N||(N={}))},"./src/events.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"Events",function(){return z});var z;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return _});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(z),M=D("./src/loader/playlist-loader.ts"),W=D("./src/loader/key-loader.ts"),H=D("./src/controller/id3-track-controller.ts"),i=D("./src/controller/latency-controller.ts"),L=D("./src/controller/level-controller.ts"),g=D("./src/controller/fragment-tracker.ts"),c=D("./src/controller/stream-controller.ts"),m=D("./src/is-supported.ts"),u=D("./src/utils/logger.ts"),o=D("./src/config.ts"),p=D("./node_modules/eventemitter3/index.js"),l=D.n(p),h=D("./src/events.ts"),s=D("./src/errors.ts");function a(T,O){for(var R=0;R<O.length;R++){var S=O[R];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function C(T,O,R){return O&&a(T.prototype,O),R&&a(T,R),T}var _=function(){T.isSupported=function(){return Object(m.isSupported)()};function T(R){R===void 0&&(R={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 S=this.config=Object(o.mergeConfig)(T.DefaultConfig,R);this.userConfig=R,Object(u.enableLogs)(S.debug),this._autoLevelCapping=-1,S.progressive&&Object(o.enableStreamingMode)(S);var w=S.abrController,E=S.bufferController,f=S.capLevelController,x=S.fpsController,v=this.abrController=new w(this),y=this.bufferController=new E(this),U=this.capLevelController=new f(this),B=new x(this),A=new M.default(this),j=new W.default(this),P=new H.default(this),b=this.levelController=new L.default(this),V=new g.FragmentTracker(this),ne=this.streamController=new c.default(this,V);U.setStreamController(ne),B.setStreamController(ne);var ce=[b,ne];this.networkControllers=ce;var me=[A,j,v,y,U,B,P,V];this.audioTrackController=this.createController(S.audioTrackController,null,ce),this.createController(S.audioStreamController,V,ce),this.subtitleTrackController=this.createController(S.subtitleTrackController,null,ce),this.createController(S.subtitleStreamController,V,ce),this.createController(S.timelineController,null,me),this.emeController=this.createController(S.emeController,null,me),this.cmcdController=this.createController(S.cmcdController,null,me),this.latencyController=this.createController(i.default,null,me),this.coreComponents=me}var O=T.prototype;return O.createController=function(S,w,E){if(S){var f=w?new S(this,w):new S(this);return E&&E.push(f),f}return null},O.on=function(S,w,E){E===void 0&&(E=this),this._emitter.on(S,w,E)},O.once=function(S,w,E){E===void 0&&(E=this),this._emitter.once(S,w,E)},O.removeAllListeners=function(S){this._emitter.removeAllListeners(S)},O.off=function(S,w,E,f){E===void 0&&(E=this),this._emitter.off(S,w,E,f)},O.listeners=function(S){return this._emitter.listeners(S)},O.emit=function(S,w,E){return this._emitter.emit(S,w,E)},O.trigger=function(S,w){if(this.config.debug)return this.emit(S,S,w);try{return this.emit(S,S,w)}catch(E){u.logger.error("An internal error happened while handling event "+S+'. Error message: "'+E.message+'". Here is a stacktrace:',E),this.trigger(h.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:S,error:E})}return!1},O.listenerCount=function(S){return this._emitter.listenerCount(S)},O.destroy=function(){u.logger.log("destroy"),this.trigger(h.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(S){return S.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(S){return S.destroy()}),this.coreComponents.length=0},O.attachMedia=function(S){u.logger.log("attachMedia"),this._media=S,this.trigger(h.Events.MEDIA_ATTACHING,{media:S})},O.detachMedia=function(){u.logger.log("detachMedia"),this.trigger(h.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(S){this.stopLoad();var w=this.media,E=this.url,f=this.url=z.buildAbsoluteURL(self.location.href,S,{alwaysNormalize:!0});u.logger.log("loadSource:"+f),w&&E&&E!==f&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(w)),this.trigger(h.Events.MANIFEST_LOADING,{url:S})},O.startLoad=function(S){S===void 0&&(S=-1),u.logger.log("startLoad("+S+")"),this.networkControllers.forEach(function(w){w.startLoad(S)})},O.stopLoad=function(){u.logger.log("stopLoad"),this.networkControllers.forEach(function(S){S.stopLoad()})},O.swapAudioCodec=function(){u.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){u.logger.log("recoverMediaError");var S=this._media;this.detachMedia(),S&&this.attachMedia(S)},O.removeLevel=function(S,w){w===void 0&&(w=0),this.levelController.removeLevel(S,w)},C(T,[{key:"levels",get:function(){var S=this.levelController.levels;return S||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(S){u.logger.log("set currentLevel:"+S),this.loadLevel=S,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(S){u.logger.log("set nextLevel:"+S),this.levelController.manualLevel=S,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(S){u.logger.log("set loadLevel:"+S),this.levelController.manualLevel=S}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(S){this.levelController.nextLoadLevel=S}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(S){u.logger.log("set firstLevel:"+S),this.levelController.firstLevel=S}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(S){u.logger.log("set startLevel:"+S),S!==-1&&(S=Math.max(S,this.minAutoLevel)),this.levelController.startLevel=S}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(S){var w=!!S;w!==this.config.capLevelToPlayerSize&&(w?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=w)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(S){this._autoLevelCapping!==S&&(u.logger.log("set autoLevelCapping:"+S),this._autoLevelCapping=S)}},{key:"bandwidthEstimate",get:function(){var S=this.abrController.bwEstimator;return S?S.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var S=this.levels,w=this.config.minAutoBitrate;if(!S)return 0;for(var E=S.length,f=0;f<E;f++)if(S[f].maxBitrate>w)return f;return 0}},{key:"maxAutoLevel",get:function(){var S=this.levels,w=this.autoLevelCapping,E;return w===-1&&S&&S.length?E=S.length-1:E=w,E}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(S){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,S)}},{key:"audioTracks",get:function(){var S=this.audioTrackController;return S?S.audioTracks:[]}},{key:"audioTrack",get:function(){var S=this.audioTrackController;return S?S.audioTrack:-1},set:function(S){var w=this.audioTrackController;w&&(w.audioTrack=S)}},{key:"subtitleTracks",get:function(){var S=this.subtitleTrackController;return S?S.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var S=this.subtitleTrackController;return S?S.subtitleTrack:-1},set:function(S){var w=this.subtitleTrackController;w&&(w.subtitleTrack=S)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var S=this.subtitleTrackController;return S?S.subtitleDisplay:!1},set:function(S){var w=this.subtitleTrackController;w&&(w.subtitleDisplay=S)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(S){this.config.lowLatencyMode=S}},{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 h.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:o.hlsDefaultConfig},set:function(S){T.defaultConfig=S}}]),T}();_.defaultConfig=void 0},"./src/is-supported.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isSupported",function(){return M}),D.d(Y,"changeTypeSupported",function(){return W});var z=D("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var H=Object(z.getMediaSource)();if(!H)return!1;var i=N(),L=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!i||i.prototype&&typeof i.prototype.appendBuffer=="function"&&typeof i.prototype.remove=="function";return!!L&&!!g}function W(){var H,i=N();return typeof(i==null||((H=i.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return u}),D.d(Y,"LoadError",function(){return p});var z=D("./src/polyfills/number.ts"),N=D("./src/errors.ts");function M(l,h){l.prototype=Object.create(h.prototype),l.prototype.constructor=l,g(l,h)}function W(l){var h=typeof Map=="function"?new Map:void 0;return W=function(a){if(a===null||!L(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(typeof h!="undefined"){if(h.has(a))return h.get(a);h.set(a,C)}function C(){return H(a,arguments,c(this).constructor)}return C.prototype=Object.create(a.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),g(C,a)},W(l)}function H(l,h,s){return i()?H=Reflect.construct:H=function(C,_,T){var O=[null];O.push.apply(O,_);var R=Function.bind.apply(C,O),S=new R;return T&&g(S,T.prototype),S},H.apply(null,arguments)}function i(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function L(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function g(l,h){return g=Object.setPrototypeOf||function(a,C){return a.__proto__=C,a},g(l,h)}function c(l){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},c(l)}var m=Math.pow(2,17),u=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var h=l.prototype;return h.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},h.abort=function(){this.loader&&this.loader.abort()},h.load=function(a,C){var _=this,T=a.url;if(!T)return Promise.reject(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var O=this.config,R=O.fLoader,S=O.loader;return new Promise(function(w,E){_.loader&&_.loader.destroy();var f=_.loader=a.loader=R?new R(O):new S(O),x=o(a),v={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:m};a.stats=f.stats,f.load(x,v,{onSuccess:function(U,B,A,j){_.resetLoader(a,f),w({frag:a,part:null,payload:U.data,networkDetails:j})},onError:function(U,B,A){_.resetLoader(a,f),E(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,response:U,networkDetails:A}))},onAbort:function(U,B,A){_.resetLoader(a,f),E(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,networkDetails:A}))},onTimeout:function(U,B,A){_.resetLoader(a,f),E(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,networkDetails:A}))},onProgress:function(U,B,A,j){C&&C({frag:a,part:null,payload:A,networkDetails:j})}})})},h.loadPart=function(a,C,_){var T=this;this.abort();var O=this.config,R=O.fLoader,S=O.loader;return new Promise(function(w,E){T.loader&&T.loader.destroy();var f=T.loader=a.loader=R?new R(O):new S(O),x=o(a,C),v={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:m};C.stats=f.stats,f.load(x,v,{onSuccess:function(U,B,A,j){T.resetLoader(a,f),T.updateStatsFromPart(a,C);var P={frag:a,part:C,payload:U.data,networkDetails:j};_(P),w(P)},onError:function(U,B,A){T.resetLoader(a,f),E(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,part:C,response:U,networkDetails:A}))},onAbort:function(U,B,A){a.stats.aborted=C.stats.aborted,T.resetLoader(a,f),E(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,part:C,networkDetails:A}))},onTimeout:function(U,B,A){T.resetLoader(a,f),E(new p({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,part:C,networkDetails:A}))}})})},h.updateStatsFromPart=function(a,C){var _=a.stats,T=C.stats,O=T.total;if(_.loaded+=T.loaded,O){var R=Math.round(a.duration/C.duration),S=Math.min(Math.round(_.loaded/O),R),w=R-S,E=w*Math.round(_.loaded/S);_.total=_.loaded+E}else _.total=Math.max(_.loaded,_.total);var f=_.loading,x=T.loading;f.start?f.first+=x.first-x.start:(f.start=x.start,f.first=x.first),f.end=x.end},h.resetLoader=function(a,C){a.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},l}();function o(l,h){h===void 0&&(h=null);var s=h||l,a={frag:l,part:h,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},C=s.byteRangeStartOffset,_=s.byteRangeEndOffset;return Object(z.isFiniteNumber)(C)&&Object(z.isFiniteNumber)(_)&&(a.rangeStart=C,a.rangeEnd=_),a}var p=function(l){M(h,l);function h(s){for(var a,C=arguments.length,_=new Array(C>1?C-1:0),T=1;T<C;T++)_[T-1]=arguments[T];return a=l.call.apply(l,[this].concat(_))||this,a.data=void 0,a.data=s,a}return h}(W(Error))},"./src/loader/fragment.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"ElementaryStreamTypes",function(){return u}),D.d(Y,"BaseSegment",function(){return o}),D.d(Y,"Fragment",function(){return p}),D.d(Y,"Part",function(){return l});var z=D("./src/polyfills/number.ts"),N=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(N),W=D("./src/utils/logger.ts"),H=D("./src/loader/level-key.ts"),i=D("./src/loader/load-stats.ts");function L(h,s){h.prototype=Object.create(s.prototype),h.prototype.constructor=h,g(h,s)}function g(h,s){return g=Object.setPrototypeOf||function(C,_){return C.__proto__=_,C},g(h,s)}function c(h,s){for(var a=0;a<s.length;a++){var C=s[a];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(h,C.key,C)}}function m(h,s,a){return s&&c(h.prototype,s),a&&c(h,a),h}var u;(function(h){h.AUDIO="audio",h.VIDEO="video",h.AUDIOVIDEO="audiovideo"})(u||(u={}));var o=function(){function h(a){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[u.AUDIO]=null,C[u.VIDEO]=null,C[u.AUDIOVIDEO]=null,C),this.baseurl=a}var s=h.prototype;return s.setByteRange=function(C,_){var T=C.split("@",2),O=[];T.length===1?O[0]=_?_.byteRangeEndOffset:0:O[0]=parseInt(T[1]),O[1]=parseInt(T[0])+O[0],this._byteRange=O},m(h,[{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(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),h}(),p=function(h){L(s,h);function s(C,_){var T;return T=h.call(this,_)||this,T._decryptdata=null,T.rawProgramDateTime=null,T.programDateTime=null,T.tagList=[],T.duration=0,T.sn=0,T.levelkey=void 0,T.type=void 0,T.loader=null,T.level=-1,T.cc=0,T.startPTS=void 0,T.endPTS=void 0,T.appendedPTS=void 0,T.startDTS=void 0,T.endDTS=void 0,T.start=0,T.deltaPTS=void 0,T.maxStartPTS=void 0,T.minEndPTS=void 0,T.stats=new i.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=C,T}var a=s.prototype;return a.createInitializationVector=function(_){for(var T=new Uint8Array(16),O=12;O<16;O++)T[O]=_>>8*(15-O)&255;return T},a.setDecryptDataFromLevelKey=function(_,T){var O=_;return(_==null?void 0:_.method)==="AES-128"&&_.uri&&!_.iv&&(O=H.LevelKey.fromURI(_.uri),O.method=_.method,O.iv=this.createInitializationVector(T),O.keyFormat="identity"),O},a.setElementaryStreamInfo=function(_,T,O,R,S,w){w===void 0&&(w=!1);var E=this.elementaryStreams,f=E[_];if(!f){E[_]={startPTS:T,endPTS:O,startDTS:R,endDTS:S,partial:w};return}f.startPTS=Math.min(f.startPTS,T),f.endPTS=Math.max(f.endPTS,O),f.startDTS=Math.min(f.startDTS,R),f.endDTS=Math.max(f.endDTS,S)},a.clearElementaryStreamInfo=function(){var _=this.elementaryStreams;_[u.AUDIO]=null,_[u.VIDEO]=null,_[u.AUDIOVIDEO]=null},m(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var _=this.sn;typeof _!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),_=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,_)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var _=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+_*1e3}},{key:"encrypted",get:function(){var _;return!!((_=this.decryptdata)!==null&&_!==void 0&&_.keyFormat&&this.decryptdata.uri)}}]),s}(o),l=function(h){L(s,h);function s(a,C,_,T,O){var R;R=h.call(this,_)||this,R.fragOffset=0,R.duration=0,R.gap=!1,R.independent=!1,R.relurl=void 0,R.fragment=void 0,R.index=void 0,R.stats=new i.LoadStats,R.duration=a.decimalFloatingPoint("DURATION"),R.gap=a.bool("GAP"),R.independent=a.bool("INDEPENDENT"),R.relurl=a.enumeratedString("URI"),R.fragment=C,R.index=T;var S=a.enumeratedString("BYTERANGE");return S&&R.setByteRange(S,O),O&&(R.fragOffset=O.fragOffset+O.duration),R}return m(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),s}(o)},"./src/loader/key-loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return W});var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),W=function(){function H(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var i=H.prototype;return i._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},i._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},i.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var c=this.loaders[g];c&&c.destroy()}this.loaders={}},i.onKeyLoading=function(g,c){var m=c.frag,u=m.type,o=this.loaders[u];if(!m.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=m.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(o&&(M.logger.warn("abort previous key loader for type:"+u),o.abort()),!p){M.logger.warn("key uri is falsy");return}var h=l.loader,s=m.loader=this.loaders[u]=new h(l);this.decrypturl=p,this.decryptkey=null;var a={url:p,frag:m,responseType:"arraybuffer"},C={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},_={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(a,C,_)}else this.decryptkey&&(m.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:m}))},i.loadsuccess=function(g,c,m){var u=m.frag;if(!u.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=u.decryptdata.key=new Uint8Array(g.data),u.loader=null,delete this.loaders[u.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:u})},i.loaderror=function(g,c){var m=c.frag,u=m.loader;u&&u.abort(),delete this.loaders[m.type],this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:m,response:g})},i.loadtimeout=function(g,c){var m=c.frag,u=m.loader;u&&u.abort(),delete this.loaders[m.type],this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:m})},H}()},"./src/loader/level-details.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"LevelDetails",function(){return H});var z=D("./src/polyfills/number.ts");function N(i,L){for(var g=0;g<L.length;g++){var c=L[g];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(i,c.key,c)}}function M(i,L,g){return L&&N(i.prototype,L),g&&N(i,g),i}var W=10,H=function(){function i(g){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=g}var L=i.prototype;return L.reloaded=function(c){if(!c){this.advanced=!0,this.updated=!0;return}var m=this.lastPartSn-c.lastPartSn,u=this.lastPartIndex-c.lastPartIndex;this.updated=this.endSN!==c.endSN||!!u||!!m,this.advanced=this.endSN>c.endSN||m>0||m===0&&u>0,this.updated||this.advanced?this.misses=Math.floor(c.misses*.6):this.misses=c.misses+1,this.availabilityDelay=c.availabilityDelay},M(i,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var c=this.driftEndTime-this.driftStartTime;if(c>0){var m=this.driftEnd-this.driftStart;return m*1e3/c}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var c;return(c=this.fragments)!==null&&c!==void 0&&c.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),i}()},"./src/loader/level-key.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"LevelKey",function(){return H});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(z);function M(i,L){for(var g=0;g<L.length;g++){var c=L[g];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(i,c.key,c)}}function W(i,L,g){return L&&M(i.prototype,L),g&&M(i,g),i}var H=function(){i.fromURL=function(g,c){return new i(g,c)},i.fromURI=function(g){return new i(g)};function i(L,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(z.buildAbsoluteURL)(L,g,{alwaysNormalize:!0}):this._uri=L}return W(i,[{key:"uri",get:function(){return this._uri}}]),i}()},"./src/loader/load-stats.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"LoadStats",function(){return z});var z=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(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return s});var z=D("./src/polyfills/number.ts"),N=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(N),W=D("./src/loader/fragment.ts"),H=D("./src/loader/level-details.ts"),i=D("./src/loader/level-key.ts"),L=D("./src/utils/attr-list.ts"),g=D("./src/utils/logger.ts"),c=D("./src/utils/codecs.ts"),m=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,u=/#EXT-X-MEDIA:(.*)/g,o=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function h(O){var R,S;return l.test((R=(S=N.parseURL(O))===null||S===void 0?void 0:S.path)!=null?R:"")}var s=function(){function O(){}return O.findGroup=function(S,w){for(var E=0;E<S.length;E++){var f=S[E];if(f.id===w)return f}},O.convertAVC1ToAVCOTI=function(S){var w=S.split(".");if(w.length>2){var E=w.shift()+".";return E+=parseInt(w.shift()).toString(16),E+=("000"+parseInt(w.shift()).toString(16)).substr(-4),E}return S},O.resolve=function(S,w){return N.buildAbsoluteURL(w,S,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(S,w){var E=[],f={},x=!1;m.lastIndex=0;for(var v;(v=m.exec(S))!=null;)if(v[1]){var y=new L.AttrList(v[1]),U={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:O.resolve(v[2],w)},B=y.decimalResolution("RESOLUTION");B&&(U.width=B.width,U.height=B.height),a((y.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),U),U.videoCodec&&U.videoCodec.indexOf("avc1")!==-1&&(U.videoCodec=O.convertAVC1ToAVCOTI(U.videoCodec)),E.push(U)}else if(v[3]){var A=new L.AttrList(v[3]);A["DATA-ID"]&&(x=!0,f[A["DATA-ID"]]=A)}return{levels:E,sessionData:x?f:null}},O.parseMasterPlaylistMedia=function(S,w,E,f){f===void 0&&(f=[]);var x,v=[],y=0;for(u.lastIndex=0;(x=u.exec(S))!==null;){var U=new L.AttrList(x[1]);if(U.TYPE===E){var B={attrs:U,bitrate:0,id:y++,groupId:U["GROUP-ID"],instreamId:U["INSTREAM-ID"],name:U.NAME||U.LANGUAGE||"",type:E,default:U.bool("DEFAULT"),autoselect:U.bool("AUTOSELECT"),forced:U.bool("FORCED"),lang:U.LANGUAGE,url:U.URI?O.resolve(U.URI,w):""};if(f.length){var A=O.findGroup(f,B.groupId)||f[0];C(B,A,"audioCodec"),C(B,A,"textCodec")}v.push(B)}}return v},O.parseLevelPlaylist=function(S,w,E,f,x){var v=new H.LevelDetails(w),y=v.fragments,U=null,B=0,A=0,j=0,P=0,b=null,V=new W.Fragment(f,w),ne,ce,me,Ie=-1,we=!1;for(o.lastIndex=0,v.m3u8=S;(ne=o.exec(S))!==null;){we&&(we=!1,V=new W.Fragment(f,w),V.start=j,V.sn=B,V.cc=P,V.level=E,U&&(V.initSegment=U,V.rawProgramDateTime=U.rawProgramDateTime));var Le=ne[1];if(Le){V.duration=parseFloat(Le);var Re=(" "+ne[2]).slice(1);V.title=Re||null,V.tagList.push(Re?["INF",Le,Re]:["INF",Le])}else if(ne[3])Object(z.isFiniteNumber)(V.duration)&&(V.start=j,me&&(V.levelkey=me),V.sn=B,V.level=E,V.cc=P,V.urlId=x,y.push(V),V.relurl=(" "+ne[3]).slice(1),T(V,b),b=V,j+=V.duration,B++,A=0,we=!0);else if(ne[4]){var De=(" "+ne[4]).slice(1);b?V.setByteRange(De,b):V.setByteRange(De)}else if(ne[5])V.rawProgramDateTime=(" "+ne[5]).slice(1),V.tagList.push(["PROGRAM-DATE-TIME",V.rawProgramDateTime]),Ie===-1&&(Ie=y.length);else{if(ne=ne[0].match(p),!ne){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(ce=1;ce<ne.length&&!(typeof ne[ce]!="undefined");ce++);var ye=(" "+ne[ce]).slice(1),X=(" "+ne[ce+1]).slice(1),k=ne[ce+2]?(" "+ne[ce+2]).slice(1):"";switch(ye){case"PLAYLIST-TYPE":v.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":B=v.startSN=parseInt(X);break;case"SKIP":{var F=new L.AttrList(X),$=F.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)($)){v.skippedSegments=$;for(var te=$;te--;)y.unshift(null);B+=$}var K=F.enumeratedString("RECENTLY-REMOVED-DATERANGES");K&&(v.recentlyRemovedDateranges=K.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(X);break;case"VERSION":v.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(X||k)&&V.tagList.push(k?[X,k]:[X]);break;case"DIS":P++;case"GAP":V.tagList.push([ye]);break;case"BITRATE":V.tagList.push([ye,X]);break;case"DISCONTINUITY-SEQ":P=parseInt(X);break;case"KEY":{var pe,Te=new L.AttrList(X),ke=Te.enumeratedString("METHOD"),ue=Te.URI,ve=Te.hexadecimalInteger("IV"),xe=Te.enumeratedString("KEYFORMATVERSIONS"),Ce=Te.enumeratedString("KEYID"),Ne=(pe=Te.enumeratedString("KEYFORMAT"))!=null?pe:"identity",Ue=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ue.indexOf(Ne)>-1){g.logger.warn("Keyformat "+Ne+" is not supported from the manifest");continue}else if(Ne!=="identity")continue;ke&&(me=i.LevelKey.fromURL(w,ue),ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ke)>=0&&(me.method=ke,me.keyFormat=Ne,Ce&&(me.keyID=Ce),xe&&(me.keyFormatVersions=xe),me.iv=ve));break}case"START":{var Ge=new L.AttrList(X),We=Ge.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(We)&&(v.startTimeOffset=We);break}case"MAP":{var it=new L.AttrList(X);V.relurl=it.URI,it.BYTERANGE&&V.setByteRange(it.BYTERANGE),V.level=E,V.sn="initSegment",me&&(V.levelkey=me),V.initSegment=null,U=V,we=!0;break}case"SERVER-CONTROL":{var Ve=new L.AttrList(X);v.canBlockReload=Ve.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=Ve.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&Ve.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=Ve.optionalFloat("PART-HOLD-BACK",0),v.holdBack=Ve.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new L.AttrList(X);v.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Me=v.partList;Me||(Me=v.partList=[]);var rt=A>0?Me[Me.length-1]:void 0,tt=A++,le=new W.Part(new L.AttrList(X),V,w,tt,rt);Me.push(le),V.duration+=le.duration;break}case"PRELOAD-HINT":{var Z=new L.AttrList(X);v.preloadHint=Z;break}case"RENDITION-REPORT":{var ee=new L.AttrList(X);v.renditionReports=v.renditionReports||[],v.renditionReports.push(ee);break}default:g.logger.warn("line parsed but not handled: "+ne);break}}}b&&!b.relurl?(y.pop(),j-=b.duration,v.partList&&(v.fragmentHint=b)):v.partList&&(T(V,b),V.cc=P,v.fragmentHint=V);var se=y.length,he=y[0],ie=y[se-1];if(j+=v.skippedSegments*v.targetduration,j>0&&se&&ie){v.averagetargetduration=j/se;var ae=ie.sn;v.endSN=ae!=="initSegment"?ae:0,he&&(v.startCC=he.cc,he.initSegment||v.fragments.every(function(de){return de.relurl&&h(de.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),V=new W.Fragment(f,w),V.relurl=ie.relurl,V.level=E,V.sn="initSegment",he.initSegment=V,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(j+=v.fragmentHint.duration),v.totalduration=j,v.endCC=P,Ie>0&&_(y,Ie),v},O}();function a(O,R){["video","audio","text"].forEach(function(S){var w=O.filter(function(f){return Object(c.isCodecType)(f,S)});if(w.length){var E=w.filter(function(f){return f.lastIndexOf("avc1",0)===0||f.lastIndexOf("mp4a",0)===0});R[S+"Codec"]=E.length>0?E[0]:w[0],O=O.filter(function(f){return w.indexOf(f)===-1})}}),R.unknownCodecs=O}function C(O,R,S){var w=R[S];w&&(O[S]=w)}function _(O,R){for(var S=O[R],w=R;w--;){var E=O[w];if(!E)return;E.programDateTime=S.programDateTime-E.duration*1e3,S=E}}function T(O,R){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):R!=null&&R.programDateTime&&(O.programDateTime=R.endProgramDateTime),Object(z.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/logger.ts"),H=D("./src/utils/mp4-tools.ts"),i=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),g=D("./src/utils/attr-list.ts");function c(o){var p=o.type;switch(p){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function m(o,p){var l=o.url;return(l===void 0||l.indexOf("data:")===0)&&(l=p.url),l}var u=function(){function o(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var p=o.prototype;return p.registerListeners=function(){var h=this.hls;h.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),h.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var h=this.hls;h.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),h.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(h){var s=this.hls.config,a=s.pLoader,C=s.loader,_=a||C,T=new _(s);return h.loader=T,this.loaders[h.type]=T,T},p.getInternalLoader=function(h){return this.loaders[h.type]},p.resetInternalLoader=function(h){this.loaders[h]&&delete this.loaders[h]},p.destroyInternalLoaders=function(){for(var h in this.loaders){var s=this.loaders[h];s&&s.destroy(),this.resetInternalLoader(h)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(h,s){var a=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:a,deliveryDirectives:null})},p.onLevelLoading=function(h,s){var a=s.id,C=s.level,_=s.url,T=s.deliveryDirectives;this.load({id:a,groupId:null,level:C,responseType:"text",type:L.PlaylistContextType.LEVEL,url:_,deliveryDirectives:T})},p.onAudioTrackLoading=function(h,s){var a=s.id,C=s.groupId,_=s.url,T=s.deliveryDirectives;this.load({id:a,groupId:C,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:_,deliveryDirectives:T})},p.onSubtitleTrackLoading=function(h,s){var a=s.id,C=s.groupId,_=s.url,T=s.deliveryDirectives;this.load({id:a,groupId:C,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:_,deliveryDirectives:T})},p.load=function(h){var s,a=this.hls.config,C=this.getInternalLoader(h);if(C){var _=C.context;if(_&&_.url===h.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+h.type),C.abort()}var T,O,R,S;switch(h.type){case L.PlaylistContextType.MANIFEST:T=a.manifestLoadingMaxRetry,O=a.manifestLoadingTimeOut,R=a.manifestLoadingRetryDelay,S=a.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:T=0,O=a.levelLoadingTimeOut;break;default:T=a.levelLoadingMaxRetry,O=a.levelLoadingTimeOut,R=a.levelLoadingRetryDelay,S=a.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(h),(s=h.deliveryDirectives)!==null&&s!==void 0&&s.part){var w;if(h.type===L.PlaylistContextType.LEVEL&&h.level!==null?w=this.hls.levels[h.level].details:h.type===L.PlaylistContextType.AUDIO_TRACK&&h.id!==null?w=this.hls.audioTracks[h.id].details:h.type===L.PlaylistContextType.SUBTITLE_TRACK&&h.id!==null&&(w=this.hls.subtitleTracks[h.id].details),w){var E=w.partTarget,f=w.targetduration;E&&f&&(O=Math.min(Math.max(E*3,f*.8)*1e3,O))}}var x={timeout:O,maxRetry:T,retryDelay:R,maxRetryDelay:S,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(h,x,v)},p.loadsuccess=function(h,s,a,C){if(C===void 0&&(C=null),a.isSidxRequest){this.handleSidxRequest(h,a),this.handlePlaylistLoaded(h,s,a,C);return}this.resetInternalLoader(a.type);var _=h.data;if(_.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(h,a,"no EXTM3U delimiter",C);return}s.parsing.start=performance.now(),_.indexOf("#EXTINF:")>0||_.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(h,s,a,C):this.handleMasterPlaylist(h,s,a,C)},p.loaderror=function(h,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!1,h)},p.loadtimeout=function(h,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!0)},p.handleMasterPlaylist=function(h,s,a,C){var _=this.hls,T=h.data,O=m(h,a),R=i.default.parseMasterPlaylist(T,O),S=R.levels,w=R.sessionData;if(!S.length){this.handleManifestParsingError(h,a,"no level found in manifest",C);return}var E=S.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),f=S.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),x=i.default.parseMasterPlaylistMedia(T,O,"AUDIO",E),v=i.default.parseMasterPlaylistMedia(T,O,"SUBTITLES",f),y=i.default.parseMasterPlaylistMedia(T,O,"CLOSED-CAPTIONS");if(x.length){var U=x.some(function(B){return!B.url});!U&&S[0].audioCodec&&!S[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}_.trigger(N.Events.MANIFEST_LOADED,{levels:S,audioTracks:x,subtitles:v,captions:y,url:O,stats:s,networkDetails:C,sessionData:w})},p.handleTrackOrLevelPlaylist=function(h,s,a,C){var _=this.hls,T=a.id,O=a.level,R=a.type,S=m(h,a),w=Object(z.isFiniteNumber)(T)?T:0,E=Object(z.isFiniteNumber)(O)?O:w,f=c(a),x=i.default.parseLevelPlaylist(h.data,S,E,f,w);if(!x.fragments.length){_.trigger(N.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:S,reason:"no fragments found in level",level:typeof a.level=="number"?a.level:void 0});return}if(R===L.PlaylistContextType.MANIFEST){var v={attrs:new g.AttrList({}),bitrate:0,details:x,name:"",url:S};_.trigger(N.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:S,stats:s,networkDetails:C,sessionData:null})}if(s.parsing.end=performance.now(),x.needSidxRanges){var y,U=(y=x.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:U,isSidxRequest:!0,type:R,level:O,levelDetails:x,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}a.levelDetails=x,this.handlePlaylistLoaded(h,s,a,C)},p.handleSidxRequest=function(h,s){var a=Object(H.parseSegmentIndex)(new Uint8Array(h.data));if(!a)return;var C=a.references,_=s.levelDetails;C.forEach(function(T,O){var R=T.info,S=_.fragments[O];S.byteRange.length===0&&S.setByteRange(String(1+R.end-R.start)+"@"+String(R.start)),S.initSegment&&S.initSegment.setByteRange(String(a.moovEndOffset)+"@0")})},p.handleManifestParsingError=function(h,s,a,C){this.hls.trigger(N.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:h.url,reason:a,response:h,context:s,networkDetails:C})},p.handleNetworkError=function(h,s,a,C){a===void 0&&(a=!1),W.logger.warn("[playlist-loader]: A network "+(a?"timeout":"error")+" occurred while loading "+h.type+" level: "+h.level+" id: "+h.id+' group-id: "'+h.groupId+'"');var _=M.ErrorDetails.UNKNOWN,T=!1,O=this.getInternalLoader(h);switch(h.type){case L.PlaylistContextType.MANIFEST:_=a?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case L.PlaylistContextType.LEVEL:_=a?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case L.PlaylistContextType.AUDIO_TRACK:_=a?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:_=a?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}O&&this.resetInternalLoader(h.type);var R={type:M.ErrorTypes.NETWORK_ERROR,details:_,fatal:T,url:h.url,loader:O,context:h,networkDetails:s};C&&(R.response=C),this.hls.trigger(N.Events.ERROR,R)},p.handlePlaylistLoaded=function(h,s,a,C){var _=a.type,T=a.level,O=a.id,R=a.groupId,S=a.loader,w=a.levelDetails,E=a.deliveryDirectives;if(!(w!=null&&w.targetduration)){this.handleManifestParsingError(h,a,"invalid target duration",C);return}if(!S)return;w.live&&(S.getCacheAge&&(w.ageHeader=S.getCacheAge()||0),(!S.getCacheAge||isNaN(w.ageHeader))&&(w.ageHeader=0));switch(_){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:w,level:T||0,id:O||0,stats:s,networkDetails:C,deliveryDirectives:E});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:w,id:O||0,groupId:R||"",stats:s,networkDetails:C,deliveryDirectives:E});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:w,id:O||0,groupId:R||"",stats:s,networkDetails:C,deliveryDirectives:E});break}},o}();Y.default=u},"./src/polyfills/number.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isFiniteNumber",function(){return z}),D.d(Y,"MAX_SAFE_INTEGER",function(){return N});var z=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,Y,D){"use strict";D.r(Y);var z=function(){function N(){}return N.getSilentFrame=function(W,H){switch(W){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(H===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(H===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},N}();Y.default=z},"./src/remux/mp4-generator.ts":function(oe,Y,D){"use strict";D.r(Y);var z=Math.pow(2,32)-1,N=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 H;for(H in M.types)M.types.hasOwnProperty(H)&&(M.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var i=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:i,audio:L};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),c=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=c,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var m=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,m,o,m,u),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,g))},M.box=function(H){for(var i=8,L=arguments.length,g=new Array(L>1?L-1:0),c=1;c<L;c++)g[c-1]=arguments[c];for(var m=g.length,u=m;m--;)i+=g[m].byteLength;var o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(H,4),m=0,i=8;m<u;m++)o.set(g[m],i),i+=g[m].byteLength;return o},M.hdlr=function(H){return M.box(M.types.hdlr,M.HDLR_TYPES[H])},M.mdat=function(H){return M.box(M.types.mdat,H)},M.mdhd=function(H,i){i*=H;var L=Math.floor(i/(z+1)),g=Math.floor(i%(z+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,H>>24&255,H>>16&255,H>>8&255,H&255,L>>24,L>>16&255,L>>8&255,L&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},M.mdia=function(H){return M.box(M.types.mdia,M.mdhd(H.timescale,H.duration),M.hdlr(H.type),M.minf(H))},M.mfhd=function(H){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},M.minf=function(H){return H.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(H)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(H))},M.moof=function(H,i,L){return M.box(M.types.moof,M.mfhd(H),M.traf(L,i))},M.moov=function(H){for(var i=H.length,L=[];i--;)L[i]=M.trak(H[i]);return M.box.apply(null,[M.types.moov,M.mvhd(H[0].timescale,H[0].duration)].concat(L).concat(M.mvex(H)))},M.mvex=function(H){for(var i=H.length,L=[];i--;)L[i]=M.trex(H[i]);return M.box.apply(null,[M.types.mvex].concat(L))},M.mvhd=function(H,i){i*=H;var L=Math.floor(i/(z+1)),g=Math.floor(i%(z+1)),c=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,L>>24,L>>16&255,L>>8&255,L&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,c)},M.sdtp=function(H){var i=H.samples||[],L=new Uint8Array(4+i.length),g,c;for(g=0;g<i.length;g++)c=i[g].flags,L[g+4]=c.dependsOn<<4|c.isDependedOn<<2|c.hasRedundancy;return M.box(M.types.sdtp,L)},M.stbl=function(H){return M.box(M.types.stbl,M.stsd(H),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(H){var i=[],L=[],g,c,m;for(g=0;g<H.sps.length;g++)c=H.sps[g],m=c.byteLength,i.push(m>>>8&255),i.push(m&255),i=i.concat(Array.prototype.slice.call(c));for(g=0;g<H.pps.length;g++)c=H.pps[g],m=c.byteLength,L.push(m>>>8&255),L.push(m&255),L=L.concat(Array.prototype.slice.call(c));var u=M.box(M.types.avcC,new Uint8Array([1,i[3],i[4],i[5],252|3,224|H.sps.length].concat(i).concat([H.pps.length]).concat(L))),o=H.width,p=H.height,l=H.pixelRatio[0],h=H.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,o>>8&255,o&255,p>>8&255,p&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]),u,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([l>>24,l>>16&255,l>>8&255,l&255,h>>24,h>>16&255,h>>8&255,h&255])))},M.esds=function(H){var i=H.config.length;return new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(H.config).concat([6,1,2]))},M.mp4a=function(H){var i=H.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,H.channelCount,0,16,0,0,0,0,i>>8&255,i&255,0,0]),M.box(M.types.esds,M.esds(H)))},M.mp3=function(H){var i=H.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,H.channelCount,0,16,0,0,0,0,i>>8&255,i&255,0,0]))},M.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(H)):M.box(M.types.stsd,M.STSD,M.mp4a(H)):M.box(M.types.stsd,M.STSD,M.avc1(H))},M.tkhd=function(H){var i=H.id,L=H.duration*H.timescale,g=H.width,c=H.height,m=Math.floor(L/(z+1)),u=Math.floor(L%(z+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,i>>24&255,i>>16&255,i>>8&255,i&255,0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255,u>>24,u>>16&255,u>>8&255,u&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,g>>8&255,g&255,0,0,c>>8&255,c&255,0,0]))},M.traf=function(H,i){var L=M.sdtp(H),g=H.id,c=Math.floor(i/(z+1)),m=Math.floor(i%(z+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,c>>24,c>>16&255,c>>8&255,c&255,m>>24,m>>16&255,m>>8&255,m&255])),M.trun(H,L.length+16+20+8+16+8+8),L)},M.trak=function(H){return H.duration=H.duration||4294967295,M.box(M.types.trak,M.tkhd(H),M.mdia(H))},M.trex=function(H){var i=H.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(H,i){var L=H.samples||[],g=L.length,c=12+16*g,m=new Uint8Array(c),u,o,p,l,h,s;for(i+=8+c,m.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255],0),u=0;u<g;u++)o=L[u],p=o.duration,l=o.size,h=o.flags,s=o.cts,m.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&240<<8,h.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*u);return M.box(M.types.trun,m)},M.initSegment=function(H){M.types||M.init();var i=M.moov(H),L=new Uint8Array(M.FTYP.byteLength+i.byteLength);return L.set(M.FTYP),L.set(i,M.FTYP.byteLength),L},M}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,Y.default=N},"./src/remux/mp4-remuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return s}),D.d(Y,"normalizePts",function(){return a});var z=D("./src/polyfills/number.ts"),N=D("./src/remux/aac-helper.ts"),M=D("./src/remux/mp4-generator.ts"),W=D("./src/events.ts"),H=D("./src/errors.ts"),i=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),g=D("./src/utils/timescale-conversion.ts");function c(){return c=Object.assign||function(O){for(var R=1;R<arguments.length;R++){var S=arguments[R];for(var w in S)Object.prototype.hasOwnProperty.call(S,w)&&(O[w]=S[w])}return O},c.apply(this,arguments)}var m=10*1e3,u=1024,o=1152,p=null,l=null,h=!1,s=function(){function O(S,w,E,f){if(f===void 0&&(f=""),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=S,this.config=w,this.typeSupported=E,this.ISGenerated=!1,p===null){var x=navigator.userAgent||"",v=x.match(/Chrome\/(\d+)/i);p=v?parseInt(v[1]):0}if(l===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);l=y?parseInt(y[1]):0}h=!!p&&p<75||!!l&&l<600}var R=O.prototype;return R.destroy=function(){},R.resetTimeStamp=function(w){i.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=w},R.resetNextTimestamp=function(){i.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},R.resetInitSegment=function(){i.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},R.getVideoStartPts=function(w){var E=!1,f=w.reduce(function(x,v){var y=v.pts-x;return y<-4294967296?(E=!0,a(x,v.pts)):y>0?x:v.pts},w[0].pts);return E&&i.logger.debug("PTS rollover detected"),f},R.remux=function(w,E,f,x,v,y,U,B){var A,j,P,b,V,ne,ce=v,me=v,Ie=w.pid>-1,we=E.pid>-1,Le=E.samples.length,Re=w.samples.length>0,De=Le>1,ye=(!Ie||Re)&&(!we||De)||this.ISGenerated||U;if(ye){this.ISGenerated||(P=this.generateIS(w,E,v));var X=this.isVideoContiguous,k=-1;if(De&&(k=C(E.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if(ne=!0,k>0){i.logger.warn("[mp4-remuxer]: Dropped "+k+" out of "+Le+" video samples due to a missing keyframe");var F=this.getVideoStartPts(E.samples);E.samples=E.samples.slice(k),E.dropped+=k,me+=(E.samples[0].pts-F)/(E.timescale||9e4)}else k===-1&&(i.logger.warn("[mp4-remuxer]: No keyframe found out of "+Le+" video samples"),ne=!1);if(this.ISGenerated){if(Re&&De){var $=this.getVideoStartPts(E.samples),te=a(w.samples[0].pts,$)-$,K=te/E.inputTimeScale;ce+=Math.max(0,K),me+=Math.max(0,-K)}if(Re){if(w.samplerate||(i.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(w,E,v)),j=this.remuxAudio(w,ce,this.isAudioContiguous,y,we||De||B===L.PlaylistLevelType.AUDIO?me:void 0),De){var pe=j?j.endPTS-j.startPTS:0;E.inputTimeScale||(i.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(w,E,v)),A=this.remuxVideo(E,me,X,pe)}}else De&&(A=this.remuxVideo(E,me,X,0));A&&(A.firstKeyFrame=k,A.independent=k!==-1)}}return this.ISGenerated&&(f.samples.length&&(V=this.remuxID3(f,v)),x.samples.length&&(b=this.remuxText(x,v))),{audio:j,video:A,initSegment:P,independent:ne,text:b,id3:V}},R.generateIS=function(w,E,f){var x=w.samples,v=E.samples,y=this.typeSupported,U={},B=!Object(z.isFiniteNumber)(this._initPTS),A="audio/mp4",j,P,b;if(B&&(j=P=Infinity),w.config&&x.length&&(w.timescale=w.samplerate,w.isAAC||(y.mpeg?(A="audio/mpeg",w.codec=""):y.mp3&&(w.codec="mp3")),U.audio={id:"audio",container:A,codec:w.codec,initSegment:!w.isAAC&&y.mpeg?new Uint8Array(0):M.default.initSegment([w]),metadata:{channelCount:w.channelCount}},B&&(b=w.inputTimeScale,j=P=x[0].pts-Math.round(b*f))),E.sps&&E.pps&&v.length&&(E.timescale=E.inputTimeScale,U.video={id:"main",container:"video/mp4",codec:E.codec,initSegment:M.default.initSegment([E]),metadata:{width:E.width,height:E.height}},B)){b=E.inputTimeScale;var V=this.getVideoStartPts(v),ne=Math.round(b*f);P=Math.min(P,a(v[0].dts,V)-ne),j=Math.min(j,V-ne)}if(Object.keys(U).length)return this.ISGenerated=!0,B&&(this._initPTS=j,this._initDTS=P),{tracks:U,initPTS:j,timescale:b}},R.remuxVideo=function(w,E,f,x){var v=w.inputTimeScale,y=w.samples,U=[],B=y.length,A=this._initPTS,j=this.nextAvcDts,P=8,b,V,ne,ce=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,Ie=0,we=!1;if(!f||j===null){var Le=E*v,Re=y[0].pts-a(y[0].dts,y[0].pts);j=Le-Re}for(var De=0;De<B;De++){var ye=y[De];if(ye.pts=a(ye.pts-A,j),ye.dts=a(ye.dts-A,j),ye.dts>ye.pts){var X=9e4*.2;Ie=Math.max(Math.min(Ie,ye.pts-ye.dts),-1*X)}ye.dts<y[De>0?De-1:De].dts&&(we=!0)}we&&y.sort(function(lt,at){var Qe=lt.dts-at.dts,Lt=lt.pts-at.pts;return Qe||Lt}),V=y[0].dts,ne=y[y.length-1].dts;var k=Math.round((ne-V)/(B-1));if(Ie<0){if(Ie<k*-2){i.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-k,!0)+" ms");for(var F=Ie,$=0;$<B;$++)y[$].dts=F=Math.max(F,y[$].pts-k),y[$].pts=Math.max(F,y[$].pts)}else{i.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(Ie,!0)+" ms to overcome this issue");for(var te=0;te<B;te++)y[te].dts=y[te].dts+Ie}V=y[0].dts}if(f){var K=V-j,pe=K>k,Te=K<-1;if(pe||Te){pe?i.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(K,!0)+" ms ("+K+"dts) hole between fragments detected, filling it"):i.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-K,!0)+" ms ("+K+"dts) overlapping between fragments detected"),V=j;var ke=y[0].pts-K;y[0].dts=V,y[0].pts=ke,i.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(ke,!0)+"/"+Object(g.toMsFromMpegTsClock)(V,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(K,!0)+" ms")}}h&&(V=Math.max(0,V));for(var ue=0,ve=0,xe=0;xe<B;xe++){for(var Ce=y[xe],Ne=Ce.units,Ue=Ne.length,Ge=0,We=0;We<Ue;We++)Ge+=Ne[We].data.length;ve+=Ge,ue+=Ue,Ce.length=Ge,Ce.dts=Math.max(Ce.dts,V),Ce.pts=Math.max(Ce.pts,Ce.dts,0),ce=Math.min(Ce.pts,ce),me=Math.max(Ce.pts,me)}ne=y[B-1].dts;var it=ve+4*ue+8,Ve;try{Ve=new Uint8Array(it)}catch(lt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:it,reason:"fail allocating video mdat "+it});return}var Xe=new DataView(Ve.buffer);Xe.setUint32(0,it),Ve.set(M.default.types.mdat,4);for(var Me=0;Me<B;Me++){for(var rt=y[Me],tt=rt.units,le=0,Z=0,ee=tt.length;Z<ee;Z++){var se=tt[Z],he=se.data,ie=se.data.byteLength;Xe.setUint32(P,ie),P+=4,Ve.set(he,P),P+=ie,le+=4+ie}if(Me<B-1)b=y[Me+1].dts-rt.dts;else{var ae=this.config,de=rt.dts-y[Me>0?Me-1:Me].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var fe=Math.floor(ae.maxBufferHole*v),be=(x?ce+x*v:this.nextAudioPts)-rt.pts;be>fe?(b=be-de,b<0&&(b=de),i.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+b/90+" ms for the last video frame.")):b=de}else b=de}var Se=Math.round(rt.pts-rt.dts);U.push(new _(rt.key,b,le,Se))}if(U.length&&p&&p<70){var Pe=U[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(b!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=ne+b,this.isVideoContiguous=!0;var Be=M.default.moof(w.sequenceNumber++,V,c({},w,{samples:U})),Je="video",$e={data1:Be,data2:Ve,startPTS:ce/v,endPTS:(me+b)/v,startDTS:V/v,endDTS:j/v,type:Je,hasAudio:!1,hasVideo:!0,nb:U.length,dropped:w.dropped};return w.samples=[],w.dropped=0,console.assert(Ve.length,"MDAT length must not be zero"),$e},R.remuxAudio=function(w,E,f,x,v){var y=w.inputTimeScale,U=w.samplerate?w.samplerate:y,B=y/U,A=w.isAAC?u:o,j=A*B,P=this._initPTS,b=!w.isAAC&&this.typeSupported.mpeg,V=[],ne=w.samples,ce=b?0:8,me=this.nextAudioPts||-1,Ie=E*y;if(this.isAudioContiguous=f=f||ne.length&&me>0&&(x&&Math.abs(Ie-me)<9e3||Math.abs(a(ne[0].pts-P,Ie)-me)<20*j),ne.forEach(function(he){he.pts=a(he.pts-P,Ie)}),!f||me<0){if(ne=ne.filter(function(he){return he.pts>=0}),!ne.length)return;v===0?me=0:x?me=Math.max(0,Ie):me=ne[0].pts}if(w.isAAC)for(var we=v!==void 0,Le=this.config.maxAudioFramesDrift,Re=0,De=me;Re<ne.length;Re++){var ye=ne[Re],X=ye.pts,k=X-De,F=Math.abs(1e3*k/y);if(k<=-Le*j&&we)Re===0&&(i.logger.warn("Audio frame @ "+(X/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*k/y)+" ms."),this.nextAudioPts=me=De=X);else if(k>=Le*j&&F<m&&we){var $=Math.round(k/j);De=X-$*j,De<0&&($--,De+=j),Re===0&&(this.nextAudioPts=me=De),i.logger.warn("[mp4-remuxer]: Injecting "+$+" audio frame @ "+(De/y).toFixed(3)+"s due to "+Math.round(1e3*k/y)+" ms gap.");for(var te=0;te<$;te++){var K=Math.max(De,0),pe=N.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);pe||(i.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),pe=ye.unit.subarray()),ne.splice(Re,0,{unit:pe,pts:K}),De+=j,Re++}}ye.pts=De,De+=j}for(var Te=null,ke=null,ue,ve=0,xe=ne.length;xe--;)ve+=ne[xe].unit.byteLength;for(var Ce=0,Ne=ne.length;Ce<Ne;Ce++){var Ue=ne[Ce],Ge=Ue.unit,We=Ue.pts;if(ke!==null){var it=V[Ce-1];it.duration=Math.round((We-ke)/B)}else if(f&&w.isAAC&&(We=me),Te=We,ve>0){ve+=ce;try{ue=new Uint8Array(ve)}catch(he){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ve,reason:"fail allocating audio mdat "+ve});return}if(!b){var Ve=new DataView(ue.buffer);Ve.setUint32(0,ve),ue.set(M.default.types.mdat,4)}}else return;ue.set(Ge,ce);var Xe=Ge.byteLength;ce+=Xe,V.push(new _(!0,A,Xe,0)),ke=We}var Me=V.length;if(!Me)return;var rt=V[V.length-1];this.nextAudioPts=me=ke+B*rt.duration;var tt=b?new Uint8Array(0):M.default.moof(w.sequenceNumber++,Te/B,c({},w,{samples:V}));w.samples=[];var le=Te/y,Z=me/y,ee="audio",se={data1:tt,data2:ue,startPTS:le,endPTS:Z,startDTS:le,endDTS:Z,type:ee,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(ue.length,"MDAT length must not be zero"),se},R.remuxEmptyAudio=function(w,E,f,x){var v=w.inputTimeScale,y=w.samplerate?w.samplerate:v,U=v/y,B=this.nextAudioPts,A=(B!==null?B:x.startDTS*v)+this._initDTS,j=x.endDTS*v+this._initDTS,P=U*u,b=Math.ceil((j-A)/P),V=N.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);if(i.logger.warn("[mp4-remuxer]: remux empty Audio"),!V){i.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ne=[],ce=0;ce<b;ce++){var me=A+ce*P;ne.push({unit:V,pts:me,dts:me})}return w.samples=ne,this.remuxAudio(w,E,f,!1)},R.remuxID3=function(w,E){var f=w.samples.length;if(!f)return;for(var x=w.inputTimeScale,v=this._initPTS,y=this._initDTS,U=0;U<f;U++){var B=w.samples[U];B.pts=a(B.pts-v,E*x)/x,B.dts=a(B.dts-y,E*x)/x}var A=w.samples;return w.samples=[],{samples:A}},R.remuxText=function(w,E){var f=w.samples.length;if(!f)return;for(var x=w.inputTimeScale,v=this._initPTS,y=0;y<f;y++){var U=w.samples[y];U.pts=a(U.pts-v,E*x)/x}w.samples.sort(function(A,j){return A.pts-j.pts});var B=w.samples;return w.samples=[],{samples:B}},O}();function a(O,R){var S;if(R===null)return O;for(R<O?S=-8589934592:S=8589934592;Math.abs(O-R)>4294967296;)O+=S;return O}function C(O){for(var R=0;R<O.length;R++)if(O[R].key)return R;return-1}var _=function(R,S,w,E){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=S,this.size=w,this.cts=E,this.flags=new T(R)},T=function(R){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=R?2:1,this.isNonSync=R?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/polyfills/number.ts"),N=D("./src/utils/mp4-tools.ts"),M=D("./src/loader/fragment.ts"),W=D("./src/utils/logger.ts"),H=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var c=g.prototype;return c.destroy=function(){},c.resetTimeStamp=function(u){this.initPTS=u,this.lastEndDTS=null},c.resetNextTimestamp=function(){this.lastEndDTS=null},c.resetInitSegment=function(u,o,p){this.audioCodec=o,this.videoCodec=p,this.generateInitSegment(u),this.emitInitSegment=!0},c.generateInitSegment=function(u){var o=this.audioCodec,p=this.videoCodec;if(!u||!u.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(N.parseInitSegment)(u);o||(o=L(l.audio,M.ElementaryStreamTypes.AUDIO)),p||(p=L(l.video,M.ElementaryStreamTypes.VIDEO));var h={};l.audio&&l.video?h.audiovideo={container:"video/mp4",codec:o+","+p,initSegment:u,id:"main"}:l.audio?h.audio={container:"audio/mp4",codec:o,initSegment:u,id:"audio"}:l.video?h.video={container:"video/mp4",codec:p,initSegment:u,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=h},c.remux=function(u,o,p,l,h){var s=this.initPTS,a=this.lastEndDTS,C={audio:void 0,video:void 0,text:l,id3:p,initSegment:void 0};Object(z.isFiniteNumber)(a)||(a=this.lastEndDTS=h||0);var _=o.samples;if(!_||!_.length)return C;var T={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(_),O=this.initData),!O||!O.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(s)||(this.initPTS=T.initPTS=s=i(O,_,a));var R=Object(N.getDuration)(_,O),S=a,w=R+S;Object(N.offsetStartDTS)(O,_,s),R>0?this.lastEndDTS=w:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var E=!!O.audio,f=!!O.video,x="";E&&(x+="audio"),f&&(x+="video");var v={data1:_,startPTS:S,startDTS:S,endPTS:w,endDTS:w,type:x,hasAudio:E,hasVideo:f,nb:1,dropped:0};return C.audio=v.type==="audio"?v:void 0,C.video=v.type!=="audio"?v:void 0,C.text=l,C.id3=p,C.initSegment=T,C},g}(),i=function(c,m,u){return Object(N.getStartDTS)(c,m)-u};function L(g,c){var m=g==null?void 0:g.codec;return m&&m.length>4?m:m==="hvc1"?"hvc1.1.c.L120.90":m==="av01"?"av01.0.04M.08":m==="avc1"||c===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=H},"./src/task-loop.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return z});var z=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=N.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(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!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(){},N}()},"./src/types/cmcd.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"CMCDVersion",function(){return z}),D.d(Y,"CMCDObjectType",function(){return N}),D.d(Y,"CMCDStreamingFormat",function(){return M}),D.d(Y,"CMCDStreamType",function(){return W});var z=1,N;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(N||(N={}));var M;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(M||(M={}));var W;(function(H){H.VOD="v",H.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"HlsSkip",function(){return M}),D.d(Y,"getSkipValue",function(){return W}),D.d(Y,"HlsUrlParameters",function(){return H}),D.d(Y,"Level",function(){return i});function z(L,g){for(var c=0;c<g.length;c++){var m=g[c];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(L,m.key,m)}}function N(L,g,c){return g&&z(L.prototype,g),c&&z(L,c),L}var M;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(M||(M={}));function W(L,g){var c=L.canSkipUntil,m=L.canSkipDateRanges,u=L.endSN,o=g!==void 0?g-u:0;return c&&o<c?m?M.v2:M.Yes:M.No}var H=function(){function L(c,m,u){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=c,this.part=m,this.skip=u}var g=L.prototype;return g.addDirectives=function(m){var u=new self.URL(m);return this.msn!==void 0&&u.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&u.searchParams.set("_HLS_part",this.part.toString()),this.skip&&u.searchParams.set("_HLS_skip",this.skip),u.toString()},L}(),i=function(){function L(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(c){return c}).join(",").replace(/\.[^.,]+/g,"")}return N(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(c){var m=c%this.url.length;this._urlId!==m&&(this.details=void 0,this._urlId=m)}}]),L}()},"./src/types/loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"PlaylistContextType",function(){return z}),D.d(Y,"PlaylistLevelType",function(){return N});var z;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var N;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"ChunkMetadata",function(){return z});var z=function(W,H,i,L,g,c){L===void 0&&(L=0),g===void 0&&(g=-1),c===void 0&&(c=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=W,this.sn=H,this.id=i,this.size=L,this.part=g,this.partial=c};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"AttrList",function(){return M});var z=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function W(i){typeof i=="string"&&(i=W.parseAttrList(i));for(var L in i)i.hasOwnProperty(L)&&(this[L]=i[L])}var H=W.prototype;return H.decimalInteger=function(L){var g=parseInt(this[L],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},H.hexadecimalInteger=function(L){if(this[L]){var g=(this[L]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var c=new Uint8Array(g.length/2),m=0;m<g.length/2;m++)c[m]=parseInt(g.slice(m*2,m*2+2),16);return c}else return null},H.hexadecimalIntegerAsNumber=function(L){var g=parseInt(this[L],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},H.decimalFloatingPoint=function(L){return parseFloat(this[L])},H.optionalFloat=function(L,g){var c=this[L];return c?parseFloat(c):g},H.enumeratedString=function(L){return this[L]},H.bool=function(L){return this[L]==="YES"},H.decimalResolution=function(L){var g=z.exec(this[L]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},W.parseAttrList=function(L){var g,c={},m='"';for(N.lastIndex=0;(g=N.exec(L))!==null;){var u=g[2];u.indexOf(m)===0&&u.lastIndexOf(m)===u.length-1&&(u=u.slice(1,-1)),c[g[1]]=u}return c},W}()},"./src/utils/binary-search.ts":function(oe,Y,D){"use strict";D.r(Y);var z={search:function(M,W){for(var H=0,i=M.length-1,L=null,g=null;H<=i;){L=(H+i)/2|0,g=M[L];var c=W(g);if(c>0)H=L+1;else if(c<0)i=L-1;else return g}return null}};Y.default=z},"./src/utils/buffer-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"BufferHelper",function(){return M});var z=D("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function W(){}return W.isBuffered=function(i,L){try{if(i){for(var g=W.getBuffered(i),c=0;c<g.length;c++)if(L>=g.start(c)&&L<=g.end(c))return!0}}catch(m){}return!1},W.bufferInfo=function(i,L,g){try{if(i){var c=W.getBuffered(i),m=[],u;for(u=0;u<c.length;u++)m.push({start:c.start(u),end:c.end(u)});return this.bufferedInfo(m,L,g)}}catch(o){}return{len:0,start:L,end:L,nextStart:void 0}},W.bufferedInfo=function(i,L,g){L=Math.max(0,L),i.sort(function(T,O){var R=T.start-O.start;return R||O.end-T.end});var c=[];if(g)for(var m=0;m<i.length;m++){var u=c.length;if(u){var o=c[u-1].end;i[m].start-o<g?i[m].end>o&&(c[u-1].end=i[m].end):c.push(i[m])}else c.push(i[m])}else c=i;for(var p=0,l,h=L,s=L,a=0;a<c.length;a++){var C=c[a].start,_=c[a].end;if(L+g>=C&&L<_)h=C,s=_,p=s-L;else if(L+g<C){l=C;break}}return{len:p,start:h||0,end:s||0,nextStart:l}},W.getBuffered=function(i){try{return i.buffered}catch(L){return z.logger.log("failed to get media.buffered",L),N}},W}()},"./src/utils/cea-608-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"Row",function(){return s}),D.d(Y,"CaptionScreen",function(){return a});var z=D("./src/utils/logger.ts"),N={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(w){var E=w;return N.hasOwnProperty(w)&&(E=N[w]),String.fromCharCode(E)},W=15,H=100,i={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},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},m=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],u;(function(S){S[S.ERROR=0]="ERROR",S[S.TEXT=1]="TEXT",S[S.WARNING=2]="WARNING",S[S.INFO=2]="INFO",S[S.DEBUG=3]="DEBUG",S[S.DATA=3]="DATA"})(u||(u={}));var o=function(){function S(){this.time=null,this.verboseLevel=u.ERROR}var w=S.prototype;return w.log=function(f,x){this.verboseLevel>=f&&z.logger.log(this.time+" ["+f+"] "+x)},S}(),p=function(w){for(var E=[],f=0;f<w.length;f++)E.push(w[f].toString(16));return E},l=function(){function S(E,f,x,v,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=E||"white",this.underline=f||!1,this.italics=x||!1,this.background=v||"black",this.flash=y||!1}var w=S.prototype;return w.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},w.setStyles=function(f){for(var x=["foreground","underline","italics","background","flash"],v=0;v<x.length;v++){var y=x[v];f.hasOwnProperty(y)&&(this[y]=f[y])}},w.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},w.equals=function(f){return this.foreground===f.foreground&&this.underline===f.underline&&this.italics===f.italics&&this.background===f.background&&this.flash===f.flash},w.copy=function(f){this.foreground=f.foreground,this.underline=f.underline,this.italics=f.italics,this.background=f.background,this.flash=f.flash},w.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},S}(),h=function(){function S(E,f,x,v,y,U){this.uchar=void 0,this.penState=void 0,this.uchar=E||" ",this.penState=new l(f,x,v,y,U)}var w=S.prototype;return w.reset=function(){this.uchar=" ",this.penState.reset()},w.setChar=function(f,x){this.uchar=f,this.penState.copy(x)},w.setPenState=function(f){this.penState.copy(f)},w.equals=function(f){return this.uchar===f.uchar&&this.penState.equals(f.penState)},w.copy=function(f){this.uchar=f.uchar,this.penState.copy(f.penState)},w.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},S}(),s=function(){function S(E){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var f=0;f<H;f++)this.chars.push(new h);this.logger=E,this.pos=0,this.currPenState=new l}var w=S.prototype;return w.equals=function(f){for(var x=!0,v=0;v<H;v++)if(!this.chars[v].equals(f.chars[v])){x=!1;break}return x},w.copy=function(f){for(var x=0;x<H;x++)this.chars[x].copy(f.chars[x])},w.isEmpty=function(){for(var f=!0,x=0;x<H;x++)if(!this.chars[x].isEmpty()){f=!1;break}return f},w.setCursor=function(f){this.pos!==f&&(this.pos=f),this.pos<0?(this.logger.log(u.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(u.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},w.moveCursor=function(f){var x=this.pos+f;if(f>1)for(var v=this.pos+1;v<x+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(x)},w.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},w.insertChar=function(f){f>=144&&this.backSpace();var x=M(f);if(this.pos>=H){this.logger.log(u.ERROR,"Cannot insert "+f.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},w.clearFromPos=function(f){var x;for(x=f;x<H;x++)this.chars[x].reset()},w.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},w.clearToEndOfRow=function(){this.clearFromPos(this.pos)},w.getTextString=function(){for(var f=[],x=!0,v=0;v<H;v++){var y=this.chars[v].uchar;y!==" "&&(x=!1),f.push(y)}return x?"":f.join("")},w.setPenStyles=function(f){this.currPenState.setStyles(f);var x=this.chars[this.pos];x.setPenState(this.currPenState)},S}(),a=function(){function S(E){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var f=0;f<W;f++)this.rows.push(new s(E));this.logger=E,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var w=S.prototype;return w.reset=function(){for(var f=0;f<W;f++)this.rows[f].clear();this.currRow=W-1},w.equals=function(f){for(var x=!0,v=0;v<W;v++)if(!this.rows[v].equals(f.rows[v])){x=!1;break}return x},w.copy=function(f){for(var x=0;x<W;x++)this.rows[x].copy(f.rows[x])},w.isEmpty=function(){for(var f=!0,x=0;x<W;x++)if(!this.rows[x].isEmpty()){f=!1;break}return f},w.backSpace=function(){var f=this.rows[this.currRow];f.backSpace()},w.clearToEndOfRow=function(){var f=this.rows[this.currRow];f.clearToEndOfRow()},w.insertChar=function(f){var x=this.rows[this.currRow];x.insertChar(f)},w.setPen=function(f){var x=this.rows[this.currRow];x.setPenStyles(f)},w.moveCursor=function(f){var x=this.rows[this.currRow];x.moveCursor(f)},w.setCursor=function(f){this.logger.log(u.INFO,"setCursor: "+f);var x=this.rows[this.currRow];x.setCursor(f)},w.setPAC=function(f){this.logger.log(u.INFO,"pacData = "+JSON.stringify(f));var x=f.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var v=0;v<W;v++)this.rows[v].clear();var y=this.currRow+1-this.nrRollUpRows,U=this.lastOutputScreen;if(U){var B=U.rows[y].cueStartTime,A=this.logger.time;if(B&&A!==null&&B<A)for(var j=0;j<this.nrRollUpRows;j++)this.rows[x-this.nrRollUpRows+j+1].copy(U.rows[y+j])}}this.currRow=x;var P=this.rows[this.currRow];if(f.indent!==null){var b=f.indent,V=Math.max(b-1,0);P.setCursor(f.indent),f.color=P.chars[V].penState.foreground}var ne={foreground:f.color,underline:f.underline,italics:f.italics,background:"black",flash:!1};this.setPen(ne)},w.setBkgData=function(f){this.logger.log(u.INFO,"bkgData = "+JSON.stringify(f)),this.backSpace(),this.setPen(f),this.insertChar(32)},w.setRollUpRows=function(f){this.nrRollUpRows=f},w.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(u.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(u.TEXT,this.getDisplayText());var f=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(f,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(u.INFO,"Rolling up")},w.getDisplayText=function(f){f=f||!1;for(var x=[],v="",y=-1,U=0;U<W;U++){var B=this.rows[U].getTextString();B&&(y=U+1,f?x.push("Row "+y+": '"+B+"'"):x.push(B.trim()))}return x.length>0&&(f?v="["+x.join(" | ")+"]":v=x.join(`
|
|
`)),v},w.getTextAndFormat=function(){return this.rows},S}(),C=function(){function S(E,f,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=E,this.outputFilter=f,this.mode=null,this.verbose=0,this.displayedMemory=new a(x),this.nonDisplayedMemory=new a(x),this.lastOutputScreen=new a(x),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var w=S.prototype;return w.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},w.getHandler=function(){return this.outputFilter},w.setHandler=function(f){this.outputFilter=f},w.setPAC=function(f){this.writeScreen.setPAC(f)},w.setBkgData=function(f){this.writeScreen.setBkgData(f)},w.setMode=function(f){if(f===this.mode)return;this.mode=f,this.logger.log(u.INFO,"MODE="+f),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=f},w.insertChars=function(f){for(var x=0;x<f.length;x++)this.writeScreen.insertChar(f[x]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(u.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(u.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},w.ccRCL=function(){this.logger.log(u.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},w.ccBS=function(){if(this.logger.log(u.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},w.ccAOF=function(){},w.ccAON=function(){},w.ccDER=function(){this.logger.log(u.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},w.ccRU=function(f){this.logger.log(u.INFO,"RU("+f+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(f)},w.ccFON=function(){this.logger.log(u.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},w.ccRDC=function(){this.logger.log(u.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},w.ccTR=function(){this.logger.log(u.INFO,"TR"),this.setMode("MODE_TEXT")},w.ccRTD=function(){this.logger.log(u.INFO,"RTD"),this.setMode("MODE_TEXT")},w.ccEDM=function(){this.logger.log(u.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},w.ccCR=function(){this.logger.log(u.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},w.ccENM=function(){this.logger.log(u.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},w.ccEOC=function(){if(this.logger.log(u.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var f=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=f,this.writeScreen=this.nonDisplayedMemory,this.logger.log(u.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},w.ccTO=function(f){this.logger.log(u.INFO,"TO("+f+") - Tab Offset"),this.writeScreen.moveCursor(f)},w.ccMIDROW=function(f){var x={flash:!1};if(x.underline=f%2===1,x.italics=f>=46,x.italics)x.foreground="white";else{var v=Math.floor(f/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=y[v]}this.logger.log(u.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},w.outputDataUpdate=function(f){f===void 0&&(f=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),f&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},w.cueSplitAtTime=function(f){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,f,this.displayedMemory),this.cueStartTime=f))},S}(),_=function(){function S(E,f,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new o;this.channels=[null,new C(E,f,v),new C(E+1,x,v)],this.cmdHistory=R(),this.logger=v}var w=S.prototype;return w.getHandler=function(f){return this.channels[f].getHandler()},w.setHandler=function(f,x){this.channels[f].setHandler(x)},w.addData=function(f,x){var v,y,U,B=!1;this.logger.time=f;for(var A=0;A<x.length;A+=2){if(y=x[A]&127,U=x[A+1]&127,y===0&&U===0)continue;if(this.logger.log(u.DATA,"["+p([x[A],x[A+1]])+"] -> ("+p([y,U])+")"),v=this.parseCmd(y,U),v||(v=this.parseMidrow(y,U)),v||(v=this.parsePAC(y,U)),v||(v=this.parseBackgroundAttributes(y,U)),!v&&(B=this.parseChars(y,U),B)){var j=this.currentChannel;if(j&&j>0){var P=this.channels[j];P.insertChars(B)}else this.logger.log(u.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!B&&this.logger.log(u.WARNING,"Couldn't parse cleaned data "+p([y,U])+" orig: "+p([x[A],x[A+1]]))}},w.parseCmd=function(f,x){var v=this.cmdHistory,y=(f===20||f===28||f===21||f===29)&&x>=32&&x<=47,U=(f===23||f===31)&&x>=33&&x<=35;if(!(y||U))return!1;if(O(f,x,v))return T(null,null,v),this.logger.log(u.DEBUG,"Repeated command ("+p([f,x])+") is dropped"),!0;var B=f===20||f===21||f===23?1:2,A=this.channels[B];return f===20||f===21||f===28||f===29?x===32?A.ccRCL():x===33?A.ccBS():x===34?A.ccAOF():x===35?A.ccAON():x===36?A.ccDER():x===37?A.ccRU(2):x===38?A.ccRU(3):x===39?A.ccRU(4):x===40?A.ccFON():x===41?A.ccRDC():x===42?A.ccTR():x===43?A.ccRTD():x===44?A.ccEDM():x===45?A.ccCR():x===46?A.ccENM():x===47&&A.ccEOC():A.ccTO(x-32),T(f,x,v),this.currentChannel=B,!0},w.parseMidrow=function(f,x){var v=0;if((f===17||f===25)&&x>=32&&x<=47){if(f===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(u.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[v];return y?(y.ccMIDROW(x),this.logger.log(u.DEBUG,"MIDROW ("+p([f,x])+")"),!0):!1}return!1},w.parsePAC=function(f,x){var v,y=this.cmdHistory,U=(f>=17&&f<=23||f>=25&&f<=31)&&x>=64&&x<=127,B=(f===16||f===24)&&x>=64&&x<=95;if(!(U||B))return!1;if(O(f,x,y))return T(null,null,y),!0;var A=f<=23?1:2;x>=64&&x<=95?v=A===1?i[f]:g[f]:v=A===1?L[f]:c[f];var j=this.channels[A];return j?(j.setPAC(this.interpretPAC(v,x)),T(f,x,y),this.currentChannel=A,!0):!1},w.interpretPAC=function(f,x){var v,y={color:null,italics:!1,indent:null,underline:!1,row:f};return x>95?v=x-96:v=x-64,y.underline=(v&1)===1,v<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((v-16)/2)*4,y},w.parseChars=function(f,x){var v,y=null,U=null;if(f>=25?(v=2,U=f-8):(v=1,U=f),U>=17&&U<=19){var B;U===17?B=x+80:U===18?B=x+112:B=x+144,this.logger.log(u.INFO,"Special char '"+M(B)+"' in channel "+v),y=[B]}else f>=32&&f<=127&&(y=x===0?[f]:[f,x]);if(y){var A=p(y);this.logger.log(u.DEBUG,"Char codes = "+A.join(",")),T(f,x,this.cmdHistory)}return y},w.parseBackgroundAttributes=function(f,x){var v=(f===16||f===24)&&x>=32&&x<=47,y=(f===23||f===31)&&x>=45&&x<=47;if(!(v||y))return!1;var U,B={};f===16||f===24?(U=Math.floor((x-32)/2),B.background=m[U],x%2===1&&(B.background=B.background+"_semi")):x===45?B.background="transparent":(B.foreground="black",x===47&&(B.underline=!0));var A=f<=23?1:2,j=this.channels[A];return j.setBkgData(B),T(f,x,this.cmdHistory),!0},w.reset=function(){for(var f=0;f<Object.keys(this.channels).length;f++){var x=this.channels[f];x&&x.reset()}this.cmdHistory=R()},w.cueSplitAtTime=function(f){for(var x=0;x<this.channels.length;x++){var v=this.channels[x];v&&v.cueSplitAtTime(f)}},S}();function T(S,w,E){E.a=S,E.b=w}function O(S,w,E){return E.a===S&&E.b===w}function R(){return{a:null,b:null}}Y.default=_},"./src/utils/codecs.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isCodecType",function(){return N}),D.d(Y,"isCodecSupportedInMp4",function(){return M});var z={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 N(W,H){var i=z[H];return!!i&&i[W.slice(0,4)]===!0}function M(W,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/utils/vttparser.ts"),N=D("./src/utils/webvtt-parser.ts"),M=D("./src/utils/texttrack-utils.ts"),W=/\s/,H={newCue:function(L,g,c,m){for(var u=[],o,p,l,h,s,a=self.VTTCue||self.TextTrackCue,C=0;C<m.rows.length;C++)if(o=m.rows[C],l=!0,h=0,s="",!o.isEmpty()){for(var _=0;_<o.chars.length;_++)W.test(o.chars[_].uchar)&&l?h++:(s+=o.chars[_].uchar,l=!1);o.cueStartTime=g,g===c&&(c+=1e-4),h>=16?h--:h++;var T=Object(z.fixLineBreaks)(s.trim()),O=Object(N.generateCueId)(g,c,T);(!L||!L.cues||!L.cues.getCueById(O))&&(p=new a(g,c,T),p.id=O,p.line=C+1,p.align="left",p.position=10+Math.min(80,Math.floor(h*8/32)*10),u.push(p))}return L&&u.length&&(u.sort(function(R,S){return R.line==="auto"||S.line==="auto"?0:R.line>8&&S.line>8?S.line-R.line:R.line-S.line}),u.forEach(function(R){return Object(M.addCueToTrack)(L,R)})),u}};Y.default=H},"./src/utils/discontinuities.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"findFirstFragWithCC",function(){return W}),D.d(Y,"shouldAlignOnDiscontinuities",function(){return H}),D.d(Y,"findDiscontinuousReferenceFrag",function(){return i}),D.d(Y,"adjustSlidingStart",function(){return g}),D.d(Y,"alignStream",function(){return c}),D.d(Y,"alignPDT",function(){return u}),D.d(Y,"alignFragmentByPDTDelta",function(){return o}),D.d(Y,"alignMediaPlaylistByPDT",function(){return p});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts"),M=D("./src/controller/level-helper.ts");function W(l,h){for(var s=null,a=0,C=l.length;a<C;a++){var _=l[a];if(_&&_.cc===h){s=_;break}}return s}function H(l,h,s){return!!(h.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function i(l,h){var s=l.fragments,a=h.fragments;if(!a.length||!s.length){N.logger.log("No fragments to align");return}var C=W(s,a[0].cc);if(!C||C&&!C.startPTS){N.logger.log("No frag in previous level to align on");return}return C}function L(l,h){if(l){var s=l.start+h;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function g(l,h){for(var s=h.fragments,a=0,C=s.length;a<C;a++)L(s[a],l);h.fragmentHint&&L(h.fragmentHint,l),h.alignedSliding=!0}function c(l,h,s){if(!h)return;m(l,s,h),!s.alignedSliding&&h.details&&u(s,h.details),!s.alignedSliding&&h.details&&!s.skippedSegments&&Object(M.adjustSliding)(h.details,s)}function m(l,h,s){if(H(l,s,h)){var a=i(s.details,h);a&&Object(z.isFiniteNumber)(a.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+h.url),g(a.start,h))}}function u(l,h){if(!h.fragments.length||!l.hasProgramDateTime||!h.hasProgramDateTime)return;var s=h.fragments[0].programDateTime,a=l.fragments[0].programDateTime,C=(a-s)/1e3+h.fragments[0].start;C&&Object(z.isFiniteNumber)(C)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(a-s)+"ms, sliding:"+C.toFixed(3)+" "+l.url+" "),g(C,l))}function o(l,h){var s=l.programDateTime;if(!s)return;var a=(s-h)/1e3;l.start=l.startPTS=a,l.endPTS=a+l.duration}function p(l,h){if(!h.fragments.length||!l.hasProgramDateTime||!h.hasProgramDateTime)return;var s=h.fragments[0].programDateTime,a=h.fragments[0].start,C=s-a*1e3;l.fragments.forEach(function(_){o(_,C)}),l.fragmentHint&&o(l.fragmentHint,C),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/utils/ewma.ts"),N=function(){function M(H,i,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 z.default(H),this.fast_=new z.default(i)}var W=M.prototype;return W.update=function(i,L){var g=this.slow_,c=this.fast_;this.slow_.halfLife!==i&&(this.slow_=new z.default(i,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new z.default(L,c.getEstimate(),c.getTotalWeight()))},W.sample=function(i,L){i=Math.max(i,this.minDelayMs_);var g=8*L,c=i/1e3,m=g/c;this.fast_.sample(c,m),this.slow_.sample(c,m)},W.canEstimate=function(){var i=this.fast_;return i&&i.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},M}();Y.default=N},"./src/utils/ewma.ts":function(oe,Y,D){"use strict";D.r(Y);var z=function(){function N(W,H,i){H===void 0&&(H=0),i===void 0&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=H,this.totalWeight_=i}var M=N.prototype;return M.sample=function(H,i){var L=Math.pow(this.alpha_,H);this.estimate_=i*(1-L)+L*this.estimate_,this.totalWeight_+=H},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},N}();Y.default=z},"./src/utils/fetch-loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"fetchSupported",function(){return o});var z=D("./src/polyfills/number.ts"),N=D("./src/loader/load-stats.ts"),M=D("./src/demux/chunk-cache.ts");function W(a,C){a.prototype=Object.create(C.prototype),a.prototype.constructor=a,c(a,C)}function H(a){var C=typeof Map=="function"?new Map:void 0;return H=function(T){if(T===null||!g(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(T))return C.get(T);C.set(T,O)}function O(){return i(T,arguments,m(this).constructor)}return O.prototype=Object.create(T.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),c(O,T)},H(a)}function i(a,C,_){return L()?i=Reflect.construct:i=function(O,R,S){var w=[null];w.push.apply(w,R);var E=Function.bind.apply(O,w),f=new E;return S&&c(f,S.prototype),f},i.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(a){return!1}}function g(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function c(a,C){return c=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},c(a,C)}function m(a){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(_){return _.__proto__||Object.getPrototypeOf(_)},m(a)}function u(){return u=Object.assign||function(a){for(var C=1;C<arguments.length;C++){var _=arguments[C];for(var T in _)Object.prototype.hasOwnProperty.call(_,T)&&(a[T]=_[T])}return a},u.apply(this,arguments)}function o(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}var p=function(){function a(_){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=_.fetchSetup||h,this.controller=new self.AbortController,this.stats=new N.LoadStats}var C=a.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(T,O,R){var S=this,w=this.stats;if(w.loading.start)throw new Error("Loader can only be used once.");w.loading.start=self.performance.now();var E=l(T,this.controller.signal),f=R.onProgress,x=T.responseType==="arraybuffer",v=x?"byteLength":"length";this.context=T,this.config=O,this.callbacks=R,this.request=this.fetchSetup(T,E),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){S.abortInternal(),R.onTimeout(w,T,S.response)},O.timeout),self.fetch(this.request).then(function(y){if(S.response=S.loader=y,!y.ok){var U=y.status,B=y.statusText;throw new s(B||"fetch, bad network response",U,y)}return w.loading.first=Math.max(self.performance.now(),w.loading.start),w.total=parseInt(y.headers.get("Content-Length")||"0"),f&&Object(z.isFiniteNumber)(O.highWaterMark)?S.loadProgressively(y,w,T,O.highWaterMark,f):x?y.arrayBuffer():y.text()}).then(function(y){var U=S.response;self.clearTimeout(S.requestTimeout),w.loading.end=Math.max(self.performance.now(),w.loading.first),w.loaded=w.total=y[v];var B={url:U.url,data:y};f&&!Object(z.isFiniteNumber)(O.highWaterMark)&&f(w,T,y,U),R.onSuccess(B,w,T,U)}).catch(function(y){if(self.clearTimeout(S.requestTimeout),w.aborted)return;var U=y.code||0;R.onError({code:U,text:y.message},T,y.details)})},C.getCacheAge=function(){var T=null;if(this.response){var O=this.response.headers.get("age");T=O?parseFloat(O):null}return T},C.loadProgressively=function(T,O,R,S,w){S===void 0&&(S=0);var E=new M.default,f=T.body.getReader(),x=function v(){return f.read().then(function(y){if(y.done)return E.dataLength&&w(O,R,E.flush(),T),Promise.resolve(new ArrayBuffer(0));var U=y.value,B=U.length;return O.loaded+=B,B<S||E.dataLength?(E.push(U),E.dataLength>=S&&w(O,R,E.flush(),T)):w(O,R,U,T),v()}).catch(function(){return Promise.reject()})};return x()},a}();function l(a,C){var _={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(u({},a.headers))};return a.rangeEnd&&_.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),_}function h(a,C){return new self.Request(a.url,C)}var s=function(a){W(C,a);function C(_,T,O){var R;return R=a.call(this,_)||this,R.code=void 0,R.details=void 0,R.code=T,R.details=O,R}return C}(H(Error));Y.default=p},"./src/utils/imsc1-ttml-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"IMSC1_CODEC",function(){return g}),D.d(Y,"parseIMSC1",function(){return o});var z=D("./src/utils/mp4-tools.ts"),N=D("./src/utils/vttparser.ts"),M=D("./src/utils/vttcue.ts"),W=D("./src/demux/id3.ts"),H=D("./src/utils/timescale-conversion.ts"),i=D("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(S){for(var w=1;w<arguments.length;w++){var E=arguments[w];for(var f in E)Object.prototype.hasOwnProperty.call(E,f)&&(S[f]=E[f])}return S},L.apply(this,arguments)}var g="stpp.ttml.im1t",c=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,m=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,u={left:"start",center:"center",right:"end",start:"start",end:"end"};function o(S,w,E,f,x){var v=Object(z.findBox)(new Uint8Array(S),["mdat"]);if(v.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var y=v[0],U=Object(W.utf8ArrayToStr)(new Uint8Array(S,y.start,y.end-y.start)),B=Object(H.toTimescaleFromScale)(w,1,E);try{f(p(U,B))}catch(A){x(A)}}function p(S,w){var E=new DOMParser,f=E.parseFromString(S,"text/xml"),x=f.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(v).reduce(function(P,b){return P[b]=x.getAttribute("ttp:"+b)||v[b],P},{}),U=x.getAttribute("xml:space")!=="preserve",B=h(l(x,"styling","style")),A=h(l(x,"layout","region")),j=l(x,"body","[begin]");return[].map.call(j,function(P){var b=s(P,U);if(!b||!P.hasAttribute("begin"))return null;var V=T(P.getAttribute("begin"),y),ne=T(P.getAttribute("dur"),y),ce=T(P.getAttribute("end"),y);if(V===null)throw _(P);if(ce===null){if(ne===null)throw _(P);ce=V+ne}var me=new M.default(V-w,ce-w,b);me.id=Object(i.generateCueId)(me.startTime,me.endTime,me.text);var Ie=A[P.getAttribute("region")],we=B[P.getAttribute("style")];me.position=10,me.size=80;var Le=a(Ie,we),Re=Le.textAlign;if(Re){var De=u[Re];De&&(me.lineAlign=De),me.align=Re}return L(me,Le),me}).filter(function(P){return P!==null})}function l(S,w,E){var f=S.getElementsByTagName(w)[0];return f?[].slice.call(f.querySelectorAll(E)):[]}function h(S){return S.reduce(function(w,E){var f=E.getAttribute("xml:id");return f&&(w[f]=E),w},{})}function s(S,w){return[].slice.call(S.childNodes).reduce(function(E,f,x){var v;return f.nodeName==="br"&&x?E+`
|
|
`:(v=f.childNodes)!==null&&v!==void 0&&v.length?s(f,w):w?E+f.textContent.trim().replace(/\s+/g," "):E+f.textContent},"")}function a(S,w){var E="http://www.w3.org/ns/ttml#styling",f=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return f.reduce(function(x,v){var y=C(w,E,v)||C(S,E,v);return y&&(x[v]=y),x},{})}function C(S,w,E){return S.hasAttributeNS(w,E)?S.getAttributeNS(w,E):null}function _(S){return new Error("Could not parse ttml timestamp "+S)}function T(S,w){if(!S)return null;var E=Object(N.parseTimeStamp)(S);return E===null&&(c.test(S)?E=O(S,w):m.test(S)&&(E=R(S,w))),E}function O(S,w){var E=c.exec(S),f=(E[4]|0)+(E[5]|0)/w.subFrameRate;return(E[1]|0)*3600+(E[2]|0)*60+(E[3]|0)+f/w.frameRate}function R(S,w){var E=m.exec(S),f=Number(E[1]),x=E[2];switch(x){case"h":return f*3600;case"m":return f*60;case"ms":return f*1e3;case"f":return f/w.frameRate;case"t":return f/w.tickRate}return f}},"./src/utils/logger.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"enableLogs",function(){return i}),D.d(Y,"logger",function(){return L});var z=function(){},N={trace:z,debug:z,log:z,warn:z,info:z,error:z},M=N;function W(g){var c=self.console[g];return c?c.bind(self.console,"["+g+"] >"):z}function H(g){for(var c=arguments.length,m=new Array(c>1?c-1:0),u=1;u<c;u++)m[u-1]=arguments[u];m.forEach(function(o){M[o]=g[o]?g[o].bind(g):W(o)})}function i(g){if(self.console&&g===!0||typeof g=="object"){H(g,"debug","log","info","warn","error");try{M.log()}catch(c){M=N}}else M=N}var L=M},"./src/utils/mediakeys-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"KeySystems",function(){return z}),D.d(Y,"requestMediaKeySystemAccess",function(){return N});var z;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(z||(z={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"bin2str",function(){return H}),D.d(Y,"readUint16",function(){return i}),D.d(Y,"readUint32",function(){return L}),D.d(Y,"writeUint32",function(){return g}),D.d(Y,"findBox",function(){return c}),D.d(Y,"parseSegmentIndex",function(){return m}),D.d(Y,"parseInitSegment",function(){return u}),D.d(Y,"getStartDTS",function(){return o}),D.d(Y,"getDuration",function(){return p}),D.d(Y,"computeRawDurationFromSamples",function(){return l}),D.d(Y,"offsetStartDTS",function(){return h}),D.d(Y,"segmentValidRange",function(){return s}),D.d(Y,"appendUint8Array",function(){return a});var z=D("./src/utils/typed-array.ts"),N=D("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,W=[].push;function H(C){return String.fromCharCode.apply(null,C)}function i(C,_){"data"in C&&(_+=C.start,C=C.data);var T=C[_]<<8|C[_+1];return T<0?65536+T:T}function L(C,_){"data"in C&&(_+=C.start,C=C.data);var T=C[_]<<24|C[_+1]<<16|C[_+2]<<8|C[_+3];return T<0?4294967296+T:T}function g(C,_,T){"data"in C&&(_+=C.start,C=C.data),C[_]=T>>24,C[_+1]=T>>16&255,C[_+2]=T>>8&255,C[_+3]=T&255}function c(C,_){var T=[];if(!_.length)return T;var O,R,S;"data"in C?(O=C.data,R=C.start,S=C.end):(O=C,R=0,S=O.byteLength);for(var w=R;w<S;){var E=L(O,w),f=H(O.subarray(w+4,w+8)),x=E>1?w+E:S;if(f===_[0])if(_.length===1)T.push({data:O,start:w+8,end:x});else{var v=c({data:O,start:w+8,end:x},_.slice(1));v.length&&W.apply(T,v)}w=x}return T}function m(C){var _=c(C,["moov"]),T=_[0],O=T?T.end:null,R=c(C,["sidx"]);if(!R||!R[0])return null;var S=[],w=R[0],E=w.data[0],f=E===0?8:16,x=L(w,f);f+=4;var v=0,y=0;E===0?f+=8:f+=16,f+=2;var U=w.end+y,B=i(w,f);f+=2;for(var A=0;A<B;A++){var j=f,P=L(w,j);j+=4;var b=P&2147483647,V=(P&2147483648)>>>31;if(V===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ne=L(w,j);j+=4,S.push({referenceSize:b,subsegmentDuration:ne,info:{duration:ne/x,start:U,end:U+b-1}}),U+=b,j+=4,f=j}return{earliestPresentationTime:v,timescale:x,version:E,referencesCount:B,references:S,moovEndOffset:O}}function u(C){for(var _=[],T=c(C,["moov","trak"]),O=0;O<T.length;O++){var R=T[O],S=c(R,["tkhd"])[0];if(S){var w=S.data[S.start],E=w===0?12:20,f=L(S,E),x=c(R,["mdia","mdhd"])[0];if(x){w=x.data[x.start],E=w===0?12:20;var v=L(x,E),y=c(R,["mdia","hdlr"])[0];if(y){var U=H(y.data.subarray(y.start+8,y.start+12)),B={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[U];if(B){var A=c(R,["mdia","minf","stbl","stsd"])[0],j=void 0;A&&(j=H(A.data.subarray(A.start+12,A.start+16))),_[f]={timescale:v,type:B},_[B]={timescale:v,id:f,codec:j}}}}}}var P=c(C,["moov","mvex","trex"]);return P.forEach(function(b){var V=L(b,4),ne=_[V];ne&&(ne.default={duration:L(b,12),flags:L(b,20)})}),_}function o(C,_){return c(_,["moof","traf"]).reduce(function(T,O){var R=c(O,["tfdt"])[0],S=R.data[R.start],w=c(O,["tfhd"]).reduce(function(E,f){var x=L(f,4),v=C[x];if(v){var y=L(R,4);S===1&&(y*=Math.pow(2,32),y+=L(R,8));var U=v.timescale||9e4,B=y/U;if(isFinite(B)&&(E===null||B<E))return B}return E},null);return w!==null&&isFinite(w)&&(T===null||w<T)?w:T},null)||0}function p(C,_){for(var T=0,O=0,R=0,S=c(C,["moof","traf"]),w=0;w<S.length;w++){var E=S[w],f=c(E,["tfhd"])[0],x=L(f,4),v=_[x];if(!v)continue;var y=v.default,U=L(f,0)|(y==null?void 0:y.flags),B=y==null?void 0:y.duration;U&8&&(U&2?B=L(f,12):B=L(f,8));for(var A=v.timescale||9e4,j=c(E,["trun"]),P=0;P<j.length;P++){if(B){var b=L(j[P],4);T=B*b}else T=l(j[P]);v.type===N.ElementaryStreamTypes.VIDEO?O+=T/A:v.type===N.ElementaryStreamTypes.AUDIO&&(R+=T/A)}}if(O===0&&R===0){var V=m(C);if(V!=null&&V.references)return V.references.reduce(function(ne,ce){return ne+ce.info.duration||0},0)}return O||R}function l(C){var _=L(C,0),T=8;_&1&&(T+=4),_&4&&(T+=4);for(var O=0,R=L(C,4),S=0;S<R;S++){if(_&256){var w=L(C,T);O+=w,T+=4}_&512&&(T+=4),_&1024&&(T+=4),_&2048&&(T+=4)}return O}function h(C,_,T){c(_,["moof","traf"]).forEach(function(O){c(O,["tfhd"]).forEach(function(R){var S=L(R,4),w=C[S];if(!w)return;var E=w.timescale||9e4;c(O,["tfdt"]).forEach(function(f){var x=f.data[f.start],v=L(f,4);if(x===0)g(f,4,v-T*E);else{v*=Math.pow(2,32),v+=L(f,8),v-=T*E,v=Math.max(v,0);var y=Math.floor(v/(M+1)),U=Math.floor(v%(M+1));g(f,4,y),g(f,8,U)}})})})}function s(C){var _={valid:null,remainder:null},T=c(C,["moof"]);if(T){if(T.length<2)return _.remainder=C,_}else return _;var O=T[T.length-1];return _.valid=Object(z.sliceUint8)(C,0,O.start-8),_.remainder=Object(z.sliceUint8)(C,O.start-8),_}function a(C,_){var T=new Uint8Array(C.length+_.length);return T.set(C),T.set(_,C.length),T}},"./src/utils/output-filter.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return z});var z=function(){function N(W,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=H}var M=N.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(H,i,L){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=i,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"sendAddTrackEvent",function(){return N}),D.d(Y,"addCueToTrack",function(){return M}),D.d(Y,"clearCurrentCues",function(){return W}),D.d(Y,"removeCuesInRange",function(){return H}),D.d(Y,"getCuesInRange",function(){return L});var z=D("./src/utils/logger.ts");function N(g,c){var m;try{m=new Event("addtrack")}catch(u){m=document.createEvent("Event"),m.initEvent("addtrack",!1,!1)}m.track=g,c.dispatchEvent(m)}function M(g,c){var m=g.mode;if(m==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(c.id))try{if(g.addCue(c),!g.cues.getCueById(c.id))throw new Error("addCue is failed for: "+c)}catch(o){z.logger.debug("[texttrack-utils]: "+o);var u=new self.TextTrackCue(c.startTime,c.endTime,c.text);u.id=c.id,g.addCue(u)}m==="disabled"&&(g.mode=m)}function W(g){var c=g.mode;if(c==="disabled"&&(g.mode="hidden"),g.cues)for(var m=g.cues.length;m--;)g.removeCue(g.cues[m]);c==="disabled"&&(g.mode=c)}function H(g,c,m){var u=g.mode;if(u==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var o=L(g.cues,c,m),p=0;p<o.length;p++)g.removeCue(o[p]);u==="disabled"&&(g.mode=u)}function i(g,c){if(c<g[0].startTime)return 0;var m=g.length-1;if(c>g[m].endTime)return-1;for(var u=0,o=m;u<=o;){var p=Math.floor((o+u)/2);if(c<g[p].startTime)o=p-1;else if(c>g[p].startTime&&u<m)u=p+1;else return p}return g[u].startTime-c<c-g[o].startTime?u:o}function L(g,c,m){var u=[],o=i(g,c);if(o>-1)for(var p=o,l=g.length;p<l;p++){var h=g[p];if(h.startTime>=c&&h.endTime<=m)u.push(h);else if(h.startTime>m)return u}return u}},"./src/utils/time-ranges.ts":function(oe,Y,D){"use strict";D.r(Y);var z={toString:function(M){for(var W="",H=M.length,i=0;i<H;i++)W+="["+M.start(i).toFixed(3)+","+M.end(i).toFixed(3)+"]";return W}};Y.default=z},"./src/utils/timescale-conversion.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"toTimescaleFromBase",function(){return N}),D.d(Y,"toTimescaleFromScale",function(){return M}),D.d(Y,"toMsFromMpegTsClock",function(){return W}),D.d(Y,"toMpegTsClockFromTimescale",function(){return H});var z=9e4;function N(i,L,g,c){g===void 0&&(g=1),c===void 0&&(c=!1);var m=i*L*g;return c?Math.round(m):m}function M(i,L,g,c){return g===void 0&&(g=1),c===void 0&&(c=!1),N(i,L,1/g,c)}function W(i,L){return L===void 0&&(L=!1),N(i,1e3,1/z,L)}function H(i,L){return L===void 0&&(L=1),N(i,z,1/L)}},"./src/utils/typed-array.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"sliceUint8",function(){return z});function z(N,M,W){return Uint8Array.prototype.slice?N.slice(M,W):new Uint8Array(Array.prototype.slice.call(N,M,W))}},"./src/utils/vttcue.ts":function(oe,Y,D){"use strict";D.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],N=["start","middle","end","left","right"];function M(g,c){if(typeof c!="string")return!1;if(!Array.isArray(g))return!1;var m=c.toLowerCase();return~g.indexOf(m)?m:!1}function W(g){return M(z,g)}function H(g){return M(N,g)}function i(g){for(var c=arguments.length,m=new Array(c>1?c-1:0),u=1;u<c;u++)m[u-1]=arguments[u];for(var o=1;o<arguments.length;o++){var p=arguments[o];for(var l in p)g[l]=p[l]}return g}function L(g,c,m){var u=this,o={enumerable:!0};u.hasBeenReset=!1;var p="",l=!1,h=g,s=c,a=m,C=null,_="",T=!0,O="auto",R="start",S=50,w="middle",E=50,f="middle";Object.defineProperty(u,"id",i({},o,{get:function(){return p},set:function(v){p=""+v}})),Object.defineProperty(u,"pauseOnExit",i({},o,{get:function(){return l},set:function(v){l=!!v}})),Object.defineProperty(u,"startTime",i({},o,{get:function(){return h},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");h=v,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",i({},o,{get:function(){return s},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",i({},o,{get:function(){return a},set:function(v){a=""+v,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",i({},o,{get:function(){return C},set:function(v){C=v,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",i({},o,{get:function(){return _},set:function(v){var y=W(v);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");_=y,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",i({},o,{get:function(){return T},set:function(v){T=!!v,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",i({},o,{get:function(){return O},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=v,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",i({},o,{get:function(){return R},set:function(v){var y=H(v);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");R=y,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",i({},o,{get:function(){return S},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");S=v,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",i({},o,{get:function(){return w},set:function(v){var y=H(v);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");w=y,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",i({},o,{get:function(){return E},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");E=v,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",i({},o,{get:function(){return f},set:function(v){var y=H(v);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");f=y,this.hasBeenReset=!0}})),u.displayState=void 0}return L.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"parseTimeStamp",function(){return M}),D.d(Y,"fixLineBreaks",function(){return c}),D.d(Y,"VTTParser",function(){return m});var z=D("./src/utils/vttcue.ts"),N=function(){function u(){}var o=u.prototype;return o.decode=function(l,h){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},u}();function M(u){function o(l,h,s,a){return(l|0)*3600+(h|0)*60+(s|0)+parseFloat(a||0)}var p=u.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?o(p[2],p[3],0,p[4]):o(p[1],p[2],p[3],p[4]):null}var W=function(){function u(){this.values=Object.create(null)}var o=u.prototype;return o.set=function(l,h){!this.get(l)&&h!==""&&(this.values[l]=h)},o.get=function(l,h,s){return s?this.has(l)?this.values[l]:h[s]:this.has(l)?this.values[l]:h},o.has=function(l){return l in this.values},o.alt=function(l,h,s){for(var a=0;a<s.length;++a)if(h===s[a]){this.set(l,h);break}},o.integer=function(l,h){/^-?\d+$/.test(h)&&this.set(l,parseInt(h,10))},o.percent=function(l,h){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(h)){var s=parseFloat(h);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},u}();function H(u,o,p,l){var h=l?u.split(l):[u];for(var s in h){if(typeof h[s]!="string")continue;var a=h[s].split(p);if(a.length!==2)continue;var C=a[0],_=a[1];o(C,_)}}var i=new z.default(0,0,""),L=i.align==="middle"?"middle":"center";function g(u,o,p){var l=u;function h(){var C=M(u);if(C===null)throw new Error("Malformed timestamp: "+l);return u=u.replace(/^[^\sa-zA-Z-]+/,""),C}function s(C,_){var T=new W;H(C,function(S,w){var E;switch(S){case"region":for(var f=p.length-1;f>=0;f--)if(p[f].id===w){T.set(S,p[f].region);break}break;case"vertical":T.alt(S,w,["rl","lr"]);break;case"line":E=w.split(","),T.integer(S,E[0]),T.percent(S,E[0])&&T.set("snapToLines",!1),T.alt(S,E[0],["auto"]),E.length===2&&T.alt("lineAlign",E[1],["start",L,"end"]);break;case"position":E=w.split(","),T.percent(S,E[0]),E.length===2&&T.alt("positionAlign",E[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":T.percent(S,w);break;case"align":T.alt(S,w,["start",L,"end","left","right"]);break}},/:/,/\s/),_.region=T.get("region",null),_.vertical=T.get("vertical","");var O=T.get("line","auto");O==="auto"&&i.line===-1&&(O=-1),_.line=O,_.lineAlign=T.get("lineAlign","start"),_.snapToLines=T.get("snapToLines",!0),_.size=T.get("size",100),_.align=T.get("align",L);var R=T.get("position","auto");R==="auto"&&i.position===50&&(R=_.align==="start"||_.align==="left"?0:_.align==="end"||_.align==="right"?100:50),_.position=R}function a(){u=u.replace(/^\s+/,"")}if(a(),o.startTime=h(),a(),u.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);u=u.substr(3),a(),o.endTime=h(),a(),s(u,o)}function c(u){return u.replace(/<br(?: \/)?>/gi,`
|
|
`)}var m=function(){function u(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var o=u.prototype;return o.parse=function(l){var h=this;l&&(h.buffer+=h.decoder.decode(l,{stream:!0}));function s(){var R=h.buffer,S=0;for(R=c(R);S<R.length&&R[S]!=="\r"&&R[S]!==`
|
|
`;)++S;var w=R.substr(0,S);return R[S]==="\r"&&++S,R[S]===`
|
|
`&&++S,h.buffer=R.substr(S),w}function a(R){H(R,function(S,w){},/:/)}try{var C="";if(h.state==="INITIAL"){if(!/\r\n|\n/.test(h.buffer))return this;C=s();var _=C.match(/^()?WEBVTT([ \t].*)?$/);if(!_||!_[0])throw new Error("Malformed WebVTT signature.");h.state="HEADER"}for(var T=!1;h.buffer;){if(!/\r\n|\n/.test(h.buffer))return this;T?T=!1:C=s();switch(h.state){case"HEADER":/:/.test(C)?a(C):C||(h.state="ID");continue;case"NOTE":C||(h.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){h.state="NOTE";break}if(!C)continue;if(h.cue=new z.default(0,0,""),h.state="CUE",C.indexOf("-->")===-1){h.cue.id=C;continue}case"CUE":if(!h.cue){h.state="BADCUE";continue}try{g(C,h.cue,h.regionList)}catch(R){h.cue=null,h.state="BADCUE";continue}h.state="CUETEXT";continue;case"CUETEXT":{var O=C.indexOf("-->")!==-1;if(!C||O&&(T=!0)){h.oncue&&h.cue&&h.oncue(h.cue),h.cue=null,h.state="ID";continue}if(h.cue===null)continue;h.cue.text&&(h.cue.text+=`
|
|
`),h.cue.text+=C}continue;case"BADCUE":C||(h.state="ID")}}}catch(R){h.state==="CUETEXT"&&h.cue&&h.oncue&&h.oncue(h.cue),h.cue=null,h.state=h.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},o.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(h){l.onparsingerror&&l.onparsingerror(h)}return l.onflush&&l.onflush(),this},u}()},"./src/utils/webvtt-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"generateCueId",function(){return m}),D.d(Y,"parseWebVTT",function(){return o});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/vttparser.ts"),M=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),H=D("./src/remux/mp4-remuxer.ts"),i=/\r\n|\n\r|\n|\r/g,L=function(l,h,s){return s===void 0&&(s=0),l.substr(s,h.length)===h},g=function(l){var h=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),a=parseInt(l.substr(-9,2)),C=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(h)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return h+=1e3*s,h+=60*1e3*a,h+=60*60*1e3*C,h},c=function(l){for(var h=5381,s=l.length;s;)h=h*33^l.charCodeAt(--s);return(h>>>0).toString()};function m(p,l,h){return c(p.toString())+c(l.toString())+c(h)}var u=function(l,h,s){var a=l[h],C=l[a.prevCC];if(!C||!C.new&&a.new){l.ccOffset=l.presentationOffset=a.start,a.new=!1;return}for(;(_=C)!==null&&_!==void 0&&_.new;){var _;l.ccOffset+=a.start-C.start,a.new=!1,a=C,C=l[a.prevCC]}l.presentationOffset=s};function o(p,l,h,s,a,C,_,T){var O=new N.VTTParser,R=Object(M.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(i,`
|
|
`).split(`
|
|
`),S=[],w=Object(W.toMpegTsClockFromTimescale)(l,h),E="00:00.000",f=0,x=0,v,y=!0,U=!1;O.oncue=function(B){var A=s[a],j=s.ccOffset,P=(f-w)/9e4;if(A!=null&&A.new&&(x!==void 0?j=s.ccOffset=A.start:u(s,a,P)),P&&(j=P-s.presentationOffset),U){var b=B.endTime-B.startTime,V=Object(H.normalizePts)((B.startTime+j-x)*9e4,C*9e4)/9e4;B.startTime=V,B.endTime=V+b}var ne=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(ne)),B.id||(B.id=m(B.startTime,B.endTime,ne)),B.endTime>0&&S.push(B)},O.onparsingerror=function(B){v=B},O.onflush=function(){if(v){T(v);return}_(S)},R.forEach(function(B){if(y)if(L(B,"X-TIMESTAMP-MAP=")){y=!1,U=!0,B.substr(16).split(",").forEach(function(A){L(A,"LOCAL:")?E=A.substr(6):L(A,"MPEGTS:")&&(f=parseInt(A.substr(7)))});try{x=g(E)/1e3}catch(A){U=!1,v=A}return}else B===""&&(y=!1);O.parse(B+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(oe,Y,D){"use strict";D.r(Y);var z=D("./src/utils/logger.ts"),N=D("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,W=function(){function H(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 N.LoadStats,this.retryDelay=0}var i=H.prototype;return i.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},i.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},i.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},i.load=function(g,c,m){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=c,this.callbacks=m,this.retryDelay=c.retryDelay,this.loadInternal()},i.loadInternal=function(){var g=this.config,c=this.context;if(!g)return;var m=this.loader=new self.XMLHttpRequest,u=this.stats;u.loading.first=0,u.loaded=0;var o=this.xhrSetup;try{if(o)try{o(m,c.url)}catch(h){m.open("GET",c.url,!0),o(m,c.url)}m.readyState||m.open("GET",c.url,!0);var p=this.context.headers;if(p)for(var l in p)m.setRequestHeader(l,p[l])}catch(h){this.callbacks.onError({code:m.status,text:h.message},c,m);return}c.rangeEnd&&m.setRequestHeader("Range","bytes="+c.rangeStart+"-"+(c.rangeEnd-1)),m.onreadystatechange=this.readystatechange.bind(this),m.onprogress=this.loadprogress.bind(this),m.responseType=c.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),m.send()},i.readystatechange=function(){var g=this.context,c=this.loader,m=this.stats;if(!g||!c)return;var u=c.readyState,o=this.config;if(m.aborted)return;if(u>=2)if(self.clearTimeout(this.requestTimeout),m.loading.first===0&&(m.loading.first=Math.max(self.performance.now(),m.loading.start)),u===4){c.onreadystatechange=null,c.onprogress=null;var p=c.status;if(p>=200&&p<300){m.loading.end=Math.max(self.performance.now(),m.loading.first);var l,h;if(g.responseType==="arraybuffer"?(l=c.response,h=l.byteLength):(l=c.responseText,h=l.length),m.loaded=m.total=h,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(m,g,l,c),!this.callbacks)return;var a={url:c.responseURL,data:l};this.callbacks.onSuccess(a,m,g,c)}else m.retry>=o.maxRetry||p>=400&&p<499?(z.logger.error(p+" while loading "+g.url),this.callbacks.onError({code:p,text:c.statusText},g,c)):(z.logger.warn(p+" while loading "+g.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,o.maxRetryDelay),m.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout)},i.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},i.loadprogress=function(g){var c=this.stats;c.loaded=g.loaded,g.lengthComputable&&(c.total=g.total)},i.getCacheAge=function(){var g=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var c=this.loader.getResponseHeader("age");g=c?parseFloat(c):null}return g},H}();Y.default=W}}).default})},vHTk:function(et,Ee,J){et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|