You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
376 lines
1.0 MiB
376 lines
1.0 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[47,5,6,7],{"+NIl":function(pt,Te,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(J,O){"use strict";function X(m,f){m.cmdState.push(f)}function F(m){return m.cmdState.length>0?m.cmdState[m.cmdState.length-1]:null}function P(m){var f=m.cmdState.pop();f&&f.closeBracket()}function W(m){for(var f=m.cmdState,y=f.length-1;y>=0;y--){var a=f[y];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function U(m,f,y){return function(){this.name=m,this.bracketNo=0,this.style=f,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var _={};_.importmodule=U("importmodule","tag",["string","builtin"]),_.documentclass=U("documentclass","tag",["","atom"]),_.usepackage=U("usepackage","tag",["atom"]),_.begin=U("begin","tag",["atom"]),_.end=U("end","tag",["atom"]),_.label=U("label","tag",["atom"]),_.ref=U("ref","tag",["atom"]),_.eqref=U("eqref","tag",["atom"]),_.cite=U("cite","tag",["atom"]),_.bibitem=U("bibitem","tag",["atom"]),_.Bibitem=U("Bibitem","tag",["atom"]),_.RBibitem=U("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(m,f){m.f=f}function d(m,f){var y;if(m.match(/^\\[a-zA-Z@]+/)){var a=m.current().slice(1);return y=_.hasOwnProperty(a)?_[a]:_.DEFAULT,y=new y,X(f,y),A(f,T),y.style}if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/\\]/))return"tag";if(m.match("\\["))return A(f,function(s,l){return p(s,l,"\\]")}),"keyword";if(m.match("\\("))return A(f,function(s,l){return p(s,l,"\\)")}),"keyword";if(m.match("$$"))return A(f,function(s,l){return p(s,l,"$$")}),"keyword";if(m.match("$"))return A(f,function(s,l){return p(s,l,"$")}),"keyword";var i=m.next();if(i=="%")return m.skipToEnd(),"comment";if(i=="}"||i=="]"){if(y=F(f),y)y.closeBracket(i),A(f,T);else return"error";return"bracket"}else return i=="{"||i=="["?(y=_.DEFAULT,y=new y,X(f,y),"bracket"):/\d/.test(i)?(m.eatWhile(/[\w.%]/),"atom"):(m.eatWhile(/[\w\-_]/),y=W(f),y.name=="begin"&&(y.argument=m.current()),y.styleIdentifier())}function p(m,f,y){if(m.eatSpace())return null;if(y&&m.match(y))return A(f,d),"keyword";if(m.match(/^\\[a-zA-Z@]+/))return"tag";if(m.match(/^[a-zA-Z]+/))return"variable-2";if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/]/))return"tag";if(m.match(/^[\^_&]/))return"tag";if(m.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(m.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var a=m.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(m.skipToEnd(),"comment"):"error"}function T(m,f){var y=m.peek(),a;return y=="{"||y=="["?(a=F(f),a.openBracket(y),m.eat(y),A(f,d),"bracket"):/[ \t\r]/.test(y)?(m.eat(y),null):(A(f,d),P(f),d(m,f))}return{startState:function(){var m=O.inMathMode?function(f,y){return p(f,y)}:d;return{cmdState:[],f:m}},copyState:function(m){return{cmdState:m.cmdState.slice(),f:m.f}},token:function(m,f){return f.f(m,f)},blankLine:function(m){m.f=d,m.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(pt,Te,q){},"/cxE":function(pt,Te,q){"use strict";q.d(Te,"e",function(){return O}),q.d(Te,"f",function(){return X}),q.d(Te,"g",function(){return F}),q.d(Te,"d",function(){return W}),q.d(Te,"a",function(){return U}),q.d(Te,"b",function(){return _}),q.d(Te,"c",function(){return A});var ue=function(){function d(){this.listeners=[],this.unexpectedErrorHandler=function(p){setTimeout(function(){throw p.stack?new Error(p.message+`
|
|
|
|
`+p.stack):p},0)}}return d.prototype.emit=function(p){this.listeners.forEach(function(T){T(p)})},d.prototype.onUnexpectedError=function(p){this.unexpectedErrorHandler(p),this.emit(p)},d.prototype.onUnexpectedExternalError=function(p){this.unexpectedErrorHandler(p)},d}(),J=new ue;function O(d){W(d)||J.onUnexpectedError(d);return}function X(d){W(d)||J.onUnexpectedExternalError(d);return}function F(d){if(d instanceof Error){var p=d.name,T=d.message,m=d.stacktrace||d.stack;return{$isError:!0,name:p,message:T,stack:m}}return d}var P="Canceled";function W(d){return d instanceof Error&&d.name===P&&d.message===P}function U(){var d=new Error(P);return d.name=d.message,d}function _(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function A(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"19Vz":function(pt,Te,q){(function(ue){ue(q("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(U,_,A){var d=A&&A!=ue.Init;if(_&&!d)U.on("blur",F),U.on("change",P),U.on("swapDoc",P),ue.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){X(U)}),P(U);else if(!_&&d){U.off("blur",F),U.off("change",P),U.off("swapDoc",P),ue.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),J(U);var p=U.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}_&&!U.hasFocus()&&F(U)});function J(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function O(U){J(U);var _=U.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=U.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var A=U.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),_.appendChild(A),U.display.lineSpace.insertBefore(_,U.display.lineSpace.firstChild)}function X(U){setTimeout(function(){var _=!1,A=U.getInputField();A.nodeName=="TEXTAREA"?_=!A.value:U.lineCount()==1&&(_=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),_?O(U):J(U)},20)}function F(U){W(U)&&O(U)}function P(U){var _=U.getWrapperElement(),A=W(U);_.className=_.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?O(U):J(U)}function W(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(pt,Te,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function(X,F){var P=X.indentUnit,W={},U=F.htmlMode?J:O;for(var _ in U)W[_]=U[_];for(var _ in F)W[_]=F[_];var A,d;function p(u,L){function S(B){return L.tokenize=B,B(u,L)}var D=u.next();if(D=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?S(f("atom","]]>")):null:u.match("--")?S(f("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),S(y(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),L.tokenize=f("meta","?>"),"meta"):(A=u.eat("/")?"closeTag":"openTag",L.tokenize=T,"tag bracket");if(D=="&"){var I;return u.eat("#")?u.eat("x")?I=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):I=u.eatWhile(/[\d]/)&&u.eat(";"):I=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),I?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function T(u,L){var S=u.next();if(S==">"||S=="/"&&u.eat(">"))return L.tokenize=p,A=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return A="equals",null;if(S=="<"){L.tokenize=p,L.state=l,L.tagName=L.tagStart=null;var D=L.tokenize(u,L);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(S)?(L.tokenize=m(S),L.stringStartCol=u.column(),L.tokenize(u,L)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(u){var L=function(S,D){for(;!S.eol();)if(S.next()==u){D.tokenize=T;break}return"string"};return L.isInAttribute=!0,L}function f(u,L){return function(S,D){for(;!S.eol();){if(S.match(L)){D.tokenize=p;break}S.next()}return u}}function y(u){return function(L,S){for(var D;(D=L.next())!=null;){if(D=="<")return S.tokenize=y(u+1),S.tokenize(L,S);if(D==">")if(u==1){S.tokenize=p;break}else return S.tokenize=y(u-1),S.tokenize(L,S)}return"meta"}}function a(u,L,S){this.prev=u.context,this.tagName=L,this.indent=u.indented,this.startOfLine=S,(W.doNotIndent.hasOwnProperty(L)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function s(u,L){for(var S;;){if(!u.context)return;if(S=u.context.tagName,!W.contextGrabbers.hasOwnProperty(S)||!W.contextGrabbers[S].hasOwnProperty(L))return;i(u)}}function l(u,L,S){return u=="openTag"?(S.tagStart=L.column(),E):u=="closeTag"?g:l}function E(u,L,S){return u=="word"?(S.tagName=L.current(),d="tag",w):W.allowMissingTagName&&u=="endTag"?(d="tag bracket",w(u,L,S)):(d="error",E)}function g(u,L,S){if(u=="word"){var D=L.current();return S.context&&S.context.tagName!=D&&W.implicitlyClosed.hasOwnProperty(S.context.tagName)&&i(S),S.context&&S.context.tagName==D||W.matchClosing===!1?(d="tag",v):(d="tag error",k)}else return W.allowMissingTagName&&u=="endTag"?(d="tag bracket",v(u,L,S)):(d="error",k)}function v(u,L,S){return u!="endTag"?(d="error",v):(i(S),l)}function k(u,L,S){return d="error",v(u,L,S)}function w(u,L,S){if(u=="word")return d="attribute",x;if(u=="endTag"||u=="selfcloseTag"){var D=S.tagName,I=S.tagStart;return S.tagName=S.tagStart=null,u=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(D)?s(S,D):(s(S,D),S.context=new a(S,D,I==S.indented)),l}return d="error",w}function x(u,L,S){return u=="equals"?b:(W.allowMissing||(d="error"),w(u,L,S))}function b(u,L,S){return u=="string"?h:u=="word"&&W.allowUnquoted?(d="string",w):(d="error",w(u,L,S))}function h(u,L,S){return u=="string"?h:w(u,L,S)}return{startState:function(u){var L={tokenize:p,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(L.baseIndent=u),L},token:function(u,L){if(!L.tagName&&u.sol()&&(L.indented=u.indentation()),u.eatSpace())return null;A=null;var S=L.tokenize(u,L);return(S||A)&&S!="comment"&&(d=null,L.state=L.state(A||S,u,L),d&&(S=d=="error"?S+" error":d)),S},indent:function(u,L,S){var D=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+P;if(D&&D.noIndent)return ue.Pass;if(u.tokenize!=T&&u.tokenize!=p)return S?S.match(/^(\s*)/)[0].length:0;if(u.tagName)return W.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+P*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(L))return 0;var I=L&&/^<(\/)?([\w_:\.-]*)/.exec(L);if(I&&I[1])for(;D;)if(D.tagName==I[2]){D=D.prev;break}else if(W.implicitlyClosed.hasOwnProperty(D.tagName))D=D.prev;else break;else if(I)for(;D;){var B=W.contextGrabbers[D.tagName];if(B&&B.hasOwnProperty(I[2]))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+P:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(u){u.state==b&&(u.state=w)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var L=[],S=u.context;S;S=S.prev)S.tagName&&L.push(S.tagName);return L.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return O});var ue=q("JYp7"),J=function(){function X(F){this.element=F,this.next=X.Undefined,this.prev=X.Undefined}return X.Undefined=new X(void 0),X}(),O=function(){function X(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}return Object.defineProperty(X.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),X.prototype.isEmpty=function(){return this._first===J.Undefined},X.prototype.clear=function(){this._first=J.Undefined,this._last=J.Undefined,this._size=0},X.prototype.unshift=function(F){return this._insert(F,!1)},X.prototype.push=function(F){return this._insert(F,!0)},X.prototype._insert=function(F,P){var W=this,U=new J(F);if(this._first===J.Undefined)this._first=U,this._last=U;else if(P){var _=this._last;this._last=U,U.prev=_,_.next=U}else{var A=this._first;this._first=U,U.next=A,A.prev=U}this._size+=1;var d=!1;return function(){d||(d=!0,W._remove(U))}},X.prototype.shift=function(){if(this._first===J.Undefined)return;var F=this._first.element;return this._remove(this._first),F},X.prototype.pop=function(){if(this._last===J.Undefined)return;var F=this._last.element;return this._remove(this._last),F},X.prototype._remove=function(F){if(F.prev!==J.Undefined&&F.next!==J.Undefined){var P=F.prev;P.next=F.next,F.next.prev=P}else F.prev===J.Undefined&&F.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):F.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):F.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1},X.prototype.iterator=function(){var F,P=this._first;return{next:function(){return P===J.Undefined?ue.c:(F?F.value=P.element:F={done:!1,value:P.element},P=P.next,F)}}},X.prototype.toArray=function(){for(var F=[],P=this._first;P!==J.Undefined;P=P.next)F.push(P.element);return F},X}()},"500L":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return g});var ue=q("+L6B"),J=q("2/Rp"),O=q("2qtc"),X=q("kLXV"),F=q("9og8"),P=q("k1fw"),W=q("miYZ"),U=q("tsqr"),_=q("oBTY"),A=q("tJVT"),d=q("DZo9"),p=q("8z0m"),T=q("WmNS"),m=q.n(T),f=q("q1tI"),y=q.n(f),a=q("m3rI"),i=q("wzkS"),s=q("y5JW"),l=q("LtfV"),E=p.a.Dragger;function g(v){var k=[];return v&&v.length>0&&(k=v.map(function(w){return{uid:w.id,id:w.id,name:w.title+s.c+w.filesize,url:w.url,filesize:w.filesize,status:"done",response:{id:w.id}}})),k}Te.b=function(v){var k=v.value,w=v.onChange,x=v.action,b=v.className,h=v.maxSize,u=h===void 0?150:h,L=v.title,S=L===void 0?"\u4E0A\u4F20\u9644\u4EF6":L,D=v.showRemoveModal,I=D===void 0?!1:D,B=v.accept,j=B===void 0?"":B,G=v.additionalText,M=v.isDragger,N=v.number,Y=N===void 0?1e3:N,ee=v.aloneClear,le=ee===void 0?!1:ee,fe=v.restrict,Pe=fe===void 0?!0:fe,Se=Object(f.useState)(!1),De=Object(A.a)(Se,2),Le=De[0],Ae=De[1],me=Object(f.useState)(k||[]),de=Object(A.a)(me,2),re=de[0],he=de[1];Object(f.useEffect)(function(){k&&(he(Object(_.a)(k)),Y===(k==null?void 0:k.length)&&Ae(!0))},[k]);var ie=function(){setTimeout(function(){re.pop(),he(Object(_.a)(re))},500)},Re={multiple:!0,disabled:Le,accept:j,withCredentials:!0,fileList:re,beforeUpload:function(ge,we){var _e=ge.size/1024/1024;return re.concat(we).length>Y?(re.pop(),he(Object(_.a)(re)),U.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(Y,"\u4E2A\u6587\u4EF6")),le?Promise.reject():(ie(),!1)):_e<u?!0:(U.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(u,"MB).")),le?Promise.reject():(ie(),!1))},action:x||"".concat(a.a.API_SERVER,"/api/attachments.json"),onChange:function(ge){var we=Object(_.a)(ge.fileList);we.length>=Y?Ae(!0):Ae(!1),he(Object(_.a)(we)),we=we.map(function(_e){var Fe;if(_e!=null&&(Fe=_e.response)!==null&&Fe!==void 0&&Fe.id){var Ue;_e.url="/api/attachments/".concat(_e==null||((Ue=_e.response)===null||Ue===void 0)?void 0:Ue.id)}return _e.name.indexOf(s.c)===-1&&(_e.name="".concat(_e.name).concat(s.c).concat(Object(s.a)(_e.size))),Object(P.a)({},_e)}),console.log("info:",ge),w(we)},onRemove:function(){var ae=Object(F.a)(m.a.mark(function we(_e){var Fe;return m.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(Fe=function(){var et=Object(F.a)(m.a.mark(function Je(){var Ze,Ye;return m.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:if(Ze=_e.response?_e.response.id:_e.id,!Ze){qe.next=8;break}return qe.next=4,Object(i.d)(_e.response?_e.response.id:_e.uid);case 4:return Ye=qe.sent,qe.abrupt("return",Ye);case 8:return qe.abrupt("return",!0);case 9:case"end":return qe.stop()}},Je)}));return function(){return et.apply(this,arguments)}}(),!I){Be.next=5;break}return Be.abrupt("return",new Promise(function(et,Je){X.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:y.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ze=Object(F.a)(m.a.mark(function dt(){var qe;return m.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return Ie.next=2,Fe();case 2:qe=Ie.sent,U.b.success("\u5220\u9664\u6210\u529F"),et(!0);case 5:case"end":return Ie.stop()}},dt)}));function Ye(){return Ze.apply(this,arguments)}return Ye}(),onCancel:function(){return et(!1)}})}));case 5:return Be.next=7,Fe();case 7:return Be.abrupt("return",Be.sent);case 8:case"end":return Be.stop()}},we)}));function ge(we){return ae.apply(this,arguments)}return ge}()};function oe(ae){ae.preventDefault(),ae.stopPropagation()}return y.a.createElement("div",{className:"multi-upload ".concat(b||"")},M&&y.a.createElement(E,Re,y.a.createElement("p",{className:"ant-upload-drag-icon"},y.a.createElement(l.a,null)),y.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",y.a.createElement("br",null),y.a.createElement("span",{style:{display:Pe?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",u,"MB) ")),G),!M&&y.a.createElement(p.a,Re,y.a.createElement(J.a,{disabled:Le},S),y.a.createElement("span",{onClick:oe,style:{marginLeft:10,color:"#FA6400",display:Pe?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",u,"MB) ")))}},"55Ip":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return s}),q.d(Te,"b",function(){return w});var ue=q("Ty5D"),J=q("dI71"),O=q("q1tI"),X=q.n(O),F=q("YS25"),P=q("17x9"),W=q.n(P),U=q("wx14"),_=q("zLVn"),A=q("9R94"),d=function(b){Object(J.a)(h,b);function h(){for(var L,S=arguments.length,D=new Array(S),I=0;I<S;I++)D[I]=arguments[I];return L=b.call.apply(b,[this].concat(D))||this,L.history=Object(F.a)(L.props),L}var u=h.prototype;return u.render=function(){return X.a.createElement(ue.c,{history:this.history,children:this.props.children})},h}(X.a.Component),p=function(b){Object(J.a)(h,b);function h(){for(var L,S=arguments.length,D=new Array(S),I=0;I<S;I++)D[I]=arguments[I];return L=b.call.apply(b,[this].concat(D))||this,L.history=Object(F.b)(L.props),L}var u=h.prototype;return u.render=function(){return X.a.createElement(ue.c,{history:this.history,children:this.props.children})},h}(X.a.Component),T=function(h,u){return typeof h=="function"?h(u):h},m=function(h,u){return typeof h=="string"?Object(F.c)(h,null,null,u):h},f=function(h){return h},y=X.a.forwardRef;typeof y=="undefined"&&(y=f);function a(b){return!!(b.metaKey||b.altKey||b.ctrlKey||b.shiftKey)}var i=y(function(b,h){var u=b.innerRef,L=b.navigate,S=b.onClick,D=Object(_.a)(b,["innerRef","navigate","onClick"]),I=D.target,B=Object(U.a)({},D,{onClick:function(G){try{S&&S(G)}catch(M){throw G.preventDefault(),M}!G.defaultPrevented&&G.button===0&&(!I||I==="_self")&&!a(G)&&(G.preventDefault(),L())}});return f!==y?B.ref=h||u:B.ref=u,X.a.createElement("a",B)}),s=y(function(b,h){var u=b.component,L=u===void 0?i:u,S=b.replace,D=b.to,I=b.innerRef,B=Object(_.a)(b,["component","replace","to","innerRef"]);return X.a.createElement(ue.e.Consumer,null,function(j){j||Object(A.a)(!1);var G=j.history,M=m(T(D,j.location),j.location),N=M?G.createHref(M):"",Y=Object(U.a)({},B,{href:N,navigate:function(){var le=T(D,j.location),fe=S?G.replace:G.push;fe(le)}});return f!==y?Y.ref=h||I:Y.innerRef=I,X.a.createElement(L,Y)})});if(!1)var l,E;var g=function(h){return h},v=X.a.forwardRef;typeof v=="undefined"&&(v=g);function k(){for(var b=arguments.length,h=new Array(b),u=0;u<b;u++)h[u]=arguments[u];return h.filter(function(L){return L}).join(" ")}var w=v(function(b,h){var u=b["aria-current"],L=u===void 0?"page":u,S=b.activeClassName,D=S===void 0?"active":S,I=b.activeStyle,B=b.className,j=b.exact,G=b.isActive,M=b.location,N=b.sensitive,Y=b.strict,ee=b.style,le=b.to,fe=b.innerRef,Pe=Object(_.a)(b,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return X.a.createElement(ue.e.Consumer,null,function(Se){Se||Object(A.a)(!1);var De=M||Se.location,Le=m(T(le,De),De),Ae=Le.pathname,me=Ae&&Ae.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),de=me?Object(ue.f)(De.pathname,{path:me,exact:j,sensitive:N,strict:Y}):null,re=!!(G?G(de,De):de),he=re?k(B,D):B,ie=re?Object(U.a)({},ee,{},I):ee,Re=Object(U.a)({"aria-current":re&&L||null,className:he,style:ie,to:Le},Pe);return g!==v?Re.ref=h||fe:Re.innerRef=fe,X.a.createElement(s,Re)})});if(!1)var x},"746U":function(pt,Te,q){"use strict";q.d(Te,"d",function(){return J}),q.d(Te,"j",function(){return O}),q.d(Te,"i",function(){return X}),q.d(Te,"h",function(){return F}),q.d(Te,"e",function(){return P}),q.d(Te,"k",function(){return W}),q.d(Te,"l",function(){return U}),q.d(Te,"a",function(){return _}),q.d(Te,"f",function(){return d}),q.d(Te,"g",function(){return p}),q.d(Te,"m",function(){return T}),q.d(Te,"c",function(){return y}),q.d(Te,"b",function(){return a}),q.d(Te,"n",function(){return i}),q.d(Te,"o",function(){return s});var ue={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function J(l){return Array.isArray?Array.isArray(l):!!(l&&typeof l.length===ue.number&&l.constructor===Array)}function O(l){return typeof l===ue.string||l instanceof String}function X(l){return typeof l===ue.object&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}function F(l){return(typeof l===ue.number||l instanceof Number)&&!isNaN(l)}function P(l){return l===!0||l===!1}function W(l){return typeof l===ue.undefined}function U(l){return W(l)||l===null}function _(l,E){if(!l)throw new Error(E?"Unexpected type, expected '"+E+"'":"Unexpected type")}var A=Object.prototype.hasOwnProperty;function d(l){if(!X(l))return!1;for(var E in l)if(A.call(l,E))return!1;return!0}function p(l){return typeof l===ue.function}function T(l,E){for(var g=Math.min(l.length,E.length),v=0;v<g;v++)m(l[v],E[v])}function m(l,E){if(O(E)){if(typeof l!==E)throw new Error("argument does not match constraint: typeof "+E)}else if(p(E)){try{if(l instanceof E)return}catch(g){}if(!U(l)&&l.constructor===E)return;if(E.length===1&&E.call(void 0,l)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function f(l){for(var E=[],g=Object.getPrototypeOf(l);Object.prototype!==g;)E=E.concat(Object.getOwnPropertyNames(g)),g=Object.getPrototypeOf(g);return E}function y(l){for(var E=[],g=0,v=f(l);g<v.length;g++){var k=v[g];typeof l[k]=="function"&&E.push(k)}return E}function a(l,E){for(var g=function(b){return function(){var h=Array.prototype.slice.call(arguments,0);return E(b,h)}},v={},k=0,w=l;k<w.length;k++){var x=w[k];v[x]=g(x)}return v}function i(l){return l===null?void 0:l}function s(l){return typeof l=="undefined"?null:l}},"7Cbv":function(pt,Te,q){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function O(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(J)}var X=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(T){return typeof T=="string"&&X.test(T)}for(var P=F,W=[],U=0;U<256;++U)W.push((U+256).toString(16).substr(1));function _(T){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=(W[T[m+0]]+W[T[m+1]]+W[T[m+2]]+W[T[m+3]]+"-"+W[T[m+4]]+W[T[m+5]]+"-"+W[T[m+6]]+W[T[m+7]]+"-"+W[T[m+8]]+W[T[m+9]]+"-"+W[T[m+10]]+W[T[m+11]]+W[T[m+12]]+W[T[m+13]]+W[T[m+14]]+W[T[m+15]]).toLowerCase();if(!P(f))throw TypeError("Stringified UUID is invalid");return f}var A=_;function d(T,m,f){T=T||{};var y=T.random||(T.rng||O)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,m){f=f||0;for(var a=0;a<16;++a)m[f+a]=y[a];return m}return A(y)}var p=Te.a=d},"7ahc":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return E});var ue=q("k1fw"),J=q("0Owb"),O=q("+L6B"),X=q("2/Rp"),F=q("y8nQ"),P=q("Vl3Y"),W=q("tJVT"),U=q("OaEy"),_=q("2fM7"),A=q("q1tI"),d=q.n(A),p=q("VrN/"),T=q.n(p),m=q("p77/"),f=q.n(m),y=q("c5Ni"),a=q.n(y),i=_.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Te.b=function(g){var v=g.callback,k=g.onCancel,w=Object(A.useState)("python"),x=Object(W.a)(w,2),b=x[0],h=x[1];function u(S){h(l[S][1])}function L(S){v(S)}return d.a.createElement(P.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:L}),d.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},d.a.createElement(_.a,{onChange:u},Object.keys(l).map(function(S){return d.a.createElement(i,{key:S,value:S},l[S][0])}))),d.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},d.a.createElement(E,{mode:b})),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),d.a.createElement(X.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function E(g){var v=g.value,k=g.onChange,w=g.mode,x=g.options,b=x===void 0?{}:x,h=Object(A.useRef)(),u=Object(A.useState)(),L=Object(W.a)(u,2),S=L[0],D=L[1];return Object(A.useEffect)(function(){if(S){function I(B){var j=B.getValue();k&&k(j)}return S.on("change",I),function(){S.off("change",I)}}},[S,k]),Object(A.useEffect)(function(){S&&S.setOption("mode",w)},[S,w]),Object(A.useEffect)(function(){S&&((v!==S.getValue()||v==="")&&setTimeout(function(){S.setValue(v||" ")},300))},[S,v]),Object(A.useEffect)(function(){if(h.current&&!S){var I=T.a.fromTextArea(h.current,Object(ue.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},b));D(I)}},[h.current,S]),d.a.createElement("div",{className:"my-codemirror-container"},d.a.createElement("textarea",{ref:h}))}},"8EBN":function(pt,Te,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";ue.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J<ue.modeInfo.length;J++){var O=ue.modeInfo[J];O.mimes&&(O.mime=O.mimes[0])}ue.findModeByMIME=function(X){X=X.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var P=ue.modeInfo[F];if(P.mime==X)return P;if(P.mimes){for(var W=0;W<P.mimes.length;W++)if(P.mimes[W]==X)return P}}if(/\+xml$/.test(X))return ue.findModeByMIME("application/xml");if(/\+json$/.test(X))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function(X){X=X.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var P=ue.modeInfo[F];if(P.ext){for(var W=0;W<P.ext.length;W++)if(P.ext[W]==X)return P}}},ue.findModeByFileName=function(X){for(var F=0;F<ue.modeInfo.length;F++){var P=ue.modeInfo[F];if(P.file&&P.file.test(X))return P}var W=X.lastIndexOf("."),U=W>-1&&X.substring(W+1,X.length);if(U)return ue.findModeByExtension(U)},ue.findModeByName=function(X){X=X.toLowerCase();for(var F=0;F<ue.modeInfo.length;F++){var P=ue.modeInfo[F];if(P.name.toLowerCase()==X)return P;if(P.alias){for(var W=0;W<P.alias.length;W++)if(P.alias[W].toLowerCase()==X)return P}}}})},"8HAY":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return P}),q.d(Te,"b",function(){return W});var ue=q("pmY6"),J=q("MI8n"),O=function(){var U=function(_,A){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,p){d.__proto__=p}||function(d,p){for(var T in p)p.hasOwnProperty(T)&&(d[T]=p[T])},U(_,A)};return function(_,A){U(_,A);function d(){this.constructor=_}_.prototype=A===null?Object.create(A):(d.prototype=A.prototype,new d)}}(),X=function(U,_,A,d){function p(T){return T instanceof A?T:new A(function(m){m(T)})}return new(A||(A=Promise))(function(T,m){function f(i){try{a(d.next(i))}catch(s){m(s)}}function y(i){try{a(d.throw(i))}catch(s){m(s)}}function a(i){i.done?T(i.value):p(i.value).then(f,y)}a((d=d.apply(U,_||[])).next())})},F=function(U,_){var A={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},d,p,T,m;return m={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function f(a){return function(i){return y([a,i])}}function y(a){if(d)throw new TypeError("Generator is already executing.");for(;A;)try{if(d=1,p&&(T=a[0]&2?p.return:a[0]?p.throw||((T=p.return)&&T.call(p),0):p.next)&&!(T=T.call(p,a[1])).done)return T;(p=0,T)&&(a=[a[0]&2,T.value]);switch(a[0]){case 0:case 1:T=a;break;case 4:return A.label++,{value:a[1],done:!1};case 5:A.label++,p=a[1],a=[0];continue;case 7:a=A.ops.pop(),A.trys.pop();continue;default:if(!(T=A.trys,T=T.length>0&&T[T.length-1])&&(a[0]===6||a[0]===2)){A=0;continue}if(a[0]===3&&(!T||a[1]>T[0]&&a[1]<T[3])){A.label=a[1];break}if(a[0]===6&&A.label<T[1]){A.label=T[1],T=a;break}if(T&&A.label<T[2]){A.label=T[2],A.ops.push(a);break}T[2]&&A.ops.pop(),A.trys.pop();continue}a=_.call(U,A)}catch(i){a=[6,i],p=0}finally{d=T=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},P=function(U){O(_,U);function _(A,d,p,T,m){d===void 0&&(d=""),p===void 0&&(p=""),T===void 0&&(T=!0);var f=U.call(this)||this;return f._onDidChange=f._register(new J.a),f.onDidChange=f._onDidChange.event,f._enabled=!0,f._checked=!1,f._id=A,f._label=d,f._cssClass=p,f._enabled=T,f._actionCallback=m,f}return Object.defineProperty(_.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"label",{get:function(){return this._label},set:function(A){this._setLabel(A)},enumerable:!0,configurable:!0}),_.prototype._setLabel=function(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))},Object.defineProperty(_.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(A){this._setTooltip(A)},enumerable:!0,configurable:!0}),_.prototype._setTooltip=function(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))},Object.defineProperty(_.prototype,"class",{get:function(){return this._cssClass},set:function(A){this._setClass(A)},enumerable:!0,configurable:!0}),_.prototype._setClass=function(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))},Object.defineProperty(_.prototype,"enabled",{get:function(){return this._enabled},set:function(A){this._setEnabled(A)},enumerable:!0,configurable:!0}),_.prototype._setEnabled=function(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))},Object.defineProperty(_.prototype,"checked",{get:function(){return this._checked},set:function(A){this._setChecked(A)},enumerable:!0,configurable:!0}),_.prototype._setChecked=function(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))},_.prototype.run=function(A,d){return this._actionCallback?this._actionCallback(A):Promise.resolve(!0)},_}(ue.a),W=function(U){O(_,U);function _(){var A=U!==null&&U.apply(this,arguments)||this;return A._onDidBeforeRun=A._register(new J.a),A.onDidBeforeRun=A._onDidBeforeRun.event,A._onDidRun=A._register(new J.a),A.onDidRun=A._onDidRun.event,A}return _.prototype.run=function(A,d){return X(this,void 0,void 0,function(){var p,T;return F(this,function(m){switch(m.label){case 0:if(!A.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:A}),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,this.runAction(A,d)];case 2:return p=m.sent(),this._onDidRun.fire({action:A,result:p}),[3,4];case 3:return T=m.sent(),this._onDidRun.fire({action:A,error:T}),[3,4];case 4:return[2]}})})},_.prototype.runAction=function(A,d){var p=d?A.run(d):A.run();return Promise.resolve(p)},_}(ue.a)},"8hTe":function(pt,Te,q){pt.exports={button:"button___1wy9m"}},"9Bee":function(pt,Te,q){"use strict";var ue=q("DYRE"),J=q("zeV3"),O=q("+L6B"),X=q("2/Rp"),F=q("k1fw"),P=q("9og8"),W=q("tJVT"),U=q("WmNS"),_=q.n(U),A=q("q1tI"),d=q.n(A),p=q("vg9a"),T=q("DlQD"),m=q.n(T),f=q("rUJ1");function y(K,c){var C=K.match(/^(\s+)(?:```)/);if(C===null)return c;var z=C[1];return c.split(`
|
|
`).map(function($){var V=$.match(/^\s+/);if(V===null)return $;var xe=Object(W.a)(V,1),Ge=xe[0];return Ge.length>=z.length?$.slice(z.length):$}).join(`
|
|
`)}var a=[],i=["<ul>"],s=new m.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function E(){a.length=0,i=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(K,c,C,z){if(c>=K.length||K[c].level<=C)return c;var $=K[c];z.push("<li><a href='#"+$.anchor+"'>"+$.text+"</a>"),c++;var V=[];return c=v(K,c,$.level,V),V.length>0&&(z.push("<ul>"),V.forEach(function(xe){z.push(xe)}),z.push("</ul>")),z.push("</li>"),c=v(K,c,C,z),c}function k(){return v(a,0,0,i),i.push("</ul>"),i.join("")}var w={heading:function(c){var C=l.exec(c);if(C)return{type:"heading",raw:C[0],depth:C[1].length,text:C[2]}},fences:function(c){var C=this.rules.block.fences.exec(c);if(C){var z=C[0],$=y(z,C[3]||""),V=C[2]?C[2].trim():C[2];if(["latex","katex","math"].indexOf(V)>=0){var xe=h(),Ge=$;$=xe,u[xe]={type:"block",expression:Ge}}return{type:"code",raw:z,lang:V,text:$}}}},x=/(?:\${2})([^\n`]+?)(?:\${2})/gi,b=0,h=function(){return"__special_katext_id_".concat(b++,"__")},u={};function L(){return u}function S(){b=0,u={}}function D(K){return K=K.replace(x,function(c,C){var z=h();return u[z]={type:"inline",expression:C},z}),K}var I=s.listitem;s.listitem=function(K){return I(D(K))};var B=s.paragraph;s.paragraph=function(K){return B(D(K))};var j=s.tablecell;s.tablecell=function(K,c){return j(D(K),c)},s.code=function(K,c,C){var z=(c||"").match(/\S*/)[0];return z?["latex","katex","math"].indexOf(z)>=0?"<p class='editormd-tex'>".concat(K,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(c,'">').concat(C?K:Object(f.escape)(K,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(C?K:Object(f.escape)(K,!0))+"</code></pre>"},s.heading=function(K,c,C){var z=this.options.headerPrefix+C.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:z,level:c,text:K}),"<h"+c+' id="'+z+'">'+K+"</h"+c+">"},m.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),m.a.use({tokenizer:w,renderer:s});var G=m.a,M=q("SJMd"),N=q("ulZh"),Y=q.n(N),ee=q("m3rI"),le=q("Oy/b"),fe=q("p5ED"),Pe=q("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Se=function(K,c){return(Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,z){C.__proto__=z}||function(C,z){for(var $ in z)Object.prototype.hasOwnProperty.call(z,$)&&(C[$]=z[$])})(K,c)};function De(K,c){function C(){this.constructor=K}Se(K,c),K.prototype=c===null?Object.create(c):(C.prototype=c.prototype,new C)}function Le(K,c,C,z){return new(C||(C=Promise))(function($,V){function xe(mt){try{tt(z.next(mt))}catch(Ke){V(Ke)}}function Ge(mt){try{tt(z.throw(mt))}catch(Ke){V(Ke)}}function tt(mt){var Ke;mt.done?$(mt.value):(Ke=mt.value,Ke instanceof C?Ke:new C(function(At){At(Ke)})).then(xe,Ge)}tt((z=z.apply(K,c||[])).next())})}function Ae(K,c){var C,z,$,V,xe={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return V={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Ge(tt){return function(mt){return function(Ke){if(C)throw new TypeError("Generator is already executing.");for(;xe;)try{if(C=1,z&&($=2&Ke[0]?z.return:Ke[0]?z.throw||(($=z.return)&&$.call(z),0):z.next)&&!($=$.call(z,Ke[1])).done)return $;switch(z=0,$&&(Ke=[2&Ke[0],$.value]),Ke[0]){case 0:case 1:$=Ke;break;case 4:return xe.label++,{value:Ke[1],done:!1};case 5:xe.label++,z=Ke[1],Ke=[0];continue;case 7:Ke=xe.ops.pop(),xe.trys.pop();continue;default:if(!($=xe.trys,($=$.length>0&&$[$.length-1])||Ke[0]!==6&&Ke[0]!==2)){xe=0;continue}if(Ke[0]===3&&(!$||Ke[1]>$[0]&&Ke[1]<$[3])){xe.label=Ke[1];break}if(Ke[0]===6&&xe.label<$[1]){xe.label=$[1],$=Ke;break}if($&&xe.label<$[2]){xe.label=$[2],xe.ops.push(Ke);break}$[2]&&xe.ops.pop(),xe.trys.pop();continue}Ke=c.call(K,xe)}catch(At){Ke=[6,At],z=0}finally{C=$=0}if(5&Ke[0])throw Ke[1];return{value:Ke[0]?Ke[1]:void 0,done:!0}}([tt,mt])}}}function me(){for(var K=0,c=0,C=arguments.length;c<C;c++)K+=arguments[c].length;var z=Array(K),$=0;for(c=0;c<C;c++)for(var V=arguments[c],xe=0,Ge=V.length;xe<Ge;xe++,$++)z[$]=V[xe];return z}var de=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(c,C){for(var z=0,$=C;z<$.length;z++){var V=$[z],xe=V[0],Ge=V[1];c.setAttribute(xe,Ge)}},K.createRect=function(c,C,z){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",c.toString()),$.setAttribute("height",C.toString()),z&&K.setAttributes($,z),$},K.createLine=function(c,C,z,$,V){var xe=document.createElementNS("http://www.w3.org/2000/svg","line");return xe.setAttribute("x1",c.toString()),xe.setAttribute("y1",C.toString()),xe.setAttribute("x2",z.toString()),xe.setAttribute("y2",$.toString()),V&&K.setAttributes(xe,V),xe},K.createPolygon=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",c),C&&K.setAttributes(z,C),z},K.createCircle=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(c/2).toString()),z.setAttribute("cy",(c/2).toString()),z.setAttribute("r",c.toString()),C&&K.setAttributes(z,C),z},K.createEllipse=function(c,C,z){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(c/2).toString()),$.setAttribute("cy",(C/2).toString()),$.setAttribute("rx",(c/2).toString()),$.setAttribute("ry",(C/2).toString()),z&&K.setAttributes($,z),$},K.createGroup=function(c){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&K.setAttributes(C,c),C},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(c,C,z,$,V,xe,Ge){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(tt,[["id",c],["orient",C],["markerWidth",z.toString()],["markerHeight",$.toString()],["refX",V.toString()],["refY",xe.toString()]]),tt.appendChild(Ge),tt},K.createText=function(c){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),c&&K.setAttributes(C,c),C},K.createTSpan=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=c,C&&K.setAttributes(z,C),z},K.createImage=function(c){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&K.setAttributes(C,c),C},K.createPoint=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=c,z.y=C,z},K.createPath=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",c),C&&K.setAttributes(z,C),z},K}(),re=function(){function K(){}return K.addKey=function(c){K.key=c},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),he=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(c,C,z){var $=this;return new Promise(function(V){var xe=z!==void 0?z:document.createElement("canvas");c===null&&($.markersOnly=!0,$.naturalSize=!1);var Ge=document.createElementNS("http://www.w3.org/2000/svg","svg");Ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ge.setAttribute("width",C.width.baseVal.valueAsString),Ge.setAttribute("height",C.height.baseVal.valueAsString),Ge.setAttribute("viewBox","0 0 "+C.viewBox.baseVal.width.toString()+" "+C.viewBox.baseVal.height.toString()),Ge.innerHTML=C.innerHTML,$.naturalSize===!0?(Ge.width.baseVal.value=c.naturalWidth,Ge.height.baseVal.value=c.naturalHeight):$.width!==void 0&&$.height!==void 0&&(Ge.width.baseVal.value=$.width,Ge.height.baseVal.value=$.height),xe.width=Ge.width.baseVal.value,xe.height=Ge.height.baseVal.value;var tt=Ge.outerHTML,mt=xe.getContext("2d");$.markersOnly!==!0&&mt.drawImage(c,0,0,xe.width,xe.height);var Ke=window.URL,At=new Image(xe.width,xe.height);At.setAttribute("crossOrigin","anonymous");var It=new Blob([tt],{type:"image/svg+xml"}),er=Ke.createObjectURL(It);At.onload=function(){mt.drawImage(At,0,0),Ke.revokeObjectURL(er);var Kr=xe.toDataURL($.imageType,$.imageQuality);V(Kr)},At.src=er})},K}(),ie=function(){},Re=function(){function K(c){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},K.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new oe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new oe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new oe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new ae("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new ae("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),oe=function(K,c){this.selector=K,this.style=c},ae=function(K,c){this.localName=K,this.style=c},ge=function(){function K(c,C,z,$,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=c,this.displayMode=C,this.markerItems=z,this.uiStyleSettings=$,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return K.prototype.show=function(c){var C=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var z=document.createElement("div");z.className=this.toolbarBlockStyleClass.name,z.style.whiteSpace="nowrap",this.uiContainer.appendChild(z),this.addActionButton(z,'<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(z,'<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(z,'<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(z,'<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(z,'<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(z,'<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(z,'<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(z,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(V){var xe=document.createElement("div");xe.className=""+C.toolbarButtonStyleClass.name,xe.setAttribute("data-type-name",V.typeName),xe.innerHTML=V.icon,xe.addEventListener("click",function(){C.markerToolbarButtonClicked(xe,V)}),C.buttons.push(xe),C.markerButtons.push(xe)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var $=document.createElement("div");$.className=this.toolbarBlockStyleClass.name,$.style.whiteSpace="nowrap",$.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild($),this.addActionButton($,'<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($,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},K.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},K.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var c=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var C=0;C<this.markerButtons.length;C++)C<c||C===c&&this.markerButtons.length-1===c?this.markerButtonBlock.appendChild(this.markerButtons[C]):(C===c&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[C]))}},K.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},K.prototype.resetButtonStyles=function(){var c=this;this.buttons.forEach(function(C){C.className=C.className.replace(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name,"").trim(),C.className=C.className.replace(c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:c.toolbarActiveButtonStyleColorsClass.name,"").trim(),C.className+=" "+(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(c,C,z){var $=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=C,V.setAttribute("data-action",z),V.addEventListener("click",function(){$.actionToolbarButtonClicked(V,z)}),z){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}c.appendChild(V),this.buttons.push(V)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ae("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new ae("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ae("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ae("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new ae("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ae("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ae("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new oe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new oe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},K.prototype.markerToolbarButtonClicked=function(c,C){this.setActiveButton(c),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("marker",C)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(c,C){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("action",C)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(c){this.resetButtonStyles(),c.className=c.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),c.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(c){var C=this.markerButtons.find(function(z){return z.getAttribute("data-type-name")===c});C&&this.setActiveButton(C)},K.prototype.setCurrentMarker=function(c){var C=this;this.currentMarker=c,this.buttons.filter(function(z){return/delete|notes/.test(z.getAttribute("data-action"))}).forEach(function(z){C.currentMarker===void 0?(z.style.fillOpacity="0.4",z.style.pointerEvents="none"):(z.style.fillOpacity="1",z.style.pointerEvents="all")})},K}(),we=function(){function K(c,C,z,$){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=C,this.uiStyleSettings=z,this.styles=$,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new ae("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new ae("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var C=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ae("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ae("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ae("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new ae("toolbox-panel-row_colors",`
|
|
background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ae("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new oe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new oe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},K.prototype.show=function(c){var C;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((C=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(c){var C,z,$=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((C=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((z=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&z!==void 0?z:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var xe;V.uiStyleSettings=$.uiStyleSettings;var Ge=document.createElement("div");Ge.className=$.toolboxButtonStyleClass.name+" "+((xe=$.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&xe!==void 0?xe:$.toolboxButtonStyleColorsClass.name),Ge.innerHTML=V.icon,Ge.title=V.title,Ge.addEventListener("click",function(){$.panelButtonClick(V)}),$.panelButtons.push(Ge),$.buttonRow.appendChild(Ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(c){var C=this,z=-1;if(c!==this.activePanel){z=this.panels.indexOf(c),this.panelRow.innerHTML="";var $=c.getUi();$.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild($),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){C.displayMode==="inline"?C.panelRow.style.display="none":C.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,xe){var Ge,tt;V.className=C.toolboxButtonStyleClass.name+" "+(xe===z?""+((Ge=C.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ge!==void 0?Ge:C.toolboxActiveButtonStyleColorsClass.name):""+((tt=C.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&tt!==void 0?tt:C.toolboxButtonStyleColorsClass.name))})},K}(),_e=function(K,c){this.title=K,this.icon=c},Fe=function(K){function c(C,z,$,V){var xe=K.call(this,C,V||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return xe.colors=[],xe.addTransparent=!1,xe.colorBoxes=[],xe.colors=z,xe.currentColor=$,xe.setCurrentColor=xe.setCurrentColor.bind(xe),xe.getColorBox=xe.getColorBox.bind(xe),xe}return De(c,K),c.prototype.getUi=function(){var C=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.whiteSpace="nowrap",this.colors.forEach(function($){var V=C.getColorBox($);z.appendChild(V),C.colorBoxes.push(V)}),z},c.prototype.getColorBox=function(C){var z=this,$=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-$,xe=document.createElement("div");xe.style.display="inline-block",xe.style.boxSizing="content-box",xe.style.width=V-2+"px",xe.style.height=V-2+"px",xe.style.padding="1px",xe.style.marginRight="2px",xe.style.marginBottom="2px",xe.style.borderWidth="2px",xe.style.borderStyle="solid",xe.style.borderRadius=(V+2)/2+"px",xe.style.borderColor=C===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",xe.addEventListener("click",function(){z.setCurrentColor(C,xe)});var Ge=document.createElement("div");return Ge.style.display="inline-block",Ge.style.width=V-2+"px",Ge.style.height=V-2+"px",Ge.style.backgroundColor=C,Ge.style.borderRadius=V/2+"px",C==="transparent"&&(Ge.style.fill=this.uiStyleSettings.toolboxAccentColor,Ge.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),xe.appendChild(Ge),xe},c.prototype.setCurrentColor=function(C,z){var $=this;this.currentColor=C,this.colorBoxes.forEach(function(V){V.style.borderColor=V===z?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(C)},c}(_e),Ue=function(){function K(c,C,z){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=C,this.globalSettings=z,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(K.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),K.prototype.ownsTarget=function(c){return!1},Object.defineProperty(K.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),K.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},K.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},K.prototype.pointerDown=function(c,C){},K.prototype.dblClick=function(c,C){},K.prototype.manipulate=function(c){},K.prototype.pointerUp=function(c){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},K.prototype.scale=function(c,C){},K.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},K.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var c=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),c.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(c)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),Be=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(c){return this.topLeft.ownsTarget(c)?this.topLeft:this.topCenter.ownsTarget(c)?this.topCenter:this.topRight.ownsTarget(c)?this.topRight:this.centerLeft.ownsTarget(c)?this.centerLeft:this.centerRight.ownsTarget(c)?this.centerRight:this.bottomLeft.ownsTarget(c)?this.bottomLeft:this.bottomCenter.ownsTarget(c)?this.bottomCenter:this.bottomRight.ownsTarget(c)?this.bottomRight:void 0},K}(),et=function(){function K(){this.GRIP_SIZE=10,this.visual=de.createGroup(),this.visual.appendChild(de.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(de.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},K}(),Je=function(){function K(){}return K.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},K.toSVGMatrix=function(c,C){return c.a=C.a,c.b=C.b,c.c=C.c,c.d=C.d,c.e=C.e,c.f=C.f,c},K}(),Ze=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(de.createTransform()),V.setupControlBox(),V}return De(c,K),Object.defineProperty(c.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"visual",{get:function(){return this._visual},set:function(C){this._visual=C;var z=de.createTransform();this._visual.transform.baseVal.appendItem(z)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(C){return!!K.prototype.ownsTarget.call(this,C)||!!(this.controlGrips.findGripByVisual(C)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(C))},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.state==="new"&&(this.left=C.x,this.top=C.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var $=this.unrotatePoint(C);if(this.manipulationStartX=$.x,this.manipulationStartY=$.y,this.offsetX=$.x-this.left,this.offsetY=$.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(z),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(z)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var xe=this.container.transform.baseVal.getItem(0);xe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(xe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(C){var z=this.state;K.prototype.pointerUp.call(this,C),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(C),this._state="select",z==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(C){this.visual.style.transform="translate("+C.x+"px, "+C.y+"px)"},c.prototype.manipulate=function(C){var z=this.unrotatePoint(C);this.state==="creating"?this.resize(C):this.state==="move"?(this.left=this.manipulationStartLeft+(z.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(z.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(z):this.state==="rotate"&&this.rotate(C)},c.prototype.resize=function(C){var z=this.manipulationStartLeft,$=this.manipulationStartWidth,V=this.manipulationStartTop,xe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:z=this.manipulationStartLeft+C.x-this.manipulationStartX,$=this.manipulationStartWidth+this.manipulationStartLeft-z;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:$=this.manipulationStartWidth+C.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+C.y-this.manipulationStartY,xe=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:xe=this.manipulationStartHeight+C.y-this.manipulationStartY}$>=0?(this.left=z,this.width=$):(this.left=z+$,this.width=-$),xe>=0?(this.top=V,this.height=xe):(this.top=V+xe,this.height=-xe),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(C){if(Math.abs(C.x-this.centerX)>.1){var z=Math.sign(C.x-this.centerX);this.rotationAngle=180*Math.atan((C.y-this.centerY)/(C.x-this.centerX))/Math.PI+90*z,this.applyRotation()}},c.prototype.applyRotation=function(){var C=this.container.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(C,0)},c.prototype.rotatePoint=function(C){if(this.rotationAngle===0)return C;var z=this.container.getCTM(),$=de.createPoint(C.x,C.y);return{x:($=$.matrixTransform(z)).x,y:$.y}},c.prototype.unrotatePoint=function(C){if(this.rotationAngle===0)return C;var z=this.container.getCTM();z=z.inverse();var $=de.createPoint(C.x,C.y);return{x:($=$.matrixTransform(z)).x,y:$.y}},c.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=de.createGroup();var C=de.createTransform();C.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(C),this.container.appendChild(this.controlBox),this.controlRect=de.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=de.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Be,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var C=this.controlBox.transform.baseVal.getItem(0);C.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(C,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},c.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},c.prototype.createGrip=function(){var C=new et;return C.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(C.visual),C},c.prototype.positionGrips=function(){var C=this.controlGrips.topLeft.GRIP_SIZE,z=-C/2,$=z,V=(this.width+this.CB_DISTANCE)/2-C/2,xe=(this.height+this.CB_DISTANCE)/2-C/2,Ge=this.height+this.CB_DISTANCE-C/2,tt=this.width+this.CB_DISTANCE-C/2;this.positionGrip(this.controlGrips.topLeft.visual,z,$),this.positionGrip(this.controlGrips.topCenter.visual,V,$),this.positionGrip(this.controlGrips.topRight.visual,tt,$),this.positionGrip(this.controlGrips.centerLeft.visual,z,xe),this.positionGrip(this.controlGrips.centerRight.visual,tt,xe),this.positionGrip(this.controlGrips.bottomLeft.visual,z,Ge),this.positionGrip(this.controlGrips.bottomCenter.visual,V,Ge),this.positionGrip(this.controlGrips.bottomRight.visual,tt,Ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,$-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(C,z,$){var V=C.transform.baseVal.getItem(0);V.setTranslate(z,$),C.transform.baseVal.replaceItem(V,0)},c.prototype.hideControlBox=function(){this.controlBox.style.display="none"},c.prototype.showControlBox=function(){this.controlBox.style.display=""},c.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Je.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Je.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},c.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var z=C;this.left=z.left,this.top=z.top,this.width=z.width,this.height=z.height,this.rotationAngle=z.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,z.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,z.containerTransformMatrix))},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z);var $=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:$.x*C,y:$.y*z});this.left=V.x,this.top=V.y,this.width=this.width*C,this.height=this.height*z,this.adjustControlBox()},c}(Ue),Ye=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return De(c,K),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual)},c.prototype.createVisual=function(){this.visual=de.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},c.prototype.manipulate=function(C){K.prototype.manipulate.call(this,C)},c.prototype.resize=function(C){K.prototype.resize.call(this,C),this.setSize()},c.prototype.setSize=function(){K.prototype.setSize.call(this),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(C){K.prototype.pointerUp.call(this,C),this.setSize()},c.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},c.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this))},c.prototype.restoreState=function(C){var z=C;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),K.prototype.restoreState.call(this,C),this.setSize()},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z),this.setSize()},c.title="Rectangle marker",c}(Ze),dt=function(K){function c(C,z,$,V){var xe=K.call(this,C,V||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return xe.widths=[],xe.widthBoxes=[],xe.widths=z,xe.currentWidth=$,xe.setCurrentWidth=xe.setCurrentWidth.bind(xe),xe}return De(c,K),c.prototype.getUi=function(){var C=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.widths.forEach(function($){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=$===C.currentWidth?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentWidth($,V)}),z.appendChild(V);var xe=document.createElement("div");xe.innerText=$.toString(),xe.style.marginRight="5px",V.appendChild(xe);var Ge=document.createElement("div");Ge.style.minHeight="20px",Ge.style.flexGrow="2",Ge.style.display="flex",Ge.style.alignItems="center";var tt=document.createElement("hr");tt.style.minWidth="20px",tt.style.border="0px",tt.style.borderTop=$+"px solid "+C.uiStyleSettings.toolboxColor,tt.style.flexGrow="2",Ge.appendChild(tt),V.appendChild(Ge),C.widthBoxes.push(V)}),z},c.prototype.setCurrentWidth=function(C,z){var $=this;this.currentWidth=C,this.widthBoxes.forEach(function(V){V.style.borderColor=V===z?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(_e),qe=function(K){function c(C,z,$,V){var xe=K.call(this,C,V||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return xe.styles=[],xe.styleBoxes=[],xe.styles=z,xe.currentStyle=$,xe.setCurrentStyle=xe.setCurrentStyle.bind(xe),xe}return De(c,K),c.prototype.getUi=function(){var C=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.styles.forEach(function($){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/C.styles.length-5+"%",V.style.borderColor=$===C.currentStyle?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentStyle($,V)}),z.appendChild(V);var xe=document.createElement("div");xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.overflow="hidden";var Ge=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+C.uiStyleSettings.toolboxColor+'" stroke-width="3" '+($!==""?'stroke-dasharray="'+$+'"':"")+` />
|
|
</svg>`;xe.innerHTML=Ge,V.appendChild(xe),C.styleBoxes.push(V)}),z},c.prototype.setCurrentStyle=function(C,z){var $=this;this.currentStyle=C,this.styleBoxes.forEach(function(V){V.style.borderColor=V===z?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(_e),ot=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",$.defaultColorSet,$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new qe("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return De(c,K),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=c.typeName,C},c.typeName="FrameMarker",c.title="Frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',c}(Ye),Ie=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},Qe=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return De(c,K),c.prototype.ownsTarget=function(C){return!!K.prototype.ownsTarget.call(this,C)||!(!this.grip1.ownsTarget(C)&&!this.grip2.ownsTarget(C))},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.manipulationStartX=C.x,this.manipulationStartY=C.y,this.state==="new"&&(this.x1=C.x,this.y1=C.y,this.x2=C.x,this.y2=C.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(z)?this.activeGrip=this.grip1:this.grip2.ownsTarget(z)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(C){var z=this.state;K.prototype.pointerUp.call(this,C),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(C),this._state="select",z==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(C){this.state==="creating"?this.resize(C):this.state==="move"?(this.x1=this.manipulationStartX1+C.x-this.manipulationStartX,this.y1=this.manipulationStartY1+C.y-this.manipulationStartY,this.x2=this.manipulationStartX2+C.x-this.manipulationStartX,this.y2=this.manipulationStartY2+C.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(C)},c.prototype.resize=function(C){switch(this.activeGrip){case this.grip1:this.x1=C.x,this.y1=C.y;break;case this.grip2:case void 0:this.x2=C.x,this.y2=C.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=de.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){this.positionGrips()},c.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},c.prototype.createGrip=function(){var C=new et;return C.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(C.visual),C},c.prototype.positionGrips=function(){var C=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-C/2,this.y1-C/2),this.positionGrip(this.grip2.visual,this.x2-C/2,this.y2-C/2)},c.prototype.positionGrip=function(C,z,$){var V=C.transform.baseVal.getItem(0);V.setTranslate(z,$),C.transform.baseVal.replaceItem(V,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},c.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var z=C;this.x1=z.x1,this.y1=z.y1,this.x2=z.x2,this.y2=z.y2},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z),this.x1=this.x1*C,this.y1=this.y1*z,this.x2=this.x2*C,this.y2=this.y2*z,this.adjustVisual(),this.adjustControlBox()},c}(Ue),st=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",$.defaultColorSet,$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new qe("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return De(c,K),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorLine&&C!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorLine=de.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=de.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},c.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),de.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},c.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},c.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var z=C;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',c}(Qe),je=function(K){function c(C,z,$,V){var xe=K.call(this,C,V||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return xe.fonts=[],xe.fontBoxes=[],xe.fonts=z,xe.currentFont=$,xe.setCurrentFont=xe.setCurrentFont.bind(xe),xe}return De(c,K),c.prototype.getUi=function(){var C=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.flexGrow="2",this.fonts.forEach(function($){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/C.fonts.length-5+"%",V.style.borderColor=$===C.currentFont?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentFont($,V)}),z.appendChild(V);var xe=document.createElement("div");xe.style.display="flex",xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.fontFamily=$,xe.style.overflow="hidden";var Ge=document.createElement("div");Ge.style.whiteSpace="nowrap",Ge.style.overflow="hidden",Ge.style.textOverflow="ellipsis",Ge.innerHTML="The quick brown fox jumps over the lazy dog",xe.appendChild(Ge),V.appendChild(xe),C.fontBoxes.push(V)}),z},c.prototype.setCurrentFont=function(C,z){var $=this;this.currentFont=C,this.fontBoxes.forEach(function(V){V.style.borderColor=V===z?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(_e),Xe=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=$.defaultColor,V.fontFamily=$.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Fe("Color",$.defaultColorSet,$.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new je("Font",$.defaultFontFamilies,$.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return De(c,K),c.prototype.ownsTarget=function(C){if(K.prototype.ownsTarget.call(this,C)||C===this.visual||C===this.textElement||C===this.bgRectangle)return!0;var z=!1;return this.textElement.childNodes.forEach(function($){$===C&&(z=!0)}),z},c.prototype.createVisual=function(){this.visual=de.createGroup(),this.bgRectangle=de.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=de.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.isMoved=!1,this.pointerDownPoint=C,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},c.prototype.renderText=function(){var C=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(z){C.textElement.appendChild(de.createTSpan(z.trim()===""?" ":z.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var C=this.textElement.getBBox(),z=1;if(C.width>0&&C.height>0){var $=(1*this.width-this.width*this.padding*2/100)/C.width,V=(1*this.height-this.height*this.padding*2/100)/C.height;z=Math.min($,V)}return z},c.prototype.getTextPosition=function(C){var z=this.textElement.getBBox(),$=0,V=0;return z.width>0&&z.height>0&&($=(this.width-z.width*C)/2,V=this.height/2-z.height*C/2),{x:$,y:V}},c.prototype.sizeText=function(){var C=this.textElement.getBBox(),z=this.getTextScale(),$=this.getTextPosition(z);$.y-=C.y*z,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+$.x+"px, "+$.y+"px) scale("+z+", "+z+")":(this.textElement.transform.baseVal.getItem(0).setTranslate($.x,$.y),this.textElement.transform.baseVal.getItem(1).setScale(z,z))},c.prototype.manipulate=function(C){K.prototype.manipulate.call(this,C),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(C.x-this.pointerDownPoint.x)>5||Math.abs(C.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(C){K.prototype.resize.call(this,C),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(C){var z=this.state;z==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,C),this.setSize(),(z==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var C=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(z){z.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var z=Number.parseFloat(C.textEditor.style.fontSize);C.textEditor.clientWidth>=Number.parseInt(C.textEditor.style.maxWidth)&&z>.9;)z-=.1,C.textEditor.style.fontSize=Math.max(z,.9)+"em"}),this.textEditor.addEventListener("keyup",function(z){z.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(z){if(z.clipboardData){var $=z.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode($)),z.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){C.textEditDivClicked(C.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},c.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var C=this.getTextScale(),z=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),$=this.textElement.getBBox(),V={x:$.width*C,y:$.height*C};z.x-=V.x/2,z.y-=V.y/2,this.textEditor.style.top=z.y+"px",this.textEditor.style.left=z.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-z.x+"px",this.textEditor.style.fontSize=Math.max(16*C,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(C){this.text=C.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},c.prototype.dblClick=function(C,z){K.prototype.dblClick.call(this,C,z),this.showTextEditor()},c.prototype.setColor=function(C){this.textElement&&de.setAttributes(this.textElement,[["fill",C]]),this.color=C,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(C)},c.prototype.setFont=function(C){this.textElement&&de.setAttributes(this.textElement,[["font-family",C]]),this.fontFamily=C,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},c.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},c.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){var z=C;this.color=z.color,this.fontFamily=z.fontFamily,this.padding=z.padding,this.text=z.text,this.createVisual(),K.prototype.restoreState.call(this,C),this.setSize()},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',c}(Ze),Ce=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=$.defaultColor,V.lineWidth=$.defaultStrokeWidth,V.pixelRatio=$.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Fe("Color",$.defaultColorSet,$.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return De(c,K),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=de.createGroup(),this.drawingImage=de.createImage(),this.visual.appendChild(this.drawingImage);var C=de.createTransform();this.visual.transform.baseVal.appendItem(C),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(C,z){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(C.x,C.y),this.drawing=!0):K.prototype.pointerDown.call(this,C,z)},c.prototype.manipulate=function(C){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(C.x,C.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,C)},c.prototype.resize=function(C){K.prototype.resize.call(this,C),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(C){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,C)},c.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},c.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var C=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),z=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],$=z[0],V=z[1],xe=z[2],Ge=z[3],tt=!1,mt=0;mt<this.canvasElement.height;mt++)for(var Ke=0;Ke<this.canvasElement.width;Ke++)C.data[mt*this.canvasElement.width*4+4*Ke+3]>0&&(tt=!0,mt<V&&(V=mt),Ke<$&&($=Ke),mt>Ge&&(Ge=mt),Ke>xe&&(xe=Ke));if(tt){this.left=$/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(xe-$)/this.pixelRatio,this.height=(Ge-V)/this.pixelRatio;var At=document.createElement("canvas");At.width=xe-$,At.height=Ge-V,At.getContext("2d").putImageData(this.canvasContext.getImageData($,V,xe-$,Ge-V),0,0),this.drawingImgUrl=At.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(C){this.color=C,this.colorChanged(C)},c.prototype.setLineWidth=function(C){this.lineWidth=C},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){this.createVisual(),K.prototype.restoreState.call(this,C),this.drawingImgUrl=C.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',c}(Ze),be=function(K){function c(C,z,$){var V=K.call(this,C,$||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=z,V.setCurrentType=V.setCurrentType.bind(V),V}return De(c,K),c.prototype.getUi=function(){var C=this,z=document.createElement("div");z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2";for(var $=function(Ge){var tt="both";switch(Ge){case 0:tt="both";break;case 1:tt="start";break;case 2:tt="end";break;case 3:tt="none"}var mt=document.createElement("div");if(mt.style.display="flex",mt.style.flexGrow="2",mt.style.alignItems="center",mt.style.justifyContent="space-between",mt.style.padding="5px",mt.style.borderWidth="2px",mt.style.borderStyle="solid",mt.style.borderColor=tt===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",mt.addEventListener("click",function(){C.setCurrentType(tt,mt)}),z.appendChild(mt),tt==="both"||tt==="start"){var Ke=document.createElement("div");Ke.style.display="flex",Ke.style.alignItems="center",Ke.style.minHeight="20px",Ke.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ke.style.marginLeft="5px",mt.appendChild(Ke)}var At=document.createElement("div");At.style.display="flex",At.style.alignItems="center",At.style.minHeight="20px",At.style.flexGrow="2";var It=document.createElement("hr");if(It.style.minWidth="20px",It.style.border="0px",It.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),It.style.flexGrow="2",At.appendChild(It),mt.appendChild(At),tt==="both"||tt==="end"){var er=document.createElement("div");er.style.display="flex",er.style.alignItems="center",er.style.minHeight="20px",er.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,er.style.marginRight="5px",mt.appendChild(er)}V.typeBoxes.push(mt)},V=this,xe=0;xe<4;xe++)$(xe);return z},c.prototype.setCurrentType=function(C,z){var $=this;this.currentType=C,this.typeBoxes.forEach(function(V){V.style.borderColor=V===z?$.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(_e),Ee=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new be("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return De(c,K),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.arrow1&&C!==this.arrow2)},c.prototype.getArrowPoints=function(C,z){var $=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return C-$/2+","+(z+V/2)+" "+C+","+(z-V/2)+" "+(C+$/2)+","+(z+V/2)},c.prototype.createTips=function(){this.arrow1=de.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=de.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",de.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),de.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.arrow1.transform.baseVal.getItem(0);z.setRotate(C,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(z,0);var $=this.arrow2.transform.baseVal.getItem(0);$.setRotate(C+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem($,0)}},c.prototype.setArrowType=function(C){this.arrowType=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var z=C;this.arrowType=z.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',c}(st),ne=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.fillColor=$.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Fe("Color",$.defaultColorSet,$.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return De(c,K),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=c.typeName,C},c.typeName="CoverMarker",c.title="Cover marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',c}(Ye),se=function(K){function c(C,z,$,V){var xe=K.call(this,C,V||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return xe.opacities=[],xe.opacityBoxes=[],xe.opacities=z,xe.currentOpacity=$,xe.setCurrentOpacity=xe.setCurrentOpacity.bind(xe),xe}return De(c,K),c.prototype.getUi=function(){var C=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",z.style.justifyContent="space-between",this.opacities.forEach(function($){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=$===C.currentOpacity?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentOpacity($,V)}),z.appendChild(V);var xe=document.createElement("div");xe.innerText=100*$+"%",V.appendChild(xe),C.opacityBoxes.push(V)}),z},c.prototype.setCurrentOpacity=function(C,z){var $=this;this.currentOpacity=C,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===z?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(_e),ce=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=$.defaultHighlightColor,V.strokeWidth=0,V.opacity=$.defaultHighlightOpacity,V.fillPanel=new Fe("Color",$.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new se("Opacity",$.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return De(c,K),c.prototype.setOpacity=function(C){this.opacity=C,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=c.typeName,C},c.typeName="HighlightMarker",c.title="Highlight marker",c.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',c}(ne),ve='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Ne=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=$.defaultStrokeColor,V.bgColor=$.defaultFillColor,V.fontFamily=$.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Fe("Text color",$.defaultColorSet,V.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Fe("Fill color",$.defaultColorSet,V.bgColor,ve),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new je("Font",$.defaultFontFamilies,$.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new et,V.tipGrip.visual.transform.baseVal.appendItem(de.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return De(c,K),c.prototype.ownsTarget=function(C){return K.prototype.ownsTarget.call(this,C)||this.tipGrip.ownsTarget(C)||this.tip===C},c.prototype.createTip=function(){de.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=de.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(C,z){this.state==="new"&&K.prototype.pointerDown.call(this,C,z),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(z)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,C,z)},c.prototype.pointerUp=function(C){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,C);else{var z=this.state==="creating";K.prototype.pointerUp.call(this,C),this.setTipPoints(z),this.positionTip()}},c.prototype.manipulate=function(C){if(this.tipMoving){var z=this.unrotatePoint(C);this.tipPosition={x:z.x-this.manipulationStartLeft,y:z.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,C)},c.prototype.setBgColor=function(C){this.bgRectangle&&this.tip&&(de.setAttributes(this.bgRectangle,[["fill",C]]),de.setAttributes(this.tip,[["fill",C]])),this.bgColor=C,this.fillColorChanged(C)},c.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},c.prototype.setTipPoints=function(C){C===void 0&&(C=!1);var z=Math.min(this.height/2,15),$=this.height/5;C&&(this.tipPosition={x:z+$/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?($=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:0},this.tipBase2Position={x:z+$,y:0}):(this.tipBase1Position={x:0,y:z},this.tipBase2Position={x:0,y:z+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?($=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-$,y:0},this.tipBase2Position={x:this.width-z,y:0}):(this.tipBase1Position={x:this.width,y:z},this.tipBase2Position={x:this.width,y:z+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?($=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-$,y:this.height},this.tipBase2Position={x:this.width-z,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-z-$},this.tipBase2Position={x:this.width,y:this.height-z}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?($=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:this.height},this.tipBase2Position={x:z+$,y:this.height}):(this.tipBase1Position={x:0,y:this.height-z},this.tipBase2Position={x:0,y:this.height-z-$})},c.prototype.resize=function(C){K.prototype.resize.call(this,C),this.positionTip()},c.prototype.positionTip=function(){de.setAttributes(this.tip,[["points",this.getTipPoints()]]);var C=this.tipGrip.visual.transform.baseVal.getItem(0);C.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(C,0)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},c.prototype.getState=function(){var C=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){var z=C;this.bgColor=z.bgColor,this.tipPosition=z.tipPosition,K.prototype.restoreState.call(this,C),this.createTip(),this.setTipPoints()},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z),this.tipPosition={x:this.tipPosition.x*C,y:this.tipPosition.y*z},this.positionTip()},c.typeName="CalloutMarker",c.title="Callout marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',c}(Xe),ke=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.fillColor=$.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Fe("Line color",me($.defaultColorSet,["transparent"]),$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Fe("Fill color",me($.defaultColorSet,["transparent"]),V.fillColor,ve),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new qe("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new se("Opacity",$.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return De(c,K),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual)},c.prototype.createVisual=function(){this.visual=de.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},c.prototype.manipulate=function(C){K.prototype.manipulate.call(this,C)},c.prototype.resize=function(C){K.prototype.resize.call(this,C),this.setSize()},c.prototype.setSize=function(){K.prototype.setSize.call(this),de.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},c.prototype.pointerUp=function(C){K.prototype.pointerUp.call(this,C),this.setSize()},c.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},c.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(C),this.stateChanged()},c.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(C){this.opacity=C,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){var z=C;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),K.prototype.restoreState.call(this,C),this.setSize()},c.prototype.scale=function(C,z){K.prototype.scale.call(this,C,z),this.setSize()},c.typeName="EllipseMarker",c.title="Ellipse marker",c.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',c}(Ze),ze=function(K){function c(C,z,$){return K.call(this,C,z,$)||this}return De(c,K),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.tip1&&C!==this.tip2)},c.prototype.createTips=function(){this.tip1=de.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.tip1),this.tip2=de.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.tip2)},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(de.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.tip1.transform.baseVal.getItem(0);z.setRotate(C,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(z,0);var $=this.tip2.transform.baseVal.getItem(0);$.setRotate(C+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem($,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',c}(st),it=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.strokePanel.colors=$.defaultColorSet,V.fillColor="transparent",V}return De(c,K),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=K.prototype.getState.call(this);return C.typeName=c.typeName,C},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',c}(ke),ct=function(){function K(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),K.prototype.addUndoStep=function(c){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(c)||(this.undoStack.push(c),JSON.stringify(this.lastRedoStep)!==JSON.stringify(c)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},K.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},K.prototype.undo=function(){if(this.undoStack.length>1){var c=this.undoStack.pop();return c!==void 0&&this.redoStack.push(c),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},K.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},K}(),ht=function(K){function c(C,z,$){var V=K.call(this,C,z,$)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",$.defaultColorSet,$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new qe("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return De(c,K),c.prototype.ownsTarget=function(C){return!(!K.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorCurve&&C!==this.visibleCurve&&!this.curveGrip.ownsTarget(C))},c.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},c.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorCurve=de.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=de.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(C,z){K.prototype.pointerDown.call(this,C,z),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=C.x,this.curveY=C.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(z)&&(this.activeGrip=this.curveGrip,this._state="resize")},c.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),de.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=de.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=de.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var C=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-C/2,this.curveY-C/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},c.prototype.manipulate=function(C){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+C.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+C.y-this.manipulationStartY),K.prototype.manipulate.call(this,C)},c.prototype.resize=function(C){this.activeGrip===this.curveGrip&&(this.curveX=C.x,this.curveY=C.y),K.prototype.resize.call(this,C),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},c.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},c.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},c.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual()},c.prototype.scale=function(C,z){this.curveX=this.curveX*C,this.curveY=this.curveY*z,K.prototype.scale.call(this,C,z)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return C.typeName=c.typeName,C},c.prototype.restoreState=function(C){K.prototype.restoreState.call(this,C);var z=C;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.curveX=z.curveX,this.curveY=z.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',c}(Qe),Lt=function(){function K(c,C){C===void 0&&(C=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=C}return Object.defineProperty(K.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),K.prototype.preventDefault=function(){this._defaultPrevented=!0},K}(),wt=function(K){function c(C,z,$){var V=K.call(this,C,!1)||this;return V.dataUrl=z,V.state=$,V}return De(c,K),c}(Lt),ft=function(K){function c(C,z,$){$===void 0&&($=!1);var V=K.call(this,C,$)||this;return V.marker=z,V}return De(c,K),c}(Lt),zt=function(){function K(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return K.prototype.addEventListener=function(c,C){this[c].push(C)},K.prototype.removeEventListener=function(c,C){var z=this[c].indexOf(C);z>-1&&this[c].splice(z,1)},K}(),Ft=function(){function K(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ie,this._isOpen=!1,this.undoRedoManager=new ct,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new zt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new Re(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=c,this.targetRoot=document.body,this.width=c.clientWidth,this.height=c.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[ot,Ce,Ee,Xe,it,ke,ce,Ne,ze,ne,st,ht]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ot,Ce,Ee,Xe,ke,ce,Ne]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ot,Ce,Ee,Xe,ce]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var C=this;this._availableMarkerTypes.splice(0),c.forEach(function(z){if(typeof z=="string"){var $=C.ALL_MARKER_TYPES.find(function(V){return V.typeName===z});$!==void 0&&C._availableMarkerTypes.push($)}else C._availableMarkerTypes.push(z)})},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(c){this._zoomLevel=c,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},K.prototype.show=function(){var c=this;this.styles.styleSheetRoot===void 0&&ie.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ie.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(C){return C(new Lt(c))})},K.prototype.render=function(){return Le(this,void 0,void 0,function(){var c;return Ae(this,function(C){switch(C.label){case 0:return this.setCurrentMarker(),(c=new he).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.markersOnly=this.renderMarkersOnly,c.width=this.renderWidth,c.height=this.renderHeight,[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return C.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,C.sent()]}})})},K.prototype.close=function(c){var C=this;if(c===void 0&&(c=!1),this.isOpen){var z=!1;c||this.eventListeners.beforeclose.forEach(function($){var V=new Lt(C,!0);$(V),V.defaultPrevented&&(z=!0)}),z||(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($){return $(new Lt(C))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var c,C=[],z=0;z<arguments.length;z++)C[z]=arguments[z];(c=this._availableMarkerTypes).push.apply(c,C)},K.prototype.addRenderEventListener=function(c){this.addEventListener("render",function(C){c(C.dataUrl,C.state)})},K.prototype.removeRenderEventListener=function(c){},K.prototype.addCloseEventListener=function(c){this.addEventListener("close",function(){c()})},K.prototype.removeCloseEventListener=function(c){},K.prototype.setupResizeObserver=function(){var c=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return c.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var c=1*this.target.clientWidth/this.target.clientHeight,C=this.editorCanvas.clientWidth/c>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,z=C<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/c;this.resize(C,z)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(c,C){this._isResizing=!0;var z=c/this.imageWidth,$=C/this.imageHeight;this.imageWidth=Math.round(c),this.imageHeight=Math.round(C),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(z,$),this._isResizing=!1},K.prototype.scaleMarkers=function(c,C){var z,$=this;this._currentMarker&&this._currentMarker instanceof Xe?this._currentMarker.scale(c,C):(z=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==$._currentMarker&&V.scale(c,C)}),z!==void 0&&this.setCurrentMarker(z)},K.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},K.prototype.setTopLeft=function(){var c=this.editingTarget.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=c.left-C.left,this.top=c.top-C.top},K.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},K.prototype.addDefs=function(){for(var c,C=[],z=0;z<arguments.length;z++)C[z]=arguments[z];this.defs=de.createDefs(),this.addDefsToImage(),(c=this.defs).append.apply(c,C)},K.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},K.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},K.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},K.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},K.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},K.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},K.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},K.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var c=document.createElement("a");c.href="https://markerjs.com/",c.target="_blank",c.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},K.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},K.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new ge(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new we(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},K.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.removeMarker=function(c){this.markerImage.removeChild(c.container),this.markers.indexOf(c)>-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},K.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},K.prototype.toolbarButtonClicked=function(c,C){if(c==="marker"&&C!==void 0)this.createNewMarker(C);else if(c==="action")switch(C){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},K.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var C=!1;if(this.eventListeners.markerbeforedelete.forEach(function($){var V=new ft(c,c._currentMarker,!0);$(V),V.defaultPrevented&&(C=!0)}),!C){var z=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($){return $(new ft(c,z))})}}},K.prototype.clear=function(){var c=this,C=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(xe){var Ge=new ft(c,void 0,!0);xe(Ge),Ge.defaultPrevented&&(C=!0)}),!C)){this.setCurrentMarker();for(var z=function(xe){var Ge=$.markers[xe];$.setCurrentMarker($.markers[xe]),$._currentMarker.dispose(),$.markerImage.removeChild($._currentMarker.container),$.markers.splice($.markers.indexOf($._currentMarker),1),$.eventListeners.markerdelete.forEach(function(tt){return tt(new ft(c,Ge))})},$=this,V=this.markers.length-1;V>=0;V--)z(V);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.prototype.showNotesEditor=function(){var c;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(c=this._currentMarker.notes)!==null&&c!==void 0?c:"",this.overlayContainer.appendChild(this.notesArea))},K.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},K.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},K.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var C=this.getState(),z=this.undoRedoManager.getLastUndoStep();if(!z||z.width===C.width&&z.height===C.height){var $=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(C),$<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new Lt(c))})}else this.undoRedoManager.replaceLastUndoStep(C),this.eventListeners.statechange.forEach(function(V){return V(new Lt(c))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var c=this,C=this.undoRedoManager.undo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new Lt(c))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var c=this,C=this.undoRedoManager.redo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new Lt(c))}))},K.prototype.stepZoom=function(){var c=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=c<this.zoomSteps.length-1?this.zoomSteps[c+1]:this.zoomSteps[0]},K.prototype.panTo=function(c){this.contentDiv.scrollBy({left:this.prevPanPoint.x-c.x,top:this.prevPanPoint.y-c.y}),this.prevPanPoint=c},K.prototype.startRenderAndClose=function(){return Le(this,void 0,void 0,function(){var c,C,z=this;return Ae(this,function($){switch($.label){case 0:return[4,this.render()];case 1:return c=$.sent(),C=this.getState(),this.eventListeners.render.forEach(function(V){return V(new wt(z,c,C))}),this.close(!0),[2]}})})},K.prototype.getState=function(c){c===!0&&this.setCurrentMarker();var C={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(z){return C.markers.push(z.getState())}),C},K.prototype.restoreState=function(c){var C=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);c.markers.forEach(function(z){var $=C._availableMarkerTypes.find(function(xe){return xe.typeName===z.typeName});if($!==void 0){var V=C.addNewMarker($);V.restoreState(z),C.markers.push(V)}}),c.width&&c.height&&(c.width!==this.imageWidth||c.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/c.width,this.imageHeight/c.height),this.eventListeners.restorestate.forEach(function(z){return z(new Lt(C))})},K.prototype.addNewMarker=function(c){var C=de.createGroup();return this.markerImage.appendChild(C),new c(C,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(c){var C,z=this;(C=typeof c=="string"?this._availableMarkerTypes.find(function($){return $.typeName===c}):c)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(C),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(C.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function($){return $(new ft(z,z._currentMarker))}))},K.prototype.markerCreated=function(c){var C=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(c),this.setCurrentMarker(c),c instanceof Ce&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ce):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(z){return z(new ft(C,C._currentMarker))})},K.prototype.colorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=c,this.settings.defaultStrokeColor=c)},K.prototype.fillColorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=c)},K.prototype.markerStateChanged=function(c){var C=this;this.eventListeners.markerchange.forEach(function(z){return z(new ft(C,c))})},K.prototype.setCurrentMarker=function(c){var C=this;this._currentMarker!==c&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(z){return z(new ft(C,C._currentMarker))})),this._currentMarker=c,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(z){return z(new ft(C,C._currentMarker))}))},K.prototype.onPointerDown=function(c){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||c.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var C=this.markers.find(function(z){return z.ownsTarget(c.target)});C!==void 0?(this.setCurrentMarker(C),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:c.clientX,y:c.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY))},K.prototype.onDblClick=function(c){if(this._isFocused||this.focus(),this.mode==="select"){var C=this.markers.find(function(z){return z.ownsTarget(c.target)});C!==void 0&&C!==this._currentMarker&&this.setCurrentMarker(C),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(c){this.touchPoints!==1&&c.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||c.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(c.clientX,c.clientY)):this.zoomLevel>1&&this.panTo({x:c.clientX,y:c.clientY}))},K.prototype.onPointerUp=function(c){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(c.clientX,c.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(c,C){var z=this.markerImage.getBoundingClientRect();return{x:(c-z.left)/this.zoomLevel,y:(C-z.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},K.prototype.addLicenseKey=function(c){re.addKey(c)},K.prototype.addEventListener=function(c,C){this.eventListeners.addEventListener(c,C)},K.prototype.removeEventListener=function(c,C){this.eventListeners.removeEventListener(c,C)},K.prototype.renderState=function(c){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(c),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var c=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(C){return C(new Lt(c))}))},K.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(C){return C(new Lt(c))}))},K.instanceCounter=0,K}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Jt=function(K,c){return(Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,z){C.__proto__=z}||function(C,z){for(var $ in z)Object.prototype.hasOwnProperty.call(z,$)&&(C[$]=z[$])})(K,c)};function Ht(K,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function C(){this.constructor=K}Jt(K,c),K.prototype=c===null?Object.create(c):(C.prototype=c.prototype,new C)}function kt(K,c,C,z){return new(C||(C=Promise))(function($,V){function xe(mt){try{tt(z.next(mt))}catch(Ke){V(Ke)}}function Ge(mt){try{tt(z.throw(mt))}catch(Ke){V(Ke)}}function tt(mt){var Ke;mt.done?$(mt.value):(Ke=mt.value,Ke instanceof C?Ke:new C(function(At){At(Ke)})).then(xe,Ge)}tt((z=z.apply(K,c||[])).next())})}function Ur(K,c){var C,z,$,V,xe={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return V={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Ge(tt){return function(mt){return function(Ke){if(C)throw new TypeError("Generator is already executing.");for(;xe;)try{if(C=1,z&&($=2&Ke[0]?z.return:Ke[0]?z.throw||(($=z.return)&&$.call(z),0):z.next)&&!($=$.call(z,Ke[1])).done)return $;switch(z=0,$&&(Ke=[2&Ke[0],$.value]),Ke[0]){case 0:case 1:$=Ke;break;case 4:return xe.label++,{value:Ke[1],done:!1};case 5:xe.label++,z=Ke[1],Ke=[0];continue;case 7:Ke=xe.ops.pop(),xe.trys.pop();continue;default:if(!($=xe.trys,($=$.length>0&&$[$.length-1])||Ke[0]!==6&&Ke[0]!==2)){xe=0;continue}if(Ke[0]===3&&(!$||Ke[1]>$[0]&&Ke[1]<$[3])){xe.label=Ke[1];break}if(Ke[0]===6&&xe.label<$[1]){xe.label=$[1],$=Ke;break}if($&&xe.label<$[2]){xe.label=$[2],xe.ops.push(Ke);break}$[2]&&xe.ops.pop(),xe.trys.pop();continue}Ke=c.call(K,xe)}catch(At){Ke=[6,At],z=0}finally{C=$=0}if(5&Ke[0])throw Ke[1];return{value:Ke[0]?Ke[1]:void 0,done:!0}}([tt,mt])}}}var Zr=function(){function K(){}return K.addKey=function(c){K.key=c},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),bt=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(c,C){for(var z=0,$=C;z<$.length;z++){var V=$[z],xe=V[0],Ge=V[1];c.setAttribute(xe,Ge)}},K.createRect=function(c,C,z){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",c.toString()),$.setAttribute("height",C.toString()),z&&K.setAttributes($,z),$},K.createLine=function(c,C,z,$,V){var xe=document.createElementNS("http://www.w3.org/2000/svg","line");return xe.setAttribute("x1",c.toString()),xe.setAttribute("y1",C.toString()),xe.setAttribute("x2",z.toString()),xe.setAttribute("y2",$.toString()),V&&K.setAttributes(xe,V),xe},K.createPolygon=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",c),C&&K.setAttributes(z,C),z},K.createCircle=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(c/2).toString()),z.setAttribute("cy",(c/2).toString()),z.setAttribute("r",c.toString()),C&&K.setAttributes(z,C),z},K.createEllipse=function(c,C,z){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(c/2).toString()),$.setAttribute("cy",(C/2).toString()),$.setAttribute("rx",(c/2).toString()),$.setAttribute("ry",(C/2).toString()),z&&K.setAttributes($,z),$},K.createGroup=function(c){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&K.setAttributes(C,c),C},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(c,C,z,$,V,xe,Ge){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(tt,[["id",c],["orient",C],["markerWidth",z.toString()],["markerHeight",$.toString()],["refX",V.toString()],["refY",xe.toString()]]),tt.appendChild(Ge),tt},K.createText=function(c){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),c&&K.setAttributes(C,c),C},K.createTSpan=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=c,C&&K.setAttributes(z,C),z},K.createImage=function(c){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&K.setAttributes(C,c),C},K.createPoint=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=c,z.y=C,z},K.createPath=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",c),C&&K.setAttributes(z,C),z},K.createElement=function(c,C){var z=document.createElementNS("http://www.w3.org/2000/svg",c);return C&&K.setAttributes(z,C),z},K.getHollowRectanglePath=function(c,C,z,$,V,xe,Ge,tt){return"M"+c+","+C+"V"+(C+$)+"H"+(c+z)+"V"+C+"H"+V+"V"+xe+"H"+(V+Ge)+"V"+(xe+tt)+"H"+V+"V"+C+"Z"},K}(),Ct=function(){function K(c){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},K.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new at("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new at("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new at("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new xt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new xt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),at=function(K,c){this.selector=K,this.style=c},xt=function(K,c){this.localName=K,this.style=c},Zt=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(c){c.className=this.blockClassName,c.buttonClassName=this.buttonClassName,c.buttonColorsClassName=this.buttonColorsClassName,c.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(c)},K.prototype.addElementBlock=function(c){c.className===void 0&&(c.className=this.blockClassName),this.blocks.push(c)},K.prototype.getUI=function(){var c=document.createElement("div");return c.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,c.style.display=this.display,this.blocks.forEach(function(C){return c.appendChild(C.getUI())}),c},K}(),nr=function(){function K(){}return K.prototype.getUI=function(){var c=document.createElement("div");if(c.className=this.className,this.minWidth!==void 0&&(c.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":c.style.justifyContent="flex-start";break;case"center":c.style.justifyContent="center";break;case"end":c.style.justifyContent="flex-end"}return c.style.whiteSpace="nowrap",c},K}(),rr=function(K){function c(){var C=K!==null&&K.apply(this,arguments)||this;return C.buttons=[],C}return Ht(c,K),c.prototype.addButton=function(C){C.className=this.buttonClassName,C.colorsClassName=this.buttonColorsClassName,C.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(C)},c.prototype.getUI=function(){var C=K.prototype.getUI.call(this);return this.buttons.forEach(function(z){return C.appendChild(z.getUI())}),C},c}(nr),Rt=function(){function K(c,C){this._isActive=!1,this._isHidden=!1,this._icon=c,this.title=C,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(c){this._icon=c,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(c){this._isActive=c,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var c=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return c.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},K.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},K.prototype.hide=function(){this._isHidden=!0},K}(),vt=function(K){function c(){var C=K!==null&&K.apply(this,arguments)||this;return C.elements=[],C}return Ht(c,K),c.prototype.addElement=function(C){this.elements.push(C)},c.prototype.getUI=function(){var C=K.prototype.getUI.call(this);return this.elements.forEach(function(z){return C.appendChild(z)}),C},c}(nr),kr=function(){function K(c,C){this.horizontal=c,this.vertical=C}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(c){return c/this.ratio},K.prototype.getHorizontalLength=function(c){return c*this.ratio},K}(),tn=function(){function K(){}return K.getIcon=function(c,C){if(c>0&&C>0){var z=new kr(c,C),$=z.ratio>=1?20:z.getHorizontalLength(20),V=z.ratio<1?20:z.getVerticalLength(20),xe=document.createElementNS("http://www.w3.org/2000/svg","svg");xe.setAttribute("xmlns","http://www.w3.org/2000/svg"),xe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(xe);var Ge=bt.createDefs();xe.appendChild(Ge);var tt=bt.createElement("clipPath",[["id","text-bg-clip"]]);Ge.appendChild(tt);var mt=bt.createPath(bt.getHollowRectanglePath((24-$)/2,(24-V)/2,$,V,(24-$)/2+2,(24-V)/2+2,$-4,V-4));xe.appendChild(mt);var Ke=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ke.appendChild(bt.createTSpan(c+":"+C)),xe.appendChild(Ke);var At=Ke.getBBox();bt.setAttributes(Ke,[["x",((24-At.width)/2).toString()],["y",((24-At.height)/2-At.y).toString()]]);var It=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(At.width))/2,(24-Math.ceil(At.height))/2,Math.ceil(At.width),Math.ceil(At.height)));return tt.appendChild(It),bt.setAttributes(mt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(xe),xe.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},K}(),Tr=function(K){function c(C,z,$){var V=K.call(this,C,z)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=$,V}return Ht(c,K),c.prototype.setupDropdown=function(){var C=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(z){z.className=C.className,z.colorsClassName=C.colorsClassName,C.dropdownBlock.appendChild(z.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},c.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},c.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},c.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},c.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},c.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},c}(Rt),Ot=function(){function K(c,C){this.GRIP_SIZE=10,this.color=c,this.fillColor=C,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},K.prototype.setCenter=function(c,C){this.visual.childNodes.forEach(function(z){return bt.setAttributes(z,[["cx",c.toString()],["cy",C.toString()]])})},K}(),Lr=function(){function K(c,C,z,$){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=C,this.margin=z,this.container=$,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(K.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(c){this._aspectRatio=c,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var c=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var C=0;C<this.numberOfGridLines;C++)this.horizontalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(z){return c.gridContainer.appendChild(z)}),this.verticalGridLines.forEach(function(z){return c.gridContainer.appendChild(z)}),this.cropRectElement=bt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},K.prototype.setCropRectangle=function(c){this.cropRect=c;var C=Object.assign({},this.cropRect);this.zoomFactor!==1&&(C.width=this.cropRect.width*this.zoomFactor,C.height=this.cropRect.height*this.zoomFactor,C.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-C.width/2,C.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-C.height/2),bt.setAttributes(this.cropRectElement,[["x",C.x.toString()],["y",C.y.toString()],["width",C.width.toString()],["height",C.height.toString()]]);var z=C.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,xe){var Ge=C.y+z*(xe+1);bt.setAttributes(V,[["x1",""+C.x],["y1",""+Ge],["x2",""+(C.x+C.width)],["y2",""+Ge]])});var $=C.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,xe){var Ge=C.x+$*(xe+1);bt.setAttributes(V,[["x1",""+Ge],["y1",""+C.y],["x2",""+Ge],["y2",""+(C.y+C.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,C.x,C.y,C.width,C.height)]]),this.topLeftGrip.setCenter(C.x,C.y),this.topRightGrip.setCenter(C.x+C.width,C.y),this.bottomLeftGrip.setCenter(C.x,C.y+C.height),this.bottomRightGrip.setCenter(C.x+C.width,C.y+C.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},K.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},K.prototype.clientToLocalCoordinates=function(c,C){var z=this.container.getBoundingClientRect();return{x:c-z.left+this.margin,y:C-z.top+this.margin}},K.prototype.onPointerDown=function(c){this.container.setPointerCapture(c.pointerId),this.previousPoint=this.clientToLocalCoordinates(c.clientX,c.clientY),this.cropRectElement===c.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(c.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(c.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(c.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(c.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var C=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(C)}c.preventDefault()},K.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},K.prototype.move=function(c){var C=c.x-this.previousPoint.x,z=c.y-this.previousPoint.y;this.zoomFactor!==1&&(C=-C/this.zoomFactor,z=-z/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+C),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+z),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},K.prototype.resize=function(c){var C=Object.assign({},this.cropRect),z=c.x-this.previousPoint.x,$=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:C.x+z<this.margin&&(z=this.margin-C.x),C.x+=z,C.width=this.cropRect.x+this.cropRect.width-C.x;break;case this.bottomRightGrip:case this.topRightGrip:C.width+z>this.canvasWidth*this.zoomFactor&&(z=this.canvasWidth*this.zoomFactor-C.width),C.width+=z}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(C.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(z),C.height=this.aspectRatio.getVerticalLength(C.width)):(C.y+=$,C.height=this.cropRect.y+this.cropRect.height-C.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?C.height=this.aspectRatio.getVerticalLength(C.width):C.height+=$}C.width<10&&(C.x=this.cropRect.x,C.width=10),C.height<10&&(C.y=this.cropRect.y,C.height=10),this.previousPoint=c,C.x>=this.margin&&C.y>=this.margin&&C.x-this.margin+C.width<=this.canvasWidth&&C.y-this.margin+C.height<=this.canvasHeight&&(this.cropRect=C,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},K.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var c=this.cropRect.x+this.cropRect.width/2,C=this.cropRect.y+this.cropRect.height/2,z=this.aspectRatio.getHorizontalLength(this.cropRect.height),$=this.aspectRatio.getVerticalLength(this.cropRect.width);z/this.canvasWidth<$/this.canvasHeight?this.cropRect.width=z:this.cropRect.height=$,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=c-this.cropRect.width/2,this.cropRect.y=C-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},K.prototype.getRescaledRect=function(c,C,z,$,V,xe){var Ge=z/c,tt=$/C;return{x:(V.x-xe)*Ge+xe,y:(V.y-xe)*tt+xe,width:V.width*Ge,height:V.height*tt}},K.prototype.scaleCanvas=function(c,C){var z=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,C,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=C,this.onCropChange&&this.onCropChange(z),this.setCropRectangle(z)},K}(),zr=function(){function K(c){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=c,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(K.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},K.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},K.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},K.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var c=this.scaleShape.transform.baseVal.getItem(0);c.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(c,0)}},K.prototype.getVisual=function(){var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",this.width+"px"),c.setAttribute("height",this.height+"px"),c.setAttribute("viewBox","0 0 "+this.width+" "+this.height),c.style.flexShrink="0",document.body.appendChild(c);for(var C="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,z=1;z<=this.width/5+10;z++){var $=z%5==0?this.height/3:this.height/6;C+="h4v"+-$+"h1v"+$}C+="v1H0Z",this.scaleShape=bt.createPath(C);var V=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(V),c.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var xe=bt.createTSpan("");return xe.innerHTML="°",this.angleLabelElement.appendChild(xe),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},K}(),rn=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(c,C,z,$,V,xe,Ge){var tt=this;return new Promise(function(mt){var Ke=document.createElement("canvas");Ke.width=c.width.baseVal.value-2*$,Ke.height=c.height.baseVal.value-2*$;var At=1,It=1;tt.naturalSize===!0?(At=C.naturalWidth/(c.width.baseVal.value-2*$)/xe,It=C.naturalHeight/(c.height.baseVal.value-2*$)/Ge,Ke.width=C.naturalWidth/xe,Ke.height=C.naturalHeight/Ge):tt.width!==void 0&&tt.height!==void 0&&(At=tt.width/z.width,It=tt.height/z.height,Ke.width*=At,Ke.height*=It);var er=Ke.getContext("2d");er.translate(Ke.width/2,Ke.height/2),er.rotate(V*Math.PI/180),er.scale(xe,Ge),er.translate(-Ke.width/2,-Ke.height/2),er.drawImage(C,0,0,Ke.width,Ke.height);var Kr=document.createElement("canvas");Kr.width=z.width*At,Kr.height=z.height*It,Kr.getContext("2d").putImageData(er.getImageData((z.x-$)*At,(z.y-$)*It,z.width*At,z.height*It),0,0),mt(Kr.toDataURL(tt.imageType,tt.imageQuality))})},K}(),He=function(){function K(c){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=K.instanceCounter++,this.styles=new Ct(this.instanceNo),this.target=c,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(c){this._gridLines=c,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(c){this._rotationAngle=c,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"aspectRatio",{get:function(){var c;return(c=this._aspectRatio)!==null&&c!==void 0?c:this.aspectRatios[0]},set:function(c){this._aspectRatio=c},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},K.prototype.show=function(){this.showUI(),this.open()},K.prototype.close=function(c){c===void 0&&(c=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),c||this.closeEventListeners.forEach(function(C){return C()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},K.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},K.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},K.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},K.prototype.setupResizeObserver=function(){var c=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,C=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,z=C+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/c;this.resize(C,z)}},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",bt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},K.prototype.resize=function(c,C){this.imageWidth=Math.round(c),this.imageHeight=Math.round(C),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},K.prototype.setEditingTarget=function(){var c=document.createElement("canvas");c.width=this.target.naturalWidth,c.height=this.target.naturalHeight,c.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var C=c.toDataURL();bt.setAttributes(this.editingTarget,[["href",C]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var c=this.target.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=c.left-C.left-this.CANVAS_MARGIN,this.top=c.top-C.top-this.CANVAS_MARGIN},K.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=bt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=bt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=bt.createGroup(),this.editingTargetRotationScaleContainer=bt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var c=bt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(c);var C=bt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(C),this.editingTargetContainer=bt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},K.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},K.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=bt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Lr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},K.prototype.zoomToCrop=function(){if(this.cropRect){var c=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,C=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=c+"px "+C+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-c+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-C+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},K.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},K.prototype.cropRectChanged=function(c){this.cropRect=c,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},K.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},K.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,C=this.target.offsetTop>c+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=C+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},K.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},K.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new Zt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var C=new rr;C.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(C);var z=[];this.aspectRatios.forEach(function(It){var er=new Rt(tn.getIcon(It.horizontal,It.vertical),It.horizontal===0&&It.vertical===0?"FREE":It.horizontal+":"+It.vertical);er.onClick=function(){return c.ratioButtonClicked(It)},z.push(er)}),this.aspectRatioButton=new Tr(tn.getIcon(0,0),"Aspect ratio",z),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,C.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var $=new Rt('<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");$.isActive=this.isGridVisible,$.onClick=function(){c.isGridVisible=!c.isGridVisible,$.isActive=c.isGridVisible},C.addButton($);var V=new Rt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(V.isActive=this.zoomToCropEnabled,V.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,V.isActive=c.zoomToCropEnabled},C.addButton(V),!Zr.isLicensed){var xe=new vt;this.topToolbar.addElementBlock(xe);var Ge=document.createElement("div");Ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var tt=document.createElement("a");tt.style.color="currentColor",tt.href="https://markerjs.com/products/cropro",tt.target="_blank",tt.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Ge.appendChild(tt),xe.addElement(Ge)}var mt=new rr;mt.minWidth=3*this.toolbarHeight+"px",mt.contentAlign="end",this.topToolbar.addButtonBlock(mt);var Ke=new Rt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ke.onClick=this.startRenderAndClose,mt.addButton(Ke),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ke.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var At=new Rt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");At.onClick=this.close,mt.addButton(At),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(At.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},K.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new Zt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var C=new rr;C.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(C);var z=new Rt('<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");z.onClick=this.rotateLeftButtonClicked,C.addButton(z);var $=new Rt('<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");$.onClick=this.rotateRightButtonClicked,C.addButton($);var V=new vt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new zr("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(mt){c.rotateBy(mt),c.straightener.angle=c.rotationAngle},V.addElement(this.straightener.getUI());var xe=new rr;xe.minWidth=2*this.toolbarHeight+"px",xe.contentAlign="end",this.bottomToolbar.addButtonBlock(xe);var Ge=new Rt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Ge.onClick=this.flipHorizontallyButtonClicked,xe.addButton(Ge);var tt=new Rt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");tt.onClick=this.flipVerticallyButtonClicked,xe.addButton(tt)},K.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},K.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},K.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new kr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},K.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},K.prototype.restoreState=function(c){if(c){var C=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(C),this.cropRectChanged(C),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(c,C){var z=this.cropImage.getBoundingClientRect();return{x:c-z.left,y:C-z.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var c=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},K.prototype.rotateLeftButtonClicked=function(){var c=this.rotationAngle-90;this.rotationAngle%90!=0&&(c+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(c)},K.prototype.rotateRightButtonClicked=function(){var c=this.rotationAngle+90;this.rotationAngle%90!=0&&(c-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(c)},K.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},K.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},K.prototype.applyRotation=function(){var c=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var C=this.editingTargetRotationContainer.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(C,0);var z=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/z.width,this.imageHeight/z.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},K.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},K.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},K.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},K.prototype.startRenderAndClose=function(){return kt(this,void 0,void 0,function(){var c,C;return Ur(this,function(z){switch(z.label){case 0:return[4,this.render()];case 1:return c=z.sent(),C=this.getState(),this.renderEventListeners.forEach(function($){return $(c,C)}),this.close(!0),[2]}})})},K.prototype.render=function(){return kt(this,void 0,void 0,function(){var c;return Ur(this,function(C){switch(C.label){case 0:return(c=new rn).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,c.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return C.sent(),[4,c.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,C.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xt("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new xt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*c)+`px;
|
|
height: `+(this.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new at("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new at("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new xt("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new xt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new xt("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new xt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new xt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},K.instanceCounter=0,K}(),lt=q("8hTe"),Pt=q.n(lt),Kt=/<pre[^>]*>/g;function Yt(K){var c=document.createElement("div");return c.innerHTML=K,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var qt=Te.a=function(K){var c=K.value,C=c===void 0?"":c,z=K.edit,$=z===void 0?!1:z,V=K.className,xe=K.showTextOnly,Ge=K.showLines,tt=K.replaces,mt=K.zoomImg,Ke=K.hasMask,At=K.style,It=At===void 0?{}:At,er=K.stylesPrev,Kr=er===void 0?{}:er,Vr=String(C),pr=Object(A.useRef)(),Qr=Object(A.useRef)(),Gn=Object(A.useState)(""),Or=Object(W.a)(Gn,2),Xr=Or[0],jr=Or[1],bn=Object(A.useState)("office"),nn=Object(W.a)(bn,2),mn=nn[0],dn=nn[1],hi=function(){var jt=new He(Qr.current);jt.displayMode="popup",jt.addRenderEventListener(function(){var Er=Object(P.a)(_.a.mark(function Ut(dr){var Vt;return _.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return pr.current.style.display="none",lr.next=3,Object(Pe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr}});case 3:Vt=lr.sent,Vt!=null&&Vt.id&&tt(Qr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return lr.stop()}},Ut)}));return function(Ut){return Er.apply(this,arguments)}}()),jt.show()},zn=function(){var jt=new Ft(Qr.current);jt.settings.displayMode="popup",jt.addEventListener("render",function(){var Er=Object(P.a)(_.a.mark(function Ut(dr){var Vt;return _.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:if(pr.current.style.display="none",!Qr.current){lr.next=6;break}return lr.next=4,Object(Pe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr.dataUrl}});case 4:Vt=lr.sent,Vt!=null&&Vt.id&&tt(Qr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return lr.stop()}},Ut)}));return function(Ut){return Er.apply(this,arguments)}}()),jt.show(),window.markerArea=jt},an=Object(A.useMemo)(function(){try{var or=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Er=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Vr=Vr.replace(or,"("+ee.a.API_SERVER+"/api/attachments/").replace(jt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(Er,'"'+ee.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),Vr=Vr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(hn){}var Ut=G(Vr),dr=L();if(Vr.match(/\[TOC\]/)&&(Ut=Ut.replace("<p>[TOC]</p>",k()),E()),Ut=Ut.replace(/(__special_katext_id_\d+__)/g,function(hn,lr){var _r=dr[lr],Kn=_r.type,Vn=_r.expression;return Object(le.renderToString)(Yt(Vn)||"",{displayMode:Kn==="block",throwOnError:!1,output:"html"})}),Ut=Ut.replace(/▁/g,"\u2581\u2581\u2581"),S(),xe){var Vt=document.createElement("div");return Vt.innerHTML=Ut,Vt.innerText}return setTimeout(function(){return On()},500),Ut},[Vr]),Yr=Object(A.useRef)();g.WebkitLineClamp=Ge,Ge&&(It=Object(F.a)(Object(F.a)({},It),g));function kn(or){var jt=or.target;if(jt.tagName.toUpperCase()==="IMG"){if(mt){var Er=jt.getAttribute("src");jr(Er),dn("image")}}else if(jt.tagName.toUpperCase()==="A"){var Ut=jt.getAttribute("href");if(Ut.indexOf("office")>-1)or.preventDefault(),jr(Ut),dn("office");else if(Ut.indexOf("application/pdf")>-1)or.preventDefault(),jr(Ut),dn("pdf");else if(Ut.indexOf("type=text")>-1)or.preventDefault(),jr(Ut),dn("html");else if(Ut.startsWith("#")){or.preventDefault();var dr=document.getElementById(Ut.replace("#",""));dr&&dr.scrollIntoView(!0)}}}var On=function(){var jt,Er=(jt=Yr.current)===null||jt===void 0?void 0:jt.querySelectorAll("video");Er==null||Er.forEach(function(Ut){if(Ut.oncontextmenu=function(){return!1},Ut.src.indexOf(".m3u8")>-1&&!Ut.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var dr=new Y.a;dr.loadSource(Ut.src),dr.attachMedia(Ut)}}})};Object(A.useEffect)(function(){if(Yr.current&&an&&(an.match(Kt)&&window.PR.prettyPrint()),Yr.current)return Yr.current.addEventListener("click",kn),function(){Yr.current.removeEventListener("click",kn),S(),E()}},[an,Yr.current,kn]);var ci=function(jt){if(!$)return;jt.target.nodeName==="IMG"?(pr.current.style.display="flex",pr.current.style.width=jt.target.clientWidth+"px",pr.current.style.height=jt.target.clientHeight+"px",pr.current.style.top=jt.target.offsetTop+"px",pr.current.style.left=jt.target.offsetLeft+"px",Qr.current.src=jt.target.getAttribute("src")):pr.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:Yr,style:Object(F.a)({},It),className:"".concat(V||""," markdown-body ").concat(Pt.a.mdBody),onMouseOver:ci,dangerouslySetInnerHTML:{__html:an}}),d.a.createElement("div",{ref:pr,className:Pt.a.button},d.a.createElement(J.a,null,d.a.createElement(X.a,{onClick:function(){return hi()}},"\u88C1\u526A"),d.a.createElement(X.a,{onClick:function(){return zn()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:Qr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),d.a.createElement(fe.a,{close:!0,data:Xr,hasMask:Ke,type:Xr!=null&&Xr.length?mn:"",style:Object(F.a)({},Kr),onClose:function(){return jr("")}}))}},"9VGf":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return O});var ue=q("q1tI"),J=q.n(ue);function O(X,F){var P=Object(ue.useRef)();Object(ue.useEffect)(function(){P.current=X}),Object(ue.useEffect)(function(){function W(){P.current()}if(F!==null){var U=setInterval(W,F);return function(){return clearInterval(U)}}},[F])}},BU3w:function(pt,Te,q){"use strict";q.d(Te,"a",function(){return P});var ue=q("MNnm"),J="rc-util-key";function O(W){if(W.attachTo)return W.attachTo;var U=document.querySelector("head");return U||document.body}function X(W){var U,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var A=document.createElement("style");if((U=_.csp)===null||U===void 0?void 0:U.nonce){var d;A.nonce=(d=_.csp)===null||d===void 0?void 0:d.nonce}A.innerHTML=W;var p=O(_),T=p.firstChild;return _.prepend&&p.prepend?p.prepend(A):_.prepend&&T?p.insertBefore(A,T):p.appendChild(A),A}var F=new Map;function P(W,U){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=O(_);if(!F.has(A)){var d=X("",_),p=d.parentNode;F.set(A,p),p.removeChild(d)}var T=Array.from(F.get(A).children).find(function(i){return i.tagName==="STYLE"&&i[J]===U});if(T){var m,f;if(((m=_.csp)===null||m===void 0?void 0:m.nonce)&&T.nonce!==((f=_.csp)===null||f===void 0?void 0:f.nonce)){var y;T.nonce=(y=_.csp)===null||y===void 0?void 0:y.nonce}return T.innerHTML!==W&&(T.innerHTML=W),T}var a=X(W,_);return a[J]=U,a}},Bd2K:function(pt,Te,q){(function(ue){ue(q("VrN/"),q("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(_,A,d){if(d!=ue.Init&&d&&_.removeKeyMap("autoCloseTags"),!A)return;var p={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(p["'/'"]=function(T){return P(T)}),(typeof A!="object"||A.whenOpening!==!1)&&(p["'>'"]=function(T){return X(T)}),_.addKeyMap(p)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function X(_){if(_.getOption("disableInput"))return ue.Pass;for(var A=_.listSelections(),d=[],p=_.getOption("autoCloseTags"),T=0;T<A.length;T++){if(!A[T].empty())return ue.Pass;var m=A[T].head,f=_.getTokenAt(m),y=ue.innerMode(_.getMode(),f.state),a=y.state,i=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(a),s=i&&i.name;if(!s)return ue.Pass;var l=y.mode.configuration=="html",E=typeof p=="object"&&p.dontCloseTags||l&&J,g=typeof p=="object"&&p.indentTags||l&&O;f.end>m.ch&&(s=s.slice(0,s.length-f.end+m.ch));var v=s.toLowerCase();if(!s||f.type=="string"&&(f.end!=m.ch||!/[\"\']/.test(f.string.charAt(f.string.length-1))||f.string.length==1)||f.type=="tag"&&i.close||f.string.indexOf("/")==m.ch-f.start-1||E&&W(E,v)>-1||U(_,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(a)||[],s,m,!0))return ue.Pass;var k=typeof p=="object"&&p.emptyTags;if(k&&W(k,s)>-1){d[T]={text:"/>",newPos:ue.Pos(m.line,m.ch+2)};continue}var w=g&&W(g,v)>-1;d[T]={indent:w,text:">"+(w?`
|
|
|
|
`:"")+"</"+s+">",newPos:w?ue.Pos(m.line+1,0):ue.Pos(m.line,m.ch+1)}}for(var x=typeof p=="object"&&p.dontIndentOnAutoClose,T=A.length-1;T>=0;T--){var b=d[T];_.replaceRange(b.text,A[T].head,A[T].anchor,"+insert");var h=_.listSelections().slice(0);h[T]={head:b.newPos,anchor:b.newPos},_.setSelections(h),!x&&b.indent&&(_.indentLine(b.newPos.line,null,!0),_.indentLine(b.newPos.line+1,null,!0))}}function F(_,A){for(var d=_.listSelections(),p=[],T=A?"/":"</",m=_.getOption("autoCloseTags"),f=typeof m=="object"&&m.dontIndentOnSlash,y=0;y<d.length;y++){if(!d[y].empty())return ue.Pass;var a=d[y].head,i=_.getTokenAt(a),s=ue.innerMode(_.getMode(),i.state),l=s.state;if(A&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=a.ch-1))return ue.Pass;var E,g=s.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")E=T+"script";else if(g&&s.mode.name=="css")E=T+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!v||v.length&&U(_,v,v[v.length-1],a))return ue.Pass;E=T+v[v.length-1]}_.getLine(a.line).charAt(i.end)!=">"&&(E+=">"),p[y]=E}if(_.replaceSelections(p),d=_.listSelections(),!f)for(var y=0;y<d.length;y++)(y==d.length-1||d[y].head.line<d[y+1].head.line)&&_.indentLine(d[y].head.line)}function P(_){return _.getOption("disableInput")?ue.Pass:F(_,!0)}ue.commands.closeTag=function(_){return F(_)};function W(_,A){if(_.indexOf)return _.indexOf(A);for(var d=0,p=_.length;d<p;++d)if(_[d]==A)return d;return-1}function U(_,A,d,p,T){if(!ue.scanForClosingTag)return!1;var m=Math.min(_.lastLine()+1,p.line+500),f=ue.scanForClosingTag(_,p,null,m);if(!f||f.tag!=d)return!1;for(var y=T?1:0,a=A.length-1;a>=0&&A[a]==d;a--)++y;p=f.to;for(var a=1;a<y;a++){var i=ue.scanForClosingTag(_,p,null,m);if(!i||i.tag!=d)return!1;p=i.to}return!0}})},BjJ7:function(pt,Te,q){"use strict";q.d(Te,"d",function(){return J}),q.d(Te,"c",function(){return O}),q.d(Te,"e",function(){return X}),q.d(Te,"b",function(){return F}),q.d(Te,"a",function(){return W});var ue=q("m3rI");function J(U){var _=!0;if(U.length>0){for(var A=0;A<U.length;A++)if(U[A].compile_success==0||!U[A].compile_success){_=!1;break}}else _=!1;return _}function O(U){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],d=0;d<U.length;d++){var p=U[d],T=_?"".concat(_,"/").concat(p.name):"".concat(p.name);A.push({title:p.name,isLeaf:!(p.type==="tree"),key:T})}return A}function X(U,_,A){for(var d=0;d<U.length;d++){var p=U[d];if(p.key===_){p.children=A;break}p.children&&X(p.children,_,A)}return U}function F(U,_,A){var d;return function(){var p=this,T=arguments,m=function(){d=null,A||U.apply(p,T)},f=A&&!d;clearTimeout(d),d=setTimeout(m,_),f&&U.apply(p,T)}}var P=!0,W=ue.a.API_SERVER},"C+DQ":function(pt,Te,q){},"C/vA":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return ue});function ue(J){var O=this,X=!1,F;return function(){return X||(X=!0,F=J.apply(O,arguments)),F}}},"Cg/j":function(pt,Te,q){"use strict";q.d(Te,"b",function(){return ue}),q.d(Te,"a",function(){return J}),q.d(Te,"c",function(){return X}),q.d(Te,"d",function(){return F});var ue;(function(P){P.serviceIds=new Map,P.DI_TARGET="$di$target",P.DI_DEPENDENCIES="$di$dependencies";function W(U){return U[P.DI_DEPENDENCIES]||[]}P.getServiceDependencies=W})(ue||(ue={}));var J=X("instantiationService");function O(P,W,U,_){W[ue.DI_TARGET]===W?W[ue.DI_DEPENDENCIES].push({id:P,index:U,optional:_}):(W[ue.DI_DEPENDENCIES]=[{id:P,index:U,optional:_}],W[ue.DI_TARGET]=W)}function X(P){if(ue.serviceIds.has(P))return ue.serviceIds.get(P);var W=function(U,_,A){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");O(W,U,A,!1)};return W.toString=function(){return P},ue.serviceIds.set(P,W),W}function F(P){return function(W,U,_){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");O(P,W,_,!0)}}},DlQD:function(pt,Te,q){(function(ue,J){pt.exports=J()})(this,function(){"use strict";function ue(Ce,be){for(var Ee=0;Ee<be.length;Ee++){var ne=be[Ee];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(Ce,ne.key,ne)}}function J(Ce,be,Ee){return be&&ue(Ce.prototype,be),Ee&&ue(Ce,Ee),Ce}function O(Ce,be){if(!Ce)return;if(typeof Ce=="string")return X(Ce,be);var Ee=Object.prototype.toString.call(Ce).slice(8,-1);if(Ee==="Object"&&Ce.constructor&&(Ee=Ce.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(Ce);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return X(Ce,be)}function X(Ce,be){(be==null||be>Ce.length)&&(be=Ce.length);for(var Ee=0,ne=new Array(be);Ee<be;Ee++)ne[Ee]=Ce[Ee];return ne}function F(Ce,be){var Ee;if(typeof Symbol=="undefined"||Ce[Symbol.iterator]==null){if(Array.isArray(Ce)||(Ee=O(Ce))||be&&Ce&&typeof Ce.length=="number"){Ee&&(Ce=Ee);var ne=0;return function(){return ne>=Ce.length?{done:!0}:{done:!1,value:Ce[ne++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return Ee=Ce[Symbol.iterator](),Ee.next.bind(Ee)}function P(Ce,be){return be={exports:{}},Ce(be,be.exports),be.exports}var W=P(function(Ce){function be(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Ee(ne){Ce.exports.defaults=ne}Ce.exports={defaults:be(),getDefaults:be,changeDefaults:Ee}}),U=W.defaults,_=W.getDefaults,A=W.changeDefaults,d=/[&<>"']/,p=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,m=/[<>"']|&(?!#?\w+;)/g,f={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(be){return f[be]};function a(Ce,be){if(be){if(d.test(Ce))return Ce.replace(p,y)}else if(T.test(Ce))return Ce.replace(m,y);return Ce}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ce){return Ce.replace(i,function(be,Ee){return Ee=Ee.toLowerCase(),Ee==="colon"?":":Ee.charAt(0)==="#"?Ee.charAt(1)==="x"?String.fromCharCode(parseInt(Ee.substring(2),16)):String.fromCharCode(+Ee.substring(1)):""})}var l=/(^|[^\[])\^/g;function E(Ce,be){Ce=Ce.source||Ce,be=be||"";var Ee={replace:function(se,ce){return ce=ce.source||ce,ce=ce.replace(l,"$1"),Ce=Ce.replace(se,ce),Ee},getRegex:function(){return new RegExp(Ce,be)}};return Ee}var g=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(Ce,be,Ee){if(Ce){var ne;try{ne=decodeURIComponent(s(Ee)).replace(g,"").toLowerCase()}catch(se){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}be&&!v.test(Ee)&&(Ee=u(be,Ee));try{Ee=encodeURI(Ee).replace(/%25/g,"%")}catch(se){return null}return Ee}var w={},x=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Ce,be){w[" "+Ce]||(x.test(Ce)?w[" "+Ce]=Ce+"/":w[" "+Ce]=I(Ce,"/",!0)),Ce=w[" "+Ce];var Ee=Ce.indexOf(":")===-1;return be.substring(0,2)==="//"?Ee?be:Ce.replace(b,"$1")+be:be.charAt(0)==="/"?Ee?be:Ce.replace(h,"$1")+be:Ce+be}var L={exec:function(){}};function S(Ce){for(var be=1,Ee,ne;be<arguments.length;be++){Ee=arguments[be];for(ne in Ee)Object.prototype.hasOwnProperty.call(Ee,ne)&&(Ce[ne]=Ee[ne])}return Ce}function D(Ce,be){var Ee=Ce.replace(/\|/g,function(ce,ve,Ne){for(var ke=!1,ze=ve;--ze>=0&&Ne[ze]==="\\";)ke=!ke;return ke?"|":" |"}),ne=Ee.split(/ \|/),se=0;if(ne.length>be)ne.splice(be);else for(;ne.length<be;)ne.push("");for(;se<ne.length;se++)ne[se]=ne[se].trim().replace(/\\\|/g,"|");return ne}function I(Ce,be,Ee){var ne=Ce.length;if(ne===0)return"";for(var se=0;se<ne;){var ce=Ce.charAt(ne-se-1);if(ce===be&&!Ee)se++;else if(ce!==be&&Ee)se++;else break}return Ce.substr(0,ne-se)}function B(Ce,be){if(Ce.indexOf(be[1])===-1)return-1;for(var Ee=Ce.length,ne=0,se=0;se<Ee;se++)if(Ce[se]==="\\")se++;else if(Ce[se]===be[0])ne++;else if(Ce[se]===be[1]&&(ne--,ne<0))return se;return-1}function j(Ce){Ce&&Ce.sanitize&&!Ce.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var G={escape:a,unescape:s,edit:E,cleanUrl:k,resolveUrl:u,noopTest:L,merge:S,splitCells:D,rtrim:I,findClosingBracket:B,checkSanitizeDeprecation:j},M=W.defaults,N=G.rtrim,Y=G.splitCells,ee=G.escape,le=G.findClosingBracket;function fe(Ce,be,Ee){var ne=be.href,se=be.title?ee(be.title):null,ce=Ce[1].replace(/\\([\[\]])/g,"$1");return Ce[0].charAt(0)!=="!"?{type:"link",raw:Ee,href:ne,title:se,text:ce}:{type:"image",raw:Ee,href:ne,title:se,text:ee(ce)}}function Pe(Ce,be){var Ee=Ce.match(/^(\s+)(?:```)/);if(Ee===null)return be;var ne=Ee[1];return be.split(`
|
|
`).map(function(se){var ce=se.match(/^\s+/);if(ce===null)return se;var ve=ce[0];return ve.length>=ne.length?se.slice(ne.length):se}).join(`
|
|
`)}var Se=function(){function Ce(Ee){this.options=Ee||M}var be=Ce.prototype;return be.space=function(ne){var se=this.rules.block.newline.exec(ne);if(se)return se[0].length>1?{type:"space",raw:se[0]}:{raw:`
|
|
`}},be.code=function(ne,se){var ce=this.rules.block.code.exec(ne);if(ce){var ve=se[se.length-1];if(ve&&ve.type==="paragraph")return{raw:ce[0],text:ce[0].trimRight()};var Ne=ce[0].replace(/^ {4}/gm,"");return{type:"code",raw:ce[0],codeBlockStyle:"indented",text:this.options.pedantic?Ne:N(Ne,`
|
|
`)}}},be.fences=function(ne){var se=this.rules.block.fences.exec(ne);if(se){var ce=se[0],ve=Pe(ce,se[3]||"");return{type:"code",raw:ce,lang:se[2]?se[2].trim():se[2],text:ve}}},be.heading=function(ne){var se=this.rules.block.heading.exec(ne);if(se)return{type:"heading",raw:se[0],depth:se[1].length,text:se[2]}},be.nptable=function(ne){var se=this.rules.block.nptable.exec(ne);if(se){var ce={type:"table",header:Y(se[1].replace(/^ *| *\| *$/g,"")),align:se[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:se[3]?se[3].replace(/\n$/,"").split(`
|
|
`):[],raw:se[0]};if(ce.header.length===ce.align.length){var ve=ce.align.length,Ne;for(Ne=0;Ne<ve;Ne++)/^ *-+: *$/.test(ce.align[Ne])?ce.align[Ne]="right":/^ *:-+: *$/.test(ce.align[Ne])?ce.align[Ne]="center":/^ *:-+ *$/.test(ce.align[Ne])?ce.align[Ne]="left":ce.align[Ne]=null;for(ve=ce.cells.length,Ne=0;Ne<ve;Ne++)ce.cells[Ne]=Y(ce.cells[Ne],ce.header.length);return ce}}},be.hr=function(ne){var se=this.rules.block.hr.exec(ne);if(se)return{type:"hr",raw:se[0]}},be.blockquote=function(ne){var se=this.rules.block.blockquote.exec(ne);if(se){var ce=se[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:se[0],text:ce}}},be.list=function(ne){var se=this.rules.block.list.exec(ne);if(se){for(var ce=se[0],ve=se[2],Ne=ve.length>1,ke=ve[ve.length-1]===")",ze={type:"list",raw:ce,ordered:Ne,start:Ne?+ve.slice(0,-1):"",loose:!1,items:[]},it=se[0].match(this.rules.block.item),ct=!1,ht,Lt,wt,ft,zt,Ft,Jt,Ht=it.length,kt=0;kt<Ht;kt++)ht=it[kt],ce=ht,Lt=ht.length,ht=ht.replace(/^ *([*+-]|\d+[.)]) */,""),~ht.indexOf(`
|
|
`)&&(Lt-=ht.length,ht=this.options.pedantic?ht.replace(/^ {1,4}/gm,""):ht.replace(new RegExp("^ {1,"+Lt+"}","gm"),"")),kt!==Ht-1&&(wt=this.rules.block.bullet.exec(it[kt+1])[0],(Ne?wt.length===1||!ke&&wt[wt.length-1]===")":wt.length>1||this.options.smartLists&&wt!==ve)&&(ft=it.slice(kt+1).join(`
|
|
`),ze.raw=ze.raw.substring(0,ze.raw.length-ft.length),kt=Ht-1)),zt=ct||/\n\n(?!\s*$)/.test(ht),kt!==Ht-1&&(ct=ht.charAt(ht.length-1)===`
|
|
`,zt||(zt=ct)),zt&&(ze.loose=!0),Ft=/^\[[ xX]\] /.test(ht),Jt=void 0,Ft&&(Jt=ht[1]!==" ",ht=ht.replace(/^\[[ xX]\] +/,"")),ze.items.push({type:"list_item",raw:ce,task:Ft,checked:Jt,loose:zt,text:ht});return ze}},be.html=function(ne){var se=this.rules.block.html.exec(ne);if(se)return{type:this.options.sanitize?"paragraph":"html",raw:se[0],pre:!this.options.sanitizer&&(se[1]==="pre"||se[1]==="script"||se[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):ee(se[0]):se[0]}},be.def=function(ne){var se=this.rules.block.def.exec(ne);if(se){se[3]&&(se[3]=se[3].substring(1,se[3].length-1));var ce=se[1].toLowerCase().replace(/\s+/g," ");return{tag:ce,raw:se[0],href:se[2],title:se[3]}}},be.table=function(ne){var se=this.rules.block.table.exec(ne);if(se){var ce={type:"table",header:Y(se[1].replace(/^ *| *\| *$/g,"")),align:se[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:se[3]?se[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ce.header.length===ce.align.length){ce.raw=se[0];var ve=ce.align.length,Ne;for(Ne=0;Ne<ve;Ne++)/^ *-+: *$/.test(ce.align[Ne])?ce.align[Ne]="right":/^ *:-+: *$/.test(ce.align[Ne])?ce.align[Ne]="center":/^ *:-+ *$/.test(ce.align[Ne])?ce.align[Ne]="left":ce.align[Ne]=null;for(ve=ce.cells.length,Ne=0;Ne<ve;Ne++)ce.cells[Ne]=Y(ce.cells[Ne].replace(/^ *\| *| *\| *$/g,""),ce.header.length);return ce}}},be.lheading=function(ne){var se=this.rules.block.lheading.exec(ne);if(se)return{type:"heading",raw:se[0],depth:se[2].charAt(0)==="="?1:2,text:se[1]}},be.paragraph=function(ne){var se=this.rules.block.paragraph.exec(ne);if(se)return{type:"paragraph",raw:se[0],text:se[1].charAt(se[1].length-1)===`
|
|
`?se[1].slice(0,-1):se[1]}},be.text=function(ne,se){var ce=this.rules.block.text.exec(ne);if(ce){var ve=se[se.length-1];return ve&&ve.type==="text"?{raw:ce[0],text:ce[0]}:{type:"text",raw:ce[0],text:ce[0]}}},be.escape=function(ne){var se=this.rules.inline.escape.exec(ne);if(se)return{type:"escape",raw:se[0],text:ee(se[1])}},be.tag=function(ne,se,ce){var ve=this.rules.inline.tag.exec(ne);if(ve)return!se&&/^<a /i.test(ve[0])?se=!0:se&&/^<\/a>/i.test(ve[0])&&(se=!1),!ce&&/^<(pre|code|kbd|script)(\s|>)/i.test(ve[0])?ce=!0:ce&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ve[0])&&(ce=!1),{type:this.options.sanitize?"text":"html",raw:ve[0],inLink:se,inRawBlock:ce,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):ee(ve[0]):ve[0]}},be.link=function(ne){var se=this.rules.inline.link.exec(ne);if(se){var ce=le(se[2],"()");if(ce>-1){var ve=se[0].indexOf("!")===0?5:4,Ne=ve+se[1].length+ce;se[2]=se[2].substring(0,ce),se[0]=se[0].substring(0,Ne).trim(),se[3]=""}var ke=se[2],ze="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ke);it?(ke=it[1],ze=it[3]):ze=""}else ze=se[3]?se[3].slice(1,-1):"";ke=ke.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=fe(se,{href:ke&&ke.replace(this.rules.inline._escapes,"$1"),title:ze&&ze.replace(this.rules.inline._escapes,"$1")},se[0]);return ct}},be.reflink=function(ne,se){var ce;if((ce=this.rules.inline.reflink.exec(ne))||(ce=this.rules.inline.nolink.exec(ne))){var ve=(ce[2]||ce[1]).replace(/\s+/g," ");if(ve=se[ve.toLowerCase()],!ve||!ve.href){var Ne=ce[0].charAt(0);return{type:"text",raw:Ne,text:Ne}}var ke=fe(ce,ve,ce[0]);return ke}},be.strong=function(ne,se,ce){ce===void 0&&(ce="");var ve=this.rules.inline.strong.start.exec(ne);if(ve&&(!ve[1]||ve[1]&&(ce===""||this.rules.inline.punctuation.exec(ce)))){se=se.slice(-1*ne.length);var Ne=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ne.lastIndex=0;for(var ke;(ve=Ne.exec(se))!=null;)if(ke=this.rules.inline.strong.middle.exec(se.slice(0,ve.index+3)),ke)return{type:"strong",raw:ne.slice(0,ke[0].length),text:ne.slice(2,ke[0].length-2)}}},be.em=function(ne,se,ce){ce===void 0&&(ce="");var ve=this.rules.inline.em.start.exec(ne);if(ve&&(!ve[1]||ve[1]&&(ce===""||this.rules.inline.punctuation.exec(ce)))){se=se.slice(-1*ne.length);var Ne=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ne.lastIndex=0;for(var ke;(ve=Ne.exec(se))!=null;)if(ke=this.rules.inline.em.middle.exec(se.slice(0,ve.index+2)),ke)return{type:"em",raw:ne.slice(0,ke[0].length),text:ne.slice(1,ke[0].length-1)}}},be.codespan=function(ne){var se=this.rules.inline.code.exec(ne);if(se){var ce=se[2].replace(/\n/g," "),ve=/[^ ]/.test(ce),Ne=ce.startsWith(" ")&&ce.endsWith(" ");return ve&&Ne&&(ce=ce.substring(1,ce.length-1)),ce=ee(ce,!0),{type:"codespan",raw:se[0],text:ce}}},be.br=function(ne){var se=this.rules.inline.br.exec(ne);if(se)return{type:"br",raw:se[0]}},be.del=function(ne){var se=this.rules.inline.del.exec(ne);if(se)return{type:"del",raw:se[0],text:se[1]}},be.autolink=function(ne,se){var ce=this.rules.inline.autolink.exec(ne);if(ce){var ve,Ne;return ce[2]==="@"?(ve=ee(this.options.mangle?se(ce[1]):ce[1]),Ne="mailto:"+ve):(ve=ee(ce[1]),Ne=ve),{type:"link",raw:ce[0],text:ve,href:Ne,tokens:[{type:"text",raw:ve,text:ve}]}}},be.url=function(ne,se){var ce;if(ce=this.rules.inline.url.exec(ne)){var ve,Ne;if(ce[2]==="@")ve=ee(this.options.mangle?se(ce[0]):ce[0]),Ne="mailto:"+ve;else{var ke;do ke=ce[0],ce[0]=this.rules.inline._backpedal.exec(ce[0])[0];while(ke!==ce[0]);ve=ee(ce[0]),ce[1]==="www."?Ne="http://"+ve:Ne=ve}return{type:"link",raw:ce[0],text:ve,href:Ne,tokens:[{type:"text",raw:ve,text:ve}]}}},be.inlineText=function(ne,se,ce){var ve=this.rules.inline.text.exec(ne);if(ve){var Ne;return se?Ne=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):ee(ve[0]):ve[0]:Ne=ee(this.options.smartypants?ce(ve[0]):ve[0]),{type:"text",raw:ve[0],text:Ne}}},Ce}(),De=G.noopTest,Le=G.edit,Ae=G.merge,me={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:De,table:De,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=Le(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=Le(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Le(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",me._comment=/<!--(?!-?>)[\s\S]*?-->/,me.html=Le(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Le(me._paragraph).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.blockquote=Le(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Ae({},me),me.gfm=Ae({},me.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),me.gfm.nptable=Le(me.gfm.nptable).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.gfm.table=Le(me.gfm.table).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.pedantic=Ae({},me.normal,{html:Le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:De,paragraph:Le(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:De,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:De,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};de._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",de.punctuation=Le(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=Le(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=Le(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=Le(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=Le(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=Le(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=Le(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=Le(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=Le(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=Le(de._blockSkip,"g").getRegex(),de.overlapSkip=Le(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,de.autolink=Le(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=Le(de.tag).replace("comment",me._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=Le(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=Le(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=Le(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=Ae({},de),de.pedantic=Ae({},de.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Le(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:Le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=Ae({},de.normal,{escape:Le(de.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),de.gfm.url=Le(de.gfm.url,"i").replace("email",de.gfm._extended_email).getRegex(),de.breaks=Ae({},de.gfm,{br:Le(de.br).replace("{2,}","*").getRegex(),text:Le(de.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var re={block:me,inline:de},he=W.defaults,ie=re.block,Re=re.inline;function oe(Ce){return Ce.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ae(Ce){var be="",Ee,ne,se=Ce.length;for(Ee=0;Ee<se;Ee++)ne=Ce.charCodeAt(Ee),Math.random()>.5&&(ne="x"+ne.toString(16)),be+="&#"+ne+";";return be}var ge=function(){function Ce(Ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ee||he,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:ie.normal,inline:Re.normal};this.options.pedantic?(ne.block=ie.pedantic,ne.inline=Re.pedantic):this.options.gfm&&(ne.block=ie.gfm,this.options.breaks?ne.inline=Re.breaks:ne.inline=Re.gfm),this.tokenizer.rules=ne}Ce.lex=function(ne,se){var ce=new Ce(se);return ce.lex(ne)};var be=Ce.prototype;return be.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},be.blockTokens=function(ne,se,ce){se===void 0&&(se=[]),ce===void 0&&(ce=!0),ne=ne.replace(/^ +$/gm,"");for(var ve,Ne,ke,ze;ne;){if(ve=this.tokenizer.space(ne)){ne=ne.substring(ve.raw.length),ve.type&&se.push(ve);continue}if(ve=this.tokenizer.code(ne,se)){ne=ne.substring(ve.raw.length),ve.type?se.push(ve):(ze=se[se.length-1],ze.raw+=`
|
|
`+ve.raw,ze.text+=`
|
|
`+ve.text);continue}if(ve=this.tokenizer.fences(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ve=this.tokenizer.heading(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ve=this.tokenizer.nptable(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ve=this.tokenizer.hr(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ve=this.tokenizer.blockquote(ne)){ne=ne.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],ce),se.push(ve);continue}if(ve=this.tokenizer.list(ne)){for(ne=ne.substring(ve.raw.length),ke=ve.items.length,Ne=0;Ne<ke;Ne++)ve.items[Ne].tokens=this.blockTokens(ve.items[Ne].text,[],!1);se.push(ve);continue}if(ve=this.tokenizer.html(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ce&&(ve=this.tokenizer.def(ne))){ne=ne.substring(ve.raw.length),this.tokens.links[ve.tag]||(this.tokens.links[ve.tag]={href:ve.href,title:ve.title});continue}if(ve=this.tokenizer.table(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ve=this.tokenizer.lheading(ne)){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ce&&(ve=this.tokenizer.paragraph(ne))){ne=ne.substring(ve.raw.length),se.push(ve);continue}if(ve=this.tokenizer.text(ne,se)){ne=ne.substring(ve.raw.length),ve.type?se.push(ve):(ze=se[se.length-1],ze.raw+=`
|
|
`+ve.raw,ze.text+=`
|
|
`+ve.text);continue}if(ne){var it="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return se},be.inline=function(ne){var se,ce,ve,Ne,ke,ze,it=ne.length;for(se=0;se<it;se++){ze=ne[se];switch(ze.type){case"paragraph":case"text":case"heading":{ze.tokens=[],this.inlineTokens(ze.text,ze.tokens);break}case"table":{for(ze.tokens={header:[],cells:[]},Ne=ze.header.length,ce=0;ce<Ne;ce++)ze.tokens.header[ce]=[],this.inlineTokens(ze.header[ce],ze.tokens.header[ce]);for(Ne=ze.cells.length,ce=0;ce<Ne;ce++)for(ke=ze.cells[ce],ze.tokens.cells[ce]=[],ve=0;ve<ke.length;ve++)ze.tokens.cells[ce][ve]=[],this.inlineTokens(ke[ve],ze.tokens.cells[ce][ve]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(Ne=ze.items.length,ce=0;ce<Ne;ce++)this.inline(ze.items[ce].tokens);break}}}return ne},be.inlineTokens=function(ne,se,ce,ve,Ne){se===void 0&&(se=[]),ce===void 0&&(ce=!1),ve===void 0&&(ve=!1),Ne===void 0&&(Ne="");var ke,ze=ne,it;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(it=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)ct.includes(it[0].slice(it[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(it=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(ke=this.tokenizer.escape(ne)){ne=ne.substring(ke.raw.length),se.push(ke);continue}if(ke=this.tokenizer.tag(ne,ce,ve)){ne=ne.substring(ke.raw.length),ce=ke.inLink,ve=ke.inRawBlock,se.push(ke);continue}if(ke=this.tokenizer.link(ne)){ne=ne.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,ve)),se.push(ke);continue}if(ke=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,ve)),se.push(ke);continue}if(ke=this.tokenizer.strong(ne,ze,Ne)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],ce,ve),se.push(ke);continue}if(ke=this.tokenizer.em(ne,ze,Ne)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],ce,ve),se.push(ke);continue}if(ke=this.tokenizer.codespan(ne)){ne=ne.substring(ke.raw.length),se.push(ke);continue}if(ke=this.tokenizer.br(ne)){ne=ne.substring(ke.raw.length),se.push(ke);continue}if(ke=this.tokenizer.del(ne)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],ce,ve),se.push(ke);continue}if(ke=this.tokenizer.autolink(ne,ae)){ne=ne.substring(ke.raw.length),se.push(ke);continue}if(!ce&&(ke=this.tokenizer.url(ne,ae))){ne=ne.substring(ke.raw.length),se.push(ke);continue}if(ke=this.tokenizer.inlineText(ne,ve,oe)){ne=ne.substring(ke.raw.length),Ne=ke.raw.slice(-1),se.push(ke);continue}if(ne){var ht="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(ht);break}else throw new Error(ht)}}return se},J(Ce,null,[{key:"rules",get:function(){return{block:ie,inline:Re}}}]),Ce}(),we=W.defaults,_e=G.cleanUrl,Fe=G.escape,Ue=function(){function Ce(Ee){this.options=Ee||we}var be=Ce.prototype;return be.code=function(ne,se,ce){var ve=(se||"").match(/\S*/)[0];if(this.options.highlight){var Ne=this.options.highlight(ne,ve);Ne!=null&&Ne!==ne&&(ce=!0,ne=Ne)}return ve?'<pre><code class="'+this.options.langPrefix+Fe(ve,!0)+'">'+(ce?ne:Fe(ne,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ce?ne:Fe(ne,!0))+`</code></pre>
|
|
`},be.blockquote=function(ne){return`<blockquote>
|
|
`+ne+`</blockquote>
|
|
`},be.html=function(ne){return ne},be.heading=function(ne,se,ce,ve){return this.options.headerIds?"<h"+se+' id="'+this.options.headerPrefix+ve.slug(ce)+'">'+ne+"</h"+se+`>
|
|
`:"<h"+se+">"+ne+"</h"+se+`>
|
|
`},be.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},be.list=function(ne,se,ce){var ve=se?"ol":"ul",Ne=se&&ce!==1?' start="'+ce+'"':"";return"<"+ve+Ne+`>
|
|
`+ne+"</"+ve+`>
|
|
`},be.listitem=function(ne){return"<li>"+ne+`</li>
|
|
`},be.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},be.paragraph=function(ne){return"<p>"+ne+`</p>
|
|
`},be.table=function(ne,se){return se&&(se="<tbody>"+se+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ne+`</thead>
|
|
`+se+`</table>
|
|
`},be.tablerow=function(ne){return`<tr>
|
|
`+ne+`</tr>
|
|
`},be.tablecell=function(ne,se){var ce=se.header?"th":"td",ve=se.align?"<"+ce+' align="'+se.align+'">':"<"+ce+">";return ve+ne+"</"+ce+`>
|
|
`},be.strong=function(ne){return"<strong>"+ne+"</strong>"},be.em=function(ne){return"<em>"+ne+"</em>"},be.codespan=function(ne){return"<code>"+ne+"</code>"},be.br=function(){return this.options.xhtml?"<br/>":"<br>"},be.del=function(ne){return"<del>"+ne+"</del>"},be.link=function(ne,se,ce){if(ne=_e(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ce;var ve='<a href="'+Fe(ne)+'"';return se&&(ve+=' title="'+se+'"'),ve+=">"+ce+"</a>",ve},be.image=function(ne,se,ce){if(ne=_e(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ce;var ve='<img src="'+ne+'" alt="'+ce+'"';return se&&(ve+=' title="'+se+'"'),ve+=this.options.xhtml?"/>":">",ve},be.text=function(ne){return ne},Ce}(),Be=function(){function Ce(){}var be=Ce.prototype;return be.strong=function(ne){return ne},be.em=function(ne){return ne},be.codespan=function(ne){return ne},be.del=function(ne){return ne},be.html=function(ne){return ne},be.text=function(ne){return ne},be.link=function(ne,se,ce){return""+ce},be.image=function(ne,se,ce){return""+ce},be.br=function(){return""},Ce}(),et=function(){function Ce(){this.seen={}}var be=Ce.prototype;return be.slug=function(ne){var se=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(se)){var ce=se;do this.seen[ce]++,se=ce+"-"+this.seen[ce];while(this.seen.hasOwnProperty(se))}return this.seen[se]=0,se},Ce}(),Je=W.defaults,Ze=G.unescape,Ye=function(){function Ce(Ee){this.options=Ee||Je,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new et}Ce.parse=function(ne,se){var ce=new Ce(se);return ce.parse(ne)};var be=Ce.prototype;return be.parse=function(ne,se){se===void 0&&(se=!0);var ce="",ve,Ne,ke,ze,it,ct,ht,Lt,wt,ft,zt,Ft,Jt,Ht,kt,Ur,Zr,bt,Ct=ne.length;for(ve=0;ve<Ct;ve++){ft=ne[ve];switch(ft.type){case"space":continue;case"hr":{ce+=this.renderer.hr();continue}case"heading":{ce+=this.renderer.heading(this.parseInline(ft.tokens),ft.depth,Ze(this.parseInline(ft.tokens,this.textRenderer)),this.slugger);continue}case"code":{ce+=this.renderer.code(ft.text,ft.lang,ft.escaped);continue}case"table":{for(Lt="",ht="",ze=ft.header.length,Ne=0;Ne<ze;Ne++)ht+=this.renderer.tablecell(this.parseInline(ft.tokens.header[Ne]),{header:!0,align:ft.align[Ne]});for(Lt+=this.renderer.tablerow(ht),wt="",ze=ft.cells.length,Ne=0;Ne<ze;Ne++){for(ct=ft.tokens.cells[Ne],ht="",it=ct.length,ke=0;ke<it;ke++)ht+=this.renderer.tablecell(this.parseInline(ct[ke]),{header:!1,align:ft.align[ke]});wt+=this.renderer.tablerow(ht)}ce+=this.renderer.table(Lt,wt);continue}case"blockquote":{wt=this.parse(ft.tokens),ce+=this.renderer.blockquote(wt);continue}case"list":{for(zt=ft.ordered,Ft=ft.start,Jt=ft.loose,ze=ft.items.length,wt="",Ne=0;Ne<ze;Ne++)kt=ft.items[Ne],Ur=kt.checked,Zr=kt.task,Ht="",kt.task&&(bt=this.renderer.checkbox(Ur),Jt?kt.tokens.length>0&&kt.tokens[0].type==="text"?(kt.tokens[0].text=bt+" "+kt.tokens[0].text,kt.tokens[0].tokens&&kt.tokens[0].tokens.length>0&&kt.tokens[0].tokens[0].type==="text"&&(kt.tokens[0].tokens[0].text=bt+" "+kt.tokens[0].tokens[0].text)):kt.tokens.unshift({type:"text",text:bt}):Ht+=bt),Ht+=this.parse(kt.tokens,Jt),wt+=this.renderer.listitem(Ht,Zr,Ur);ce+=this.renderer.list(wt,zt,Ft);continue}case"html":{ce+=this.renderer.html(ft.text);continue}case"paragraph":{ce+=this.renderer.paragraph(this.parseInline(ft.tokens));continue}case"text":{for(wt=ft.tokens?this.parseInline(ft.tokens):ft.text;ve+1<Ct&&ne[ve+1].type==="text";)ft=ne[++ve],wt+=`
|
|
`+(ft.tokens?this.parseInline(ft.tokens):ft.text);ce+=se?this.renderer.paragraph(wt):wt;continue}default:{var at='Token with "'+ft.type+'" type was not found.';if(this.options.silent){console.error(at);return}else throw new Error(at)}}}return ce},be.parseInline=function(ne,se){se=se||this.renderer;var ce="",ve,Ne,ke=ne.length;for(ve=0;ve<ke;ve++){Ne=ne[ve];switch(Ne.type){case"escape":{ce+=se.text(Ne.text);break}case"html":{ce+=se.html(Ne.text);break}case"link":{ce+=se.link(Ne.href,Ne.title,this.parseInline(Ne.tokens,se));break}case"image":{ce+=se.image(Ne.href,Ne.title,Ne.text);break}case"strong":{ce+=se.strong(this.parseInline(Ne.tokens,se));break}case"em":{ce+=se.em(this.parseInline(Ne.tokens,se));break}case"codespan":{ce+=se.codespan(Ne.text);break}case"br":{ce+=se.br();break}case"del":{ce+=se.del(this.parseInline(Ne.tokens,se));break}case"text":{ce+=se.text(Ne.text);break}default:{var ze='Token with "'+Ne.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}}return ce},Ce}(),dt=G.merge,qe=G.checkSanitizeDeprecation,ot=G.escape,Ie=W.getDefaults,Qe=W.changeDefaults,st=W.defaults;function je(Ce,be,Ee){if(typeof Ce=="undefined"||Ce===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ce!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ce)+", string expected");if(typeof be=="function"&&(Ee=be,be=null),be=dt({},je.defaults,be||{}),qe(be),Ee){var ne=be.highlight,se;try{se=ge.lex(Ce,be)}catch(ke){return Ee(ke)}var ce=function(ze){var it;if(!ze)try{it=Ye.parse(se,be)}catch(ct){ze=ct}return be.highlight=ne,ze?Ee(ze):Ee(null,it)};if(!ne||ne.length<3)return ce();if(delete be.highlight,!se.length)return ce();var ve=0;je.walkTokens(se,function(ke){ke.type==="code"&&(ve++,setTimeout(function(){ne(ke.text,ke.lang,function(ze,it){if(ze)return ce(ze);it!=null&&it!==ke.text&&(ke.text=it,ke.escaped=!0),ve--,ve===0&&ce()})},0))}),ve===0&&ce();return}try{var Ne=ge.lex(Ce,be);return be.walkTokens&&je.walkTokens(Ne,be.walkTokens),Ye.parse(Ne,be)}catch(ke){if(ke.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,be.silent)return"<p>An error occurred:</p><pre>"+ot(ke.message+"",!0)+"</pre>";throw ke}}je.options=je.setOptions=function(Ce){return dt(je.defaults,Ce),Qe(je.defaults),je},je.getDefaults=Ie,je.defaults=st,je.use=function(Ce){var be=dt({},Ce);if(Ce.renderer&&function(){var ne=je.defaults.renderer||new Ue,se=function(Ne){var ke=ne[Ne];ne[Ne]=function(){for(var ze=arguments.length,it=new Array(ze),ct=0;ct<ze;ct++)it[ct]=arguments[ct];var ht=Ce.renderer[Ne].apply(ne,it);return ht===!1&&(ht=ke.apply(ne,it)),ht}};for(var ce in Ce.renderer)se(ce);be.renderer=ne}(),Ce.tokenizer&&function(){var ne=je.defaults.tokenizer||new Se,se=function(Ne){var ke=ne[Ne];ne[Ne]=function(){for(var ze=arguments.length,it=new Array(ze),ct=0;ct<ze;ct++)it[ct]=arguments[ct];var ht=Ce.tokenizer[Ne].apply(ne,it);return ht===!1&&(ht=ke.apply(ne,it)),ht}};for(var ce in Ce.tokenizer)se(ce);be.tokenizer=ne}(),Ce.walkTokens){var Ee=je.defaults.walkTokens;be.walkTokens=function(ne){Ce.walkTokens(ne),Ee&&Ee(ne)}}je.setOptions(be)},je.walkTokens=function(Ce,be){for(var Ee=F(Ce),ne;!(ne=Ee()).done;){var se=ne.value;be(se);switch(se.type){case"table":{for(var ce=F(se.tokens.header),ve;!(ve=ce()).done;){var Ne=ve.value;je.walkTokens(Ne,be)}for(var ke=F(se.tokens.cells),ze;!(ze=ke()).done;)for(var it=ze.value,ct=F(it),ht;!(ht=ct()).done;){var Lt=ht.value;je.walkTokens(Lt,be)}break}case"list":{je.walkTokens(se.items,be);break}default:se.tokens&&je.walkTokens(se.tokens,be)}}},je.Parser=Ye,je.parser=Ye.parse,je.Renderer=Ue,je.TextRenderer=Be,je.Lexer=ge,je.lexer=ge.lex,je.Tokenizer=Se,je.Slugger=et,je.parse=je;var Xe=je;return Xe})},ELLl:function(pt,Te,q){(function(ue){ue(q("VrN/"))})(function(ue){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(f,y,a){a&&a!=ue.Init&&(f.removeKeyMap(F),f.state.closeBrackets=null),y&&(P(X(y,"pairs")),f.state.closeBrackets=y,f.addKeyMap(F))});function X(f,y){return y=="pairs"&&typeof f=="string"?f:typeof f=="object"&&f[y]!=null?f[y]:J[y]}var F={Backspace:_,Enter:A};function P(f){for(var y=0;y<f.length;y++){var a=f.charAt(y),i="'"+a+"'";F[i]||(F[i]=W(a))}}P(J.pairs+"`");function W(f){return function(y){return p(y,f)}}function U(f){var y=f.state.closeBrackets;if(!y||y.override)return y;var a=f.getModeAt(f.getCursor());return a.closeBrackets||y}function _(f){var y=U(f);if(!y||f.getOption("disableInput"))return ue.Pass;for(var a=X(y,"pairs"),i=f.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var l=T(f,i[s].head);if(!l||a.indexOf(l)%2!=0)return ue.Pass}for(var s=i.length-1;s>=0;s--){var E=i[s].head;f.replaceRange("",O(E.line,E.ch-1),O(E.line,E.ch+1),"+delete")}}function A(f){var y=U(f),a=y&&X(y,"explode");if(!a||f.getOption("disableInput"))return ue.Pass;for(var i=f.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var l=T(f,i[s].head);if(!l||a.indexOf(l)%2!=0)return ue.Pass}f.operation(function(){var E=f.lineSeparator()||`
|
|
`;f.replaceSelection(E+E,null),f.execCommand("goCharLeft"),i=f.listSelections();for(var g=0;g<i.length;g++){var v=i[g].head.line;f.indentLine(v,null,!0),f.indentLine(v+1,null,!0)}})}function d(f){var y=ue.cmpPos(f.anchor,f.head)>0;return{anchor:new O(f.anchor.line,f.anchor.ch+(y?-1:1)),head:new O(f.head.line,f.head.ch+(y?1:-1))}}function p(f,y){var a=U(f);if(!a||f.getOption("disableInput"))return ue.Pass;var i=X(a,"pairs"),s=i.indexOf(y);if(s==-1)return ue.Pass;for(var l=X(a,"closeBefore"),E=X(a,"triples"),g=i.charAt(s+1)==y,v=f.listSelections(),k=s%2==0,w,x=0;x<v.length;x++){var b=v[x],h=b.head,u,L=f.getRange(h,O(h.line,h.ch+1));if(k&&!b.empty())u="surround";else if((g||!k)&&L==y)g&&m(f,h)?u="both":E.indexOf(y)>=0&&f.getRange(h,O(h.line,h.ch+3))==y+y+y?u="skipThree":u="skip";else if(g&&h.ch>1&&E.indexOf(y)>=0&&f.getRange(O(h.line,h.ch-2),h)==y+y){if(h.ch>2&&/\bstring/.test(f.getTokenTypeAt(O(h.line,h.ch-2))))return ue.Pass;u="addFour"}else if(g){var S=h.ch==0?" ":f.getRange(O(h.line,h.ch-1),h);if(!ue.isWordChar(L)&&S!=y&&!ue.isWordChar(S))u="both";else return ue.Pass}else if(k&&(L.length===0||/\s/.test(L)||l.indexOf(L)>-1))u="both";else return ue.Pass;if(!w)w=u;else if(w!=u)return ue.Pass}var D=s%2?i.charAt(s-1):y,I=s%2?y:i.charAt(s+1);f.operation(function(){if(w=="skip")f.execCommand("goCharRight");else if(w=="skipThree")for(var B=0;B<3;B++)f.execCommand("goCharRight");else if(w=="surround"){for(var j=f.getSelections(),B=0;B<j.length;B++)j[B]=D+j[B]+I;f.replaceSelections(j,"around"),j=f.listSelections().slice();for(var B=0;B<j.length;B++)j[B]=d(j[B]);f.setSelections(j)}else w=="both"?(f.replaceSelection(D+I,null),f.triggerElectric(D+I),f.execCommand("goCharLeft")):w=="addFour"&&(f.replaceSelection(D+D+D+D,"before"),f.execCommand("goCharRight"))})}function T(f,y){var a=f.getRange(O(y.line,y.ch-1),O(y.line,y.ch+1));return a.length==2?a:null}function m(f,y){var a=f.getTokenAt(O(y.line,y.ch+1));return/\bstring/.test(a.type)&&a.start==y.ch&&(y.ch==0||!/\bstring/.test(f.getTokenTypeAt(y)))}})},GfqC:function(pt,Te,q){"use strict";var ue=q("q1tI"),J=q.n(ue),O=q("TSYQ"),X=q.n(O);function F(G,M){var N="cannot "+G.method+" "+G.action+" "+M.status+"'",Y=new Error(N);return Y.status=M.status,Y.method=G.method,Y.url=G.action,Y}function P(G){var M=G.responseText||G.response;if(!M)return M;try{return JSON.parse(M)}catch(N){return M}}function W(G){var M=new XMLHttpRequest;G.onProgress&&M.upload&&(M.upload.onprogress=function(le){le.total>0&&(le.percent=le.loaded/le.total*100),G.onProgress(le)});var N=new FormData;G.data&&Object.keys(G.data).forEach(function(ee){var le=G.data[ee];if(Array.isArray(le)){le.forEach(function(fe){N.append(ee+"[]",fe)});return}N.append(ee,G.data[ee])}),G.file instanceof Blob?N.append(G.filename,G.file,G.file.name):N.append(G.filename,G.file),M.onerror=function(le){G.onError(le)},M.onload=function(){return M.status<200||M.status>=300?G.onError(F(G,M),P(M)):G.onSuccess(P(M),M)},M.open(G.method,G.action,!0),G.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var Y=G.headers||{};return Y["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(ee){Y[ee]!==null&&M.setRequestHeader(ee,Y[ee])}),M.send(N),{abort:function(){M.abort()}}}var U=+new Date,_=0;function A(){return"rc-upload-"+U+"-"+ ++_}function d(G,M){return G.indexOf(M,G.length-M.length)!==-1}var p=function(G,M){if(G&&M){var N=Array.isArray(M)?M:M.split(","),Y=G.name||"",ee=G.type||"",le=ee.replace(/\/.*$/,"");return N.some(function(fe){var Pe=fe.trim();return Pe.charAt(0)==="."?d(Y.toLowerCase(),Pe.toLowerCase()):/\/\*$/.test(Pe)?le===Pe.replace(/\/.*$/,""):ee===Pe})}return!0};function T(G,M){var N=G.createReader(),Y=[];function ee(){N.readEntries(function(le){var fe=Array.prototype.slice.apply(le);Y=Y.concat(fe);var Pe=!fe.length;Pe?M(Y):ee()})}ee()}var m=function(M,N,Y){var ee=function le(fe,Pe){Pe=Pe||"",fe.isFile?fe.file(function(Se){Y(Se)&&(fe.fullPath&&!Se.webkitRelativePath&&(Object.defineProperties(Se,{webkitRelativePath:{writable:!0}}),Se.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(Se,{webkitRelativePath:{writable:!1}})),N([Se]))}):fe.isDirectory&&T(fe,function(Se){Se.forEach(function(De){le(De,""+Pe+fe.name+"/")})})};M.forEach(function(le){ee(le.webkitGetAsEntry())})},f=m,y=Object.assign||function(G){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(G[Y]=N[Y])}return G},a=function(){function G(M,N){var Y=[],ee=!0,le=!1,fe=void 0;try{for(var Pe=M[Symbol.iterator](),Se;!(ee=(Se=Pe.next()).done)&&!(Y.push(Se.value),N&&Y.length===N);ee=!0);}catch(De){le=!0,fe=De}finally{try{!ee&&Pe.return&&Pe.return()}finally{if(le)throw fe}}return Y}return function(M,N){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return G(M,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function G(M,N){for(var Y=0;Y<N.length;Y++){var ee=N[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(M,ee.key,ee)}}return function(M,N,Y){return N&&G(M.prototype,N),Y&&G(M,Y),M}}();function s(G,M,N){return M in G?Object.defineProperty(G,M,{value:N,enumerable:!0,configurable:!0,writable:!0}):G[M]=N,G}function l(G,M){var N={};for(var Y in G){if(M.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(G,Y))continue;N[Y]=G[Y]}return N}function E(G,M){if(!(G instanceof M))throw new TypeError("Cannot call a class as a function")}function g(G,M){if(!G)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:G}function v(G,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);G.prototype=Object.create(M&&M.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(G,M):G.__proto__=M)}var k=function(M){return Object.keys(M).reduce(function(N,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(N[Y]=M[Y]),N},{})},w=function(G){v(M,G);function M(){var N,Y,ee,le;E(this,M);for(var fe=arguments.length,Pe=Array(fe),Se=0;Se<fe;Se++)Pe[Se]=arguments[Se];return le=(Y=(ee=g(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Pe))),ee),ee.state={uid:A()},ee.reqs={},ee.onChange=function(De){var Le=De.target.files;ee.uploadFiles(Le),ee.reset()},ee.onClick=function(De){var Le=ee.fileInput;if(!Le)return;var Ae=ee.props,me=Ae.children,de=Ae.onClick;me&&me.type==="button"&&(Le.parentNode.focus(),Le.parentNode.querySelector("button").blur()),Le.click(),de&&de(De)},ee.onKeyDown=function(De){De.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(De){var Le=ee.props.multiple;if(De.preventDefault(),De.type==="dragover")return;if(ee.props.directory)f(Array.prototype.slice.call(De.dataTransfer.items),ee.uploadFiles,function(me){return p(me,ee.props.accept)});else{var Ae=Array.prototype.slice.call(De.dataTransfer.files).filter(function(me){return p(me,ee.props.accept)});Le===!1&&(Ae=Ae.slice(0,1)),ee.uploadFiles(Ae)}},ee.uploadFiles=function(De){var Le=Array.prototype.slice.call(De);Le.map(function(Ae){return Ae.uid=A(),Ae}).forEach(function(Ae){ee.upload(Ae,Le)})},ee.saveFileInput=function(De){ee.fileInput=De},Y),g(ee,le)}return i(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,ee){var le=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return le.post(Y)},0);var Pe=fe.beforeUpload(Y,ee);Pe&&Pe.then?Pe.then(function(Se){var De=Object.prototype.toString.call(Se);return De==="[object File]"||De==="[object Blob]"?le.post(Se):le.post(Y)}).catch(function(Se){console.log(Se)}):Pe!==!1&&setTimeout(function(){return le.post(Y)},0);return}},{key:"post",value:function(Y){var ee=this;if(!this._isMounted)return;var le=this.props,fe=le.onStart,Pe=le.onProgress,Se=le.transformFile,De=Se===void 0?function(Le){return Le}:Se;new Promise(function(Le){var Ae=le.action;return typeof Ae=="function"&&(Ae=Ae(Y)),Le(Ae)}).then(function(Le){var Ae=Y.uid,me=le.customRequest||W,de=Promise.resolve(De(Y)).then(function(re){var he=le.data;return typeof he=="function"&&(he=he(re)),Promise.all([re,he])}).catch(function(re){console.error(re)});de.then(function(re){var he=a(re,2),ie=he[0],Re=he[1],oe={action:Le,filename:le.name,data:Re,file:ie,headers:le.headers,withCredentials:le.withCredentials,method:le.method||"post",onProgress:Pe?function(ae){Pe(ae,Y)}:null,onSuccess:function(ge,we){delete ee.reqs[Ae],le.onSuccess(ge,Y,we)},onError:function(ge,we){delete ee.reqs[Ae],le.onError(ge,we,Y)}};fe(Y),ee.reqs[Ae]=me(oe)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(Y){var ee=this.reqs;if(Y){var le=Y;Y&&Y.uid&&(le=Y.uid),ee[le]&&ee[le].abort&&ee[le].abort(),delete ee[le]}else Object.keys(ee).forEach(function(fe){ee[fe]&&ee[fe].abort&&ee[fe].abort(),delete ee[fe]})}},{key:"render",value:function(){var Y,ee=this.props,le=ee.component,fe=ee.prefixCls,Pe=ee.className,Se=ee.disabled,De=ee.id,Le=ee.style,Ae=ee.multiple,me=ee.accept,de=ee.children,re=ee.directory,he=ee.openFileDialogOnClick,ie=ee.onMouseEnter,Re=ee.onMouseLeave,oe=l(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ae=X()((Y={},s(Y,fe,!0),s(Y,fe+"-disabled",Se),s(Y,Pe,Pe),Y)),ge=Se?{}:{onClick:he?this.onClick:function(){},onKeyDown:he?this.onKeyDown:function(){},onMouseEnter:ie,onMouseLeave:Re,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(le,y({},ge,{className:ae,role:"button",style:Le}),J.a.createElement("input",y({},k(oe),{id:De,type:"file",ref:this.saveFileInput,onClick:function(_e){return _e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:re?"directory":null,webkitdirectory:re?"webkitdirectory":null,multiple:Ae,onChange:this.onChange})),de)}}]),M}(ue.Component),x=w,b=Object.assign||function(G){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(G[Y]=N[Y])}return G},h=function(){function G(M,N){for(var Y=0;Y<N.length;Y++){var ee=N[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(M,ee.key,ee)}}return function(M,N,Y){return N&&G(M.prototype,N),Y&&G(M,Y),M}}();function u(G,M){if(!(G instanceof M))throw new TypeError("Cannot call a class as a function")}function L(G,M){if(!G)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:G}function S(G,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);G.prototype=Object.create(M&&M.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(G,M):G.__proto__=M)}function D(){}var I=function(G){S(M,G);function M(){var N,Y,ee,le;u(this,M);for(var fe=arguments.length,Pe=Array(fe),Se=0;Se<fe;Se++)Pe[Se]=arguments[Se];return le=(Y=(ee=L(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Pe))),ee),ee.saveUploader=function(De){ee.uploader=De},Y),L(ee,le)}return h(M,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return J.a.createElement(x,b({},this.props,{ref:this.saveUploader}))}}]),M}(ue.Component);I.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:D,onError:D,onSuccess:D,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var B=I,j=Te.a=B},HmJG:function(pt,Te,q){},JYp7:function(pt,Te,q){"use strict";q.d(Te,"c",function(){return J}),q.d(Te,"d",function(){return O}),q.d(Te,"f",function(){return F}),q.d(Te,"a",function(){return P}),q.d(Te,"b",function(){return W}),q.d(Te,"e",function(){return U});var ue=function(){var _=function(A,d){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,T){p.__proto__=T}||function(p,T){for(var m in T)T.hasOwnProperty(m)&&(p[m]=T[m])},_(A,d)};return function(A,d){_(A,d);function p(){this.constructor=A}A.prototype=d===null?Object.create(d):(p.prototype=d.prototype,new p)}}(),J={done:!0,value:void 0},O;(function(_){var A={next:function(){return J}};function d(){return A}_.empty=d;function p(g){var v=!1;return{next:function(){return v?J:(v=!0,{done:!1,value:g})}}}_.single=p;function T(g,v,k){return v===void 0&&(v=0),k===void 0&&(k=g.length),{next:function(){return v>=k?J:{done:!1,value:g[v++]}}}}_.fromArray=T;function m(g){return{next:function(){var v=g.next();return v.done?J:{done:!1,value:v.value}}}}_.fromNativeIterator=m;function f(g){return g?Array.isArray(g)?_.fromArray(g):g:_.empty()}_.from=f;function y(g,v){return{next:function(){var k=g.next();return k.done?J:{done:!1,value:v(k.value)}}}}_.map=y;function a(g,v){return{next:function(){for(;;){var k=g.next();if(k.done)return J;if(v(k.value))return{done:!1,value:k.value}}}}}_.filter=a;function i(g,v){for(var k=g.next();!k.done;k=g.next())v(k.value)}_.forEach=i;function s(g,v){v===void 0&&(v=Number.POSITIVE_INFINITY);var k=[];if(v===0)return k;for(var w=0,x=g.next();!x.done&&!(k.push(x.value),++w>=v);x=g.next());return k}_.collect=s;function l(){for(var g=[],v=0;v<arguments.length;v++)g[v]=arguments[v];var k=0;return{next:function(){if(k>=g.length)return J;var w=g[k],x=w.next();return x.done?(k++,this.next()):x}}}_.concat=l;function E(g){return new X(g)}_.chain=E})(O||(O={}));var X=function(){function _(A){this.it=A}return _.prototype.next=function(){return this.it.next()},_}();function F(_){return Array.isArray(_)?O.fromArray(_):_||O.empty()}var P=function(){function _(A,d,p,T){d===void 0&&(d=0),p===void 0&&(p=A.length),T===void 0&&(T=d-1),this.items=A,this.start=d,this.end=p,this.index=T}return _.prototype.first=function(){return this.index=this.start,this.current()},_.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},_.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},_}(),W=function(_){ue(A,_);function A(d,p,T,m){return p===void 0&&(p=0),T===void 0&&(T=d.length),m===void 0&&(m=p-1),_.call(this,d,p,T,m)||this}return A.prototype.current=function(){return _.prototype.current.call(this)},A.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},A.prototype.first=function(){return this.index=this.start,this.current()},A.prototype.last=function(){return this.index=this.end-1,this.current()},A.prototype.parent=function(){return null},A}(P),U=function(){function _(A,d){this.iterator=A,this.fn=d}return _.prototype.next=function(){return this.fn(this.iterator.next())},_}()},LdHM:function(pt,Te,q){"use strict";q.d(Te,"b",function(){return l}),q.d(Te,"a",function(){return g});var ue=q("1OyB"),J=q("vuIU"),O=q("Ji7U"),X=q("LK+K"),F=q("q1tI"),P=q("rePB"),W=q("Ff2n"),U=q("ODXe"),_=q("4IlW"),A=q("bX4T"),d=q("YrtM"),p=q("TSYQ"),T=q.n(p),m=q("+nKL"),f=q("8OUc"),y=function(Y,ee){var le=Y.prefixCls,fe=Y.id,Pe=Y.flattenOptions,Se=Y.childrenAsData,De=Y.values,Le=Y.searchValue,Ae=Y.multiple,me=Y.defaultActiveFirstOption,de=Y.height,re=Y.itemHeight,he=Y.notFoundContent,ie=Y.open,Re=Y.menuItemSelectedIcon,oe=Y.virtual,ae=Y.onSelect,ge=Y.onToggleOpen,we=Y.onActiveValue,_e=Y.onScroll,Fe=Y.onMouseEnter,Ue="".concat(le,"-item"),Be=Object(d.a)(function(){return Pe},[ie,Pe],function(Xe,Ce){return Ce[0]&&Xe[1]!==Ce[1]}),et=F.useRef(null),Je=function(Ce){Ce.preventDefault()},Ze=function(Ce){et.current&&et.current.scrollTo({index:Ce})},Ye=function(Ce){for(var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ee=Be.length,ne=0;ne<Ee;ne+=1){var se=(Ce+ne*be+Ee)%Ee,ce=Be[se],ve=ce.group,Ne=ce.data;if(!ve&&!Ne.disabled)return se}return-1},dt=F.useState(function(){return Ye(0)}),qe=Object(U.a)(dt,2),ot=qe[0],Ie=qe[1],Qe=function(Ce){Ie(Ce);var be=Be[Ce];if(!be){we(null,-1);return}we(be.data.value,Ce)};F.useEffect(function(){Qe(me!==!1?Ye(0):-1)},[Be.length,Le]),F.useEffect(function(){var Xe=setTimeout(function(){if(!Ae&&ie&&De.size===1){var Ce=Array.from(De)[0],be=Be.findIndex(function(Ee){var ne=Ee.data;return ne.value===Ce});Qe(be),Ze(be)}});return function(){return clearTimeout(Xe)}},[ie]);var st=function(Ce){Ce!==void 0&&ae(Ce,{selected:!De.has(Ce)}),Ae||ge(!1)};if(F.useImperativeHandle(ee,function(){return{onKeyDown:function(Ce){var be=Ce.which;switch(be){case _.a.UP:case _.a.DOWN:{var Ee=0;if(be===_.a.UP?Ee=-1:be===_.a.DOWN&&(Ee=1),Ee!==0){var ne=Ye(ot+Ee,Ee);Ze(ne),Qe(ne)}break}case _.a.ENTER:{var se=Be[ot];se&&!se.data.disabled?st(se.data.value):st(void 0),ie&&Ce.preventDefault();break}case _.a.ESC:ge(!1)}},onKeyUp:function(){},scrollTo:function(Ce){Ze(Ce)}}}),Be.length===0)return F.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:Je},he);function je(Xe){var Ce=Be[Xe];if(!Ce)return null;var be=Ce.data||{},Ee=be.value,ne=be.label,se=be.children,ce=Object(A.a)(be,!0),ve=Se?se:ne;return Ce?F.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},ce,{key:Xe,role:"option",id:"".concat(fe,"_list_").concat(Xe),"aria-selected":De.has(Ee)}),Ee):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},je(ot-1),je(ot),je(ot+1)),F.createElement(m.a,{itemKey:"key",ref:et,data:Be,height:de,itemHeight:re,fullHeight:!1,onMouseDown:Je,onScroll:_e,virtual:oe,onMouseEnter:Fe},function(Xe,Ce){var be,Ee=Xe.group,ne=Xe.groupOption,se=Xe.data,ce=se.label,ve=se.key;if(Ee)return F.createElement("div",{className:T()(Ue,"".concat(Ue,"-group"))},ce!==void 0?ce:ve);var Ne=se.disabled,ke=se.value,ze=se.title,it=se.children,ct=se.style,ht=se.className,Lt=Object(W.a)(se,["disabled","value","title","children","style","className"]),wt=De.has(ke),ft="".concat(Ue,"-option"),zt=T()(Ue,ft,ht,(be={},Object(P.a)(be,"".concat(ft,"-grouped"),ne),Object(P.a)(be,"".concat(ft,"-active"),ot===Ce&&!Ne),Object(P.a)(be,"".concat(ft,"-disabled"),Ne),Object(P.a)(be,"".concat(ft,"-selected"),wt),be)),Ft=Se?it:ce,Jt=!Re||typeof Re=="function"||wt;return F.createElement("div",Object.assign({},Lt,{"aria-selected":wt,className:zt,title:ze,onMouseMove:function(){if(ot===Ce||Ne)return;Qe(Ce)},onClick:function(){Ne||st(ke)},style:ct}),F.createElement("div",{className:"".concat(ft,"-content")},Ft||ke),F.isValidElement(Re)||wt,Jt&&F.createElement(f.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Re,customizeIconProps:{isSelected:wt}},wt?"\u2713":null))}))},a=F.forwardRef(y);a.displayName="OptionList";var i=a,s=function(){return null};s.isSelectOption=!0;var l=s,E=function(){return null};E.isSelectOptGroup=!0;var g=E,v=q("VTBJ"),k=q("Zm9Q");function w(N){var Y=N.key,ee=N.props,le=ee.children,fe=ee.value,Pe=Object(W.a)(ee,["children","value"]);return Object(v.a)({key:Y,value:fe!==void 0?fe:Y,children:le},Pe)}function x(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(N).map(function(ee,le){if(!F.isValidElement(ee)||!ee.type)return null;var fe=ee.type.isSelectOptGroup,Pe=ee.key,Se=ee.props,De=Se.children,Le=Object(W.a)(Se,["children"]);return Y||!fe?w(ee):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Pe===null?le:Pe,"__"),label:Pe},Le),{},{options:x(De)})}).filter(function(ee){return ee})}var b=q("2Qr1"),h=q("qNPg"),u=q("U8pU"),L=q("Kwbf"),S=q("WKfj");function D(N){var Y=N.mode,ee=N.options,le=N.children,fe=N.backfill,Pe=N.allowClear,Se=N.placeholder,De=N.getInputElement,Le=N.showSearch,Ae=N.onSearch,me=N.defaultOpen,de=N.autoFocus,re=N.labelInValue,he=N.value,ie=N.inputValue,Re=N.optionLabelProp,oe=Y==="multiple"||Y==="tags",ae=Le!==void 0?Le:oe||Y==="combobox",ge=ee||x(le);if(Object(L.a)(Y!=="tags"||ge.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var we=ge.some(function(Ue){return Ue.options?Ue.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(L.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(L.a)(Y!=="combobox"||!Re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(L.a)(Y==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(L.a)(Y==="combobox"||!De,"`getInputElement` only work with `combobox` mode."),Object(L.b)(Y!=="combobox"||!De||!Pe||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ae&&!ae&&Y!=="combobox"&&Y!=="tags"&&Object(L.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(L.b)(!me||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var _e=Object(S.d)(he);Object(L.a)(!re||_e.every(function(Ue){return Object(u.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(L.a)(!oe||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(le){var Fe=null;Object(k.a)(le).some(function(Ue){if(!F.isValidElement(Ue)||!Ue.type)return!1;var Be=Ue.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var et=Object(k.a)(Ue.props.children).every(function(Je){return!F.isValidElement(Je)||!Ue.type||Je.type.isSelectOption?!0:(Fe=Je.type,!1)});return!et}return Fe=Be,!0}),Fe&&Object(L.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(L.a)(ie===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=D,B=Object(h.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:x,flattenOptions:b.d,getLabeledValue:b.e,filterOptions:b.b,isValueDisabled:b.g,findValueOption:b.c,warningProps:I,fillOptionsWithMissingValue:b.a}),j=function(N){Object(O.a)(ee,N);var Y=Object(X.a)(ee);function ee(){var le;return Object(ue.a)(this,ee),le=Y.apply(this,arguments),le.selectRef=F.createRef(),le.focus=function(){le.selectRef.current.focus()},le.blur=function(){le.selectRef.current.blur()},le}return Object(J.a)(ee,[{key:"render",value:function(){return F.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),ee}(F.Component);j.Option=l,j.OptGroup=g;var G=j,M=Te.c=G},M8RZ:function(pt,Te,q){"use strict";q.d(Te,"a",function(){return _});var ue=q("fWQN"),J=q("mtLc"),O=q("yKVA"),X=q("879j"),F=q("q1tI"),P=q.n(F),W=q("i8i4"),U=q.n(W),_=function(A){Object(O.a)(p,A);var d=Object(X.a)(p);function p(T){var m;Object(ue.a)(this,p),m=d.call(this,T);var f=window.document;return m.node=f.createElement("div"),f.body.appendChild(m.node),m}return Object(J.a)(p,[{key:"render",value:function(){var m=this.props.children;return Object(W.createPortal)(m,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(P.a.Component)},MI8n:function(pt,Te,q){"use strict";q.d(Te,"b",function(){return P}),q.d(Te,"a",function(){return _}),q.d(Te,"e",function(){return A}),q.d(Te,"d",function(){return d}),q.d(Te,"c",function(){return p}),q.d(Te,"f",function(){return T});var ue=q("/cxE"),J=q("C/vA"),O=q("pmY6"),X=q("24hK"),F=function(){var m=function(f,y){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var s in i)i.hasOwnProperty(s)&&(a[s]=i[s])},m(f,y)};return function(f,y){m(f,y);function a(){this.constructor=f}f.prototype=y===null?Object.create(y):(a.prototype=y.prototype,new a)}}(),P;(function(m){m.None=function(){return O.a.None};function f(I){return function(B,j,G){j===void 0&&(j=null);var M=!1,N;return N=I(function(Y){return M?void 0:(N?N.dispose():M=!0,B.call(j,Y))},null,G),M&&N.dispose(),N}}m.once=f;function y(I,B){return g(function(j,G,M){return G===void 0&&(G=null),I(function(N){return j.call(G,B(N))},null,M)})}m.map=y;function a(I,B){return g(function(j,G,M){return G===void 0&&(G=null),I(function(N){B(N),j.call(G,N)},null,M)})}m.forEach=a;function i(I,B){return g(function(j,G,M){return G===void 0&&(G=null),I(function(N){return B(N)&&j.call(G,N)},null,M)})}m.filter=i;function s(I){return I}m.signal=s;function l(){for(var I=[],B=0;B<arguments.length;B++)I[B]=arguments[B];return function(j,G,M){return G===void 0&&(G=null),O.e.apply(void 0,I.map(function(N){return N(function(Y){return j.call(G,Y)},null,M)}))}}m.any=l;function E(I,B,j){var G=j;return y(I,function(M){return G=B(G,M),G})}m.reduce=E;function g(I){var B,j=new _({onFirstListenerAdd:function(){B=I(j.fire,j)},onLastListenerRemove:function(){B.dispose()}});return j.event}m.snapshot=g;function v(I,B,j,G,M){j===void 0&&(j=100),G===void 0&&(G=!1);var N,Y=void 0,ee=void 0,le=0,fe=new _({leakWarningThreshold:M,onFirstListenerAdd:function(){N=I(function(Pe){le++,Y=B(Y,Pe),G&&!ee&&(fe.fire(Y),Y=void 0),clearTimeout(ee),ee=setTimeout(function(){var Se=Y;Y=void 0,ee=void 0,(!G||le>1)&&fe.fire(Se),le=0},j)})},onLastListenerRemove:function(){N.dispose()}});return fe.event}m.debounce=v;function k(I){var B=new Date().getTime();return y(f(I),function(j){return new Date().getTime()-B})}m.stopwatch=k;function w(I){var B=!0,j;return i(I,function(G){var M=B||G!==j;return B=!1,j=G,M})}m.latch=w;function x(I,B,j){B===void 0&&(B=!1),j===void 0&&(j=[]);var G=j.slice(),M=I(function(ee){G?G.push(ee):Y.fire(ee)}),N=function(){G&&G.forEach(function(ee){return Y.fire(ee)}),G=null},Y=new _({onFirstListenerAdd:function(){M||(M=I(function(ee){return Y.fire(ee)}))},onFirstListenerDidAdd:function(){G&&(B?setTimeout(N):N())},onLastListenerRemove:function(){M&&M.dispose(),M=null}});return Y.event}m.buffer=x;var b=function(){function I(B){this.event=B}return I.prototype.map=function(B){return new I(y(this.event,B))},I.prototype.forEach=function(B){return new I(a(this.event,B))},I.prototype.filter=function(B){return new I(i(this.event,B))},I.prototype.reduce=function(B,j){return new I(E(this.event,B,j))},I.prototype.latch=function(){return new I(w(this.event))},I.prototype.debounce=function(B,j,G,M){return j===void 0&&(j=100),G===void 0&&(G=!1),new I(v(this.event,B,j,G,M))},I.prototype.on=function(B,j,G){return this.event(B,j,G)},I.prototype.once=function(B,j,G){return f(this.event)(B,j,G)},I}();function h(I){return new b(I)}m.chain=h;function u(I,B,j){j===void 0&&(j=function(ee){return ee});var G=function(){for(var ee=[],le=0;le<arguments.length;le++)ee[le]=arguments[le];return Y.fire(j.apply(void 0,ee))},M=function(){return I.on(B,G)},N=function(){return I.removeListener(B,G)},Y=new _({onFirstListenerAdd:M,onLastListenerRemove:N});return Y.event}m.fromNodeEventEmitter=u;function L(I,B,j){j===void 0&&(j=function(ee){return ee});var G=function(){for(var ee=[],le=0;le<arguments.length;le++)ee[le]=arguments[le];return Y.fire(j.apply(void 0,ee))},M=function(){return I.addEventListener(B,G)},N=function(){return I.removeEventListener(B,G)},Y=new _({onFirstListenerAdd:M,onLastListenerRemove:N});return Y.event}m.fromDOMEventEmitter=L;function S(I){var B=new _,j=!1;return I.then(void 0,function(){return null}).then(function(){j?B.fire(void 0):setTimeout(function(){return B.fire(void 0)},0)}),j=!0,B.event}m.fromPromise=S;function D(I){return new Promise(function(B){return f(I)(B)})}m.toPromise=D})(P||(P={}));var W=-1,U=function(){function m(f,y){y===void 0&&(y=Math.random().toString(18).slice(2,5)),this.customThreshold=f,this.name=y,this._warnCountdown=0}return m.prototype.dispose=function(){this._stacks&&this._stacks.clear()},m.prototype.check=function(f){var y=this,a=W;if(typeof this.customThreshold=="number"&&(a=this.customThreshold),a<=0||f<a)return;this._stacks||(this._stacks=new Map);var i=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),s=this._stacks.get(i)||0;if(this._stacks.set(i,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;var l,E=0;this._stacks.forEach(function(g,v){(!l||E<g)&&(l=v,E=g)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+f+" listeners already. MOST frequent listener ("+E+"):"),console.warn(l)}return function(){var g=y._stacks.get(i)||0;y._stacks.set(i,g-1)}},m}(),_=function(){function m(f){this._disposed=!1,this._options=f,this._leakageMon=W>0?new U(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(m.prototype,"event",{get:function(){var f=this;return this._event||(this._event=function(y,a,i){f._listeners||(f._listeners=new X.a);var s=f._listeners.isEmpty();s&&f._options&&f._options.onFirstListenerAdd&&f._options.onFirstListenerAdd(f);var l=f._listeners.push(a?[y,a]:y);s&&f._options&&f._options.onFirstListenerDidAdd&&f._options.onFirstListenerDidAdd(f),f._options&&f._options.onListenerDidAdd&&f._options.onListenerDidAdd(f,y,a);var E;f._leakageMon&&(E=f._leakageMon.check(f._listeners.size));var g;return g={dispose:function(){if(E&&E(),g.dispose=m._noop,!f._disposed&&(l(),f._options&&f._options.onLastListenerRemove)){var v=f._listeners&&!f._listeners.isEmpty();v||f._options.onLastListenerRemove(f)}}},i instanceof O.b?i.add(g):Array.isArray(i)&&i.push(g),g}),this._event},enumerable:!0,configurable:!0}),m.prototype.fire=function(f){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new X.a);for(var y=this._listeners.iterator(),a=y.next();!a.done;a=y.next())this._deliveryQueue.push([a.value,f]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),s=i[0],l=i[1];try{typeof s=="function"?s.call(void 0,l):s[0].call(s[1],l)}catch(E){Object(ue.e)(E)}}}},m.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},m._noop=function(){},m}(),A=function(m){F(f,m);function f(y){var a=m.call(this,y)||this;return a._isPaused=0,a._eventQueue=new X.a,a._mergeFn=y&&y.merge,a}return f.prototype.pause=function(){this._isPaused++},f.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var y=this._eventQueue.toArray();this._eventQueue.clear(),m.prototype.fire.call(this,this._mergeFn(y))}else for(;!this._isPaused&&this._eventQueue.size!==0;)m.prototype.fire.call(this,this._eventQueue.shift())},f.prototype.fire=function(y){this._listeners&&(this._isPaused!==0?this._eventQueue.push(y):m.prototype.fire.call(this,y))},f}(_),d=function(){function m(){var f=this;this.hasListeners=!1,this.events=[],this.emitter=new _({onFirstListenerAdd:function(){return f.onFirstListenerAdd()},onLastListenerRemove:function(){return f.onLastListenerRemove()}})}return Object.defineProperty(m.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),m.prototype.add=function(f){var y=this,a={event:f,listener:null};this.events.push(a),this.hasListeners&&this.hook(a);var i=function(){y.hasListeners&&y.unhook(a);var s=y.events.indexOf(a);y.events.splice(s,1)};return Object(O.h)(Object(J.a)(i))},m.prototype.onFirstListenerAdd=function(){var f=this;this.hasListeners=!0,this.events.forEach(function(y){return f.hook(y)})},m.prototype.onLastListenerRemove=function(){var f=this;this.hasListeners=!1,this.events.forEach(function(y){return f.unhook(y)})},m.prototype.hook=function(f){var y=this;f.listener=f.event(function(a){return y.emitter.fire(a)})},m.prototype.unhook=function(f){f.listener&&f.listener.dispose(),f.listener=null},m.prototype.dispose=function(){this.emitter.dispose()},m}(),p=function(){function m(){this.buffers=[]}return m.prototype.wrapEvent=function(f){var y=this;return function(a,i,s){return f(function(l){var E=y.buffers[y.buffers.length-1];E?E.push(function(){return a.call(i,l)}):a.call(i,l)},void 0,s)}},m.prototype.bufferEvents=function(f){var y=[];this.buffers.push(y);var a=f();return this.buffers.pop(),y.forEach(function(i){return i()}),a},m}(),T=function(){function m(){var f=this;this.listening=!1,this.inputEvent=P.None,this.inputEventListener=O.a.None,this.emitter=new _({onFirstListenerDidAdd:function(){f.listening=!0,f.inputEventListener=f.inputEvent(f.emitter.fire,f.emitter)},onLastListenerRemove:function(){f.listening=!1,f.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(m.prototype,"input",{set:function(f){this.inputEvent=f,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=f(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),m.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},m}()},N0LK:function(pt,Te,q){"use strict";q.d(Te,"x",function(){return ue}),q.d(Te,"F",function(){return J}),q.d(Te,"r",function(){return X}),q.d(Te,"o",function(){return F}),q.d(Te,"p",function(){return P}),q.d(Te,"Q",function(){return W}),q.d(Te,"K",function(){return _}),q.d(Te,"k",function(){return A}),q.d(Te,"N",function(){return d}),q.d(Te,"m",function(){return p}),q.d(Te,"l",function(){return T}),q.d(Te,"I",function(){return m}),q.d(Te,"H",function(){return f}),q.d(Te,"q",function(){return y}),q.d(Te,"t",function(){return a}),q.d(Te,"D",function(){return i}),q.d(Te,"e",function(){return s}),q.d(Te,"f",function(){return l}),q.d(Te,"B",function(){return E}),q.d(Te,"C",function(){return g}),q.d(Te,"n",function(){return k}),q.d(Te,"O",function(){return x}),q.d(Te,"c",function(){return b}),q.d(Te,"d",function(){return h}),q.d(Te,"z",function(){return u}),q.d(Te,"A",function(){return L}),q.d(Te,"u",function(){return S}),q.d(Te,"E",function(){return I}),q.d(Te,"G",function(){return B}),q.d(Te,"i",function(){return G}),q.d(Te,"g",function(){return N}),q.d(Te,"v",function(){return ee}),q.d(Te,"h",function(){return le}),q.d(Te,"y",function(){return fe}),q.d(Te,"w",function(){return Pe}),q.d(Te,"a",function(){return Se}),q.d(Te,"P",function(){return De}),q.d(Te,"L",function(){return Le}),q.d(Te,"J",function(){return Ae}),q.d(Te,"j",function(){return me}),q.d(Te,"M",function(){return de}),q.d(Te,"s",function(){return re}),q.d(Te,"b",function(){return he});function ue(oe){return!oe||typeof oe!="string"?!0:oe.trim().length===0}function J(oe,ae,ge){ge===void 0&&(ge="0");for(var we=""+oe,_e=[we],Fe=we.length;Fe<ae;Fe++)_e.push(ge);return _e.reverse().join("")}var O=/{(\d+)}/g;function X(oe){for(var ae=[],ge=1;ge<arguments.length;ge++)ae[ge-1]=arguments[ge];return ae.length===0?oe:oe.replace(O,function(we,_e){var Fe=parseInt(_e,10);return isNaN(Fe)||Fe<0||Fe>=ae.length?we:ae[Fe]})}function F(oe){return oe.replace(/[<>&]/g,function(ae){switch(ae){case"<":return"<";case">":return">";case"&":return"&";default:return ae}})}function P(oe){return oe.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function W(oe,ae){ae===void 0&&(ae=" ");var ge=U(oe,ae);return _(ge,ae)}function U(oe,ae){if(!oe||!ae)return oe;var ge=ae.length;if(ge===0||oe.length===0)return oe;for(var we=0;oe.indexOf(ae,we)===we;)we=we+ge;return oe.substring(we)}function _(oe,ae){if(!oe||!ae)return oe;var ge=ae.length,we=oe.length;if(ge===0||we===0)return oe;for(var _e=we,Fe=-1;!(Fe=oe.lastIndexOf(ae,_e-1),Fe===-1||Fe+ge!==_e);){if(Fe===0)return"";_e=Fe}return oe.substring(0,_e)}function A(oe){return oe.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(oe,ae){if(oe.length<ae.length)return!1;if(oe===ae)return!0;for(var ge=0;ge<ae.length;ge++)if(oe[ge]!==ae[ge])return!1;return!0}function p(oe,ae){var ge=oe.length-ae.length;return ge>0?oe.indexOf(ae,ge)===ge:ge===0?oe===ae:!1}function T(oe,ae,ge){if(ge===void 0&&(ge={}),!oe)throw new Error("Cannot create regex from empty string");ae||(oe=P(oe)),ge.wholeWord&&(/\B/.test(oe.charAt(0))||(oe="\\b"+oe),/\B/.test(oe.charAt(oe.length-1))||(oe=oe+"\\b"));var we="";return ge.global&&(we+="g"),ge.matchCase||(we+="i"),ge.multiline&&(we+="m"),ge.unicode&&(we+="u"),new RegExp(oe,we)}function m(oe){if(oe.source==="^"||oe.source==="^$"||oe.source==="$"||oe.source==="^\\s*$")return!1;var ae=oe.exec("");return!!(ae&&oe.lastIndex===0)}function f(oe){return(oe.global?"g":"")+(oe.ignoreCase?"i":"")+(oe.multiline?"m":"")+(oe.unicode?"u":"")}function y(oe){for(var ae=0,ge=oe.length;ae<ge;ae++){var we=oe.charCodeAt(ae);if(we!==32&&we!==9)return ae}return-1}function a(oe,ae,ge){ae===void 0&&(ae=0),ge===void 0&&(ge=oe.length);for(var we=ae;we<ge;we++){var _e=oe.charCodeAt(we);if(_e!==32&&_e!==9)return oe.substring(ae,we)}return oe.substring(ae,ge)}function i(oe,ae){ae===void 0&&(ae=oe.length-1);for(var ge=ae;ge>=0;ge--){var we=oe.charCodeAt(ge);if(we!==32&&we!==9)return ge}return-1}function s(oe,ae){return oe<ae?-1:oe>ae?1:0}function l(oe,ae){for(var ge=Math.min(oe.length,ae.length),we=0;we<ge;we++){var _e=oe.charCodeAt(we),Fe=ae.charCodeAt(we);if(_e===Fe)continue;g(_e)&&(_e+=32),g(Fe)&&(Fe+=32);var Ue=_e-Fe;if(Ue===0)continue;return E(_e)&&E(Fe)?Ue:s(oe.toLowerCase(),ae.toLowerCase())}return oe.length<ae.length?-1:oe.length>ae.length?1:0}function E(oe){return oe>=97&&oe<=122}function g(oe){return oe>=65&&oe<=90}function v(oe){return E(oe)||g(oe)}function k(oe,ae){return oe.length===ae.length&&w(oe,ae)}function w(oe,ae,ge){ge===void 0&&(ge=oe.length);for(var we=0;we<ge;we++){var _e=oe.charCodeAt(we),Fe=ae.charCodeAt(we);if(_e===Fe)continue;if(v(_e)&&v(Fe)){var Ue=Math.abs(_e-Fe);if(Ue!==0&&Ue!==32)return!1}else if(String.fromCharCode(_e).toLowerCase()!==String.fromCharCode(Fe).toLowerCase())return!1}return!0}function x(oe,ae){var ge=ae.length;return ae.length>oe.length?!1:w(oe,ae,ge)}function b(oe,ae){var ge,we=Math.min(oe.length,ae.length);for(ge=0;ge<we;ge++)if(oe.charCodeAt(ge)!==ae.charCodeAt(ge))return ge;return we}function h(oe,ae){var ge,we=Math.min(oe.length,ae.length),_e=oe.length-1,Fe=ae.length-1;for(ge=0;ge<we;ge++)if(oe.charCodeAt(_e-ge)!==ae.charCodeAt(Fe-ge))return ge;return we}function u(oe){return 55296<=oe&&oe<=56319}function L(oe){return 56320<=oe&&oe<=57343}function S(oe,ae,ge){var we=oe.charCodeAt(ge);if(u(we)&&ge+1<ae){var _e=oe.charCodeAt(ge+1);if(L(_e))return(we-55296<<10)+(_e-56320)+65536}return we}function D(oe,ae){var ge=oe.charCodeAt(ae-1);if(L(ge)&&ae>1){var we=oe.charCodeAt(ae-2);if(u(we))return(we-55296<<10)+(ge-56320)+65536}return ge}function I(oe,ae){var ge=ie.getInstance(),we=ae,_e=oe.length,Fe=S(oe,_e,ae);ae+=Fe>=65536?2:1;for(var Ue=ge.getGraphemeBreakType(Fe);ae<_e;){var Be=S(oe,_e,ae),et=ge.getGraphemeBreakType(Be);if(he(Ue,et))break;ae+=Be>=65536?2:1,Ue=et}return ae-we}function B(oe,ae){var ge=ie.getInstance(),we=ae,_e=D(oe,ae);ae-=_e>=65536?2:1;for(var Fe=ge.getGraphemeBreakType(_e);ae>0;){var Ue=D(oe,ae),Be=ge.getGraphemeBreakType(Ue);if(he(Be,Fe))break;ae-=Ue>=65536?2:1,Fe=Be}return we-ae}var j=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function G(oe){return j.test(oe)}var M=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function N(oe){return M.test(oe)}var Y=/^[\t\n\r\x20-\x7E]*$/;function ee(oe){return Y.test(oe)}function le(oe){for(var ae=0,ge=oe.length;ae<ge;ae++)if(fe(oe.charCodeAt(ae)))return!0;return!1}function fe(oe){return oe=+oe,oe>=11904&&oe<=55215||oe>=63744&&oe<=64255||oe>=65281&&oe<=65374}function Pe(oe){return oe>=127462&&oe<=127487||oe>=9728&&oe<=10175||oe>=127744&&oe<=128591||oe>=128640&&oe<=128764||oe>=128992&&oe<=129003||oe>=129280&&oe<=129535||oe>=129648&&oe<=129651||oe>=129656&&oe<=129666||oe>=129680&&oe<=129685}var Se=String.fromCharCode(65279);function De(oe){return!!(oe&&oe.length>0&&oe.charCodeAt(0)===65279)}function Le(oe){return btoa(encodeURIComponent(oe))}function Ae(oe,ae){for(var ge="",we=0;we<ae;we++)ge+=oe;return ge}function me(oe,ae){return ae===void 0&&(ae=!1),oe?(ae&&(oe=oe.replace(/\\./g,"")),oe.toLowerCase()!==oe):!1}function de(oe){var ae=90-65+1;return oe=oe%(2*ae),oe<ae?String.fromCharCode(97+oe):String.fromCharCode(65+oe-ae)}function re(oe){var ae=ie.getInstance();return ae.getGraphemeBreakType(oe)}function he(oe,ae){return oe===0?ae!==5&&ae!==7:oe===2&&ae===3?!1:oe===4||oe===2||oe===3||(ae===4||ae===2||ae===3)?!0:oe===8&&(ae===8||ae===9||ae===11||ae===12)||((oe===11||oe===9)&&(ae===9||ae===10)||((oe===12||oe===10)&&ae===10||(ae===5||ae===13||(ae===7||(oe===1||oe===13&&ae===14)))))?!1:!(oe===6&&ae===6)}var ie=function(){function oe(){this._data=Re()}return oe.getInstance=function(){return oe._INSTANCE||(oe._INSTANCE=new oe),oe._INSTANCE},oe.prototype.getGraphemeBreakType=function(ae){if(ae<32)return ae===10?3:ae===13?2:4;if(ae<127)return 0;for(var ge=this._data,we=ge.length/3,_e=1;_e<=we;)if(ae<ge[3*_e])_e=2*_e;else if(ae>ge[3*_e+1])_e=2*_e+1;else return ge[3*_e+2];return 0},oe._INSTANCE=null,oe}();function Re(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},Ot1p:function(pt,Te,q){"use strict";var ue=q("2qtc"),J=q("kLXV"),O=q("rAM+"),X=q("miYZ"),F=q("tsqr"),P=q("9og8"),W=q("tJVT"),U=q("jrin"),_=q("WmNS"),A=q.n(_),d=q("q1tI"),p=q.n(d),T=q("VrN/"),m=q.n(T),f=q("bdgK"),y=q("p77/"),a=q("Bd2K"),i=q("ELLl"),s=q("19Vz"),l=q("lZu9"),E=q("+NIl"),g=q("kSUc"),v=q("9Bee"),k=function(ke){var ze=ke.value,it=ze===void 0?"":ze,ct=ke.className,ht=ke.showTextOnly,Lt=ke.showLines,wt=ke.style,ft=wt===void 0?{}:wt,zt=Object(d.useMemo)(function(){return""},[it]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:zt}}))},w=q("0Owb"),x=q("dejd"),b=q("C+DQ"),h=q("1vsH"),u=q("m3rI"),L=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function S(ke){var ze=ke.onActionCallback,it=ke.title,ct=ke.icon,ht=ke.actionName,Lt=ke.className,wt=Lt===void 0?"":Lt,ft=ke.children;function zt(){ze(ht)}return p.a.createElement("a",{title:it,className:wt,onClick:zt},p.a.createElement("i",{className:"md-iconfont ".concat(ct)}),ft)}var D=function(ke){var ze=ke.watch,it=ke.showNullButton,ct=ke.onActionCallback,ht=ke.fullScreen,Lt=ke.insertTemp,wt=ke.hidetoolBar,ft=ke.uuid,zt=ke.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.D)("_educoder_session"),"&key=").concat(ft,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Ft=[].concat(L,[{title:"".concat(ze?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ze?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!wt&&Ft.map(function(Jt,Ht){return p.a.createElement("li",{key:Ht},Jt.actionName?p.a.createElement(S,Object(w.a)({},Jt,{onActionCallback:ct})):p.a.createElement("span",{className:"v-line"}))}),it?p.a.createElement("li",null,p.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ct},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Lt&&p.a.createElement("li",null,p.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Lt),onActionCallback:ct},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(S,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ct})))},I=q("M8RZ"),B=q("+L6B"),j=q("2/Rp"),G=q("y8nQ"),M=q("Vl3Y"),N=q("5NDa"),Y=q("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},le=function(ke){var ze=ke.callback,it=ke.onCancel;function ct(ht){ze(ht)}return p.a.createElement(M.a,Object(w.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ct}),p.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(Y.a,null)),p.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(Y.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},fe=q("7ahc"),Pe=q("k1fw"),Se=q("HmJG"),De=q("BjJ7"),Le=M.a.useForm,Ae={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},de=function(ke){var ze=ke.callback,it=ke.onCancel,ct=Le(),ht=Object(W.a)(ct,1),Lt=ht[0],wt=Object(d.useRef)();function ft(Jt){ze(Object(Pe.a)(Object(Pe.a)({},Jt),{},{name:wt.current}))}function zt(Jt,Ht){Lt.setFieldsValue({src:"/api/attachments/".concat(Jt.id,"?type=").concat(Jt.content_type),type:Ht.type})}function Ft(Jt){var Ht=Jt.target.files[0];wt.current=Ht.name,he(Ht,zt)}return p.a.createElement(M.a,Object(w.a)({form:Lt},me,{className:"upload-image-panel",onFinish:ft}),p.a.createElement(M.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},p.a.createElement(Y.a,{style:Ae})),p.a.createElement(re,{onFileChange:Ft}))),p.a.createElement(M.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},p.a.createElement(Y.a,{style:{width:264}})),p.a.createElement(M.a.Item,{style:{textAlign:"right"}},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function re(ke){var ze=ke.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:ze}))}function he(ke,ze){if(!ke)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",ke),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var ct=new window.XMLHttpRequest;ct.withCredentials=!0,ct.addEventListener("load",function(ht){ze(JSON.parse(ht.target.responseText),ke)},!1),ct.addEventListener("error",function(ht){console.error(ht)},!1),ct.open("POST","".concat(De.a,"/api/attachments.json")),ct.send(it)}var ie=q("giR+"),Re=q("fyUT"),oe=q("7Kak"),ae=q("9yH6"),ge=ae.a.Group,we={margin:"0 8px"},_e=function(ke){var ze=ke.callback,it=ke.onCancel;function ct(ht){ze(ht)}return p.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ct},p.a.createElement("div",{className:"flex-container"},p.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:we},"\u884C\u6570"),p.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(Re.a,null)),p.a.createElement("span",{style:we},"\u5217\u6570"),p.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(Re.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12}},p.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(M.a.Item,{name:"align"},p.a.createElement(ge,null,p.a.createElement(ae.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(ae.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(ae.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(ae.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},Fe=q("ErOA"),Ue=q("7Cbv"),Be="link",et="upload-image",Je="code-block",Ze="add-table",Ye="------------",dt={default:Ye,left:":".concat(Ye),center:":".concat(Ye,":"),right:"".concat(Ye,":")},qe=q("9VGf"),ot,Ie;function Qe(){}var st=0,je=1e4,Xe="\u2581",Ce=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function be(ke){return/^\d+$/.test(ke)?"".concat(ke,"px"):ke}var Ee=navigator.platform.toUpperCase().indexOf("MAC")>=0,ne=Ee?"Cmd":"Ctrl",se=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ce=(ot={},Object(U.a)(ot,ne+"-B","bold"),Object(U.a)(ot,ne+"-I","italic"),ot),ve=(Ie={},Object(U.a)(Ie,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Ie,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Ie,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Ie,Ze,"\u6DFB\u52A0\u8868\u683C"),Ie),Ne=Te.a=function(ke){var ze=ke.defaultValue,it=ze===void 0?"":ze,ct=ke.onChange,ht=ke.width,Lt=ht===void 0?"100%":ht,wt=ke.height,ft=wt===void 0?400:wt,zt=ke.miniToolbar,Ft=zt===void 0?!1:zt,Jt=ke.isFocus,Ht=Jt===void 0?!1:Jt,kt=ke.watch,Ur=ke.insertTemp,Zr=ke.mode,bt=Zr===void 0?"markdown":Zr,Ct=ke.id,at=Ct===void 0?"markdown-editor-id":Ct,xt=ke.showResizeBar,Zt=xt===void 0?!1:xt,nr=ke.noStorage,rr=nr===void 0?!1:nr,Rt=ke.showNullButton,vt=Rt===void 0?!1:Rt,kr=ke.hidetoolBar,tn=kr===void 0?!1:kr,Tr=ke.fullScreen,Ot=Tr===void 0?!1:Tr,Lr=ke.onBlur,zr=ke.onCMBeforeChange,rn=ke.onFullScreen,He=ke.className,lt=He===void 0?"":He,Pt=ke.disablePaste,Kt=Pt===void 0?!1:Pt,Yt=ke.placeholder,qt=Yt===void 0?"":Yt,K=ke.values,c=K===void 0?"":K,C=Object(d.useState)(null),z=Object(W.a)(C,2),$=z[0],V=z[1],xe=Object(d.useState)(it),Ge=Object(W.a)(xe,2),tt=Ge[0],mt=Ge[1],Ke=Object(d.useState)(kt),At=Object(W.a)(Ke,2),It=At[0],er=At[1],Kr=Object(d.useState)(Ot),Vr=Object(W.a)(Kr,2),pr=Vr[0],Qr=Vr[1],Gn=Object(d.useState)(""),Or=Object(W.a)(Gn,2),Xr=Or[0],jr=Or[1],bn=Object(d.useState)(0),nn=Object(W.a)(bn,2),mn=nn[0],dn=nn[1],hi=Object(d.useState)(ft),zn=Object(W.a)(hi,2),an=zn[0],Yr=zn[1],kn=Object(d.useState)(!1),On=Object(W.a)(kn,2),ci=On[0],or=On[1],jt=Object(d.useRef)(Object(Ue.a)()),Er=Object(d.useRef)(!1),Ut=Object(d.useRef)(),dr=Object(d.useRef)(),Vt=Object(d.useRef)(),hn=Object(d.useRef)(),lr=Object(d.useRef)(),_r=function(){var yt=Object(P.a)(A.a.mark(function Dt(){var St,Mt;return A.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,Object(Fe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:jt.current}});case 2:Mt=$t.sent,Mt!=null&&(St=Mt.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",$,dr),Mt.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?$.replaceSelection(".concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?$.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Bt.content_type.indexOf("pdf")>-1?$.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,'&disposition=inline" target="_blank">').concat(Bt.name,"</a>")):$.replaceSelection("[".concat(Bt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return $t.stop()}},Dt)}));return function(){return yt.apply(this,arguments)}}();Object(d.useEffect)(function(){mt(c),$==null||$.setValue(c)},[c]),Object(d.useEffect)(function(){rn==null||rn(pr)},[pr]),Object(d.useEffect)(function(){if(dr.current){var yt=m.a.fromTextArea(dr.current,{mode:bt,lineNumbers:!Ft,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Ht&&yt.focus();function Dt(St,Mt){if(Kt){Mt.preventDefault();return}var Wt=Mt.clipboardData;if(Wt){var $t=Wt.types.toString(),Bt=Wt.items;if($t==="Files"||Wt.types.indexOf("Files")>-1){if(Mt.preventDefault(),bt=="stex")return;try{var hr,Pr=Bt[1];((hr=Bt[0])===null||hr===void 0?void 0:hr.kind)==="file"&&(Pr=Bt[0]);var Nt=Pr.getAsFile(),En=Nt.name.split(".").pop();he(Nt,function(Gt){if(Gt.id){var gr,qr,en;(Nt==null||((gr=Nt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((qr=Nt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((en=Nt.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):se.includes(En)?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return yt.on("paste",Dt),yt.on("dragleave",function(St,Mt){Vt.current.classList.remove("mouse-hover-md")}),yt.on("dragover",function(St,Mt){Vt.current.classList.add("mouse-hover-md")}),yt.on("drop",function(St,Mt){Vt.current.classList.add("mouse-hover-md");var Wt;if(Wt=Mt.dataTransfer.files,Wt.length>0){Mt.preventDefault(),Mt.stopPropagation();for(var $t=function(Pr){var Nt=Wt[Pr],En=Nt.name.split(".").pop();he(Nt,function(Gt){if(Gt.id){var gr,qr,en;(Nt==null||((gr=Nt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?yt.replaceSelection(".concat(Gt.content_type,")")):(Nt==null||((qr=Nt.type)===null||qr===void 0)?void 0:qr.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Nt==null||((en=Nt.type)===null||en===void 0)?void 0:en.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):se.includes(En)?yt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):yt.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt<Wt.length;Bt++)$t(Bt)}}),V(yt),function(){yt.off("paste",Dt)}}},[]);var Kn=Object(d.useCallback)(function(){if(Vt.current)try{}catch(yt){console.log(yt,"---- to set md editor body height")}},[an,Vt,pr]);Object(d.useEffect)(function(){function yt(){var St=new f.default(function(Mt){var Wt=Object(O.a)(Mt),$t;try{for(Wt.s();!($t=Wt.n()).done;){var Bt=$t.value;(Bt.target.offsetHeight>0||Bt.target.offsetWidth>0)&&(Kn(),$.setSize("100%","100%"),$.refresh())}}catch(hr){Wt.e(hr)}finally{Wt.f()}});return St.observe(dr.current.parentElement),St}if($){var Dt=yt();return function(){Dt.unobserve(dr.current.parentElement)}}},[$,Kn]),Object(d.useEffect)(function(){if($){for(var yt=[],Dt=function(){var Bt=Mt[St];Wt=Object(W.a)(Bt,2);var hr=Wt[0],Pr=Wt[1],Nt=Object(U.a)({},hr,function(){Vn(Pr)});yt.push(Nt),$.addKeyMap(Nt)},St=0,Mt=Object.entries(ce);St<Mt.length;St++){var Wt;Dt()}return Ut.current=setInterval(function(){Er.current&&_r()},4e3),function(){clearInterval(Ut.current);var $t=Object(O.a)(yt),Bt;try{for($t.s();!(Bt=$t.n()).done;){var hr=Bt.value;$.removeKeyMap(hr)}}catch(Pr){$t.e(Pr)}finally{$t.f()}}}},[$]),Object(d.useEffect)(function(){Ot!==pr&&Qr(Ot)},[Ot]),Object(qe.a)(function(){if(!rr&&mn>0){var yt=new Date().getTime(),Dt=window.sessionStorage.getItem(at);yt>=mn+je&&(!Dt||Dt!==tt)&&(window.sessionStorage.setItem(at,tt),or(!0))}},je),Object(d.useEffect)(function(){er(kt)},[$,kt]),Object(d.useEffect)(function(){$&&(Ht&&$.focus())},[$,Ht]),Object(d.useEffect)(function(){if(It&&$){var yt=$.getScrollerElement();function Dt(St){var Mt=St.target;if(lr.current){var Wt=Mt.scrollTop/Mt.scrollHeight;lr.current.scrollTop=lr.current.scrollHeight*Wt}}return yt.addEventListener("scroll",Dt),function(){yt.removeEventListener("scroll",Dt)}}},[$,It]),Object(d.useEffect)(function(){if($&&zr){function yt(Dt,St){zr(Dt,St)}return $.on("beforeChange",yt),function(){$.off("beforeChange",yt)}}},[$,zr]),Object(d.useEffect)(function(){if($&&Lr){function yt(){Lr($.getValue())}return $.on("blur",yt),function(){$.off("blur",yt)}}},[$,Lr]),Object(d.useEffect)(function(){if($){function yt(Dt){var St=Dt.getValue();mt(St),dn(new Date().getTime()),Dt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ct&&ct(St)}return $.on("change",yt),function(){$.off("change",yt)}}},[$,ct]),Object(d.useEffect)(function(){$&&(it==null?($.setValue(""),mt("")):it!==$.getValue()&&($.setValue(it),mt(it),$.setCursor($.lineCount(),0)))},[$,it]);var Vn=Object(d.useCallback)(function(yt){var Dt=$.getCursor(),St=$.getSelection(),Mt=St.split(`
|
|
`);switch(yt){case"bold":return $.replaceSelection("**"+St+"**"),St===""&&$.setCursor(Dt.line,Dt.ch+2),$.focus();case"italic":return $.replaceSelection("*"+St+"*"),St===""&&$.setCursor(Dt.line,Dt.ch+1),$.focus();case"code":return $.replaceSelection("`"+St+"`"),St===""&&$.setCursor(Dt.line,Dt.ch+1),$.focus();case"inline-latex":return $.replaceSelection("`$$"+St+"$$`"),St===""&&$.setCursor(Dt.line,Dt.ch+3),$.focus();case"latex":return $.replaceSelection("```latex\n"+St+"\n```"),$.setCursor(Dt.line+1,St.length+1),$.focus();case"line-break":return $.replaceSelection(`<br/>
|
|
`),$.focus();case"list-ul":return St===""?$.replaceSelection("- "+St):$.replaceSelection(Mt.map(function(Wt){return Wt===""?"":"- ".concat(Wt)}).join(`
|
|
`)),$.focus();case"list-ol":return St===""?$.replaceSelection("1. "+St):$.replaceSelection(Mt.map(function(Wt,$t){return Wt===""?"":"".concat($t+1,". ").concat(Wt)}).join(`
|
|
`)),$.focus();case"add-null-ch":return St===""&&$.setCursor(Dt.line,Dt.ch+1),$.replaceSelection(Xe),$.focus();case"inster-template-1":return St===""&&$.setCursor(Dt.line,Dt.ch),$.replaceSelection(Ce),$.focus();case"eraser":return $.setValue(""),$.focus();case"trigger-watch":return er(!It),$.focus();case"trigger-full-screen":return Qr(!pr),$.focus();case Be:jr(Be);return;case Je:jr(Je);return;case et:jr(et);return;case Ze:jr(Ze);return;default:throw new Error}},[$,It,pr]),xn=Object(d.useCallback)(function(yt){jr("");switch(Xr){case Be:var Dt=yt.title,St=yt.link;return $.replaceSelection("[".concat(Dt,"](").concat(St,")")),$.focus();case Je:var Mt=yt.language,Wt=yt.content;return $.replaceSelection(["```"+Mt,Wt,"```"].join(`
|
|
`)),$.focus();case et:var $t=yt.src,Bt=yt.alt,hr=yt.name;return $t.indexOf("type=image")>-1?$.replaceSelection(".concat($t,' "').concat(Bt||"",'" )')):$t.indexOf("type=application/pdf")>-1?$.replaceSelection('<a href="'.concat($t,'&disposition=inline" target="_blank">').concat(hr,"</a>")):$.replaceSelection('<a href="'.concat($t,'" target="_blank">').concat(hr,"</a>")),$.focus();case Ze:for(var Pr=yt.row,Nt=yt.col,En=yt.align,Gt=`
|
|
`,gr=0;gr<Pr;gr++){for(var qr=[],en=[],Wi=0;Wi<Nt;Wi++)gr===1&&en.push(dt[En]),qr.push(" ");gr===1&&(Gt+="| ".concat(en.join(" | "),` |
|
|
`)),Gt+="| ".concat(qr.join(Nt===1?"":" | "),` |
|
|
`)}return $.replaceSelection(Gt+`
|
|
`),$.focus();default:throw new Error}},[$,Xr]),Ui=Object(d.useMemo)(function(){switch(Xr){case Be:return p.a.createElement(le,{callback:xn,onCancel:Wr});case Je:return p.a.createElement(fe.b,{callback:xn,onCancel:Wr});case et:return p.a.createElement(de,{callback:xn,onCancel:Wr});case Ze:return p.a.createElement(_e,{callback:xn,onCancel:Wr});default:return null}},[Xr]);function Wr(){jr("")}Object(d.useEffect)(function(){if(hn.current){var yt=hn.current,Dt=!1,St=0;function Mt(Bt){Dt=!0,St=Bt.pageY}function Wt(){Dt=!1}function $t(Bt){if(Dt){var hr=Bt.pageY-St;hr<0&&(hr=0),hr>300&&(hr=300);var Pr=ft+hr+"px";Yr(Pr)}}return yt.addEventListener("mousedown",Mt),document.addEventListener("mousemove",$t),document.addEventListener("mouseup",Wt),function(){yt.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",$t),document.removeEventListener("mouseup",Wt)}}},[$,hn]),Object(d.useEffect)(function(){Yr(ft)},[ft]);var fi=be(Lt),on=be(an),Xn={width:fi,height:on},ji=Object(d.useMemo)(function(){if(mn){var yt=new Date(mn),Dt=yt.getHours(),St=yt.getMinutes(),Mt=yt.getSeconds();return Dt=Dt<10?"0"+Dt:Dt,St=St<10?"0"+St:St,Mt=Mt<10?"0"+Mt:Mt,"".concat(Dt,":").concat(St,":").concat(Mt)}return 0},[mn]);function _n(){window.sessionStorage.removeItem(at),or(!1),dn(0)}function $a(){or(!1),dn(0),$.setValue(window.sessionStorage.getItem(at))}function da(yt,Dt){var St=$.getValue();St=St.replace(yt,Dt),mt(St),$==null||$.setValue(St)}return p.a.createElement(d.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Vt},p.a.createElement("div",{className:"markdown-editor-container ".concat(lt," ").concat(It?"on-preview":""," ").concat(Ft?"mini":""," ").concat(pr?"full-screen":""),style:Xn},p.a.createElement(D,{insertTemp:Ur,watch:It,fullScreen:pr,showNullButton:vt,onActionCallback:Vn,hidetoolBar:tn,uuid:jt.current,setOpenPhones:function(){Er.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:dr,placeholder:qt})),It?p.a.createElement("div",{ref:lr,className:"preview-container"},bt==="stex"&&p.a.createElement(k,{value:tt}),bt!=="stex"&&p.a.createElement(v.a,{edit:!0,value:tt,replaces:da})):null))),Zt?p.a.createElement("a",{ref:hn,className:"editor-resize"}):null,p.a.createElement(I.a,null,ve[Xr]?p.a.createElement(J.a,{centered:!0,title:ve[Xr],visible:!0,onCancel:Wr,footer:null},Ui):null))}},QDVR:function(pt,Te,q){"use strict";q.d(Te,"e",function(){return J}),q.d(Te,"d",function(){return O}),q.d(Te,"c",function(){return W}),q.d(Te,"b",function(){return U}),q.d(Te,"a",function(){return A});var ue=function(){var d=function(p,T){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,f){m.__proto__=f}||function(m,f){for(var y in f)f.hasOwnProperty(y)&&(m[y]=f[y])},d(p,T)};return function(p,T){d(p,T);function m(){this.constructor=p}p.prototype=T===null?Object.create(T):(m.prototype=T.prototype,new m)}}();function J(d){var p=[];return d.forEach(function(T){return p.push(T)}),p}function O(d){var p=[];return d.forEach(function(T,m){return p.push(m)}),p}var X=function(){function d(){this._value="",this._pos=0}return d.prototype.reset=function(p){return this._value=p,this._pos=0,this},d.prototype.next=function(){return this._pos+=1,this},d.prototype.hasNext=function(){return this._pos<this._value.length-1},d.prototype.cmp=function(p){var T=p.charCodeAt(0),m=this._value.charCodeAt(this._pos);return T-m},d.prototype.value=function(){return this._value[this._pos]},d}(),F=function(){function d(p){p===void 0&&(p=!0),this._splitOnBackslash=p}return d.prototype.reset=function(p){return this._value=p.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},d.prototype.hasNext=function(){return this._to<this._value.length},d.prototype.next=function(){this._from=this._to;for(var p=!0;this._to<this._value.length;this._to++){var T=this._value.charCodeAt(this._to);if(T===47||this._splitOnBackslash&&T===92)if(p)this._from++;else break;else p=!1}return this},d.prototype.cmp=function(p){for(var T=0,m=p.length,f=this._from;T<m&&f<this._to;){var y=p.charCodeAt(T)-this._value.charCodeAt(f);if(y!==0)return y;T+=1,f+=1}return m===this._to-this._from?0:T<m?-1:1},d.prototype.value=function(){return this._value.substring(this._from,this._to)},d}(),P=function(){function d(){}return d}(),W=function(){function d(p){this._iter=p}return d.forPaths=function(){return new d(new F)},d.forStrings=function(){return new d(new X)},d.prototype.clear=function(){this._root=void 0},d.prototype.set=function(p,T){var m=this._iter.reset(p),f;for(this._root||(this._root=new P,this._root.segment=m.value()),f=this._root;;){var y=m.cmp(f.segment);if(y>0)f.left||(f.left=new P,f.left.segment=m.value()),f=f.left;else if(y<0)f.right||(f.right=new P,f.right.segment=m.value()),f=f.right;else if(m.hasNext())m.next(),f.mid||(f.mid=new P,f.mid.segment=m.value()),f=f.mid;else break}var a=f.value;return f.value=T,f.key=p,a},d.prototype.get=function(p){for(var T=this._iter.reset(p),m=this._root;m;){var f=T.cmp(m.segment);if(f>0)m=m.left;else if(f<0)m=m.right;else if(T.hasNext())T.next(),m=m.mid;else break}return m?m.value:void 0},d.prototype.findSubstr=function(p){for(var T=this._iter.reset(p),m=this._root,f=void 0;m;){var y=T.cmp(m.segment);if(y>0)m=m.left;else if(y<0)m=m.right;else if(T.hasNext())T.next(),f=m.value||f,m=m.mid;else break}return m&&m.value||f},d.prototype.forEach=function(p){this._forEach(this._root,p)},d.prototype._forEach=function(p,T){p&&(this._forEach(p.left,T),p.value&&T(p.value,p.key),this._forEach(p.mid,T),this._forEach(p.right,T))},d}(),U=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(p,T){this.map.set(this.toKey(p),T)},d.prototype.get=function(p){return this.map.get(this.toKey(p))},d.prototype.toKey=function(p){var T=p.toString();return this.ignoreCase&&(T=T.toLowerCase()),T},d}(),_=function(){function d(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return d.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(d.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),d.prototype.get=function(p,T){T===void 0&&(T=0);var m=this._map.get(p);return m?(T!==0&&this.touch(m,T),m.value):void 0},d.prototype.set=function(p,T,m){m===void 0&&(m=0);var f=this._map.get(p);if(f)f.value=T,m!==0&&this.touch(f,m);else{f={key:p,value:T,next:void 0,previous:void 0};switch(m){case 0:this.addItemLast(f);break;case 1:this.addItemFirst(f);break;case 2:this.addItemLast(f);break;default:this.addItemLast(f);break}this._map.set(p,f),this._size++}},d.prototype.delete=function(p){return!!this.remove(p)},d.prototype.remove=function(p){var T=this._map.get(p);return T?(this._map.delete(p),this.removeItem(T),this._size--,T.value):void 0},d.prototype.forEach=function(p,T){for(var m=this._head;m;)T?p.bind(T)(m.value,m.key,this):p(m.value,m.key,this),m=m.next},d.prototype.trimOld=function(p){if(p>=this.size)return;if(p===0){this.clear();return}for(var T=this._head,m=this.size;T&&m>p;)this._map.delete(T.key),T=T.next,m--;this._head=T,this._size=m,T&&(T.previous=void 0)},d.prototype.addItemFirst=function(p){if(!this._head&&!this._tail)this._tail=p;else if(this._head)p.next=this._head,this._head.previous=p;else throw new Error("Invalid list");this._head=p},d.prototype.addItemLast=function(p){if(!this._head&&!this._tail)this._head=p;else if(this._tail)p.previous=this._tail,this._tail.next=p;else throw new Error("Invalid list");this._tail=p},d.prototype.removeItem=function(p){if(p===this._head&&p===this._tail)this._head=void 0,this._tail=void 0;else if(p===this._head){if(!p.next)throw new Error("Invalid list");p.next.previous=void 0,this._head=p.next}else if(p===this._tail){if(!p.previous)throw new Error("Invalid list");p.previous.next=void 0,this._tail=p.previous}else{var T=p.next,m=p.previous;if(!T||!m)throw new Error("Invalid list");T.previous=m,m.next=T}p.next=void 0,p.previous=void 0},d.prototype.touch=function(p,T){if(!this._head||!this._tail)throw new Error("Invalid list");if(T!==1&&T!==2)return;if(T===1){if(p===this._head)return;var m=p.next,f=p.previous;p===this._tail?(f.next=void 0,this._tail=f):(m.previous=f,f.next=m),p.previous=void 0,p.next=this._head,this._head.previous=p,this._head=p}else if(T===2){if(p===this._tail)return;var m=p.next,f=p.previous;p===this._head?(m.previous=void 0,this._head=m):(m.previous=f,f.next=m),p.next=void 0,p.previous=this._tail,this._tail.next=p,this._tail=p}},d.prototype.toJSON=function(){var p=[];return this.forEach(function(T,m){p.push([m,T])}),p},d}(),A=function(d){ue(p,d);function p(T,m){m===void 0&&(m=1);var f=d.call(this)||this;return f._limit=T,f._ratio=Math.min(Math.max(0,m),1),f}return p.prototype.get=function(T){return d.prototype.get.call(this,T,2)},p.prototype.peek=function(T){return d.prototype.get.call(this,T,0)},p.prototype.set=function(T,m){d.prototype.set.call(this,T,m,2),this.checkTrim()},p.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},p}(_)},SJMd:function(pt,Te){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var q,ue,J,O=!1,X,F;window.PR_SHOULD_USE_CONTINUATION=!0;var P,W;(function(){var U=window,_=["break,continue,do,else,for,if,return,while"],A=[_,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],d=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[d,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],T=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],m=[d,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],f="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[d,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",i=[_,"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=[_,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[p,m,T,y,a,i,s,l],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",k="kwd",w="com",x="typ",b="lit",h="pun",u="pln",L="tag",S="dec",D="src",I="atn",B="atv",j="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(ae){for(var ge=0,we=!1,_e=!1,Fe=0,Ue=ae.length;Fe<Ue;++Fe){var Be=ae[Fe];if(Be.ignoreCase)_e=!0;else if(/[a-z]/i.test(Be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,_e=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function Je(ot){var Ie=ot.charCodeAt(0);if(Ie!==92)return Ie;var Qe=ot.charAt(1);return Ie=et[Qe],Ie||("0"<=Qe&&Qe<="7"?parseInt(ot.substring(1),8):Qe==="u"||Qe==="x"?parseInt(ot.substring(2),16):ot.charCodeAt(1))}function Ze(ot){if(ot<32)return(ot<16?"\\x0":"\\x")+ot.toString(16);var Ie=String.fromCharCode(ot);return Ie==="\\"||Ie==="-"||Ie==="]"||Ie==="^"?"\\"+Ie:Ie}function Ye(ot){var Ie=ot.substring(1,ot.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")),Qe=[],st=Ie[0]==="^",je=["["];st&&je.push("^");for(var Xe=st?1:0,Ce=Ie.length;Xe<Ce;++Xe){var be=Ie[Xe];if(/\\[bdsw]/i.test(be))je.push(be);else{var Ee=Je(be),ne;Xe+2<Ce&&Ie[Xe+1]==="-"?(ne=Je(Ie[Xe+2]),Xe+=2):ne=Ee,Qe.push([Ee,ne]),ne<65||Ee>122||(ne<65||Ee>90||Qe.push([Math.max(65,Ee)|32,Math.min(ne,90)|32]),ne<97||Ee>122||Qe.push([Math.max(97,Ee)&~32,Math.min(ne,122)&~32]))}}Qe.sort(function(Ne,ke){return Ne[0]-ke[0]||ke[1]-Ne[1]});for(var se=[],ce=[],Xe=0;Xe<Qe.length;++Xe){var ve=Qe[Xe];ve[0]<=ce[1]+1?ce[1]=Math.max(ce[1],ve[1]):se.push(ce=ve)}for(var Xe=0;Xe<se.length;++Xe){var ve=se[Xe];je.push(Ze(ve[0])),ve[1]>ve[0]&&(ve[1]+1>ve[0]&&je.push("-"),je.push(Ze(ve[1])))}return je.push("]"),je.join("")}function dt(ot){for(var Ie=ot.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")),Qe=Ie.length,st=[],je=0,Xe=0;je<Qe;++je){var Ce=Ie[je];if(Ce==="(")++Xe;else if(Ce.charAt(0)==="\\"){var be=+Ce.substring(1);be&&(be<=Xe?st[be]=-1:Ie[je]=Ze(be))}}for(var je=1;je<st.length;++je)st[je]===-1&&(st[je]=++ge);for(var je=0,Xe=0;je<Qe;++je){var Ce=Ie[je];if(Ce==="(")++Xe,st[Xe]||(Ie[je]="(?:");else if(Ce.charAt(0)==="\\"){var be=+Ce.substring(1);be&&be<=Xe&&(Ie[je]="\\"+st[be])}}for(var je=0;je<Qe;++je)Ie[je]==="^"&&Ie[je+1]!=="^"&&(Ie[je]="");if(ot.ignoreCase&&we)for(var je=0;je<Qe;++je){var Ce=Ie[je],Ee=Ce.charAt(0);Ce.length>=2&&Ee==="["?Ie[je]=Ye(Ce):Ee!=="\\"&&(Ie[je]=Ce.replace(/[a-zA-Z]/g,function(ce){var ve=ce.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return Ie.join("")}for(var qe=[],Fe=0,Ue=ae.length;Fe<Ue;++Fe){var Be=ae[Fe];if(Be.global||Be.multiline)throw new Error(""+Be);qe.push("(?:"+dt(Be)+")")}return new RegExp(qe.join("|"),_e?"gi":"g")}function N(ae,ge){var we=/(?:^|\s)nocode(?:\s|$)/,_e=[],Fe=0,Ue=[],Be=0;function et(Je){var Ze=Je.nodeType;if(Ze==1){if(we.test(Je.className))return;for(var Ye=Je.firstChild;Ye;Ye=Ye.nextSibling)et(Ye);var dt=Je.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(_e[Be]=`
|
|
`,Ue[Be<<1]=Fe++,Ue[Be++<<1|1]=Je)}else if(Ze==3||Ze==4){var qe=Je.nodeValue;qe.length&&(ge?qe=qe.replace(/\r\n?/g,`
|
|
`):qe=qe.replace(/[ \t\r\n]+/g," "),_e[Be]=qe,Ue[Be<<1]=Fe,Fe+=qe.length,Ue[Be++<<1|1]=Je)}}return et(ae),{sourceCode:_e.join("").replace(/\n$/,""),spans:Ue}}function Y(ae,ge,we,_e,Fe){if(!we)return;var Ue={sourceNode:ae,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:ge,decorations:null};_e(Ue),Fe.push.apply(Fe,Ue.decorations)}var ee=/\S/;function le(ae){for(var ge=void 0,we=ae.firstChild;we;we=we.nextSibling){var _e=we.nodeType;ge=_e===1?ge?ae:we:_e===3&&ee.test(we.nodeValue)?ae:ge}return ge===ae?void 0:ge}function fe(ae,ge){var we={},_e;(function(){for(var Be=ae.concat(ge),et=[],Je={},Ze=0,Ye=Be.length;Ze<Ye;++Ze){var dt=Be[Ze],qe=dt[3];if(qe)for(var ot=qe.length;--ot>=0;)we[qe.charAt(ot)]=dt;var Ie=dt[1],Qe=""+Ie;Je.hasOwnProperty(Qe)||(et.push(Ie),Je[Qe]=null)}et.push(/[\0-\uffff]/),_e=M(et)})();var Fe=ge.length,Ue=function(Be){for(var et=Be.sourceCode,Je=Be.basePos,Ze=Be.sourceNode,Ye=[Je,u],dt=0,qe=et.match(_e)||[],ot={},Ie=0,Qe=qe.length;Ie<Qe;++Ie){var st=qe[Ie],je=ot[st],Xe=void 0,Ce;if(typeof je=="string")Ce=!1;else{var be=we[st.charAt(0)];if(be)Xe=st.match(be[1]),je=be[0];else{for(var Ee=0;Ee<Fe;++Ee)if(be=ge[Ee],Xe=st.match(be[1]),Xe){je=be[0];break}Xe||(je=u)}Ce=je.length>=5&&je.substring(0,5)==="lang-",Ce&&!(Xe&&typeof Xe[1]=="string")&&(Ce=!1,je=D),Ce||(ot[st]=je)}var ne=dt;if(dt+=st.length,!Ce)Ye.push(Je+ne,je);else{var se=Xe[1],ce=st.indexOf(se),ve=ce+se.length;Xe[2]&&(ve=st.length-Xe[2].length,ce=ve-se.length);var Ne=je.substring(5);Y(Ze,Je+ne,st.substring(0,ce),Ue,Ye),Y(Ze,Je+ne+ce,se,de(Ne,se),Ye),Y(Ze,Je+ne+ve,st.substring(ve),Ue,Ye)}}Be.decorations=Ye};return Ue}function Pe(ae){var ge=[],we=[];ae.tripleQuotedStrings?ge.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ae.multiLineStrings?ge.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ge.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ae.verbatimStrings&&we.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var _e=ae.hashComments;_e&&(ae.cStyleComments?(_e>1?ge.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ge.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ge.push([w,/^#[^\r\n]*/,null,"#"])),ae.cStyleComments&&(we.push([w,/^\/\/[^\r\n]*/,null]),we.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=ae.regexLiterals;if(Fe){var Ue=Fe>1?"":`
|
|
\r`,Be=Ue?".":"[\\S\\s]",et="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+G+"("+et+")")])}var Je=ae.types;Je&&we.push([x,Je]);var Ze=(""+ae.keywords).replace(/^ | $/g,"");Ze.length&&we.push([k,new RegExp("^(?:"+Ze.replace(/[\s,]+/g,"|")+")\\b"),null]),ge.push([u,/^\s+/,null,` \r
|
|
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return ae.regexLiterals&&(Ye+="(?!s*/)"),we.push([b,/^@[a-z_$][a-z_$@0-9]*/i,null],[x,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[b,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[h,new RegExp(Ye),null]),fe(ge,we)}var Se=Pe({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function De(ae,ge,we){for(var _e=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ue=ae.ownerDocument,Be=Ue.createElement("li");ae.firstChild;)Be.appendChild(ae.firstChild);var et=[Be];function Je(Ie){var Qe=Ie.nodeType;if(Qe==1&&!_e.test(Ie.className))if(Ie.nodeName==="br")Ze(Ie),Ie.parentNode&&Ie.parentNode.removeChild(Ie);else for(var st=Ie.firstChild;st;st=st.nextSibling)Je(st);else if((Qe==3||Qe==4)&&we){var je=Ie.nodeValue,Xe=je.match(Fe);if(Xe){var Ce=je.substring(0,Xe.index);Ie.nodeValue=Ce;var be=je.substring(Xe.index+Xe[0].length);if(be){var Ee=Ie.parentNode;Ee.insertBefore(Ue.createTextNode(be),Ie.nextSibling)}Ze(Ie),Ce||Ie.parentNode.removeChild(Ie)}}}function Ze(Ie){for(;!Ie.nextSibling;)if(Ie=Ie.parentNode,!Ie)return;function Qe(Xe,Ce){var be=Ce?Xe.cloneNode(!1):Xe,Ee=Xe.parentNode;if(Ee){var ne=Qe(Ee,1),se=Xe.nextSibling;ne.appendChild(be);for(var ce=se;ce;ce=se)se=ce.nextSibling,ne.appendChild(ce)}return be}for(var st=Qe(Ie.nextSibling,0),je;(je=st.parentNode)&&je.nodeType===1;)st=je;et.push(st)}for(var Ye=0;Ye<et.length;++Ye)Je(et[Ye]);ge===(ge|0)&&et[0].setAttribute("value",ge);var dt=Ue.createElement("ol");dt.className="linenums";for(var qe=Math.max(0,ge-1|0)||0,Ye=0,ot=et.length;Ye<ot;++Ye)Be=et[Ye],Be.className="L"+(Ye+qe)%10,Be.firstChild||Be.appendChild(Ue.createTextNode("\xA0")),dt.appendChild(Be);ae.appendChild(dt)}function Le(ae){var ge=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ge=ge&&+ge[1]<=8;var we=/\n/g,_e=ae.sourceCode,Fe=_e.length,Ue=0,Be=ae.spans,et=Be.length,Je=0,Ze=ae.decorations,Ye=Ze.length,dt=0;Ze[Ye]=Fe;var qe,ot;for(ot=qe=0;ot<Ye;)Ze[ot]!==Ze[ot+2]?(Ze[qe++]=Ze[ot++],Ze[qe++]=Ze[ot++]):ot+=2;for(Ye=qe,ot=qe=0;ot<Ye;){for(var Ie=Ze[ot],Qe=Ze[ot+1],st=ot+2;st+2<=Ye&&Ze[st+1]===Qe;)st+=2;Ze[qe++]=Ie,Ze[qe++]=Qe,ot=st}Ye=Ze.length=qe;var je=ae.sourceNode,Xe="";je&&(Xe=je.style.display,je.style.display="none");try{for(var Ce=null;Je<et;){var be=Be[Je],Ee=Be[Je+2]||Fe,ne=Ze[dt+2]||Fe,st=Math.min(Ee,ne),se=Be[Je+1],ce;if(se.nodeType!==1&&(ce=_e.substring(Ue,st))){ge&&(ce=ce.replace(we,"\r")),se.nodeValue=ce;var ve=se.ownerDocument,Ne=ve.createElement("span");Ne.className=Ze[dt+1];var ke=se.parentNode;ke.replaceChild(Ne,se),Ne.appendChild(se),Ue<Ee&&(Be[Je+1]=se=ve.createTextNode(_e.substring(st,Ee)),ke.insertBefore(se,Ne.nextSibling))}Ue=st,Ue>=Ee&&(Je+=2),Ue>=ne&&(dt+=2)}}finally{je&&(je.style.display=Xe)}}var Ae={};function me(ae,ge){for(var we=ge.length;--we>=0;){var _e=ge[we];Ae.hasOwnProperty(_e)?U.console&&console.warn("cannot override language handler %s",_e):Ae[_e]=ae}}function de(ae,ge){return ae&&Ae.hasOwnProperty(ae)||(ae=/^\s*</.test(ge)?"default-markup":"default-code"),Ae[ae]}me(Se,["default-code"]),me(fe([],[[u,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[w,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(fe([[u,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[L,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),me(fe([],[[B,/^[\s\S]+/]]),["uq.val"]),me(Pe({keywords:p,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),me(Pe({keywords:"null,true,false"}),["json"]),me(Pe({keywords:m,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),me(Pe({keywords:T,cStyleComments:!0}),["java"]),me(Pe({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Pe({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Pe({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Pe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Pe({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Pe({keywords:f,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(fe([],[[v,/^[\s\S]+/]]),["regex"]);function re(ae){var ge=ae.langExtension;try{var we=N(ae.sourceNode,ae.pre),_e=we.sourceCode;ae.sourceCode=_e,ae.spans=we.spans,ae.basePos=0,de(ge,_e)(ae),Le(ae)}catch(Fe){U.console&&console.log(Fe&&Fe.stack||Fe)}}function he(ae,ge,we){var _e=we||!1,Fe=ge||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+ae+"</pre>",Ue=Ue.firstChild,_e&&De(Ue,_e,!0);var Be={langExtension:Fe,numberLines:_e,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return re(Be),Ue.innerHTML}function ie(ae,ge){var we=ge||document.body,_e=we.ownerDocument||document;function Fe(be){return we.getElementsByTagName(be)}for(var Ue=[Fe("pre"),Fe("code"),Fe("xmp")],Be=[],et=0;et<Ue.length;++et)for(var Je=0,Ze=Ue[et].length;Je<Ze;++Je)Be.push(Ue[et][Je]);Ue=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var dt=0,qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,ot=/\bprettyprint\b/,Ie=/\bprettyprinted\b/,Qe=/pre|xmp/i,st=/^code$/i,je=/^(?:pre|code|xmp)$/i,Xe={};function Ce(){for(var be=U.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:Infinity;dt<Be.length&&Ye.now()<be;dt++){for(var Ee=Be[dt],ne=Xe,se=Ee;se=se.previousSibling;){var ce=se.nodeType,ve=(ce===7||ce===8)&&se.nodeValue;if(ve?!/^\??prettify\b/.test(ve):ce!==3||/\S/.test(se.nodeValue))break;if(ve){ne={},ve.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ht,kt,Ur){ne[kt]=Ur});break}}var Ne=Ee.className;if((ne!==Xe||ot.test(Ne))&&!Ie.test(Ne)){for(var ke=!1,ze=Ee.parentNode;ze;ze=ze.parentNode){var it=ze.tagName;if(je.test(it)&&ze.className&&ot.test(ze.className)){ke=!0;break}}if(!ke){Ee.className+=" prettyprinted";var ct=ne.lang;if(!ct){ct=Ne.match(qe);var ht;!ct&&(ht=le(Ee))&&st.test(ht.tagName)&&(ct=ht.className.match(qe)),ct&&(ct=ct[1])}var Lt;if(Qe.test(Ee.tagName))Lt=1;else{var wt=Ee.currentStyle,ft=_e.defaultView,zt=wt?wt.whiteSpace:ft&&ft.getComputedStyle?ft.getComputedStyle(Ee,null).getPropertyValue("white-space"):0;Lt=zt&&zt.substring(0,3)==="pre"}var Ft=ne.linenums;(Ft=Ft==="true"||+Ft)||(Ft=Ne.match(/\blinenums\b(?::(\d+))?/),Ft=Ft?Ft[1]&&Ft[1].length?+Ft[1]:!0:!1),Ft&&De(Ee,Ft,Lt);var Jt={langExtension:ct,sourceNode:Ee,numberLines:Ft,pre:Lt,sourceCode:null,basePos:null,spans:null,decorations:null};re(Jt)}}}dt<Be.length?U.setTimeout(Ce,250):typeof ae=="function"&&ae()}Ce()}var Re=U.PR={createSimpleLexer:fe,registerLangHandler:me,sourceDecorator:Pe,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:B,PR_COMMENT:w,PR_DECLARATION:S,PR_KEYWORD:k,PR_LITERAL:b,PR_NOCODE:j,PR_PLAIN:u,PR_PUNCTUATION:h,PR_SOURCE:D,PR_STRING:v,PR_TAG:L,PR_TYPE:x,prettyPrintOne:O?U.prettyPrintOne=he:P=he,prettyPrint:W=O?U.prettyPrint=ie:W=ie},oe=U.define;typeof oe=="function"&&oe.amd&&oe("google-code-prettify",[],function(){return Re})})()},T8No:function(pt,Te,q){"use strict";q.d(Te,"a",function(){return X}),q.d(Te,"b",function(){return T}),q.d(Te,"d",function(){return m}),q.d(Te,"c",function(){return f}),q.d(Te,"e",function(){return y});var ue=q("N0LK"),J=q("Cg/j"),O=function(){var a=function(i,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,E){l.__proto__=E}||function(l,E){for(var g in E)E.hasOwnProperty(g)&&(l[g]=E[g])},a(i,s)};return function(i,s){a(i,s);function l(){this.constructor=i}i.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}}(),X=function(){function a(){}return a.has=function(i){return P.create(i)},a.equals=function(i,s){return W.create(i,s)},a.regex=function(i,s){return A.create(i,s)},a.not=function(i){return _.create(i)},a.and=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return p.create(i)},a.or=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return T.create(i)},a.deserialize=function(i,s){return s===void 0&&(s=!1),i?this._deserializeOrExpression(i,s):void 0},a._deserializeOrExpression=function(i,s){var l=this,E=i.split("||");return T.create(E.map(function(g){return l._deserializeAndExpression(g,s)}))},a._deserializeAndExpression=function(i,s){var l=this,E=i.split("&&");return p.create(E.map(function(g){return l._deserializeOne(g,s)}))},a._deserializeOne=function(i,s){if(i=i.trim(),i.indexOf("!=")>=0){var l=i.split("!=");return U.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("==")>=0){var l=i.split("==");return W.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("=~")>=0){var l=i.split("=~");return A.create(l[0].trim(),this._deserializeRegexValue(l[1],s))}return/^\!\s*/.test(i)?_.create(i.substr(1).trim()):P.create(i)},a._deserializeValue=function(i,s){if(i=i.trim(),i==="true")return!0;if(i==="false")return!1;var l=/^'([^']*)'$/.exec(i);return l?l[1].trim():i},a._deserializeRegexValue=function(i,s){if(Object(ue.x)(i)){if(s)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var l=i.indexOf("/"),E=i.lastIndexOf("/");if(l===E||l<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var g=i.slice(l+1,E),v=i[E+1]==="i"?"i":"";try{return new RegExp(g,v)}catch(k){if(s)throw new Error("bad regexp-value '"+i+"', parse error: "+k);return console.warn("bad regexp-value '"+i+"', parse error: "+k),null}},a}();function F(a,i){var s=a.getType(),l=i.getType();if(s!==l)return s-l;switch(s){case 1:return a.cmp(i);case 2:return a.cmp(i);case 3:return a.cmp(i);case 4:return a.cmp(i);case 6:return a.cmp(i);case 7:return a.cmp(i);case 5:return a.cmp(i);default:throw new Error("Unknown ContextKeyExpr!")}}var P=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 1},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return _.create(this.key)},a}(),W=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?P.create(i):_.create(i):new a(i,s)},a.prototype.getType=function(){return 3},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)==this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return U.create(this.key,this.value)},a}(),U=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?_.create(i):P.create(i):new a(i,s)},a.prototype.getType=function(){return 4},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)!=this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return W.create(this.key,this.value)},a}(),_=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 2},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return P.create(this.key)},a}(),A=function(){function a(i,s){this.key=i,this.regexp=s}return a.create=function(i,s){return new a(i,s)},a.prototype.getType=function(){return 6},a.prototype.cmp=function(i){if(this.key<i.key)return-1;if(this.key>i.key)return 1;var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return s<l?-1:s>l?1:0},a.prototype.equals=function(i){if(i instanceof a){var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return this.key===i.key&&s===l}return!1},a.prototype.evaluate=function(i){var s=i.getValue(this.key);return this.regexp?this.regexp.test(s):!1},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return d.create(this)},a}(),d=function(){function a(i){this._actual=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 7},a.prototype.cmp=function(i){return this._actual.cmp(i._actual)},a.prototype.equals=function(i){return i instanceof a?this._actual.equals(i._actual):!1},a.prototype.evaluate=function(i){return!this._actual.evaluate(i)},a.prototype.keys=function(){return this._actual.keys()},a.prototype.negate=function(){return this._actual},a}(),p=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 5},a.prototype.cmp=function(i){if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(var s=0,l=this.expr.length;s<l;s++){var E=F(this.expr[s],i.expr[s]);if(E!==0)return E}return 0},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].evaluate(i))return!1;return!0},a._normalizeArr=function(i){var s=[];if(i){for(var l=0,E=i.length;l<E;l++){var g=i[l];if(!g)continue;if(g instanceof a){s=s.concat(g.expr);continue}if(g instanceof T)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');s.push(g)}s.sort(F)}return s},a.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push.apply(i,E.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push(E.negate())}return T.create(i)},a}(),T=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 8},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(this.expr[s].evaluate(i))return!0;return!1},a._normalizeArr=function(i){var s=[];if(i){for(var l=0,E=i.length;l<E;l++){var g=i[l];if(!g)continue;if(g instanceof a){s=s.concat(g.expr);continue}s.push(g)}s.sort(F)}return s},a.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push.apply(i,E.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var E=l[s];i.push(E.negate())}for(var g=function(D){return D instanceof a?D.expr:[D]};i.length>1;){for(var v=i.shift(),k=i.shift(),w=[],x=0,b=g(v);x<b.length;x++)for(var h=b[x],u=0,L=g(k);u<L.length;u++){var S=L[u];w.push(X.and(h,S))}i.unshift(X.or.apply(X,w))}return i[0]},a}(),m=function(a){O(i,a);function i(s,l){var E=a.call(this,s)||this;return E._defaultValue=l,E}return i.prototype.bindTo=function(s){return s.createKey(this.key,this._defaultValue)},i.prototype.getValue=function(s){return s.getContextKeyValue(this.key)},i.prototype.toNegated=function(){return X.not(this.key)},i}(P),f=Object(J.c)("contextKeyService"),y="setContext"},"VrN/":function(pt,Te,q){(function(ue,J){pt.exports=J()})(this,function(){"use strict";var ue=navigator.userAgent,J=navigator.platform,O=/gecko\/\d/i.test(ue),X=/MSIE \d/.test(ue),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),P=/Edge\/(\d+)/.exec(ue),W=X||F||P,U=W&&(X?document.documentMode||6:+(P||F)[1]),_=!P&&/WebKit\//.test(ue),A=_&&/Qt\/\d+\.\d+/.test(ue),d=!P&&/Chrome\//.test(ue),p=/Opera\//.test(ue),T=/Apple Computer/.test(navigator.vendor),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),f=/PhantomJS/.test(ue),y=!P&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),a=/Android/.test(ue),i=y||a||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),s=y||/Mac/.test(J),l=/\bCrOS\b/.test(ue),E=/win/i.test(J),g=p&&ue.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(p=!1,_=!0);var v=s&&(A||p&&(g==null||g<12.11)),k=O||W&&U>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x=function(e,t){var n=e.className,r=w(t).exec(n);if(r){var o=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(o?r[1]+o:"")}};function b(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return b(e).appendChild(t)}function u(e,t,n,r){var o=document.createElement(e);if(n&&(o.className=n),r&&(o.style.cssText=r),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var R=0;R<t.length;++R)o.appendChild(t[R]);return o}function L(e,t,n,r){var o=u(e,t,n,r);return o.setAttribute("role","presentation"),o}var S;document.createRange?S=function(e,t,n,r){var o=document.createRange();return o.setEnd(r||e,n),o.setStart(e,t),o}:S=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(o){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function D(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function I(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function B(e,t){var n=e.className;w(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!w(n[r]).test(t)&&(t+=" "+n[r]);return t}var G=function(e){e.select()};y?G=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(G=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Y(e,t,n,r,o){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var R=r||0,H=o||0;;){var Z=e.indexOf(" ",R);if(Z<0||Z>=t)return H+(t-R);H+=Z-R,H+=n-H%n,R=Z+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function le(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var fe=50,Pe={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},De={origin:"*mouse"},Le={origin:"+move"};function Ae(e,t,n){for(var r=0,o=0;;){var R=e.indexOf(" ",r);R==-1&&(R=e.length);var H=R-r;if(R==e.length||o+H>=t)return r+Math.min(H,t-o);if(o+=R-r,o+=n-o%n,r=R+1,o>=t)return r}}var me=[""];function de(e){for(;me.length<=e;)me.push(re(me)+" ");return me[e]}function re(e){return e[e.length-1]}function he(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ie(e,t,n){for(var r=0,o=n(t);r<e.length&&n(e[r])<=o;)r++;e.splice(r,0,t)}function Re(){}function oe(e,t){var n;return Object.create?n=Object.create(e):(Re.prototype=e,n=new Re),t&&N(t,n),n}var ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ge(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ae.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ge(e)?!0:t.test(e):ge(e)}function _e(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ue(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Be(e,t,n){for(;(n<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=n;return t}function et(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var o=(t+n)/2,R=r<0?Math.ceil(o):Math.floor(o);if(R==t)return e(R)?t:n;e(R)?n=R:t=R+r}}function Je(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var o=!1,R=0;R<e.length;++R){var H=e[R];(H.from<n&&H.to>t||t==n&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,n),H.level==1?"rtl":"ltr",R),o=!0)}o||r(t,n,"ltr")}var Ze=null;function Ye(e,t,n){var r;Ze=null;for(var o=0;o<e.length;++o){var R=e[o];if(R.from<t&&R.to>t)return o;R.to==t&&(R.from!=R.to&&n=="before"?r=o:Ze=o),R.from==t&&(R.from!=R.to&&n!="before"?r=o:Ze=o)}return r!=null?r:Ze}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,R=/[LRr]/,H=/[Lb1n]/,Z=/[1n]/;function Q(te,pe,ye){this.level=te,this.from=pe,this.to=ye}return function(te,pe){var ye=pe=="ltr"?"L":"R";if(te.length==0||pe=="ltr"&&!r.test(te))return!1;for(var Me=te.length,Oe=[],We=0;We<Me;++We)Oe.push(n(te.charCodeAt(We)));for(var Ve=0,$e=ye;Ve<Me;++Ve){var rt=Oe[Ve];rt=="m"?Oe[Ve]=$e:$e=rt}for(var ut=0,nt=ye;ut<Me;++ut){var gt=Oe[ut];gt=="1"&&nt=="r"?Oe[ut]="n":R.test(gt)&&(nt=gt,gt=="r"&&(Oe[ut]="R"))}for(var Tt=1,Et=Oe[0];Tt<Me-1;++Tt){var _t=Oe[Tt];_t=="+"&&Et=="1"&&Oe[Tt+1]=="1"?Oe[Tt]="1":_t==","&&Et==Oe[Tt+1]&&(Et=="1"||Et=="n")&&(Oe[Tt]=Et),Et=_t}for(var tr=0;tr<Me;++tr){var br=Oe[tr];if(br==",")Oe[tr]="N";else if(br=="%"){var ar=void 0;for(ar=tr+1;ar<Me&&Oe[ar]=="%";++ar);for(var Gr=tr&&Oe[tr-1]=="!"||ar<Me&&Oe[ar]=="1"?"1":"N",Nr=tr;Nr<ar;++Nr)Oe[Nr]=Gr;tr=ar-1}}for(var cr=0,Fr=ye;cr<Me;++cr){var Sr=Oe[cr];Fr=="L"&&Sr=="1"?Oe[cr]="L":R.test(Sr)&&(Fr=Sr)}for(var mr=0;mr<Me;++mr)if(o.test(Oe[mr])){var fr=void 0;for(fr=mr+1;fr<Me&&o.test(Oe[fr]);++fr);for(var sr=(mr?Oe[mr-1]:ye)=="L",Br=(fr<Me?Oe[fr]:ye)=="L",ui=sr==Br?sr?"L":"R":ye,Rn=mr;Rn<fr;++Rn)Oe[Rn]=ui;mr=fr-1}for(var Ar=[],pn,xr=0;xr<Me;)if(H.test(Oe[xr])){var Xa=xr;for(++xr;xr<Me&&H.test(Oe[xr]);++xr);Ar.push(new Q(0,Xa,xr))}else{var yn=xr,Wn=Ar.length,Hn=pe=="rtl"?1:0;for(++xr;xr<Me&&Oe[xr]!="L";++xr);for(var Rr=yn;Rr<xr;)if(Z.test(Oe[Rr])){yn<Rr&&(Ar.splice(Wn,0,new Q(1,yn,Rr)),Wn+=Hn);var di=Rr;for(++Rr;Rr<xr&&Z.test(Oe[Rr]);++Rr);Ar.splice(Wn,0,new Q(2,di,Rr)),Wn+=Hn,yn=Rr}else++Rr;yn<xr&&Ar.splice(Wn,0,new Q(1,yn,xr))}return pe=="ltr"&&(Ar[0].level==1&&(pn=te.match(/^\s+/))&&(Ar[0].from=pn[0].length,Ar.unshift(new Q(0,0,pn[0].length))),re(Ar).level==1&&(pn=te.match(/\s+$/))&&(re(Ar).to-=pn[0].length,Ar.push(new Q(0,Me-pn[0].length,Me)))),pe=="rtl"?Ar.reverse():Ar}}();function qe(e,t){var n=e.order;return n==null&&(n=e.order=dt(e.text,t)),n}var ot=[],Ie=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||ot).concat(n)}};function Qe(e,t){return e._handlers&&e._handlers[t]||ot}function st(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,o=r&&r[t];if(o){var R=le(o,n);R>-1&&(r[t]=o.slice(0,R).concat(o.slice(R+1)))}}}function je(e,t){var n=Qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),o=0;o<n.length;++o)n[o].apply(null,r)}function Xe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),je(e,n||t.type,e,t),ce(t)||t.codemirrorIgnore}function Ce(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)le(n,t[r])==-1&&n.push(t[r])}function be(e,t){return Qe(e,t).length>0}function Ee(e){e.prototype.on=function(t,n){Ie(this,t,n)},e.prototype.off=function(t,n){st(this,t,n)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function se(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ce(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ve(e){ne(e),se(e)}function Ne(e){return e.target||e.srcElement}function ke(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var ze=function(){if(W&&U<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),it;function ct(e){if(it==null){var t=u("span","\u200B");h(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(it=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&U<8))}var n=it?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ht;function Lt(e){if(ht!=null)return ht;var t=h(e,document.createTextNode("A\u062EA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return b(e),!n||n.left==n.right?!1:ht=r.right-n.right<3}var wt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var o=e.indexOf(`
|
|
`,t);o==-1&&(o=e.length);var R=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),H=R.indexOf("\r");H!=-1?(n.push(R.slice(0,H)),t+=H+1):(n.push(R),t=o+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ft=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},zt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ft=null;function Jt(e){if(Ft!=null)return Ft;var t=h(e,u("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return Ft=Math.abs(n.left-r.left)>1}var Ht={},kt={};function Ur(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ht[e]=t}function Zr(e,t){kt[e]=t}function bt(e){if(typeof e=="string"&&kt.hasOwnProperty(e))e=kt[e];else if(e&&typeof e.name=="string"&&kt.hasOwnProperty(e.name)){var t=kt[e.name];typeof t=="string"&&(t={name:t}),e=oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return bt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return bt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ct(e,t){t=bt(t);var n=Ht[t.name];if(!n)return Ct(e,"text/plain");var r=n(e,t);if(at.hasOwnProperty(t.name)){var o=at[t.name];for(var R in o){if(!o.hasOwnProperty(R))continue;r.hasOwnProperty(R)&&(r["_"+R]=r[R]),r[R]=o[R]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)r[H]=t.modeProps[H];return r}var at={};function xt(e,t){var n=at.hasOwnProperty(e)?at[e]:at[e]={};N(t,n)}function Zt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var o=t[r];o instanceof Array&&(o=o.concat([])),n[r]=o}return n}function nr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function rr(e,t,n){return e.startState?e.startState(t,n):!0}var Rt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Rt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Y(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(H){return n?H.toLowerCase():H},o=this.string.substr(this.pos,e.length);if(r(o)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var R=this.string.slice(this.pos).match(e);return R&&R.index>0?null:(R&&t!==!1&&(this.pos+=R[0].length),R)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function vt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var o=n.children[r],R=o.chunkSize();if(t<R){n=o;break}t-=R}return n.lines[t]}function kr(e,t,n){var r=[],o=t.line;return e.iter(t.line,n.line+1,function(R){var H=R.text;o==n.line&&(H=H.slice(0,n.ch)),o==t.line&&(H=H.slice(t.ch)),r.push(H),++o}),r}function tn(e,t,n){var r=[];return e.iter(t,n,function(o){r.push(o.text)}),r}function Tr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,n=le(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var o=0;!(r.children[o]==t);++o)n+=r.children[o].chunkSize();return n+t.first}function Lr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var o=e.children[r],R=o.height;if(t<R){e=o;continue e}t-=R,n+=o.chunkSize()}return n}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Z=e.lines[H],Q=Z.height;if(t<Q)break;t-=Q}return n+H}function zr(e,t){return t>=e.first&&t<e.first+e.size}function rn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function He(e,t,n){if(n===void 0&&(n=null),!(this instanceof He))return new He(e,t,n);this.line=e,this.ch=t,this.sticky=n}function lt(e,t){return e.line-t.line||e.ch-t.ch}function Pt(e,t){return e.sticky==t.sticky&<(e,t)==0}function Kt(e){return He(e.line,e.ch)}function Yt(e,t){return lt(e,t)<0?t:e}function qt(e,t){return lt(e,t)<0?e:t}function K(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function c(e,t){if(t.line<e.first)return He(e.first,0);var n=e.first+e.size-1;return t.line>n?He(n,vt(e,n).text.length):C(t,vt(e,t.line).text.length)}function C(e,t){var n=e.ch;return n==null||n>t?He(e.line,t):n<0?He(e.line,0):e}function z(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=c(e,t[r]);return n}var $=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,n){return t instanceof $?new V(e,Zt(e.mode,t.state),n,t.lookAhead):new V(e,Zt(e.mode,t),n)},V.prototype.save=function(e){var t=e!==!1?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new $(t,this.maxLookAhead):t};function xe(e,t,n,r){var o=[e.state.modeGen],R={};Vr(e,t.text,e.doc.mode,n,function(te,pe){return o.push(te,pe)},R,r);for(var H=n.state,Z=function(te){n.baseTokens=o;var pe=e.state.overlays[te],ye=1,Me=0;n.state=!0,Vr(e,t.text,pe.mode,n,function(Oe,We){for(var Ve=ye;Me<Oe;){var $e=o[ye];$e>Oe&&o.splice(ye,1,Oe,o[ye+1],$e),ye+=2,Me=Math.min(Oe,$e)}if(!We)return;if(pe.opaque)o.splice(Ve,ye-Ve,Oe,"overlay "+We),ye=Ve+2;else for(;Ve<ye;Ve+=2){var rt=o[Ve+1];o[Ve+1]=(rt?rt+" ":"")+"overlay "+We}},R),n.state=H,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Z(Q);return{styles:o,classes:R.bgClass||R.textClass?R:null}}function Ge(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=tt(e,Ot(t)),o=t.text.length>e.options.maxHighlightLength&&Zt(e.doc.mode,r.state),R=xe(e,t,r);o&&(r.state=o),t.stateAfter=r.save(!o),t.styles=R.styles,R.classes?t.styleClasses=R.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function tt(e,t,n){var r=e.doc,o=e.display;if(!r.mode.startState)return new V(r,!0,t);var R=pr(e,t,n),H=R>r.first&&vt(r,R-1).stateAfter,Z=H?V.fromSaved(r,H,R):new V(r,rr(r.mode),R);return r.iter(R,t,function(Q){mt(e,Q.text,Z);var te=Z.line;Q.stateAfter=te==t-1||te%5==0||te>=o.viewFrom&&te<o.viewTo?Z.save():null,Z.nextLine()}),n&&(r.modeFrontier=Z.line),Z}function mt(e,t,n,r){var o=e.doc.mode,R=new Rt(t,e.options.tabSize,n);for(R.start=R.pos=r||0,t==""&&Ke(o,n.state);!R.eol();)At(o,R,n.state),R.start=R.pos}function Ke(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=nr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function At(e,t,n,r){for(var o=0;o<10;o++){r&&(r[0]=nr(e,n).mode);var R=e.token(t,n);if(t.pos>t.start)return R}throw new Error("Mode "+e.name+" failed to advance stream.")}var It=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function er(e,t,n,r){var o=e.doc,R=o.mode,H;t=c(o,t);var Z=vt(o,t.line),Q=tt(e,t.line,n),te=new Rt(Z.text,e.options.tabSize,Q),pe;for(r&&(pe=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,H=At(R,te,Q.state),r&&pe.push(new It(te,H,Zt(o.mode,Q.state)));return r?pe:new It(te,H,Q.state)}function Kr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Vr(e,t,n,r,o,R,H){var Z=n.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var Q=0,te=null,pe=new Rt(t,e.options.tabSize,r),ye,Me=e.options.addModeClass&&[null];for(t==""&&Kr(Ke(n,r.state),R);!pe.eol();){if(pe.pos>e.options.maxHighlightLength?(Z=!1,H&&mt(e,t,r,pe.pos),pe.pos=t.length,ye=null):ye=Kr(At(n,pe,r.state,Me),R),Me){var Oe=Me[0].name;Oe&&(ye="m-"+(ye?Oe+" "+ye:Oe))}if(!Z||te!=ye){for(;Q<pe.start;)Q=Math.min(pe.start,Q+5e3),o(Q,te);te=ye}pe.start=pe.pos}for(;Q<pe.pos;){var We=Math.min(pe.pos,Q+5e3);o(We,te),Q=We}}function pr(e,t,n){for(var r,o,R=e.doc,H=n?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>H;--Z){if(Z<=R.first)return R.first;var Q=vt(R,Z-1),te=Q.stateAfter;if(te&&(!n||Z+(te instanceof $?te.lookAhead:0)<=R.modeFrontier))return Z;var pe=Y(Q.text,null,e.options.tabSize);(o==null||r>pe)&&(o=Z-1,r=pe)}return o}function Qr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var o=vt(e,r).stateAfter;if(o&&(!(o instanceof $)||r+o.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Gn=!1,Or=!1;function Xr(){Gn=!0}function jr(){Or=!0}function bn(e,t,n){this.marker=e,this.from=t,this.to=n}function nn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function mn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function dn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function hi(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var R=e[o],H=R.marker,Z=R.from==null||(H.inclusiveLeft?R.from<=t:R.from<t);if(Z||R.from==t&&H.type=="bookmark"&&(!n||!R.marker.insertLeft)){var Q=R.to==null||(H.inclusiveRight?R.to>=t:R.to>t);(r||(r=[])).push(new bn(H,R.from,Q?null:R.to))}}return r}function zn(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var R=e[o],H=R.marker,Z=R.to==null||(H.inclusiveRight?R.to>=t:R.to>t);if(Z||R.from==t&&H.type=="bookmark"&&(!n||R.marker.insertLeft)){var Q=R.from==null||(H.inclusiveLeft?R.from<=t:R.from<t);(r||(r=[])).push(new bn(H,Q?null:R.from-t,R.to==null?null:R.to-t))}}return r}function an(e,t){if(t.full)return null;var n=zr(e,t.from.line)&&vt(e,t.from.line).markedSpans,r=zr(e,t.to.line)&&vt(e,t.to.line).markedSpans;if(!n&&!r)return null;var o=t.from.ch,R=t.to.ch,H=lt(t.from,t.to)==0,Z=hi(n,o,H),Q=zn(r,R,H),te=t.text.length==1,pe=re(t.text).length+(te?o:0);if(Z)for(var ye=0;ye<Z.length;++ye){var Me=Z[ye];if(Me.to==null){var Oe=nn(Q,Me.marker);Oe?te&&(Me.to=Oe.to==null?null:Oe.to+pe):Me.to=o}}if(Q)for(var We=0;We<Q.length;++We){var Ve=Q[We];if(Ve.to!=null&&(Ve.to+=pe),Ve.from==null){var $e=nn(Z,Ve.marker);$e||(Ve.from=pe,te&&(Z||(Z=[])).push(Ve))}else Ve.from+=pe,te&&(Z||(Z=[])).push(Ve)}Z&&(Z=Yr(Z)),Q&&Q!=Z&&(Q=Yr(Q));var rt=[Z];if(!te){var ut=t.text.length-2,nt;if(ut>0&&Z)for(var gt=0;gt<Z.length;++gt)Z[gt].to==null&&(nt||(nt=[])).push(new bn(Z[gt].marker,null,null));for(var Tt=0;Tt<ut;++Tt)rt.push(nt);rt.push(Q)}return rt}function Yr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function kn(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(Oe){if(Oe.markedSpans)for(var We=0;We<Oe.markedSpans.length;++We){var Ve=Oe.markedSpans[We].marker;Ve.readOnly&&(!r||le(r,Ve)==-1)&&(r||(r=[])).push(Ve)}}),!r)return null;for(var o=[{from:t,to:n}],R=0;R<r.length;++R)for(var H=r[R],Z=H.find(0),Q=0;Q<o.length;++Q){var te=o[Q];if(lt(te.to,Z.from)<0||lt(te.from,Z.to)>0)continue;var pe=[Q,1],ye=lt(te.from,Z.from),Me=lt(te.to,Z.to);(ye<0||!H.inclusiveLeft&&!ye)&&pe.push({from:te.from,to:Z.from}),(Me>0||!H.inclusiveRight&&!Me)&&pe.push({from:Z.to,to:te.to}),o.splice.apply(o,pe),Q+=pe.length-3}return o}function On(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function ci(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function or(e){return e.inclusiveLeft?-1:0}function jt(e){return e.inclusiveRight?1:0}function Er(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),o=t.find(),R=lt(r.from,o.from)||or(e)-or(t);if(R)return-R;var H=lt(r.to,o.to)||jt(e)-jt(t);return H||t.id-e.id}function Ut(e,t){var n=Or&&e.markedSpans,r;if(n)for(var o=void 0,R=0;R<n.length;++R)o=n[R],o.marker.collapsed&&(t?o.from:o.to)==null&&(!r||Er(r,o.marker)<0)&&(r=o.marker);return r}function dr(e){return Ut(e,!0)}function Vt(e){return Ut(e,!1)}function hn(e,t){var n=Or&&e.markedSpans,r;if(n)for(var o=0;o<n.length;++o){var R=n[o];R.marker.collapsed&&(R.from==null||R.from<t)&&(R.to==null||R.to>t)&&(!r||Er(r,R.marker)<0)&&(r=R.marker)}return r}function lr(e,t,n,r,o){var R=vt(e,t),H=Or&&R.markedSpans;if(H)for(var Z=0;Z<H.length;++Z){var Q=H[Z];if(!Q.marker.collapsed)continue;var te=Q.marker.find(0),pe=lt(te.from,n)||or(Q.marker)-or(o),ye=lt(te.to,r)||jt(Q.marker)-jt(o);if(pe>=0&&ye<=0||pe<=0&&ye>=0)continue;if(pe<=0&&(Q.marker.inclusiveRight&&o.inclusiveLeft?lt(te.to,n)>=0:lt(te.to,n)>0)||pe>=0&&(Q.marker.inclusiveRight&&o.inclusiveLeft?lt(te.from,r)<=0:lt(te.from,r)<0))return!0}}function _r(e){for(var t;t=dr(e);)e=t.find(-1,!0).line;return e}function Kn(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function Vn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xn(e,t){var n=vt(e,t),r=_r(n);return n==r?t:Ot(r)}function Ui(e,t){if(t>e.lastLine())return t;var n=vt(e,t),r;if(!Wr(e,n))return t;for(;r=Vt(n);)n=r.find(1,!0).line;return Ot(n)+1}function Wr(e,t){var n=Or&&t.markedSpans;if(n)for(var r=void 0,o=0;o<n.length;++o){if(r=n[o],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fi(e,t,r))return!0}}function fi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return fi(e,r.line,nn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var o=void 0,R=0;R<t.markedSpans.length;++R)if(o=t.markedSpans[R],o.marker.collapsed&&!o.marker.widgetNode&&o.from==n.to&&(o.to==null||o.to!=n.from)&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&fi(e,t,o))return!0}function on(e){e=_r(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var o=n.lines[r];if(o==e)break;t+=o.height}for(var R=n.parent;R;n=R,R=n.parent)for(var H=0;H<R.children.length;++H){var Z=R.children[H];if(Z==n)break;t+=Z.height}return t}function Xn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=dr(r);){var o=n.find(0,!0);r=o.from.line,t+=o.from.ch-o.to.ch}for(r=e;n=Vt(r);){var R=n.find(0,!0);t-=r.text.length-R.from.ch,r=R.to.line,t+=r.text.length-R.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=vt(n,n.first),t.maxLineLength=Xn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var o=Xn(r);o>t.maxLineLength&&(t.maxLineLength=o,t.maxLine=r)})}var _n=function(e,t,n){this.text=e,ci(this,t),this.height=n?n(this):1};_n.prototype.lineNo=function(){return Ot(this)},Ee(_n);function $a(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),On(e),ci(e,n);var o=r?r(e):1;o!=e.height&&Tr(e,o)}function da(e){e.parent=null,On(e)}var yt={},Dt={};function St(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Dt:yt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Mt(e,t){var n=L("span",null,null,_?"padding-right: .1px":null),r={pre:L("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var R=o?t.rest[o-1]:t.line,H=void 0;r.pos=0,r.addToken=$t,Lt(e.display.measure)&&(H=qe(R,e.doc.direction))&&(r.addToken=hr(r.addToken,H)),r.map=[];var Z=t!=e.display.externalMeasured&&Ot(R);Nt(R,r,Ge(e,R,Z)),R.styleClasses&&(R.styleClasses.bgClass&&(r.bgClass=j(R.styleClasses.bgClass,r.bgClass||"")),R.styleClasses.textClass&&(r.textClass=j(R.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ct(e.display.measure))),o==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(_){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Wt(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function $t(e,t,n,r,o,R,H){if(!t)return;var Z=e.splitSpaces?Bt(t,e.trailingSpace):t,Q=e.cm.state.specialChars,te=!1,pe;if(!Q.test(t))e.col+=t.length,pe=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,pe),W&&U<9&&(te=!0),e.pos+=t.length;else{pe=document.createDocumentFragment();for(var ye=0;;){Q.lastIndex=ye;var Me=Q.exec(t),Oe=Me?Me.index-ye:t.length-ye;if(Oe){var We=document.createTextNode(Z.slice(ye,ye+Oe));W&&U<9?pe.appendChild(u("span",[We])):pe.appendChild(We),e.map.push(e.pos,e.pos+Oe,We),e.col+=Oe,e.pos+=Oe}if(!Me)break;ye+=Oe+1;var Ve=void 0;if(Me[0]==" "){var $e=e.cm.options.tabSize,rt=$e-e.col%$e;Ve=pe.appendChild(u("span",de(rt),"cm-tab")),Ve.setAttribute("role","presentation"),Ve.setAttribute("cm-text"," "),e.col+=rt}else Me[0]=="\r"||Me[0]==`
|
|
`?(Ve=pe.appendChild(u("span",Me[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ve.setAttribute("cm-text",Me[0]),e.col+=1):(Ve=e.cm.options.specialCharPlaceholder(Me[0]),Ve.setAttribute("cm-text",Me[0]),W&&U<9?pe.appendChild(u("span",[Ve])):pe.appendChild(Ve),e.col+=1);e.map.push(e.pos,e.pos+1,Ve),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,n||r||o||te||R||H){var ut=n||"";r&&(ut+=r),o&&(ut+=o);var nt=u("span",[pe],ut,R);if(H)for(var gt in H)H.hasOwnProperty(gt)&>!="style"&>!="class"&&nt.setAttribute(gt,H[gt]);return e.content.appendChild(nt)}e.content.appendChild(pe)}function Bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",o=0;o<e.length;o++){var R=e.charAt(o);R==" "&&n&&(o==e.length-1||e.charCodeAt(o+1)==32)&&(R="\xA0"),r+=R,n=R==" "}return r}function hr(e,t){return function(n,r,o,R,H,Z,Q){o=o?o+" cm-force-border":"cm-force-border";for(var te=n.pos,pe=te+r.length;;){for(var ye=void 0,Me=0;Me<t.length&&!(ye=t[Me],ye.to>te&&ye.from<=te);Me++);if(ye.to>=pe)return e(n,r,o,R,H,Z,Q);e(n,r.slice(0,ye.to-te),o,R,null,Z,Q),R=null,r=r.slice(ye.to-te),te=ye.to}}}function Pr(e,t,n,r){var o=!r&&n.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!r&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",n.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function Nt(e,t,n){var r=e.markedSpans,o=e.text,R=0;if(!r){for(var H=1;H<n.length;H+=2)t.addToken(t,o.slice(R,R=n[H]),St(n[H+1],t.cm.options));return}for(var Z=o.length,Q=0,te=1,pe="",ye,Me,Oe=0,We,Ve,$e,rt,ut;;){if(Oe==Q){We=Ve=$e=Me="",ut=null,rt=null,Oe=Infinity;for(var nt=[],gt=void 0,Tt=0;Tt<r.length;++Tt){var Et=r[Tt],_t=Et.marker;if(_t.type=="bookmark"&&Et.from==Q&&_t.widgetNode)nt.push(_t);else if(Et.from<=Q&&(Et.to==null||Et.to>Q||_t.collapsed&&Et.to==Q&&Et.from==Q)){if(Et.to!=null&&Et.to!=Q&&Oe>Et.to&&(Oe=Et.to,Ve=""),_t.className&&(We+=" "+_t.className),_t.css&&(Me=(Me?Me+";":"")+_t.css),_t.startStyle&&Et.from==Q&&($e+=" "+_t.startStyle),_t.endStyle&&Et.to==Oe&&(gt||(gt=[])).push(_t.endStyle,Et.to),_t.title&&((ut||(ut={})).title=_t.title),_t.attributes)for(var tr in _t.attributes)(ut||(ut={}))[tr]=_t.attributes[tr];_t.collapsed&&(!rt||Er(rt.marker,_t)<0)&&(rt=Et)}else Et.from>Q&&Oe>Et.from&&(Oe=Et.from)}if(gt)for(var br=0;br<gt.length;br+=2)gt[br+1]==Oe&&(Ve+=" "+gt[br]);if(!rt||rt.from==Q)for(var ar=0;ar<nt.length;++ar)Pr(t,0,nt[ar]);if(rt&&(rt.from||0)==Q){if(Pr(t,(rt.to==null?Z+1:rt.to)-Q,rt.marker,rt.from==null),rt.to==null)return;rt.to==Q&&(rt=!1)}}if(Q>=Z)break;for(var Gr=Math.min(Z,Oe);;){if(pe){var Nr=Q+pe.length;if(!rt){var cr=Nr>Gr?pe.slice(0,Gr-Q):pe;t.addToken(t,cr,ye?ye+We:We,$e,Q+cr.length==Oe?Ve:"",Me,ut)}if(Nr>=Gr){pe=pe.slice(Gr-Q),Q=Gr;break}Q=Nr,$e=""}pe=o.slice(R,R=n[te++]),ye=St(n[te++],t.cm.options)}}}function En(e,t,n){this.line=t,this.rest=Vn(t),this.size=this.rest?Ot(re(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wr(e,t)}function Gt(e,t,n){for(var r=[],o,R=t;R<n;R=o){var H=new En(e.doc,vt(e.doc,R),R);o=R+H.size,r.push(H)}return r}var gr=null;function qr(e){gr?gr.ops.push(e):e.ownsGroup=gr={ops:[e],delayedCallbacks:[]}}function en(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var o=e.ops[r];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(n<t.length)}function Wi(e,t){var n=e.ownsGroup;if(!n)return;try{en(n)}finally{gr=null,t(n)}}var pi=null;function Cr(e,t){var n=Qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),o;gr?o=gr.delayedCallbacks:pi?o=pi:(o=pi=[],setTimeout(_s,0));for(var R=function(Z){o.push(function(){return n[Z].apply(null,r)})},H=0;H<n.length;++H)R(H)}function _s(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var o=0;o<t.changes.length;o++){var R=t.changes[o];R=="text"?Ms(e,t):R=="gutter"?Qa(e,t,n,r):R=="class"?ha(e,t):R=="widget"&&Is(e,t,r)}t.changes=null}function mi(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&U<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=mi(t);t.background=r.insertBefore(u("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Mt(e,t)}function Ms(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){Ps(e,t),t.line.wrapClass?mi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=mi(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var R=t.line.gutterMarkers;if(e.options.lineNumbers||R){var H=mi(t),Z=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),H.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!R||!R["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(u("div",rn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),R)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=e.display.gutterSpecs[Q].className,pe=R.hasOwnProperty(te)&&R[te];pe&&Z.appendChild(u("div",[pe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=w("CodeMirror-linewidget"),o=t.node.firstChild,R=void 0;o;o=R)R=o.nextSibling,r.test(o.className)&&t.node.removeChild(o);qa(e,t,n)}function Ns(e,t,n,r){var o=Za(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),ha(e,t),Qa(e,t,n,r),qa(e,t,r),t.node}function qa(e,t,n){if(eo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,n,!1)}function eo(e,t,n,r,o){if(!t.widgets)return;for(var R=mi(n),H=0,Z=t.widgets;H<Z.length;++H){var Q=Z[H],te=u("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Fs(Q,te,n,r),e.display.input.setUneditable(te),o&&Q.above?R.insertBefore(te,n.gutter||n.text):R.appendChild(te),Cr(Q,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var o=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(o-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),h(t.display.measure,u("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function gn(e,t){for(var n=Ne(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Hi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,u("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function cn(e){return fe-e.display.nativeBarWidth}function Pn(e){return e.display.scroller.clientWidth-cn(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-cn(e)-e.display.barHeight}function Bs(e,t,n){var r=e.options.lineWrapping,o=r&&Pn(e);if(!t.measure.heights||r&&t.measure.width!=o){var R=t.measure.heights=[];if(r){t.measure.width=o;for(var H=t.text.firstChild.getClientRects(),Z=0;Z<H.length-1;Z++){var Q=H[Z],te=H[Z+1];Math.abs(Q.bottom-te.bottom)>2&&R.push((Q.bottom+te.top)/2-n.top)}}R.push(n.bottom-n.top)}}function ro(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var o=0;o<e.rest.length;o++)if(Ot(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Us(e,t){t=_r(t);var n=Ot(t),r=e.display.externalMeasured=new En(e.doc,t,n);r.lineN=n;var o=r.built=Mt(e,r);return r.text=o.pre,h(e.display.lineMeasure,o.pre),r}function no(e,t,n,r){return fn(e,Yn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Yn(e,t){var n=Ot(t),r=pa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,xa(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var o=ro(r,t,n);return{line:t,view:r,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function fn(e,t,n,r,o){t.before&&(n=-1);var R=n+(r||""),H;return t.cache.hasOwnProperty(R)?H=t.cache[R]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,n,r),H.bogus||(t.cache[R]=H)),{left:H.left,right:H.right,top:o?H.rtop:H.top,bottom:o?H.rbottom:H.bottom}}var io={left:0,right:0,top:0,bottom:0};function ao(e,t,n){for(var r,o,R,H,Z,Q,te=0;te<e.length;te+=3)if(Z=e[te],Q=e[te+1],t<Z?(o=0,R=1,H="left"):t<Q?(o=t-Z,R=o+1):(te==e.length-3||t==Q&&e[te+3]>t)&&(R=Q-Z,o=R-1,t>=Q&&(H="right")),o!=null){if(r=e[te+2],Z==Q&&n==(r.insertLeft?"left":"right")&&(H=n),n=="left"&&o==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],H="left";if(n=="right"&&o==Q-Z)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],H="right";break}return{node:r,start:o,end:R,collapse:H,coverStart:Z,coverEnd:Q}}function js(e,t){var n=io;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var o=e.length-1;o>=0&&!((n=e[o]).left!=n.right);o--);return n}function Ws(e,t,n,r){var o=ao(t.map,n,r),R=o.node,H=o.start,Z=o.end,Q=o.collapse,te;if(R.nodeType==3){for(var pe=0;pe<4;pe++){for(;H&&Ue(t.line.text.charAt(o.coverStart+H));)--H;for(;o.coverStart+Z<o.coverEnd&&Ue(t.line.text.charAt(o.coverStart+Z));)++Z;if(W&&U<9&&H==0&&Z==o.coverEnd-o.coverStart?te=R.parentNode.getBoundingClientRect():te=js(S(R,H,Z).getClientRects(),r),te.left||te.right||H==0)break;Z=H,H=H-1,Q="right"}W&&U<11&&(te=Hs(e.display.measure,te))}else{H>0&&(Q=r="right");var ye;e.options.lineWrapping&&(ye=R.getClientRects()).length>1?te=ye[r=="right"?ye.length-1:0]:te=R.getBoundingClientRect()}if(W&&U<9&&!H&&(!te||!te.left&&!te.right)){var Me=R.parentNode.getClientRects()[0];Me?te={left:Me.left,right:Me.left+Jn(e.display),top:Me.top,bottom:Me.bottom}:te=io}for(var Oe=te.top-t.rect.top,We=te.bottom-t.rect.top,Ve=(Oe+We)/2,$e=t.view.measure.heights,rt=0;rt<$e.length-1&&!(Ve<$e[rt]);rt++);var ut=rt?$e[rt-1]:0,nt=$e[rt],gt={left:(Q=="right"?te.right:te.left)-t.rect.left,right:(Q=="left"?te.left:te.right)-t.rect.left,top:ut,bottom:nt};return!te.left&&!te.right&&(gt.bogus=!0),e.options.singleCursorHeightPerLine||(gt.rtop=Oe,gt.rbottom=We),gt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Jt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,b(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vi(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return d&&a?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return d&&a?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=gi(e.widgets[n]));return t}function Gi(e,t,n,r,o){if(!o){var R=ma(t);n.top+=R,n.bottom+=R}if(r=="line")return n;r||(r="local");var H=on(t);if(r=="local"?H+=Hi(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Z=e.display.lineSpace.getBoundingClientRect();H+=Z.top+(r=="window"?0:uo());var Q=Z.left+(r=="window"?0:lo());n.left+=Q,n.right+=Q}return n.top+=H,n.bottom+=H,n}function ho(e,t,n){if(n=="div")return t;var r=t.left,o=t.top;if(n=="page")r-=lo(),o-=uo();else if(n=="local"||!n){var R=e.display.sizer.getBoundingClientRect();r+=R.left,o+=R.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:o-H.top}}function ga(e,t,n,r,o){return r||(r=vt(e.doc,t.line)),Gi(e,r,no(e,r,t.ch,o),n)}function sn(e,t,n,r,o,R){r=r||vt(e.doc,t.line),o||(o=Yn(e,r));function H(We,Ve){var $e=fn(e,o,We,Ve?"right":"left",R);return Ve?$e.left=$e.right:$e.right=$e.left,Gi(e,r,$e,n)}var Z=qe(r,e.doc.direction),Q=t.ch,te=t.sticky;if(Q>=r.text.length?(Q=r.text.length,te="before"):Q<=0&&(Q=0,te="after"),!Z)return H(te=="before"?Q-1:Q,te=="before");function pe(We,Ve,$e){var rt=Z[Ve],ut=rt.level==1;return H($e?We-1:We,ut!=$e)}var ye=Ye(Z,Q,te),Me=Ze,Oe=pe(Q,ye,te=="before");return Me!=null&&(Oe.other=pe(Q,Me,te!="before")),Oe}function co(e,t){var n=0;t=c(e.doc,t),e.options.lineWrapping||(n=Jn(e.display)*t.ch);var r=vt(e.doc,t.line),o=on(r)+Hi(e.display);return{left:n,right:n,top:o,bottom:o+r.height}}function va(e,t,n,r,o){var R=He(e,t,n);return R.xRel=o,r&&(R.outside=r),R}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var o=Lr(r,n),R=r.first+r.size-1;if(o>R)return va(r.first+r.size-1,vt(r,R).text.length,null,1,1);t<0&&(t=0);for(var H=vt(r,o);;){var Z=Gs(e,H,o,t,n),Q=hn(H,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!Q)return Z;var te=Q.find(1);if(te.line==o)return te;H=vt(r,o=te.line)}}function fo(e,t,n,r){r-=ma(t);var o=t.text.length,R=et(function(H){return fn(e,n,H-1).bottom<=r},o,0);return o=et(function(H){return fn(e,n,H).top>r},R,o),{begin:R,end:o}}function po(e,t,n,r){n||(n=Yn(e,t));var o=Gi(e,t,fn(e,n,r),"line").top;return fo(e,t,n,o)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Gs(e,t,n,r,o){o-=on(t);var R=Yn(e,t),H=ma(t),Z=0,Q=t.text.length,te=!0,pe=qe(t,e.doc.direction);if(pe){var ye=(e.options.lineWrapping?Ks:zs)(e,t,n,R,pe,r,o);te=ye.level!=1,Z=te?ye.from:ye.to-1,Q=te?ye.to:ye.from-1}var Me=null,Oe=null,We=et(function(Tt){var Et=fn(e,R,Tt);return Et.top+=H,Et.bottom+=H,ba(Et,r,o,!1)?(Et.top<=o&&Et.left<=r&&(Me=Tt,Oe=Et),!0):!1},Z,Q),Ve,$e,rt=!1;if(Oe){var ut=r-Oe.left<Oe.right-r,nt=ut==te;We=Me+(nt?0:1),$e=nt?"after":"before",Ve=ut?Oe.left:Oe.right}else{!te&&(We==Q||We==Z)&&We++,$e=We==0?"after":We==t.text.length?"before":fn(e,R,We-(te?1:0)).bottom+H<=o==te?"after":"before";var gt=sn(e,He(n,We,$e),"line",t,R);Ve=gt.left,rt=o<gt.top?-1:o>=gt.bottom?1:0}return We=Be(t.text,We,1),va(n,We,$e,rt,r-Ve)}function zs(e,t,n,r,o,R,H){var Z=et(function(ye){var Me=o[ye],Oe=Me.level!=1;return ba(sn(e,He(n,Oe?Me.to:Me.from,Oe?"before":"after"),"line",t,r),R,H,!0)},0,o.length-1),Q=o[Z];if(Z>0){var te=Q.level!=1,pe=sn(e,He(n,te?Q.from:Q.to,te?"after":"before"),"line",t,r);ba(pe,R,H,!0)&&pe.top>H&&(Q=o[Z-1])}return Q}function Ks(e,t,n,r,o,R,H){var Z=fo(e,t,r,H),Q=Z.begin,te=Z.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var pe=null,ye=null,Me=0;Me<o.length;Me++){var Oe=o[Me];if(Oe.from>=te||Oe.to<=Q)continue;var We=Oe.level!=1,Ve=fn(e,r,We?Math.min(te,Oe.to)-1:Math.max(Q,Oe.from)).right,$e=Ve<R?R-Ve+1e9:Ve-R;(!pe||ye>$e)&&(pe=Oe,ye=$e)}return pe||(pe=o[o.length-1]),pe.from<Q&&(pe={from:Q,to:pe.to,level:pe.level}),pe.to>te&&(pe={from:pe.from,to:te,level:pe.level}),pe}var Mn;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mn==null){Mn=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mn.appendChild(document.createTextNode("x")),Mn.appendChild(u("br"));Mn.appendChild(document.createTextNode("x"))}h(e.measure,Mn);var n=Mn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),b(e.measure),n||1}function Jn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),n=u("pre",[t],"CodeMirror-line-like");h(e.measure,n);var r=t.getBoundingClientRect(),o=(r.right-r.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function xa(e){for(var t=e.display,n={},r={},o=t.gutters.clientLeft,R=t.gutters.firstChild,H=0;R;R=R.nextSibling,++H){var Z=e.display.gutterSpecs[H].className;n[Z]=R.offsetLeft+R.clientLeft+o,r[Z]=R.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=$n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Jn(e.display)-3);return function(o){if(Wr(e.doc,o))return 0;var R=0;if(o.widgets)for(var H=0;H<o.widgets.length;H++)o.widgets[H].height&&(R+=o.widgets[H].height);return n?R+(Math.ceil(o.text.length/r)||1)*t:R+t}}function Ca(e){var t=e.doc,n=mo(e);t.iter(function(r){var o=n(r);o!=r.height&&Tr(r,o)})}function In(e,t,n,r){var o=e.display;if(!n&&Ne(t).getAttribute("cm-not-content")=="true")return null;var R,H,Z=o.lineSpace.getBoundingClientRect();try{R=t.clientX-Z.left,H=t.clientY-Z.top}catch(ye){return null}var Q=ya(e,R,H),te;if(r&&Q.xRel>0&&(te=vt(e.doc,Q.line).text).length==Q.ch){var pe=Y(te,te.length,e.options.tabSize)-te.length;Q=He(Q.line,Math.max(0,Math.round((R-to(e.display).left)/Jn(e.display))-pe))}return Q}function Nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Mr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var o=e.display;if(r&&n<o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Or&&xn(e.doc,t)<o.viewTo&&Sn(e);else if(n<=o.viewFrom)Or&&Ui(e.doc,n+r)>o.viewFrom?Sn(e):(o.viewFrom+=r,o.viewTo+=r);else if(t<=o.viewFrom&&n>=o.viewTo)Sn(e);else if(t<=o.viewFrom){var R=zi(e,n,n+r,1);R?(o.view=o.view.slice(R.index),o.viewFrom=R.lineN,o.viewTo+=r):Sn(e)}else if(n>=o.viewTo){var H=zi(e,t,t,-1);H?(o.view=o.view.slice(0,H.index),o.viewTo=H.lineN):Sn(e)}else{var Z=zi(e,t,t,-1),Q=zi(e,n,n+r,1);Z&&Q?(o.view=o.view.slice(0,Z.index).concat(Gt(e,Z.lineN,Q.lineN)).concat(o.view.slice(Q.index)),o.viewTo+=r):Sn(e)}var te=o.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(o.externalMeasured=null))}function Cn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var R=r.view[Nn(e,t)];if(R.node==null)return;var H=R.changes||(R.changes=[]);le(H,n)==-1&&H.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zi(e,t,n,r){var o=Nn(e,t),R,H=e.display.view;if(!Or||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var Z=e.display.viewFrom,Q=0;Q<o;Q++)Z+=H[Q].size;if(Z!=t){if(r>0){if(o==H.length-1)return null;R=Z+H[o].size-t,o++}else R=Z-t;t+=R,n+=R}for(;xn(e.doc,n)!=n;){if(o==(r<0?0:H.length-1))return null;n+=r*H[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Vs(e,t,n){var r=e.display,o=r.view;o.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Gt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Gt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Gt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function go(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var o=t[r];!o.hidden&&(!o.node||o.changes)&&++n}return n}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},o=r.cursors=document.createDocumentFragment(),R=r.selection=document.createDocumentFragment(),H=0;H<n.sel.ranges.length;H++){if(!t&&H==n.sel.primIndex)continue;var Z=n.sel.ranges[H];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var Q=Z.empty();(Q||e.options.showCursorWhenSelecting)&&yo(e,Z.head,o),Q||Xs(e,Z,R)}return r}function yo(e,t,n){var r=sn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=n.appendChild(u("div","\xA0","CodeMirror-cursor"));if(o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var R=n.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));R.style.display="",R.style.left=r.other.left+"px",R.style.top=r.other.top+"px",R.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,o=e.doc,R=document.createDocumentFragment(),H=to(e.display),Z=H.left,Q=Math.max(r.sizerWidth,Pn(e)-r.sizer.offsetLeft)-H.right,te=o.direction=="ltr";function pe(nt,gt,Tt,Et){gt<0&&(gt=0),gt=Math.round(gt),Et=Math.round(Et),R.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
|
|
top: `+gt+"px; width: "+(Tt==null?Q-nt:Tt)+`px;
|
|
height: `+(Et-gt)+"px"))}function ye(nt,gt,Tt){var Et=vt(o,nt),_t=Et.text.length,tr,br;function ar(cr,Fr){return ga(e,He(nt,cr),"div",Et,Fr)}function Gr(cr,Fr,Sr){var mr=po(e,Et,null,cr),fr=Fr=="ltr"==(Sr=="after")?"left":"right",sr=Sr=="after"?mr.begin:mr.end-(/\s/.test(Et.text.charAt(mr.end-1))?2:1);return ar(sr,fr)[fr]}var Nr=qe(Et,o.direction);return Je(Nr,gt||0,Tt==null?_t:Tt,function(cr,Fr,Sr,mr){var fr=Sr=="ltr",sr=ar(cr,fr?"left":"right"),Br=ar(Fr-1,fr?"right":"left"),ui=gt==null&&cr==0,Rn=Tt==null&&Fr==_t,Ar=mr==0,pn=!Nr||mr==Nr.length-1;if(Br.top-sr.top<=3){var xr=(te?ui:Rn)&&Ar,Xa=(te?Rn:ui)&&pn,yn=xr?Z:(fr?sr:Br).left,Wn=Xa?Q:(fr?Br:sr).right;pe(yn,sr.top,Wn-yn,sr.bottom)}else{var Hn,Rr,di,Ya;fr?(Hn=te&&ui&&Ar?Z:sr.left,Rr=te?Q:Gr(cr,Sr,"before"),di=te?Z:Gr(Fr,Sr,"after"),Ya=te&&Rn&&pn?Q:Br.right):(Hn=te?Gr(cr,Sr,"before"):Z,Rr=!te&&ui&&Ar?Q:sr.right,di=!te&&Rn&&pn?Z:Br.left,Ya=te?Gr(Fr,Sr,"after"):Q),pe(Hn,sr.top,Rr-Hn,sr.bottom),sr.bottom<Br.top&&pe(Z,sr.bottom,null,Br.top),pe(di,Br.top,Ya-di,Br.bottom)}(!tr||Ki(sr,tr)<0)&&(tr=sr),Ki(Br,tr)<0&&(tr=Br),(!br||Ki(sr,br)<0)&&(br=sr),Ki(Br,br)<0&&(br=Br)}),{start:tr,end:br}}var Me=t.from(),Oe=t.to();if(Me.line==Oe.line)ye(Me.line,Me.ch,Oe.ch);else{var We=vt(o,Me.line),Ve=vt(o,Oe.line),$e=_r(We)==_r(Ve),rt=ye(Me.line,Me.ch,$e?We.text.length+1:null).end,ut=ye(Oe.line,$e?0:null,Oe.ch).start;$e&&(rt.top<ut.top-2?(pe(rt.right,rt.top,null,rt.bottom),pe(Z,ut.top,ut.left,ut.bottom)):pe(rt.right,rt.top,ut.left-rt.right,rt.bottom)),rt.bottom<ut.top&&pe(Z,rt.bottom,null,ut.top)}n.appendChild(R)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),_&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Zn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,x(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var o=t.view[r],R=e.options.lineWrapping,H=void 0,Z=0;if(o.hidden)continue;if(W&&U<8){var Q=o.node.offsetTop+o.node.offsetHeight;H=Q-n,n=Q}else{var te=o.node.getBoundingClientRect();H=te.bottom-te.top,!R&&o.text.firstChild&&(Z=o.text.firstChild.getBoundingClientRect().right-te.left-1)}var pe=o.line.height-H;if((pe>.005||pe<-.005)&&(Tr(o.line,H),Eo(o.line),o.rest))for(var ye=0;ye<o.rest.length;ye++)Eo(o.rest[ye]);if(Z>e.display.sizerWidth){var Me=Math.ceil(Z/Jn(e.display));Me>e.display.maxLineLength&&(e.display.maxLineLength=Me,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Xi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Hi(e));var o=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,R=Lr(t,r),H=Lr(t,o);if(n&&n.ensure){var Z=n.ensure.from.line,Q=n.ensure.to.line;Z<R?(R=Z,H=Lr(t,on(vt(t,Z))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=H&&(R=Lr(t,on(vt(t,Q))-e.wrapper.clientHeight),H=Q)}return{from:R,to:Math.max(H,R+1)}}function Ys(e,t){if(Xe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),o=null;if(t.top+r.top<0?o=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!f){var R=u("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Hi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+cn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(R),R.scrollIntoView(o),e.display.lineSpace.removeChild(R)}}function $s(e,t,n,r){r==null&&(r=0);var o;!e.options.lineWrapping&&t==n&&(t=t.ch?He(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?He(t.line,t.ch+1,"before"):t);for(var R=0;R<5;R++){var H=!1,Z=sn(e,t),Q=!n||n==t?Z:sn(e,n);o={left:Math.min(Z.left,Q.left),top:Math.min(Z.top,Q.top)-r,right:Math.max(Z.left,Q.left),bottom:Math.max(Z.bottom,Q.bottom)+r};var te=wa(e,o),pe=e.doc.scrollTop,ye=e.doc.scrollLeft;if(te.scrollTop!=null&&(xi(e,te.scrollTop),Math.abs(e.doc.scrollTop-pe)>1&&(H=!0)),te.scrollLeft!=null&&(Fn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-ye)>1&&(H=!0)),!H)break}return o}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&Fn(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,R=fa(e),H={};t.bottom-t.top>R&&(t.bottom=t.top+R);var Z=e.doc.height+ca(n),Q=t.top<r,te=t.bottom>Z-r;if(t.top<o)H.scrollTop=Q?0:t.top;else if(t.bottom>o+R){var pe=Math.min(t.top,(te?Z:t.bottom)-R);pe!=o&&(H.scrollTop=pe)}var ye=e.options.fixedGutter?0:n.gutters.offsetWidth,Me=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ye,Oe=Pn(e)-n.gutters.offsetWidth,We=t.right-t.left>Oe;return We&&(t.right=t.left+Oe),t.left<10?H.scrollLeft=0:t.left<Me?H.scrollLeft=Math.max(0,t.left+ye-(We?0:10)):t.right>Oe+Me-3&&(H.scrollLeft=t.right+(We?0:10)-Oe),H}function Aa(e,t){if(t==null)return;Yi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Qn(e){Yi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,n){(t!=null||n!=null)&&Yi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){Yi(e),e.curOp.scrollToPos=t}function Yi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=co(e,t.from),r=co(e,t.to);Co(e,n,r,t.margin)}}function Co(e,t,n,r){var o=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});bi(e,o.scrollLeft,o.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||Da(e,{top:t}),So(e,t,!0),O&&Da(e),Si(e,100)}function So(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Fn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+cn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Bn=function(e,t,n){this.cm=n;var r=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),Ie(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ie(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var o=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var R=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+R)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Bn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bn.prototype.zeroWidthHack=function(){var e=s&&!m?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Bn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var o=e.getBoundingClientRect(),R=n=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);R!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ci=function(){};Ci.prototype.update=function(){return{bottom:0,right:0}},Ci.prototype.setScrollLeft=function(){},Ci.prototype.setScrollTop=function(){},Ci.prototype.clear=function(){};function qn(e,t){t||(t=Ei(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var o=0;o<4&&n!=e.display.barWidth||r!=e.display.barHeight;o++)n!=e.display.barWidth&&e.options.lineWrapping&&Vi(e),To(e,Ei(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var wo={native:Bn,null:Ci};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&x(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ie(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Fn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Un(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},qr(e.curOp)}function jn(e){var t=e.curOp;t&&Wi(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var o=0;o<t.length;o++)rl(t[o]);for(var R=0;R<t.length;R++)nl(t[R]);for(var H=0;H<t.length;H++)il(t[H])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $i(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vi(t),e.barMeasure=Ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+cn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Pn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&ka(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&bo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fn(t,e.scrollLeft,!0,!0),e.scrollToPos){var o=$s(t,c(r,e.scrollToPos.from),c(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,o)}var R=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(R)for(var Z=0;Z<R.length;++Z)R[Z].lines.length||je(R[Z],"hide");if(H)for(var Q=0;Q<H.length;++Q)H[Q].lines.length&&je(H[Q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&je(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Hr(e,t){if(e.curOp)return t();Un(e);try{return t()}finally{jn(e)}}function vr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Un(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function Dr(e){return function(){if(this.curOp)return e.apply(this,arguments);Un(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function yr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Un(t);try{return e.apply(this,arguments)}finally{jn(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=tt(e,t.highlightFrontier),o=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(R){if(r.line>=e.display.viewFrom){var H=R.styles,Z=R.text.length>e.options.maxHighlightLength?Zt(t.mode,r.state):null,Q=xe(e,R,r,!0);Z&&(r.state=Z),R.styles=Q.styles;var te=R.styleClasses,pe=Q.classes;pe?R.styleClasses=pe:te&&(R.styleClasses=null);for(var ye=!H||H.length!=R.styles.length||te!=pe&&(!te||!pe||te.bgClass!=pe.bgClass||te.textClass!=pe.textClass),Me=0;!ye&&Me<H.length;++Me)ye=H[Me]!=R.styles[Me];ye&&o.push(r.line),R.stateAfter=r.save(),r.nextLine()}else R.text.length<=e.options.maxHighlightLength&&mt(e,R.text,r),R.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),o.length&&Hr(e,function(){for(var R=0;R<o.length;R++)Cn(e,o[R],"text")})}var $i=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Xi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Pn(e),this.force=n,this.dims=xa(e),this.events=[]};$i.prototype.signal=function(e,t){be(e,t)&&this.events.push(arguments)},$i.prototype.finish=function(){for(var e=0;e<this.events.length;e++)je.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=cn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=cn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=I();if(!t||!D(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==I())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Sn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&go(e)==0)return!1;Ro(e)&&(Sn(e),t.dims=xa(e));var o=r.first+r.size,R=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(o,t.visible.to+e.options.viewportMargin);n.viewFrom<R&&R-n.viewFrom<20&&(R=Math.max(r.first,n.viewFrom)),n.viewTo>H&&n.viewTo-H<20&&(H=Math.min(o,n.viewTo)),Or&&(R=xn(e.doc,R),H=Ui(e.doc,H));var Z=R!=n.viewFrom||H!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,R,H),n.viewOffset=on(vt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=go(e);if(!Z&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=sl(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(te),b(n.cursorDiv),b(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Z&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Si(e,400)),n.updateLineNumbers=null,!0}function Lo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Pn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Xi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xi(e.display,e.doc,n));if(!La(e,t))break;Vi(e);var o=Ei(e);yi(e),qn(e,o),ka(e,o),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new $i(e,t);if(La(e,n)){Vi(e),Lo(e,n);var r=Ei(e);yi(e),qn(e,r),ka(e,r),n.finish()}}function ul(e,t,n){var r=e.display,o=e.options.lineNumbers,R=r.lineDiv,H=R.firstChild;function Z(We){var Ve=We.nextSibling;return _&&s&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),Ve}for(var Q=r.view,te=r.viewFrom,pe=0;pe<Q.length;pe++){var ye=Q[pe];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=R){var Me=Ns(e,ye,te,n);R.insertBefore(Me,H)}else{for(;H!=ye.node;)H=Z(H);var Oe=o&&t!=null&&t<=te&&ye.lineNumber;ye.changes&&(le(ye.changes,"gutter")>-1&&(Oe=!1),Ja(e,ye,te,n)),Oe&&(b(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(rn(e.options,te)))),H=ye.node.nextSibling}te+=ye.size}for(;H;)H=Z(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ka(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+cn(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,R=r+"px",H=0;H<n.length;H++)if(!n[H].hidden){e.options.fixedGutter&&(n[H].gutter&&(n[H].gutter.style.left=R),n[H].gutterBackground&&(n[H].gutterBackground.style.left=R));var Z=n[H].alignable;if(Z)for(var Q=0;Q<Z.length;Q++)Z[Q].style.left=R}e.options.fixedGutter&&(t.gutters.style.left=r+o+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=rn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var o=r.measure.appendChild(u("div",[u("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),R=o.firstChild.offsetWidth,H=o.offsetWidth-R;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(R,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,o=0;o<e.length;o++){var R=e[o],H=null;if(typeof R!="string"&&(H=R.style,R=R.className),R=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:R,style:H})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ko(e){var t=e.gutters,n=e.gutterSpecs;b(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var o=n[r],R=o.className,H=o.style,Z=t.appendChild(u("div",null,"CodeMirror-gutter "+R));H&&(Z.style.cssText=H),R=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function Ti(e){ko(e.display),Mr(e),Do(e)}function dl(e,t,n,r){var o=this;this.input=n,o.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=L("div",null,"CodeMirror-code"),o.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=u("div",null,"CodeMirror-cursors"),o.measure=u("div",null,"CodeMirror-measure"),o.lineMeasure=u("div",null,"CodeMirror-measure"),o.lineSpace=L("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var R=L("div",[o.lineSpace],"CodeMirror-lines");o.mover=u("div",[R],null,"position: relative"),o.sizer=u("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=u("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),o.gutters=u("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=u("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=u("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),W&&U<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),!_&&!(O&&i)&&(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Oa(r.gutters,r.lineNumbers),ko(o),n.init(o)}var Ji=0,$r=null;W?$r=-.53:O?$r=15:d?$r=-.7:T&&($r=-1/3);function Oo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function hl(e){var t=Oo(e);return t.x*=$r,t.y*=$r,t}function _o(e,t){var n=Oo(t),r=n.x,o=n.y,R=e.display,H=R.scroller,Z=H.scrollWidth>H.clientWidth,Q=H.scrollHeight>H.clientHeight;if(!(r&&Z||o&&Q))return;if(o&&s&&_){e:for(var te=t.target,pe=R.view;te!=H;te=te.parentNode)for(var ye=0;ye<pe.length;ye++)if(pe[ye].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!O&&!p&&$r!=null){o&&Q&&xi(e,Math.max(0,H.scrollTop+o*$r)),Fn(e,Math.max(0,H.scrollLeft+r*$r)),(!o||o&&Q)&&ne(t),R.wheelStartX=null;return}if(o&&$r!=null){var Me=o*$r,Oe=e.doc.scrollTop,We=Oe+R.wrapper.clientHeight;Me<0?Oe=Math.max(0,Oe+Me-50):We=Math.min(e.doc.height,We+Me+50),Da(e,{top:Oe,bottom:We})}Ji<20&&(R.wheelStartX==null?(R.wheelStartX=H.scrollLeft,R.wheelStartY=H.scrollTop,R.wheelDX=r,R.wheelDY=o,setTimeout(function(){if(R.wheelStartX==null)return;var Ve=H.scrollLeft-R.wheelStartX,$e=H.scrollTop-R.wheelStartY,rt=$e&&R.wheelDY&&$e/R.wheelDY||Ve&&R.wheelDX&&Ve/R.wheelDX;if(R.wheelStartX=R.wheelStartY=null,!rt)return;$r=($r*Ji+rt)/(Ji+1),++Ji},200)):(R.wheelDX+=r,R.wheelDY+=o))}var Jr=function(e,t){this.ranges=e,this.primIndex=t};Jr.prototype.primary=function(){return this.ranges[this.primIndex]},Jr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Pt(n.anchor,r.anchor)||!Pt(n.head,r.head))return!1}return!0},Jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Xt(Kt(this.ranges[t].anchor),Kt(this.ranges[t].head));return new Jr(e,this.primIndex)},Jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Jr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(lt(t,r.from())>=0&<(e,r.to())<=0)return n}return-1};var Xt=function(e,t){this.anchor=e,this.head=t};Xt.prototype.from=function(){return qt(this.anchor,this.head)},Xt.prototype.to=function(){return Yt(this.anchor,this.head)},Xt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ln(e,t,n){var r=e&&e.options.selectionsMayTouch,o=t[n];t.sort(function(Me,Oe){return lt(Me.from(),Oe.from())}),n=le(t,o);for(var R=1;R<t.length;R++){var H=t[R],Z=t[R-1],Q=lt(Z.to(),H.from());if(r&&!H.empty()?Q>0:Q>=0){var te=qt(Z.from(),H.from()),pe=Yt(Z.to(),H.to()),ye=Z.empty()?H.from()==H.head:Z.from()==Z.head;R<=n&&--n,t.splice(--R,2,new Xt(ye?pe:te,ye?te:pe))}}return new Jr(t,n)}function Tn(e,t){return new Jr([new Xt(e,t||e)],0)}function wn(e){return e.text?He(e.from.line+e.text.length-1,re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(lt(e,t.from)<0)return e;if(lt(e,t.to)<=0)return wn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=wn(t).ch-t.to.ch),He(n,r)}function _a(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var o=e.sel.ranges[r];n.push(new Xt(Po(o.anchor,t),Po(o.head,t)))}return ln(e.cm,n,e.sel.primIndex)}function Mo(e,t,n){return e.line==t.line?He(n.line,e.ch-t.ch+n.ch):He(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var r=[],o=He(e.first,0),R=o,H=0;H<t.length;H++){var Z=t[H],Q=Mo(Z.from,o,R),te=Mo(wn(Z),o,R);if(o=Z.to,R=te,n=="around"){var pe=e.sel.ranges[H],ye=lt(pe.head,pe.anchor)<0;r[H]=new Xt(ye?te:Q,ye?Q:te)}else r[H]=new Xt(Q,Q)}return new Jr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Ct(e.options,e.doc.modeOption),wi(e)}function wi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Si(e,100),e.state.modeGen++,e.curOp&&Mr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function o(ut){return n?n[ut]:null}function R(ut,nt,gt){$a(ut,nt,gt,r),Cr(ut,"change",ut,t)}function H(ut,nt){for(var gt=[],Tt=ut;Tt<nt;++Tt)gt.push(new _n(te[Tt],o(Tt),r));return gt}var Z=t.from,Q=t.to,te=t.text,pe=vt(e,Z.line),ye=vt(e,Q.line),Me=re(te),Oe=o(te.length-1),We=Q.line-Z.line;if(t.full)e.insert(0,H(0,te.length)),e.remove(te.length,e.size-te.length);else if(Io(e,t)){var Ve=H(0,te.length-1);R(ye,ye.text,Oe),We&&e.remove(Z.line,We),Ve.length&&e.insert(Z.line,Ve)}else if(pe==ye)if(te.length==1)R(pe,pe.text.slice(0,Z.ch)+Me+pe.text.slice(Q.ch),Oe);else{var $e=H(1,te.length-1);$e.push(new _n(Me+pe.text.slice(Q.ch),Oe,r)),R(pe,pe.text.slice(0,Z.ch)+te[0],o(0)),e.insert(Z.line+1,$e)}else if(te.length==1)R(pe,pe.text.slice(0,Z.ch)+te[0]+ye.text.slice(Q.ch),o(0)),e.remove(Z.line+1,We);else{R(pe,pe.text.slice(0,Z.ch)+te[0],o(0)),R(ye,Me+ye.text.slice(Q.ch),Oe);var rt=H(1,te.length-1);We>1&&e.remove(Z.line+1,We-1),e.insert(Z.line+1,rt)}Cr(e,"change",e,t)}function An(e,t,n){function r(o,R,H){if(o.linked)for(var Z=0;Z<o.linked.length;++Z){var Q=o.linked[Z];if(Q.doc==R)continue;var te=H&&Q.sharedHist;if(n&&!te)continue;t(Q.doc,te),r(Q.doc,o,te)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Pa(e),Fo(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,Mr(e)}function Fo(e){(e.doc.direction=="rtl"?B:x)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Hr(e,function(){Fo(e),Mr(e)})}function Zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:Kt(t.from),to:wn(t),text:kr(e,t.from,t.to)};return jo(e,n,t.from.line,t.to.line+1),An(e,function(r){return jo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=re(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Bo(e.done),re(e.done);if(e.done.length&&!re(e.done).ranges)return re(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),re(e.done)}function Uo(e,t,n,r){var o=e.history;o.undone.length=0;var R=+new Date,H,Z;if((o.lastOp==r||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>R-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(o,o.lastOp==r)))Z=re(H.changes),lt(t.from,t.to)==0&<(t.from,Z.to)==0?Z.to=wn(t):H.changes.push(Ia(e,t));else{var Q=re(o.done);for((!Q||!Q.ranges)&&Qi(e.sel,o.done),H={changes:[Ia(e,t)],generation:o.generation},o.done.push(H);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(n),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=R,o.lastOp=o.lastSelOp=r,o.lastOrigin=o.lastSelOrigin=t.origin,Z||je(e,"historyAdded")}function ml(e,t,n,r){var o=t.charAt(0);return o=="*"||o=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var o=e.history,R=r&&r.origin;n==o.lastSelOp||R&&o.lastSelOrigin==R&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==R||ml(e,R,re(o.done),t))?o.done[o.done.length-1]=t:Qi(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=R,o.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(o.undone)}function Qi(e,t){var n=re(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var o=t["spans_"+e.id],R=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((o||(o=t["spans_"+e.id]={}))[R]=H.markedSpans),++R})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],o=0;o<t.text.length;++o)r.push(vl(n[o]));return r}function Wo(e,t){var n=yl(e,t),r=an(e,t);if(!n)return r;if(!r)return n;for(var o=0;o<n.length;++o){var R=n[o],H=r[o];if(R&&H){e:for(var Z=0;Z<H.length;++Z){for(var Q=H[Z],te=0;te<R.length;++te)if(R[te].marker==Q.marker)continue e;R.push(Q)}}else H&&(n[o]=H)}return n}function ei(e,t,n){for(var r=[],o=0;o<e.length;++o){var R=e[o];if(R.ranges){r.push(n?Jr.prototype.deepCopy.call(R):R);continue}var H=R.changes,Z=[];r.push({changes:Z});for(var Q=0;Q<H.length;++Q){var te=H[Q],pe=void 0;if(Z.push({from:te.from,to:te.to,text:te.text}),t)for(var ye in te)(pe=ye.match(/^spans_(\d+)$/))&&(le(t,Number(pe[1]))>-1&&(re(Z)[ye]=te[ye],delete te[ye]))}}return r}function Na(e,t,n,r){if(r){var o=e.anchor;if(n){var R=lt(t,o)<0;R!=lt(n,o)<0?(o=t,t=n):R!=lt(t,n)<0&&(t=n)}return new Xt(o,t)}else return new Xt(n||t,t)}function qi(e,t,n,r,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),wr(e,new Jr([Na(e.sel.primary(),t,n,o)],0),r)}function Ho(e,t,n){for(var r=[],o=e.cm&&(e.cm.display.shift||e.extend),R=0;R<e.sel.ranges.length;R++)r[R]=Na(e.sel.ranges[R],t[R],null,o);var H=ln(e.cm,r,e.sel.primIndex);wr(e,H,n)}function Fa(e,t,n,r){var o=e.sel.ranges.slice(0);o[t]=n,wr(e,ln(e.cm,o,e.sel.primIndex),r)}function Go(e,t,n,r){wr(e,Tn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(o){this.ranges=[];for(var R=0;R<o.length;R++)this.ranges[R]=new Xt(c(e,o[R].anchor),c(e,o[R].head))},origin:n&&n.origin};return je(e,"beforeSelectionChange",e,r),e.cm&&je(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ln(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,o=re(r);o&&o.ranges?(r[r.length-1]=t,ea(e,t,n)):wr(e,t,n)}function wr(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(be(e,"beforeSelectionChange")||e.cm&&be(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(lt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Qn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ce(e.cm)),Cr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,n,r){for(var o,R=0;R<t.ranges.length;R++){var H=t.ranges[R],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[R],Q=ta(e,H.anchor,Z&&Z.anchor,n,r),te=ta(e,H.head,Z&&Z.head,n,r);(o||Q!=H.anchor||te!=H.head)&&(o||(o=t.ranges.slice(0,R)),o[R]=new Xt(Q,te))}return o?ln(e.cm,o,t.primIndex):t}function ti(e,t,n,r,o){var R=vt(e,t.line);if(R.markedSpans)for(var H=0;H<R.markedSpans.length;++H){var Z=R.markedSpans[H],Q=Z.marker,te="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,pe="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Z.from==null||(te?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(pe?Z.to>=t.ch:Z.to>t.ch))){if(o&&(je(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(R.markedSpans){--H;continue}else break;if(!Q.atomic)continue;if(n){var ye=Q.find(r<0?1:-1),Me=void 0;if((r<0?pe:te)&&(ye=Yo(e,ye,-r,ye&&ye.line==t.line?R:null)),ye&&ye.line==t.line&&(Me=lt(ye,n))&&(r<0?Me<0:Me>0))return ti(e,ye,t,r,o)}var Oe=Q.find(r<0?-1:1);return(r<0?te:pe)&&(Oe=Yo(e,Oe,r,Oe.line==t.line?R:null)),Oe?ti(e,Oe,t,r,o):null}}return t}function ta(e,t,n,r,o){var R=r||1,H=ti(e,t,n,R,o)||!o&&ti(e,t,n,R,!0)||ti(e,t,n,-R,o)||!o&&ti(e,t,n,-R,!0);return H||(e.cantEdit=!0,He(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?c(e,He(t.line-1)):null:n>0&&t.ch==(r||vt(e,t.line)).text.length?t.line<e.first+e.size-1?He(t.line+1,0):null:new He(t.line,t.ch+n)}function $o(e){e.setSelection(He(e.firstLine(),0),He(e.lastLine()),Se)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(o,R,H,Z){o&&(r.from=c(e,o)),R&&(r.to=c(e,R)),H&&(r.text=H),Z!==void 0&&(r.origin=Z)}),je(e,"beforeChange",e,r),e.cm&&je(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ri(e,t,n){if(e.cm){if(!e.cm.curOp)return vr(e.cm,ri)(e,t,n);if(e.cm.state.suppressEdits)return}if((be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Gn&&!n&&kn(e,t.from,t.to);if(r)for(var o=r.length-1;o>=0;--o)Zo(e,{from:r[o].from,to:r[o].to,text:o?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&<(t.from,t.to)==0)return;var n=_a(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),Ai(e,t,n,an(e,t));var r=[];An(e,function(o,R){!R&&le(r,o.history)==-1&&(ts(o.history,t),r.push(o.history)),Ai(o,t,null,an(o,t))})}function ra(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var o=e.history,R,H=e.sel,Z=t=="undo"?o.done:o.undone,Q=t=="undo"?o.undone:o.done,te=0;te<Z.length&&!(R=Z[te],n?R.ranges&&!R.equals(e.sel):!R.ranges);te++);if(te==Z.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(R=Z.pop(),R.ranges){if(Qi(R,Q),n&&!R.equals(e.sel)){wr(e,R,{clearRedo:!1});return}H=R}else if(r){Z.push(R);return}else break;var pe=[];Qi(H,Q),Q.push({changes:pe,generation:o.generation}),o.generation=R.generation||++o.maxGeneration;for(var ye=be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"),Me=function(Ve){var $e=R.changes[Ve];if($e.origin=t,ye&&!Jo(e,$e,!1))return Z.length=0,{};pe.push(Ia(e,$e));var rt=Ve?_a(e,$e):re(Z);Ai(e,$e,rt,Wo(e,$e)),!Ve&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:wn($e)});var ut=[];An(e,function(nt,gt){!gt&&le(ut,nt.history)==-1&&(ts(nt.history,$e),ut.push(nt.history)),Ai(nt,$e,null,Wo(nt,$e))})},Oe=R.changes.length-1;Oe>=0;--Oe){var We=Me(Oe);if(We)return We.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Jr(he(e.sel.ranges,function(o){return new Xt(He(o.anchor.line+t,o.anchor.ch),He(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){Mr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Cn(e.cm,r,"gutter")}}function Ai(e,t,n,r){if(e.cm&&!e.cm.curOp)return vr(e.cm,Ai)(e,t,n,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);Qo(e,o),t={from:He(e.first,0),to:He(t.to.line+o,t.to.ch),text:[re(t.text)],origin:t.origin}}var R=e.lastLine();t.to.line>R&&(t={from:t.from,to:He(R,vt(e,R).text.length),text:[t.text[0]],origin:t.origin}),t.removed=kr(e,t.from,t.to),n||(n=_a(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),ea(e,n,Se),e.cantEdit&&ta(e,He(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,o=e.display,R=t.from,H=t.to,Z=!1,Q=R.line;e.options.lineWrapping||(Q=Ot(_r(vt(r,R.line))),r.iter(Q,H.line+1,function(Oe){if(Oe==o.maxLine)return Z=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ce(e),Ma(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(Q,R.line+t.text.length,function(Oe){var We=Xn(Oe);We>o.maxLineLength&&(o.maxLine=Oe,o.maxLineLength=We,o.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),Qr(r,R.line),Si(e,400);var te=t.text.length-(H.line-R.line)-1;t.full?Mr(e):R.line==H.line&&t.text.length==1&&!Io(e.doc,t)?Cn(e,R.line,"text"):Mr(e,R.line,H.line+1,te);var pe=be(e,"changes"),ye=be(e,"change");if(ye||pe){var Me={from:R,to:H,text:t.text,removed:t.removed,origin:t.origin};ye&&Cr(e,"change",e,Me),pe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Me)}e.display.selForContextMenu=null}function ni(e,t,n,r,o){var R;r||(r=n),lt(r,n)<0&&(R=[r,n],n=R[0],r=R[1]),typeof t=="string"&&(t=e.splitLines(t)),ri(e,{from:n,to:r,text:t,origin:o})}function qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,n,r){for(var o=0;o<e.length;++o){var R=e[o],H=!0;if(R.ranges){R.copied||(R=e[o]=R.deepCopy(),R.copied=!0);for(var Z=0;Z<R.ranges.length;Z++)qo(R.ranges[Z].anchor,t,n,r),qo(R.ranges[Z].head,t,n,r);continue}for(var Q=0;Q<R.changes.length;++Q){var te=R.changes[Q];if(n<te.from.line)te.from=He(te.from.line+r,te.from.ch),te.to=He(te.to.line+r,te.to.ch);else if(t<=te.to.line){H=!1;break}}H||(e.splice(0,o+1),o=0)}}function ts(e,t){var n=t.from.line,r=t.to.line,o=t.text.length-(r-n)-1;es(e.done,n,r,o),es(e.undone,n,r,o)}function Li(e,t,n,r){var o=t,R=t;return typeof t=="number"?R=vt(e,K(e,t)):o=Ot(t),o==null?null:(r(R,o)&&e.cm&&Cn(e.cm,o,n),R)}function Di(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Di.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var o=this.lines[n];this.height-=o.height,da(o),Cr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Ri(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var o=e[r];t+=o.chunkSize(),n+=o.height,o.parent=this}this.size=t,this.height=n,this.parent=null}Ri.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],o=r.chunkSize();if(e<o){var R=Math.min(t,o-e),H=r.height;if(r.removeInner(e,R),this.height-=H-r.height,o==R&&(this.children.splice(n--,1),r.parent=null),(t-=R)==0)break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Di))){var Z=[];this.collapse(Z),this.children=[new Di(Z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var o=this.children[r],R=o.chunkSize();if(e<=R){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var H=o.lines.length%25+25,Z=H;Z<o.lines.length;){var Q=new Di(o.lines.slice(Z,Z+=25));o.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}o.lines=o.lines.slice(0,H),this.maybeSpill()}break}e-=R}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ri(t);if(e.parent){e.size-=n.size,e.height-=n.height;var o=le(e.parent.children,e);e.parent.children.splice(o+1,0,n)}else{var r=new Ri(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var o=this.children[r],R=o.chunkSize();if(e<R){var H=Math.min(t,R-e);if(o.iterN(e,H,n))return!0;if((t-=H)==0)break;e=0}else e-=R}}};var ki=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};ki.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ot(n);if(r==null||!t)return;for(var o=0;o<t.length;++o)t[o]==this&&t.splice(o--,1);t.length||(n.widgets=null);var R=gi(this);Tr(n,Math.max(0,n.height-R)),e&&(Hr(e,function(){rs(e,n,-R),Cn(e,r,"widget")}),Cr(e,"lineWidgetCleared",e,this,r))},ki.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var o=gi(this)-t;if(!o)return;Wr(this.doc,r)||Tr(r,r.height+o),n&&Hr(n,function(){n.curOp.forceUpdate=!0,rs(n,r,o),Cr(n,"lineWidgetChanged",n,e,Ot(r))})},Ee(ki);function rs(e,t,n){on(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,n)}function El(e,t,n,r){var o=new ki(e,n,r),R=e.cm;return R&&o.noHScroll&&(R.display.alignWidgets=!0),Li(e,t,"widget",function(H){var Z=H.widgets||(H.widgets=[]);if(o.insertAt==null?Z.push(o):Z.splice(Math.min(Z.length-1,Math.max(0,o.insertAt)),0,o),o.line=H,R&&!Wr(e,H)){var Q=on(H)<e.scrollTop;Tr(H,H.height+gi(o)),Q&&Aa(R,o.height),R.curOp.forceUpdate=!0}return!0}),R&&Cr(R,"lineWidgetAdded",R,o,typeof t=="number"?t:Ot(t)),o}var ns=0,Ln=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};Ln.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Un(e),be(this,"clear")){var n=this.find();n&&Cr(this,"clear",n.from,n.to)}for(var r=null,o=null,R=0;R<this.lines.length;++R){var H=this.lines[R],Z=nn(H.markedSpans,this);e&&!this.collapsed?Cn(e,Ot(H),"text"):e&&(Z.to!=null&&(o=Ot(H)),Z.from!=null&&(r=Ot(H))),H.markedSpans=mn(H.markedSpans,Z),Z.from==null&&this.collapsed&&!Wr(this.doc,H)&&e&&Tr(H,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var te=_r(this.lines[Q]),pe=Xn(te);pe>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=pe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Mr(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Cr(e,"markerCleared",e,this,r,o),t&&jn(e),this.parent&&this.parent.clear()},Ln.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,o=0;o<this.lines.length;++o){var R=this.lines[o],H=nn(R.markedSpans,this);if(H.from!=null&&(n=He(t?R:Ot(R),H.from),e==-1))return n;if(H.to!=null&&(r=He(t?R:Ot(R),H.to),e==1))return r}return n&&{from:n,to:r}},Ln.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Hr(r,function(){var o=t.line,R=Ot(t.line),H=pa(r,R);if(H&&(oo(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Wr(n.doc,o)&&n.height!=null){var Z=n.height;n.height=null;var Q=gi(n)-Z;Q&&Tr(o,o.height+Q)}Cr(r,"markerChanged",r,e)})},Ln.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||le(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ln.prototype.detachLine=function(e){if(this.lines.splice(le(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ee(Ln);function ii(e,t,n,r,o){if(r&&r.shared)return Cl(e,t,n,r,o);if(e.cm&&!e.cm.curOp)return vr(e.cm,ii)(e,t,n,r,o);var R=new Ln(e,o),H=lt(t,n);if(r&&N(r,R,!1),H>0||H==0&&R.clearWhenEmpty!==!1)return R;if(R.replacedWith&&(R.collapsed=!0,R.widgetNode=L("span",[R.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||R.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(R.widgetNode.insertLeft=!0)),R.collapsed){if(lr(e,t.line,t,n,R)||t.line!=n.line&&lr(e,n.line,t,n,R))throw new Error("Inserting collapsed marker partially overlapping an existing one");jr()}R.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Z=t.line,Q=e.cm,te;if(e.iter(Z,n.line+1,function(ye){Q&&R.collapsed&&!Q.options.lineWrapping&&_r(ye)==Q.display.maxLine&&(te=!0),R.collapsed&&Z!=t.line&&Tr(ye,0),dn(ye,new bn(R,Z==t.line?t.ch:null,Z==n.line?n.ch:null)),++Z}),R.collapsed&&e.iter(t.line,n.line+1,function(ye){Wr(e,ye)&&Tr(ye,0)}),R.clearOnEnter&&Ie(R,"beforeCursorEnter",function(){return R.clear()}),R.readOnly&&(Xr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),R.collapsed&&(R.id=++ns,R.atomic=!0),Q){if(te&&(Q.curOp.updateMaxLine=!0),R.collapsed)Mr(Q,t.line,n.line+1);else if(R.className||R.startStyle||R.endStyle||R.css||R.attributes||R.title)for(var pe=t.line;pe<=n.line;pe++)Cn(Q,pe,"text");R.atomic&&Vo(Q.doc),Cr(Q,"markerAdded",Q,R)}return R}var Oi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Oi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Cr(this,"clear")},Oi.prototype.find=function(e,t){return this.primary.find(e,t)},Ee(Oi);function Cl(e,t,n,r,o){r=N(r),r.shared=!1;var R=[ii(e,t,n,r,o)],H=R[0],Z=r.widgetNode;return An(e,function(Q){Z&&(r.widgetNode=Z.cloneNode(!0)),R.push(ii(Q,c(Q,t),c(Q,n),r,o));for(var te=0;te<Q.linked.length;++te)if(Q.linked[te].isParent)return;H=re(R)}),new Oi(R,H)}function is(e){return e.findMarks(He(e.first,0),e.clipPos(He(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],o=r.find(),R=e.clipPos(o.from),H=e.clipPos(o.to);if(lt(R,H)){var Z=ii(e,R,H,r.primary,r.primary.type);r.markers.push(Z),Z.parent=r}}}function Tl(e){for(var t=function(r){var o=e[r],R=[o.primary.doc];An(o.primary.doc,function(Q){return R.push(Q)});for(var H=0;H<o.markers.length;H++){var Z=o.markers[H];le(R,Z.doc)==-1&&(Z.parent=null,o.markers.splice(H--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Ir=function(e,t,n,r,o){if(!(this instanceof Ir))return new Ir(e,t,n,r,o);n==null&&(n=0),Ri.call(this,[new Di([new _n("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var R=He(n,0);this.sel=Tn(R),this.history=new Zi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=o=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:R,to:R,text:e}),wr(this,Tn(R),Se)};Ir.prototype=oe(Ri.prototype,{constructor:Ir,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:yr(function(e){var t=He(this.first,0),n=this.first+this.size-1;ri(this,{from:t,to:He(n,vt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),wr(this,Tn(t),Se)}),replaceRange:function(e,t,n,r){t=c(this,t),n=n?c(this,n):t,ni(this,e,t,n,r)},getRange:function(e,t,n){var r=kr(this,c(this,e),c(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(zr(this,e))return vt(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=vt(this,e)),_r(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return c(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:yr(function(e,t,n){Go(this,c(this,typeof e=="number"?He(e,t||0):e),null,n)}),setSelection:yr(function(e,t,n){Go(this,c(this,e),c(this,t||e),n)}),extendSelection:yr(function(e,t,n){qi(this,c(this,e),t&&c(this,t),n)}),extendSelections:yr(function(e,t){Ho(this,z(this,e),t)}),extendSelectionsBy:yr(function(e,t){var n=he(this.sel.ranges,e);Ho(this,z(this,n),t)}),setSelections:yr(function(e,t,n){if(!e.length)return;for(var r=[],o=0;o<e.length;o++)r[o]=new Xt(c(this,e[o].anchor),c(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),wr(this,ln(this.cm,r,t),n)}),addSelection:yr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Xt(c(this,e),c(this,t||e))),wr(this,ln(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var o=kr(this,t[r].from(),t[r].to());n=n?n.concat(o):o}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var o=kr(this,n[r].from(),n[r].to());e!==!1&&(o=o.join(e||this.lineSeparator())),t[r]=o}return t},replaceSelection:function(e,t,n){for(var r=[],o=0;o<this.sel.ranges.length;o++)r[o]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:yr(function(e,t,n){for(var r=[],o=this.sel,R=0;R<o.ranges.length;R++){var H=o.ranges[R];r[R]={from:H.from(),to:H.to(),text:this.splitLines(e[R]),origin:n}}for(var Z=t&&t!="end"&&cl(this,r,t),Q=r.length-1;Q>=0;Q--)ri(this,r[Q]);Z?zo(this,Z):this.cm&&Qn(this.cm)}),undo:yr(function(){ra(this,"undo")}),redo:yr(function(){ra(this,"redo")}),undoSelection:yr(function(){ra(this,"undo",!0)}),redoSelection:yr(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Zi(this.history.maxGeneration),An(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ei(this.history.done),undone:ei(this.history.undone)}},setHistory:function(e){var t=this.history=new Zi(this.history.maxGeneration);t.done=ei(e.done.slice(0),null,!0),t.undone=ei(e.undone.slice(0),null,!0)},setGutterMarker:yr(function(e,t,n){return Li(this,e,"gutter",function(r){var o=r.gutterMarkers||(r.gutterMarkers={});return o[t]=n,!n&&_e(o)&&(r.gutterMarkers=null),!0})}),clearGutter:yr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Li(t,n,"gutter",function(){return n.gutterMarkers[e]=null,_e(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!zr(this,e))return null;if(t=e,e=vt(this,e),!e)return null}else if(t=Ot(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:yr(function(e,t,n){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[o])r[o]=n;else{if(w(n).test(r[o]))return!1;r[o]+=" "+n}return!0})}),removeLineClass:yr(function(e,t,n){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",R=r[o];if(R)if(n==null)r[o]=null;else{var H=R.match(w(n));if(!H)return!1;var Z=H.index+H[0].length;r[o]=R.slice(0,H.index)+(!H.index||Z==R.length?"":" ")+R.slice(Z)||null}else return!1;return!0})}),addLineWidget:yr(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ii(this,c(this,e),c(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=c(this,e),ii(this,e,e,n,"bookmark")},findMarksAt:function(e){e=c(this,e);var t=[],n=vt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var o=n[r];(o.from==null||o.from<=e.ch)&&(o.to==null||o.to>=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,n){e=c(this,e),t=c(this,t);var r=[],o=e.line;return this.iter(e.line,t.line+1,function(R){var H=R.markedSpans;if(H)for(var Z=0;Z<H.length;Z++){var Q=H[Z];!(Q.to!=null&&o==e.line&&e.ch>=Q.to||Q.from==null&&o!=e.line||Q.from!=null&&o==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++o}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(o){var R=o.text.length+r;if(R>e)return t=e,!0;e-=R,++n}),c(this,He(n,t))},indexFromPos:function(e){e=c(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Ir(tn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Ir(tn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,is(this)),r},unlinkDoc:function(e){if(e instanceof ir&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(is(this));break}if(e.history==this.history){var r=[e.id];An(e,function(o){return r.push(o.id)},!0),e.history=new Zi(null),e.history.done=ei(this.history.done,r),e.history.undone=ei(this.history.undone,r)}},iterLinkedDocs:function(e){An(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):wt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:yr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Ir.prototype.eachLine=Ir.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),Xe(t,e)||gn(t.display,e))return;ne(e),W&&(as=+new Date);var n=In(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var o=r.length,R=Array(o),H=0,Z=function(){++H==o&&vr(t,function(){n=c(t.doc,n);var Oe={from:n,to:n,text:t.doc.splitLines(R.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};ri(t.doc,Oe),zo(t.doc,Tn(c(t.doc,n),c(t.doc,wn(Oe))))})()},Q=function(Oe,We){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,Oe.type)==-1){Z();return}var Ve=new FileReader;Ve.onerror=function(){return Z()},Ve.onload=function(){var $e=Ve.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){Z();return}R[We]=$e,Z()},Ve.readAsText(Oe)},te=0;te<r.length;te++)Q(r[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var pe=e.dataTransfer.getData("Text");if(pe){var ye;if(t.state.draggingText&&!t.state.draggingText.copy&&(ye=t.listSelections()),ea(t.doc,Tn(n,n)),ye)for(var Me=0;Me<ye.length;++Me)ni(t.doc,"",ye[Me].anchor,ye[Me].head,"drag");t.replaceSelection(pe,"around","paste"),t.display.input.focus()}}catch(Oe){}}}function Ll(e,t){if(W&&(!e.state.draggingText||+new Date-as<100)){ve(t);return}if(Xe(e,t)||gn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!T){var n=u("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),p&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=In(e,t);if(!n)return;var r=document.createDocumentFragment();yo(e,n,r),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),h(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var o=t[r].CodeMirror;o&&n.push(o)}n.length&&n[0].operation(function(){for(var R=0;R<n.length;R++)e(n[R])})}var ls=!1;function Rl(){if(ls)return;kl(),ls=!0}function kl(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ol)},100))}),Ie(window,"blur",function(){return ss(Zn)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Dn={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},_i=0;_i<10;_i++)Dn[_i+48]=Dn[_i+96]=String(_i);for(var na=65;na<=90;na++)Dn[na]=String.fromCharCode(na);for(var Pi=1;Pi<=12;Pi++)Dn[Pi+111]=Dn[Pi+63235]="F"+Pi;var vn={};vn.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},vn.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},vn.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},vn.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},vn.default=s?vn.macDefault:vn.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,o,R,H=0;H<t.length-1;H++){var Z=t[H];if(/^(cmd|meta|m)$/i.test(Z))R=!0;else if(/^a(lt)?$/i.test(Z))n=!0;else if(/^(c|ctrl|control)$/i.test(Z))r=!0;else if(/^s(hift)?$/i.test(Z))o=!0;else throw new Error("Unrecognized modifier name: "+Z)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),R&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var o=he(n.split(" "),_l),R=0;R<o.length;R++){var H=void 0,Z=void 0;R==o.length-1?(Z=o.join(" "),H=r):(Z=o.slice(0,R+1).join(" "),H="...");var Q=t[Z];if(!Q)t[Z]=H;else if(Q!=H)throw new Error("Inconsistent bindings for "+Z)}delete e[n]}for(var te in t)e[te]=t[te];return e}function ai(e,t,n,r){t=ia(t);var o=t.call?t.call(e,r):t[e];if(o===!1)return"nothing";if(o==="...")return"multi";if(o!=null&&n(o))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ai(e,t.fallthrough,n,r);for(var R=0;R<t.fallthrough.length;R++){var H=ai(e,t.fallthrough[R],n,r);if(H)return H}}}function us(e){var t=typeof e=="string"?e:Dn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(v?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(v?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(p&&e.keyCode==34&&e.char)return!1;var n=Dn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ds(n,e,t))}function ia(e){return typeof e=="string"?vn[e]:e}function oi(e,t){for(var n=e.doc.sel.ranges,r=[],o=0;o<n.length;o++){for(var R=t(n[o]);r.length&<(R.from,re(r).to)<=0;){var H=r.pop();if(lt(H.from,R.from)<0){R.from=H.from;break}}r.push(R)}Hr(e,function(){for(var Z=r.length-1;Z>=0;Z--)ni(e.doc,"",r[Z].from,r[Z].to,"+delete");Qn(e)})}function Ba(e,t,n){var r=Be(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ua(e,t,n){var r=Ba(e,t.ch,n);return r==null?null:new He(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,o){if(e){t.doc.direction=="rtl"&&(o=-o);var R=qe(n,t.doc.direction);if(R){var H=o<0?re(R):R[0],Z=o<0==(H.level==1),Q=Z?"after":"before",te;if(H.level>0||t.doc.direction=="rtl"){var pe=Yn(t,n);te=o<0?n.text.length-1:0;var ye=fn(t,pe,te).top;te=et(function(Me){return fn(t,pe,Me).top==ye},o<0==(H.level==1)?H.from:H.to-1,te),Q=="before"&&(te=Ba(n,te,1))}else te=o<0?H.to:H.from;return new He(r,te,Q)}}return new He(r,o<0?n.text.length:0,o<0?"before":"after")}function Ml(e,t,n,r){var o=qe(t,e.doc.direction);if(!o)return Ua(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var R=Ye(o,n.ch,n.sticky),H=o[R];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>n.ch:H.from<n.ch))return Ua(t,n,r);var Z=function(rt,ut){return Ba(t,rt instanceof He?rt.ch:rt,ut)},Q,te=function(rt){return e.options.lineWrapping?(Q=Q||Yn(e,t),po(e,t,Q,rt)):{begin:0,end:t.text.length}},pe=te(n.sticky=="before"?Z(n,-1):n.ch);if(e.doc.direction=="rtl"||H.level==1){var ye=H.level==1==r<0,Me=Z(n,ye?1:-1);if(Me!=null&&(ye?Me<=H.to&&Me<=pe.end:Me>=H.from&&Me>=pe.begin)){var Oe=ye?"before":"after";return new He(n.line,Me,Oe)}}var We=function(rt,ut,nt){for(var gt=function(tr,br){return br?new He(n.line,Z(tr,1),"before"):new He(n.line,tr,"after")};rt>=0&&rt<o.length;rt+=ut){var Tt=o[rt],Et=ut>0==(Tt.level!=1),_t=Et?nt.begin:Z(nt.end,-1);if(Tt.from<=_t&&_t<Tt.to)return gt(_t,Et);if(_t=Et?Tt.from:Z(Tt.to,-1),nt.begin<=_t&&_t<nt.end)return gt(_t,Et)}},Ve=We(R+r,r,pe);if(Ve)return Ve;var $e=r>0?pe.end:Z(pe.begin,-1);return $e!=null&&!(r>0&&$e==t.text.length)&&(Ve=We(r>0?0:o.length-1,r,te($e)),Ve)?Ve:null}var Mi={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return oi(e,function(t){if(t.empty()){var n=vt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:He(t.head.line+1,0)}:{from:t.head,to:He(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return oi(e,function(t){return{from:He(t.from().line,0),to:c(e.doc,He(t.to().line+1,0))}})},delLineLeft:function(e){return oi(e,function(t){return{from:He(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(He(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(He(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Le)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Le)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},Le)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,o=0;o<n.length;o++){var R=n[o].from(),H=Y(e.getLine(R.line),R.ch,r);t.push(de(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var o=t[r].head,R=vt(e.doc,o.line).text;if(R){if(o.ch==R.length&&(o=new He(o.line,o.ch-1)),o.ch>0)o=new He(o.line,o.ch+1),e.replaceRange(R.charAt(o.ch-1)+R.charAt(o.ch-2),He(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var H=vt(e.doc,o.line-1).text;H&&(o=new He(o.line,1),e.replaceRange(R.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),He(o.line-1,H.length-1),o,"+transpose"))}}n.push(new Xt(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Qn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var n=vt(e.doc,t),r=_r(n);return r!=n&&(t=Ot(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=vt(e.doc,t),r=Kn(n);return r!=n&&(t=Ot(r)),ja(!0,e,n,t,-1)}function fs(e,t){var n=cs(e,t.line),r=vt(e.doc,n.line),o=qe(r,e.doc.direction);if(!o||o[0].level==0){var R=Math.max(n.ch,r.text.search(/\S/)),H=t.line==n.line&&t.ch<=R&&t.ch;return He(n.line,H?0:R,n.sticky)}return n}function aa(e,t,n){if(typeof t=="string"&&(t=Mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),o=t(e)!=Pe}finally{e.display.shift=r,e.state.suppressEdits=!1}return o}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var o=ai(t,e.state.keyMaps[r],n,e);if(o)return o}return e.options.extraKeys&&ai(t,e.options.extraKeys,n,e)||ai(t,e.options.keyMap,n,e)}var Fl=new ee;function Ii(e,t,n,r){var o=e.state.keySeq;if(o){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==o&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,o+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var o=Nl(e,t,r);return o=="multi"&&(e.state.keySeq=t),o=="handled"&&Cr(e,"keyHandled",e,t,n),(o=="handled"||o=="multi")&&(ne(n),Sa(e)),!!o}function ms(e,t){var n=hs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ii(e,"Shift-"+n,t,function(r){return aa(e,r,!0)})||Ii(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):Ii(e,n,t,function(r){return aa(e,r)}):!1}function Bl(e,t,n){return Ii(e,"'"+n+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=I(),Xe(t,e))return;W&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ms(t,e);p&&(Wa=r?n:null,!r&&n==88&&!zt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(x(t,"CodeMirror-crosshair"),st(document,"keyup",n),st(document,"mouseover",n))}Ie(document,"keyup",n),Ie(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Xe(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(gn(t.display,e)||Xe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(p&&n==Wa){Wa=null,ne(e);return}if(p&&(!e.which||e.which<10)&&ms(t,e))return;var o=String.fromCharCode(r==null?n:r);if(o=="\b")return;if(Bl(t,e,o))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&<(t,this.pos)==0&&n==this.button};var Ni,Fi;function Wl(e,t){var n=+new Date;return Fi&&Fi.compare(n,e,t)?(Ni=Fi=null,"triple"):Ni&&Ni.compare(n,e,t)?(Fi=new Ha(n,e,t),Ni=null,"double"):(Ni=new Ha(n,e,t),Fi=null,"single")}function bs(e){var t=this,n=t.display;if(Xe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,gn(n,e)){_||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=In(t,e),o=ke(e),R=r?Wl(r,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,o,r,R,e))return;o==1?r?zl(t,r,R,e):Ne(e)==n.scroller&&ne(e):o==2?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):o==3&&(k?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,o){var R="Click";return r=="double"?R="Double"+R:r=="triple"&&(R="Triple"+R),R=(t==1?"Left":t==2?"Middle":"Right")+R,Ii(e,ds(R,o),o,function(H){if(typeof H=="string"&&(H=Mi[H]),!H)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=H(e,n)!=Pe}finally{e.state.suppressEdits=!1}return Z})}function Gl(e,t,n){var r=e.getOption("configureMouse"),o=r?r(e,t,n):{};if(o.unit==null){var R=l?n.shiftKey&&n.metaKey:n.altKey;o.unit=R?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||n.shiftKey),o.addNew==null&&(o.addNew=s?n.metaKey:n.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(s?n.altKey:n.ctrlKey)),o}function zl(e,t,n,r){W?setTimeout(M(bo,e),0):e.curOp.focus=I();var o=Gl(e,n,r),R=e.doc.sel,H;e.options.dragDrop&&ze&&!e.isReadOnly()&&n=="single"&&(H=R.contains(t))>-1&&(lt((H=R.ranges[H]).from(),t)<0||t.xRel>0)&&(lt(H.to(),t)>0||t.xRel<0)?Kl(e,r,t,o):Vl(e,r,t,o)}function Kl(e,t,n,r){var o=e.display,R=!1,H=vr(e,function(te){_&&(o.scroller.draggable=!1),e.state.draggingText=!1,st(o.wrapper.ownerDocument,"mouseup",H),st(o.wrapper.ownerDocument,"mousemove",Z),st(o.scroller,"dragstart",Q),st(o.scroller,"drop",H),R||(ne(te),r.addNew||qi(e.doc,n,null,null,r.extend),_&&!T||W&&U==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),Z=function(te){R=R||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Q=function(){return R=!0};_&&(o.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Ie(o.wrapper.ownerDocument,"mouseup",H),Ie(o.wrapper.ownerDocument,"mousemove",Z),Ie(o.scroller,"dragstart",Q),Ie(o.scroller,"drop",H),xo(e),setTimeout(function(){return o.input.focus()},20)}function xs(e,t,n){if(n=="char")return new Xt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Xt(He(t.line,0),c(e.doc,He(t.line+1,0)));var r=n(e,t);return new Xt(r.from,r.to)}function Vl(e,t,n,r){var o=e.display,R=e.doc;ne(t);var H,Z,Q=R.sel,te=Q.ranges;if(r.addNew&&!r.extend?(Z=R.sel.contains(n),Z>-1?H=te[Z]:H=new Xt(n,n)):(H=R.sel.primary(),Z=R.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new Xt(n,n)),n=In(e,t,!0,!0),Z=-1;else{var pe=xs(e,n,r.unit);r.extend?H=Na(H,pe.anchor,pe.head,r.extend):H=pe}r.addNew?Z==-1?(Z=te.length,wr(R,ln(e,te.concat([H]),Z),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Z].empty()&&r.unit=="char"&&!r.extend?(wr(R,ln(e,te.slice(0,Z).concat(te.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),Q=R.sel):Fa(R,Z,H,De):(Z=0,wr(R,new Jr([H],0),De),Q=R.sel);var ye=n;function Me(nt){if(lt(ye,nt)==0)return;if(ye=nt,r.unit=="rectangle"){for(var gt=[],Tt=e.options.tabSize,Et=Y(vt(R,n.line).text,n.ch,Tt),_t=Y(vt(R,nt.line).text,nt.ch,Tt),tr=Math.min(Et,_t),br=Math.max(Et,_t),ar=Math.min(n.line,nt.line),Gr=Math.min(e.lastLine(),Math.max(n.line,nt.line));ar<=Gr;ar++){var Nr=vt(R,ar).text,cr=Ae(Nr,tr,Tt);tr==br?gt.push(new Xt(He(ar,cr),He(ar,cr))):Nr.length>cr&>.push(new Xt(He(ar,cr),He(ar,Ae(Nr,br,Tt))))}gt.length||gt.push(new Xt(n,n)),wr(R,ln(e,Q.ranges.slice(0,Z).concat(gt),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var Fr=H,Sr=xs(e,nt,r.unit),mr=Fr.anchor,fr;lt(Sr.anchor,mr)>0?(fr=Sr.head,mr=qt(Fr.from(),Sr.anchor)):(fr=Sr.anchor,mr=Yt(Fr.to(),Sr.head));var sr=Q.ranges.slice(0);sr[Z]=Xl(e,new Xt(c(R,mr),fr)),wr(R,ln(e,sr,Z),De)}}var Oe=o.wrapper.getBoundingClientRect(),We=0;function Ve(nt){var gt=++We,Tt=In(e,nt,!0,r.unit=="rectangle");if(!Tt)return;if(lt(Tt,ye)!=0){e.curOp.focus=I(),Me(Tt);var Et=Xi(o,R);(Tt.line>=Et.to||Tt.line<Et.from)&&setTimeout(vr(e,function(){We==gt&&Ve(nt)}),150)}else{var _t=nt.clientY<Oe.top?-20:nt.clientY>Oe.bottom?20:0;_t&&setTimeout(vr(e,function(){if(We!=gt)return;o.scroller.scrollTop+=_t,Ve(nt)}),50)}}function $e(nt){e.state.selectingText=!1,We=Infinity,nt&&(ne(nt),o.input.focus()),st(o.wrapper.ownerDocument,"mousemove",rt),st(o.wrapper.ownerDocument,"mouseup",ut),R.history.lastSelOrigin=null}var rt=vr(e,function(nt){nt.buttons===0||!ke(nt)?$e(nt):Ve(nt)}),ut=vr(e,$e);e.state.selectingText=ut,Ie(o.wrapper.ownerDocument,"mousemove",rt),Ie(o.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var n=t.anchor,r=t.head,o=vt(e.doc,n.line);if(lt(n,r)==0&&n.sticky==r.sticky)return t;var R=qe(o);if(!R)return t;var H=Ye(R,n.ch,n.sticky),Z=R[H];if(Z.from!=n.ch&&Z.to!=n.ch)return t;var Q=H+(Z.from==n.ch==(Z.level!=1)?0:1);if(Q==0||Q==R.length)return t;var te;if(r.line!=n.line)te=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var pe=Ye(R,r.ch,r.sticky),ye=pe-H||(r.ch-n.ch)*(Z.level==1?-1:1);pe==Q-1||pe==Q?te=ye<0:te=ye>0}var Me=R[Q+(te?-1:0)],Oe=te==(Me.level==1),We=Oe?Me.from:Me.to,Ve=Oe?"after":"before";return n.ch==We&&n.sticky==Ve?t:new Xt(new He(n.line,We,Ve),r)}function Es(e,t,n,r){var o,R;if(t.touches)o=t.touches[0].clientX,R=t.touches[0].clientY;else try{o=t.clientX,R=t.clientY}catch(Me){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ne(t);var H=e.display,Z=H.lineDiv.getBoundingClientRect();if(R>Z.bottom||!be(e,n))return ce(t);R-=Z.top-H.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=H.gutters.childNodes[Q];if(te&&te.getBoundingClientRect().right>=o){var pe=Lr(e.doc,R),ye=e.display.gutterSpecs[Q];return je(e,n,e,pe,ye.className,t),ce(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Cs(e,t){if(gn(e.display,t)||Yl(e,t))return;if(Xe(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return be(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var si={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function n(r,o,R,H){e.defaults[r]=o,R&&(t[r]=H?function(Z,Q,te){te!=si&&R(Z,Q,te)}:R)}e.defineOption=n,e.Init=si,n("value","",function(r,o){return r.setValue(o)},!0),n("mode",null,function(r,o){r.doc.modeOption=o,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),Mr(r)},!0),n("lineSeparator",null,function(r,o){if(r.doc.lineSep=o,!o)return;var R=[],H=r.doc.first;r.doc.iter(function(Q){for(var te=0;;){var pe=Q.text.indexOf(o,te);if(pe==-1)break;te=pe+o.length,R.push(He(H,pe))}H++});for(var Z=R.length-1;Z>=0;Z--)ni(r.doc,o,R[Z],He(R[Z].line,R[Z].ch+o.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,o,R){r.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),R!=si&&r.refresh()}),n("specialCharPlaceholder",Wt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,o){return r.getInputField().spellcheck=o},!0),n("autocorrect",!1,function(r,o){return r.getInputField().autocorrect=o},!0),n("autocapitalize",!1,function(r,o){return r.getInputField().autocapitalize=o},!0),n("rtlMoveVisually",!E),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),Ti(r)},!0),n("keyMap","default",function(r,o,R){var H=ia(o),Z=R!=si&&ia(R);Z&&Z.detach&&Z.detach(r,H),H.attach&&H.attach(r,Z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,o){r.display.gutterSpecs=Oa(o,r.options.lineNumbers),Ti(r)},!0),n("fixedGutter",!0,function(r,o){r.display.gutters.style.left=o?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return qn(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,o){r.display.gutterSpecs=Oa(r.options.gutters,o),Ti(r)},!0),n("firstLineNumber",1,Ti,!0),n("lineNumberFormatter",function(r){return r},Ti,!0),n("showCursorWhenSelecting",!1,yi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,o){o=="nocursor"&&(Zn(r),r.display.input.blur()),r.display.input.readOnlyChanged(o)}),n("screenReaderLabel",null,function(r,o){o=o===""?null:o,r.display.input.screenReaderLabelChanged(o)}),n("disableInput",!1,function(r,o){o||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,yi,!0),n("singleCursorHeightPerLine",!0,yi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wi,!0),n("addModeClass",!1,wi,!0),n("pollInterval",100),n("undoDepth",200,function(r,o){return r.doc.history.undoDepth=o}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wi,!0),n("moveInputWithCursor",!0,function(r,o){o||r.display.input.resetPosition()}),n("tabindex",null,function(r,o){return r.display.input.getField().tabIndex=o||""}),n("autofocus",null),n("direction","ltr",function(r,o){return r.doc.setDirection(o)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=si;if(!t!=!r){var o=e.display.dragFunctions,R=t?Ie:st;R(e.display.scroller,"dragstart",o.start),R(e.display.scroller,"dragenter",o.enter),R(e.display.scroller,"dragover",o.over),R(e.display.scroller,"dragleave",o.leave),R(e.display.scroller,"drop",o.drop)}}function Zl(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(x(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Ca(e),Mr(e),vi(e),setTimeout(function(){return qn(e)},100)}function ir(e,t){var n=this;if(!(this instanceof ir))return new ir(e,t);this.options=t=t?N(t):{},N(Ts,t,!1);var r=t.value;typeof r=="string"?r=new Ir(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var o=new ir.inputStyles[t.inputStyle](this),R=this.display=new dl(e,r,o,t);R.wrapper.CodeMirror=this,Ss(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!i&&R.input.focus(),W&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Rl(),Un(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Zn(this);for(var H in oa)oa.hasOwnProperty(H)&&oa[H](this,t[H],si);Ro(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<za.length;++Z)za[Z](this);jn(this),_&&t.lineWrapping&&getComputedStyle(R.lineDiv).textRendering=="optimizelegibility"&&(R.lineDiv.style.textRendering="auto")}ir.defaults=Ts,ir.optionHandlers=oa;function Ql(e){var t=e.display;Ie(t.scroller,"mousedown",vr(e,bs)),W&&U<11?Ie(t.scroller,"dblclick",vr(e,function(Q){if(Xe(e,Q))return;var te=In(e,Q);if(!te||Ga(e,Q)||gn(e.display,Q))return;ne(Q);var pe=e.findWordAt(te);qi(e.doc,pe.anchor,pe.head)})):Ie(t.scroller,"dblclick",function(Q){return Xe(e,Q)||ne(Q)}),Ie(t.scroller,"contextmenu",function(Q){return Cs(e,Q)}),Ie(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Cs(e,Q)});var n,r={end:0};function o(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function R(Q){if(Q.touches.length!=1)return!1;var te=Q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function H(Q,te){if(te.left==null)return!0;var pe=te.left-Q.left,ye=te.top-Q.top;return pe*pe+ye*ye>20*20}Ie(t.scroller,"touchstart",function(Q){if(!Xe(e,Q)&&!R(Q)&&!Ga(e,Q)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(Q){var te=t.activeTouch;if(te&&!gn(t,Q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var pe=e.coordsChar(t.activeTouch,"page"),ye;!te.prev||H(te,te.prev)?ye=new Xt(pe,pe):!te.prev.prev||H(te,te.prev.prev)?ye=e.findWordAt(pe):ye=new Xt(He(pe.line,0),c(e.doc,He(pe.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),ne(Q)}o()}),Ie(t.scroller,"touchcancel",o),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(Q){return _o(e,Q)}),Ie(t.scroller,"DOMMouseScroll",function(Q){return _o(e,Q)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){Xe(e,Q)||ve(Q)},over:function(Q){Xe(e,Q)||(Dl(e,Q),ve(Q))},start:function(Q){return Ll(e,Q)},drop:vr(e,Al),leave:function(Q){Xe(e,Q)||os(e)}};var Z=t.input.getField();Ie(Z,"keyup",function(Q){return vs.call(e,Q)}),Ie(Z,"keydown",vr(e,gs)),Ie(Z,"keypress",vr(e,ys)),Ie(Z,"focus",function(Q){return Ta(e,Q)}),Ie(Z,"blur",function(Q){return Zn(e,Q)})}var za=[];ir.defineInitHook=function(e){return za.push(e)};function Bi(e,t,n,r){var o=e.doc,R;n==null&&(n="add"),n=="smart"&&(o.mode.indent?R=tt(e,t).state:n="prev");var H=e.options.tabSize,Z=vt(o,t),Q=Y(Z.text,null,H);Z.stateAfter&&(Z.stateAfter=null);var te=Z.text.match(/^\s*/)[0],pe;if(!r&&!/\S/.test(Z.text))pe=0,n="not";else if(n=="smart"&&(pe=o.mode.indent(R,Z.text.slice(te.length),Z.text),pe==Pe||pe>150)){if(!r)return;n="prev"}n=="prev"?t>o.first?pe=Y(vt(o,t-1).text,null,H):pe=0:n=="add"?pe=Q+e.options.indentUnit:n=="subtract"?pe=Q-e.options.indentUnit:typeof n=="number"&&(pe=Q+n),pe=Math.max(0,pe);var ye="",Me=0;if(e.options.indentWithTabs)for(var Oe=Math.floor(pe/H);Oe;--Oe)Me+=H,ye+=" ";if(Me<pe&&(ye+=de(pe-Me)),ye!=te)return ni(o,ye,He(t,0),He(t,te.length),"+input"),Z.stateAfter=null,!0;for(var We=0;We<o.sel.ranges.length;We++){var Ve=o.sel.ranges[We];if(Ve.head.line==t&&Ve.head.ch<te.length){var $e=He(t,te.length);Fa(o,We,new Xt($e,$e));break}}}var un=null;function sa(e){un=e}function Ka(e,t,n,r,o){var R=e.doc;e.display.shift=!1,r||(r=R.sel);var H=+new Date-200,Z=o=="paste"||e.state.pasteIncoming>H,Q=wt(t),te=null;if(Z&&r.ranges.length>1)if(un&&un.text.join(`
|
|
`)==t){if(r.ranges.length%un.text.length==0){te=[];for(var pe=0;pe<un.text.length;pe++)te.push(R.splitLines(un.text[pe]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=he(Q,function(rt){return[rt]}));for(var ye=e.curOp.updateInput,Me=r.ranges.length-1;Me>=0;Me--){var Oe=r.ranges[Me],We=Oe.from(),Ve=Oe.to();Oe.empty()&&(n&&n>0?We=He(We.line,We.ch-n):e.state.overwrite&&!Z?Ve=He(Ve.line,Math.min(vt(R,Ve.line).text.length,Ve.ch+re(Q).length)):Z&&un&&un.lineWise&&un.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(We=Ve=He(We.line,0)));var $e={from:We,to:Ve,text:te?te[Me%te.length]:Q,origin:o||(Z?"paste":e.state.cutIncoming>H?"cut":"+input")};ri(e.doc,$e),Cr(e,"inputRead",e,$e)}t&&!Z&&As(e,t),Qn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ye),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Hr(t,function(){return Ka(t,n,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var o=n.ranges[r];if(o.head.ch>100||r&&n.ranges[r-1].head.line==o.head.line)continue;var R=e.getModeAt(o.head),H=!1;if(R.electricChars){for(var Z=0;Z<R.electricChars.length;Z++)if(t.indexOf(R.electricChars.charAt(Z))>-1){H=Bi(e,o.head.line,"smart");break}}else R.electricInput&&(R.electricInput.test(vt(e.doc,o.head.line).text.slice(0,o.head.ch))&&(H=Bi(e,o.head.line,"smart")));H&&Cr(e,"electricInput",e,o.head.line)}}function Ls(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var o=e.doc.sel.ranges[r].head.line,R={anchor:He(o,0),head:He(o+1,0)};n.push(R),t.push(e.getRange(R.anchor,R.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return _?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,o){var R=this.options,H=R[r];if(R[r]==o&&r!="mode")return;R[r]=o,t.hasOwnProperty(r)&&vr(this,t[r])(this,o,H),je(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,o){this.state.keyMaps[o?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var o=this.state.keyMaps,R=0;R<o.length;++R)if(o[R]==r||o[R].name==r)return o.splice(R,1),!0},addOverlay:Dr(function(r,o){var R=r.token?r:e.getMode(this.options,r);if(R.startState)throw new Error("Overlays may not be stateful.");ie(this.state.overlays,{mode:R,modeSpec:r,opaque:o&&o.opaque,priority:o&&o.priority||0},function(H){return H.priority}),this.state.modeGen++,Mr(this)}),removeOverlay:Dr(function(r){for(var o=this.state.overlays,R=0;R<o.length;++R){var H=o[R].modeSpec;if(H==r||typeof r=="string"&&H.name==r){o.splice(R,1),this.state.modeGen++,Mr(this);return}}}),indentLine:Dr(function(r,o,R){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),zr(this.doc,r)&&Bi(this,r,o,R)}),indentSelection:Dr(function(r){for(var o=this.doc.sel.ranges,R=-1,H=0;H<o.length;H++){var Z=o[H];if(Z.empty())Z.head.line>R&&(Bi(this,Z.head.line,r,!0),R=Z.head.line,H==this.doc.sel.primIndex&&Qn(this));else{var Q=Z.from(),te=Z.to(),pe=Math.max(R,Q.line);R=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var ye=pe;ye<R;++ye)Bi(this,ye,r);var Me=this.doc.sel.ranges;Q.ch==0&&o.length==Me.length&&Me[H].from().ch>0&&Fa(this.doc,H,new Xt(Q,Me[H].to()),Se)}}}),getTokenAt:function(r,o){return er(this,r,o)},getLineTokens:function(r,o){return er(this,He(r),o,!0)},getTokenTypeAt:function(r){r=c(this.doc,r);var o=Ge(this,vt(this.doc,r.line)),R=0,H=(o.length-1)/2,Z=r.ch,Q;if(Z==0)Q=o[2];else for(;;){var te=R+H>>1;if((te?o[te*2-1]:0)>=Z)H=te;else if(o[te*2+1]<Z)R=te+1;else{Q=o[te*2+2];break}}var pe=Q?Q.indexOf("overlay "):-1;return pe<0?Q:pe==0?null:Q.slice(0,pe-1)},getModeAt:function(r){var o=this.doc.mode;return o.innerMode?e.innerMode(o,this.getTokenAt(r).state).mode:o},getHelper:function(r,o){return this.getHelpers(r,o)[0]},getHelpers:function(r,o){var R=[];if(!n.hasOwnProperty(o))return R;var H=n[o],Z=this.getModeAt(r);if(typeof Z[o]=="string")H[Z[o]]&&R.push(H[Z[o]]);else if(Z[o])for(var Q=0;Q<Z[o].length;Q++){var te=H[Z[o][Q]];te&&R.push(te)}else Z.helperType&&H[Z.helperType]?R.push(H[Z.helperType]):H[Z.name]&&R.push(H[Z.name]);for(var pe=0;pe<H._global.length;pe++){var ye=H._global[pe];ye.pred(Z,this)&&le(R,ye.val)==-1&&R.push(ye.val)}return R},getStateAfter:function(r,o){var R=this.doc;return r=K(R,r==null?R.first+R.size-1:r),tt(this,r+1,o).state},cursorCoords:function(r,o){var R,H=this.doc.sel.primary();return r==null?R=H.head:typeof r=="object"?R=c(this.doc,r):R=r?H.from():H.to(),sn(this,R,o||"page")},charCoords:function(r,o){return ga(this,c(this.doc,r),o||"page")},coordsChar:function(r,o){return r=ho(this,r,o||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,o){return r=ho(this,{top:r,left:0},o||"page").top,Lr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,o,R){var H=!1,Z;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,H=!0),Z=vt(this.doc,r)}else Z=r;return Gi(this,Z,{top:0,left:0},o||"page",R||H).top+(H?this.doc.height-on(Z):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Jn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,o,R,H,Z){var Q=this.display;r=sn(this,c(this.doc,r));var te=r.bottom,pe=r.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),Q.sizer.appendChild(o),H=="over")te=r.top;else if(H=="above"||H=="near"){var ye=Math.max(Q.wrapper.clientHeight,this.doc.height),Me=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(H=="above"||r.bottom+o.offsetHeight>ye)&&r.top>o.offsetHeight?te=r.top-o.offsetHeight:r.bottom+o.offsetHeight<=ye&&(te=r.bottom),pe+o.offsetWidth>Me&&(pe=Me-o.offsetWidth)}o.style.top=te+"px",o.style.left=o.style.right="",Z=="right"?(pe=Q.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(Z=="left"?pe=0:Z=="middle"&&(pe=(Q.sizer.clientWidth-o.offsetWidth)/2),o.style.left=pe+"px"),R&&Js(this,{left:pe,top:te,right:pe+o.offsetWidth,bottom:te+o.offsetHeight})},triggerOnKeyDown:Dr(gs),triggerOnKeyPress:Dr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Dr(bs),execCommand:function(r){if(Mi.hasOwnProperty(r))return Mi[r].call(null,this)},triggerElectric:Dr(function(r){As(this,r)}),findPosH:function(r,o,R,H){var Z=1;o<0&&(Z=-1,o=-o);for(var Q=c(this.doc,r),te=0;te<o&&!(Q=Va(this.doc,Q,Z,R,H),Q.hitSide);++te);return Q},moveH:Dr(function(r,o){var R=this;this.extendSelectionsBy(function(H){return R.display.shift||R.doc.extend||H.empty()?Va(R.doc,H.head,r,o,R.options.rtlMoveVisually):r<0?H.from():H.to()},Le)}),deleteH:Dr(function(r,o){var R=this.doc.sel,H=this.doc;R.somethingSelected()?H.replaceSelection("",null,"+delete"):oi(this,function(Z){var Q=Va(H,Z.head,r,o,!1);return r<0?{from:Q,to:Z.head}:{from:Z.head,to:Q}})}),findPosV:function(r,o,R,H){var Z=1,Q=H;o<0&&(Z=-1,o=-o);for(var te=c(this.doc,r),pe=0;pe<o;++pe){var ye=sn(this,te,"div");if(Q==null?Q=ye.left:ye.left=Q,te=ks(this,ye,Z,R),te.hitSide)break}return te},moveV:Dr(function(r,o){var R=this,H=this.doc,Z=[],Q=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(pe){if(Q)return r<0?pe.from():pe.to();var ye=sn(R,pe.head,"div");pe.goalColumn!=null&&(ye.left=pe.goalColumn),Z.push(ye.left);var Me=ks(R,ye,r,o);return o=="page"&&pe==H.sel.primary()&&Aa(R,ga(R,Me,"div").top-ye.top),Me},Le),Z.length)for(var te=0;te<H.sel.ranges.length;te++)H.sel.ranges[te].goalColumn=Z[te]}),findWordAt:function(r){var o=this.doc,R=vt(o,r.line).text,H=r.ch,Z=r.ch;if(R){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Z==R.length)&&H?--H:++Z;for(var te=R.charAt(H),pe=we(te,Q)?function(ye){return we(ye,Q)}:/\s/.test(te)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!we(ye)};H>0&&pe(R.charAt(H-1));)--H;for(;Z<R.length&&pe(R.charAt(Z));)++Z}return new Xt(He(r.line,H),He(r.line,Z))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):x(this.display.cursorDiv,"CodeMirror-overwrite"),je(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Dr(function(r,o){bi(this,r,o)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-cn(this)-this.display.barHeight,width:r.scrollWidth-cn(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Pn(this)}},scrollIntoView:Dr(function(r,o){r==null?(r={from:this.doc.sel.primary().head,to:null},o==null&&(o=this.options.cursorScrollMargin)):typeof r=="number"?r={from:He(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=o||0,r.from.line!=null?Zs(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Dr(function(r,o){var R=this,H=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=H(r)),o!=null&&(this.display.wrapper.style.height=H(o)),this.options.lineWrapping&&so(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(Q){if(Q.widgets){for(var te=0;te<Q.widgets.length;te++)if(Q.widgets[te].noHScroll){Cn(R,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,je(this,"refresh",this)}),operation:function(r){return Hr(this,r)},startOperation:function(){return Un(this)},endOperation:function(){return jn(this)},refresh:Dr(function(){var r=this.display.cachedTextHeight;Mr(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-$n(this.display))>.5||this.options.lineWrapping)&&Ca(this),je(this,"refresh",this)}),swapDoc:Dr(function(r){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Cr(this,"swapDoc",this,o),o}),phrase:function(r){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,r)?o[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ee(e),e.registerHelper=function(r,o,R){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][o]=R},e.registerGlobalHelper=function(r,o,R,H){e.registerHelper(r,o,H),n[r]._global.push({pred:R,val:H})}}function Va(e,t,n,r,o){var R=t,H=n,Z=vt(e,t.line),Q=o&&e.direction=="rtl"?-n:n;function te(){var ut=t.line+Q;return ut<e.first||ut>=e.first+e.size?!1:(t=new He(ut,t.ch,t.sticky),Z=vt(e,ut))}function pe(ut){var nt;if(r=="codepoint"){var gt=Z.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(gt)?nt=null:nt=new He(t.line,Math.max(0,Math.min(Z.text.length,t.ch+n*(gt>=55296&><56320?2:1))),-n)}else o?nt=Ml(e.cm,Z,t,n):nt=Ua(Z,t,n);if(nt==null)if(!ut&&te())t=ja(o,e.cm,Z,t.line,Q);else return!1;else t=nt;return!0}if(r=="char"||r=="codepoint")pe();else if(r=="column")pe(!0);else if(r=="word"||r=="group")for(var ye=null,Me=r=="group",Oe=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(n<0&&!pe(!We));We=!1){var Ve=Z.text.charAt(t.ch)||`
|
|
`,$e=we(Ve,Oe)?"w":Me&&Ve==`
|
|
`?"n":!Me||/\s/.test(Ve)?null:"p";if(Me&&!We&&!$e&&($e="s"),ye&&ye!=$e){n<0&&(n=1,pe(),t.sticky="after");break}if($e&&(ye=$e),n>0&&!pe(!We))break}var rt=ta(e,t,R,H,!0);return Pt(R,rt)&&(rt.hitSide=!0),rt}function ks(e,t,n,r){var o=e.doc,R=t.left,H;if(r=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Z-.5*$n(e.display),3);H=(n>0?t.bottom:t.top)+n*Q}else r=="line"&&(H=n>0?t.bottom+3:t.top-3);for(var te;!(te=ya(e,R,H),!te.outside);){if(n<0?H<=0:H>=o.height){te.hitSide=!0;break}H+=n*5}return te}var Qt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Qt.prototype.init=function(e){var t=this,n=this,r=n.cm,o=n.div=e.lineDiv;Ds(o,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function R(Z){for(var Q=Z.target;Q;Q=Q.parentNode){if(Q==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Ie(o,"paste",function(Z){if(!R(Z)||Xe(r,Z)||ws(Z,r))return;U<=11&&setTimeout(vr(r,function(){return t.updateFromDOM()}),20)}),Ie(o,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),Ie(o,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),Ie(o,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(o,"touchstart",function(){return n.forceCompositionEnd()}),Ie(o,"input",function(){t.composing||t.readFromDOMSoon()});function H(Z){if(!R(Z)||Xe(r,Z))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Z.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=Ls(r);sa({lineWise:!0,text:Q.text}),Z.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Se),r.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var te=un.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",te),Z.clipboardData.getData("Text")==te){Z.preventDefault();return}}var pe=Rs(),ye=pe.firstChild;r.display.lineSpace.insertBefore(pe,r.display.lineSpace.firstChild),ye.value=un.text.join(`
|
|
`);var Me=document.activeElement;G(ye),setTimeout(function(){r.display.lineSpace.removeChild(pe),Me.focus(),Me==o&&n.showPrimarySelection()},50)}Ie(o,"copy",H),Ie(o,"cut",H)},Qt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Qt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Qt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Qt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Qt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line<t.display.viewFrom){e.removeAllRanges();return}var R=la(t,e.anchorNode,e.anchorOffset),H=la(t,e.focusNode,e.focusOffset);if(R&&!R.bad&&H&&!H.bad&<(qt(R,H),r)==0&<(Yt(R,H),o)==0)return;var Z=t.display.view,Q=r.line>=t.display.viewFrom&&Os(t,r)||{node:Z[0].measure.map[2],offset:0},te=o.line<t.display.viewTo&&Os(t,o);if(!te){var pe=Z[Z.length-1].measure,ye=pe.maps?pe.maps[pe.maps.length-1]:pe.map;te={node:ye[ye.length-1],offset:ye[ye.length-2]-ye[ye.length-3]}}if(!Q||!te){e.removeAllRanges();return}var Me=e.rangeCount&&e.getRangeAt(0),Oe;try{Oe=S(Q.node,Q.offset,te.offset,te.node)}catch(We){}Oe&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),Oe.collapsed||(e.removeAllRanges(),e.addRange(Oe))):(e.removeAllRanges(),e.addRange(Oe)),Me&&e.anchorNode==null?e.addRange(Me):O&&this.startGracePeriod()),this.rememberSelection()},Qt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Qt.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},Qt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Qt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Qt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Qt.prototype.blur=function(){this.div.blur()},Qt.prototype.getField=function(){return this.div},Qt.prototype.supportsTouch=function(){return!0},Qt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Hr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Qt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Qt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(a&&d&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);n&&r&&Hr(t,function(){wr(t.doc,Tn(n,r),Se),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Qt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),o=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=He(r.line-1,vt(e.doc,r.line-1).length)),o.ch==vt(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=He(o.line+1,0)),r.line<t.viewFrom||o.line>t.viewTo-1)return!1;var R,H,Z;r.line==t.viewFrom||(R=Nn(e,r.line))==0?(H=Ot(t.view[0].line),Z=t.view[0].node):(H=Ot(t.view[R].line),Z=t.view[R-1].node.nextSibling);var Q=Nn(e,o.line),te,pe;if(Q==t.view.length-1?(te=t.viewTo-1,pe=t.lineDiv.lastChild):(te=Ot(t.view[Q+1].line)-1,pe=t.view[Q+1].node.previousSibling),!Z)return!1;for(var ye=e.doc.splitLines(tu(e,Z,pe,H,te)),Me=kr(e.doc,He(H,0),He(te,vt(e.doc,te).text.length));ye.length>1&&Me.length>1;)if(re(ye)==re(Me))ye.pop(),Me.pop(),te--;else if(ye[0]==Me[0])ye.shift(),Me.shift(),H++;else break;for(var Oe=0,We=0,Ve=ye[0],$e=Me[0],rt=Math.min(Ve.length,$e.length);Oe<rt&&Ve.charCodeAt(Oe)==$e.charCodeAt(Oe);)++Oe;for(var ut=re(ye),nt=re(Me),gt=Math.min(ut.length-(ye.length==1?Oe:0),nt.length-(Me.length==1?Oe:0));We<gt&&ut.charCodeAt(ut.length-We-1)==nt.charCodeAt(nt.length-We-1);)++We;if(ye.length==1&&Me.length==1&&H==r.line)for(;Oe&&Oe>r.ch&&ut.charCodeAt(ut.length-We-1)==nt.charCodeAt(nt.length-We-1);)Oe--,We++;ye[ye.length-1]=ut.slice(0,ut.length-We).replace(/^\u200b+/,""),ye[0]=ye[0].slice(Oe).replace(/\u200b+$/,"");var Tt=He(H,Oe),Et=He(te,Me.length?re(Me).length-We:0);if(ye.length>1||ye[0]||lt(Tt,Et))return ni(e.doc,ye,Tt,Et,"+input"),!0},Qt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qt.prototype.reset=function(){this.forceCompositionEnd()},Qt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Qt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Qt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Hr(this.cm,function(){return Mr(e.cm)})},Qt.prototype.setUneditable=function(e){e.contentEditable="false"},Qt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||vr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Qt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Qt.prototype.onContextMenu=function(){},Qt.prototype.resetPosition=function(){},Qt.prototype.needsContentAttribute=!0;function Os(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=vt(e.doc,t.line),o=ro(n,r,t.line),R=qe(r,e.doc.direction),H="left";if(R){var Z=Ye(R,t.ch);H=Z%2?"right":"left"}var Q=ao(o.map,t.ch,H);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function li(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,o){var R="",H=!1,Z=e.doc.lineSeparator(),Q=!1;function te(Oe){return function(We){return We.id==Oe}}function pe(){H&&(R+=Z,Q&&(R+=Z),H=Q=!1)}function ye(Oe){Oe&&(pe(),R+=Oe)}function Me(Oe){if(Oe.nodeType==1){var We=Oe.getAttribute("cm-text");if(We){ye(We);return}var Ve=Oe.getAttribute("cm-marker"),$e;if(Ve){var rt=e.findMarks(He(r,0),He(o+1,0),te(+Ve));rt.length&&($e=rt[0].find(0))&&ye(kr(e.doc,$e.from,$e.to).join(Z));return}if(Oe.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(Oe.nodeName);if(!/^br$/i.test(Oe.nodeName)&&Oe.textContent.length==0)return;ut&&pe();for(var nt=0;nt<Oe.childNodes.length;nt++)Me(Oe.childNodes[nt]);/^(pre|p)$/i.test(Oe.nodeName)&&(Q=!0),ut&&(H=!0)}else Oe.nodeType==3&&ye(Oe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Me(t),t==n);)t=t.nextSibling,Q=!1;return R}function la(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return li(e.clipPos(He(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var o=0;o<e.display.view.length;o++){var R=e.display.view[o];if(R.node==r)return ru(R,t,n)}}function ru(e,t,n){var r=e.text.firstChild,o=!1;if(!t||!D(r,t))return li(He(Ot(e.line),0),!0);if(t==r&&(o=!0,t=r.childNodes[n],n=0,!t)){var R=e.rest?re(e.rest):e.line;return li(He(Ot(R),R.text.length),o)}var H=t.nodeType==3?t:null,Z=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,n&&(n=H.nodeValue.length));Z.parentNode!=r;)Z=Z.parentNode;var Q=e.measure,te=Q.maps;function pe($e,rt,ut){for(var nt=-1;nt<(te?te.length:0);nt++)for(var gt=nt<0?Q.map:te[nt],Tt=0;Tt<gt.length;Tt+=3){var Et=gt[Tt+2];if(Et==$e||Et==rt){var _t=Ot(nt<0?e.line:e.rest[nt]),tr=gt[Tt]+ut;return(ut<0||Et!=$e)&&(tr=gt[Tt+(ut?1:0)]),He(_t,tr)}}}var ye=pe(H,Z,n);if(ye)return li(ye,o);for(var Me=Z.nextSibling,Oe=H?H.nodeValue.length-n:0;Me;Me=Me.nextSibling){if(ye=pe(Me,Me.firstChild,0),ye)return li(He(ye.line,ye.ch-Oe),o);Oe+=Me.textContent.length}for(var We=Z.previousSibling,Ve=n;We;We=We.previousSibling){if(ye=pe(We,We.firstChild,-1),ye)return li(He(ye.line,ye.ch+Ve),o);Ve+=We.textContent.length}}var ur=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};ur.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),y&&(o.style.width="0px"),Ie(o,"input",function(){W&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ie(o,"paste",function(H){if(Xe(r,H)||ws(H,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function R(H){if(Xe(r,H))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Z=Ls(r);sa({lineWise:!0,text:Z.text}),H.type=="cut"?r.setSelections(Z.ranges,null,Se):(n.prevInput="",o.value=Z.text.join(`
|
|
`),G(o))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Ie(o,"cut",R),Ie(o,"copy",R),Ie(e.scroller,"paste",function(H){if(gn(e,H)||Xe(r,H))return;if(!o.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Z=new Event("paste");Z.clipboardData=H.clipboardData,o.dispatchEvent(Z)}),Ie(e.lineSpace,"selectstart",function(H){gn(e,H)||ne(H)}),Ie(o,"compositionstart",function(){var H=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ur.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},ur.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ur.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var o=sn(e,n.sel.primary().head,"div"),R=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+H.top-R.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+H.left-R.left))}return r},ur.prototype.showSelection=function(e){var t=this.cm,n=t.display;h(n.cursorDiv,e.cursors),h(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ur.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&G(this.textarea),W&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&U>=9&&(this.hasSelection=null))},ur.prototype.getField=function(){return this.textarea},ur.prototype.supportsTouch=function(){return!1},ur.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},ur.prototype.blur=function(){this.textarea.blur()},ur.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ur.prototype.receivedFocus=function(){this.slowPoll()},ur.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},ur.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ur.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ft(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=n.value;if(o==r&&!t.somethingSelected())return!1;if(W&&U>=9&&this.hasSelection===o||s&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var R=o.charCodeAt(0);if(R==8203&&!r&&(r="\u200B"),R==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Z=Math.min(r.length,o.length);H<Z&&r.charCodeAt(H)==o.charCodeAt(H);)++H;return Hr(t,function(){Ka(t,o.slice(H),r.length-H,null,e.composing?"*compose":null),o.length>1e3||o.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ur.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ur.prototype.onKeyPress=function(){W&&U>=9&&(this.hasSelection=null),this.fastPoll()},ur.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var R=In(n,e),H=r.scroller.scrollTop;if(!R||p)return;var Z=n.options.resetSelectionOnContextMenu;Z&&n.doc.sel.contains(R)==-1&&vr(n,wr)(n.doc,Tn(R),Se);var Q=o.style.cssText,te=t.wrapper.style.cssText,pe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-pe.top-5)+"px; left: "+(e.clientX-pe.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 ye;_&&(ye=window.scrollY),r.input.focus(),_&&window.scrollTo(null,ye),r.input.reset(),n.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=Oe,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Me(){if(o.selectionStart!=null){var Ve=n.somethingSelected(),$e="\u200B"+(Ve?o.value:"");o.value="\u21DA",o.value=$e,t.prevInput=Ve?"":"\u200B",o.selectionStart=1,o.selectionEnd=$e.length,r.selForContextMenu=n.doc.sel}}function Oe(){if(t.contextMenuPending!=Oe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,o.style.cssText=Q,W&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),o.selectionStart!=null){(!W||W&&U<9)&&Me();var Ve=0,$e=function(){r.selForContextMenu==n.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?vr(n,$o)(n):Ve++<10?r.detectingSelectAll=setTimeout($e,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout($e,200)}}if(W&&U>=9&&Me(),k){ve(e);var We=function(){st(window,"mouseup",We),setTimeout(Oe,20)};Ie(window,"mouseup",We)}else setTimeout(Oe,50)},ur.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ur.prototype.setUneditable=function(){},ur.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?N(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=I();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Z.getValue()}var o;if(e.form&&(Ie(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var R=e.form;o=R.submit;try{var H=R.submit=function(){r(),R.submit=o,R.submit(),R.submit=H}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(st(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var Z=ir(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Z}function iu(e){e.off=st,e.on=Ie,e.wheelEventPixels=hl,e.Doc=Ir,e.splitLines=wt,e.countColumn=Y,e.findColumn=Ae,e.isWordChar=ge,e.Pass=Pe,e.signal=je,e.Line=_n,e.changeEnd=wn,e.scrollbarModel=wo,e.Pos=He,e.cmpPos=lt,e.modes=Ht,e.mimeModes=kt,e.resolveMode=bt,e.getMode=Ct,e.modeExtensions=at,e.extendMode=xt,e.copyState=Zt,e.startState=rr,e.innerMode=nr,e.commands=Mi,e.keyMap=vn,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ai,e.normalizeKeyMap=Pl,e.StringStream=Rt,e.SharedTextMarker=Oi,e.TextMarker=Ln,e.LineWidget=ki,e.e_preventDefault=ne,e.e_stopPropagation=se,e.e_stop=ve,e.addClass=B,e.contains=D,e.rmClass=x,e.keyNames=Dn}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Ir.prototype)Ir.prototype.hasOwnProperty(ua)&&le(au,ua)<0&&(ir.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ir.prototype[ua]));return Ee(Ir),ir.inputStyles={textarea:ur,contenteditable:Qt},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),Ur.apply(this,arguments)},ir.defineMIME=Zr,ir.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ir.defineMIME("text/plain","null"),ir.defineExtension=function(e,t){ir.prototype[e]=t},ir.defineDocExtension=function(e,t){Ir.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},Y1PL:function(pt,Te,q){"use strict";q.r(Te),q.d(Te,"ResizableTextArea",function(){return le});var ue=q("wx14"),J=q("1OyB"),O=q("vuIU"),X=q("Ji7U"),F=q("LK+K"),P=q("q1tI"),W=q("VTBJ"),U=q("rePB"),_=q("Zm9Q"),A=q("Kwbf"),d=q("c+Xe"),p=q("m+aA"),T=q("bdgK"),m=new Map;function f(Se){Se.forEach(function(De){var Le,Ae=De.target;(Le=m.get(Ae))===null||Le===void 0||Le.forEach(function(me){return me(Ae)})})}var y=new T.default(f),a=null,i=null;function s(Se,De){m.has(Se)||(m.set(Se,new Set),y.observe(Se)),m.get(Se).add(De)}function l(Se,De){m.has(Se)&&(m.get(Se).delete(De),m.get(Se).size||(y.unobserve(Se),m.delete(Se)))}var E=function(Se){Object(X.a)(Le,Se);var De=Object(F.a)(Le);function Le(){return Object(J.a)(this,Le),De.apply(this,arguments)}return Object(O.a)(Le,[{key:"render",value:function(){return this.props.children}}]),Le}(P.Component),g=P.createContext(null);function v(Se){var De=Se.children,Le=Se.onBatchResize,Ae=P.useRef(0),me=P.useRef([]),de=P.useContext(g),re=P.useCallback(function(he,ie,Re){Ae.current+=1;var oe=Ae.current;me.current.push({size:he,element:ie,data:Re}),Promise.resolve().then(function(){oe===Ae.current&&(Le==null||Le(me.current),me.current=[])}),de==null||de(he,ie,Re)},[Le,de]);return P.createElement(g.Provider,{value:re},De)}function k(Se){var De=Se.children,Le=Se.disabled,Ae=P.useRef(null),me=P.useRef(null),de=P.useContext(g),re=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=P.isValidElement(De)&&Object(d.c)(De),ie=he?De.ref:null,Re=P.useMemo(function(){return Object(d.a)(ie,Ae)},[ie,Ae]),oe=P.useRef(Se);oe.current=Se;var ae=P.useCallback(function(ge){var we=oe.current,_e=we.onResize,Fe=we.data,Ue=ge.getBoundingClientRect(),Be=Ue.width,et=Ue.height,Je=ge.offsetWidth,Ze=ge.offsetHeight,Ye=Math.floor(Be),dt=Math.floor(et);if(re.current.width!==Ye||re.current.height!==dt||re.current.offsetWidth!==Je||re.current.offsetHeight!==Ze){var qe={width:Ye,height:dt,offsetWidth:Je,offsetHeight:Ze};re.current=qe;var ot=Je===Math.round(Be)?Be:Je,Ie=Ze===Math.round(et)?et:Ze,Qe=Object(W.a)(Object(W.a)({},qe),{},{offsetWidth:ot,offsetHeight:Ie});de==null||de(Qe,ge,Fe),_e&&Promise.resolve().then(function(){_e(Qe,ge)})}},[]);return P.useEffect(function(){var ge=Object(p.a)(Ae.current)||Object(p.a)(me.current);return ge&&!Le&&s(ge,ae),function(){return l(ge,ae)}},[Ae.current,Le]),P.createElement(E,{ref:me},he?P.cloneElement(De,{ref:Re}):De)}var w="rc-observer-key";function x(Se){var De=Se.children,Le=Object(_.a)(De);return Le.map(function(Ae,me){var de=(Ae==null?void 0:Ae.key)||"".concat(w,"-").concat(me);return P.createElement(k,Object(ue.a)({},Se,{key:de}),Ae)})}x.Collection=v;var b=x,h=q("bT9E"),u=q("TSYQ"),L=q.n(u),S=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,D=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],I={},B;function j(Se){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(De&&I[Le])return I[Le];var Ae=window.getComputedStyle(Se),me=Ae.getPropertyValue("box-sizing")||Ae.getPropertyValue("-moz-box-sizing")||Ae.getPropertyValue("-webkit-box-sizing"),de=parseFloat(Ae.getPropertyValue("padding-bottom"))+parseFloat(Ae.getPropertyValue("padding-top")),re=parseFloat(Ae.getPropertyValue("border-bottom-width"))+parseFloat(Ae.getPropertyValue("border-top-width")),he=D.map(function(Re){return"".concat(Re,":").concat(Ae.getPropertyValue(Re))}).join(";"),ie={sizingStyle:he,paddingSize:de,borderSize:re,boxSizing:me};return De&&Le&&(I[Le]=ie),ie}function G(Se){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ae=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),Se.getAttribute("wrap")?B.setAttribute("wrap",Se.getAttribute("wrap")):B.removeAttribute("wrap");var me=j(Se,De),de=me.paddingSize,re=me.borderSize,he=me.boxSizing,ie=me.sizingStyle;B.setAttribute("style","".concat(ie,";").concat(S)),B.value=Se.value||Se.placeholder||"";var Re=Number.MIN_SAFE_INTEGER,oe=Number.MAX_SAFE_INTEGER,ae=B.scrollHeight,ge;if(he==="border-box"?ae+=re:he==="content-box"&&(ae-=de),Le!==null||Ae!==null){B.value=" ";var we=B.scrollHeight-de;Le!==null&&(Re=we*Le,he==="border-box"&&(Re=Re+de+re),ae=Math.max(Re,ae)),Ae!==null&&(oe=we*Ae,he==="border-box"&&(oe=oe+de+re),ge=ae>oe?"":"hidden",ae=Math.min(oe,ae))}return{height:ae,minHeight:Re,maxHeight:oe,overflowY:ge,resize:"none"}}var M=q("Gytx"),N=q.n(M),Y;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})(Y||(Y={}));var ee=function(Se){Object(X.a)(Le,Se);var De=Object(F.a)(Le);function Le(Ae){var me;return Object(J.a)(this,Le),me=De.call(this,Ae),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(de){me.textArea=de},me.handleResize=function(de){var re=me.state.resizeStatus,he=me.props,ie=he.autoSize,Re=he.onResize;if(re!==Y.NONE)return;typeof Re=="function"&&Re(de),ie&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var de=me.props.autoSize;if(!de||!me.textArea)return;var re=de.minRows,he=de.maxRows,ie=G(me.textArea,!1,re,he);me.setState({textareaStyles:ie,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var de=me.props,re=de.prefixCls,he=re===void 0?"rc-textarea":re,ie=de.autoSize,Re=de.onResize,oe=de.className,ae=de.disabled,ge=me.state,we=ge.textareaStyles,_e=ge.resizeStatus,Fe=Object(h.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=L()(he,oe,Object(U.a)({},"".concat(he,"-disabled"),ae));"value"in Fe&&(Fe.value=Fe.value||"");var Be=Object(W.a)(Object(W.a)(Object(W.a)({},me.props.style),we),_e===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(b,{onResize:me.handleResize,disabled:!(ie||Re)},P.createElement("textarea",Object(ue.a)({},Fe,{className:Ue,style:Be,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:Y.NONE},me}return Object(O.a)(Le,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!N()(me.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var me=this.textArea.selectionStart,de=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,de)}}catch(re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Le}(P.Component),le=ee,fe=function(Se){Object(X.a)(Le,Se);var De=Object(F.a)(Le);function Le(Ae){var me;Object(J.a)(this,Le),me=De.call(this,Ae),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(re){me.resizableTextArea=re},me.handleChange=function(re){var he=me.props.onChange;me.setValue(re.target.value,function(){me.resizableTextArea.resizeTextarea()}),he&&he(re)},me.handleKeyDown=function(re){var he=me.props,ie=he.onPressEnter,Re=he.onKeyDown;re.keyCode===13&&ie&&ie(re),Re&&Re(re)};var de=typeof Ae.value=="undefined"||Ae.value===null?Ae.defaultValue:Ae.value;return me.state={value:de},me}return Object(O.a)(Le,[{key:"setValue",value:function(me,de){"value"in this.props||this.setState({value:me},de)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(le,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),Le}(P.Component),Pe=Te.default=fe},ZW9T:function(pt,Te,q){"use strict";q.d(Te,"a",function(){return b});var ue=q("k1fw"),J=q("oBTY"),O=q("9og8"),X=q("miYZ"),F=q("tsqr"),P=q("rAM+"),W=q("tJVT"),U=q("PpiC"),_=q("WmNS"),A=q.n(_),d=q("q1tI"),p=q.n(d),T=q("bdgK");function m(h,u,L,S,D){var I=u.getWordUntilPosition(L),B={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:I.startColumn,endColumn:I.endColumn},j=S.map(function(G){return{label:G,kind:h.languages.CompletionItemKind.Keyword,insertText:G,insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:B}});return D.map(function(G){j.push(Object(ue.a)(Object(ue.a)({},G),{},{range:B}))}),j}var f=function(h){var u={label:"ifelse",kind:h.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];h.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(B,j){var G=m(h,B,j,L,[u]);return{suggestions:G}}});var S=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];h.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(B,j){var G=[{label:"print",kind:h.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],M=m(h,B,j,S,G);return{suggestions:M}}});var D=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];h.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(B,j){var G=[u,{label:"main",kind:h.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:h.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],M=m(h,B,j,D,G);return{suggestions:M}}})},y="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",a=q("fjLI"),i=q("LvDl"),s=q("+ua5");function l(h){return/^\d+$/.test(h)?"".concat(h,"px"):h}function E(){}var g=!1,v={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function k(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=h;if(Array.isArray(h)){for(var L=0;L<h.length;L++){var S=v[h[L]];if(S)return S}return u[0]}return v[u]||u}var w=null,x=Te.b=function(h){var u=h.width,L=u===void 0?"100%":u,S=h.height,D=S===void 0?"100%":S,I=h.value,B=h.language,j=B===void 0?"javascript":B,G=h.style,M=G===void 0?{}:G,N=h.options,Y=N===void 0?{}:N,ee=h.overrideServices,le=ee===void 0?{}:ee,fe=h.theme,Pe=fe===void 0?"vs-dark":fe,Se=h.onEditBlur,De=h.onSave,Le=h.autoHeight,Ae=Le===void 0?!1:Le,me=h.forbidCopy,de=me===void 0?!1:me,re=h.onChange,he=re===void 0?E:re,ie=h.editorDidMount,Re=ie===void 0?E:ie,oe=h.onFocus,ae=oe===void 0?E:oe,ge=h.onBreakPoint,we=ge===void 0?E:ge,_e=h.breakPointValue,Fe=_e===void 0?[]:_e,Ue=h.filename,Be=Ue===void 0?"educoder.txt":Ue,et=h.errorLine,Je=h.errorContent,Ze=Je===void 0?"":Je,Ye=h.highlightLine,dt=h.openBreakPoint,qe=dt===void 0?!1:dt,ot=Object(U.a)(h,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),Ie=Object(d.useRef)(),Qe=Object(d.useRef)({}),st=Object(d.useRef)(),je=Object(d.useRef)(),Xe=Object(d.useRef)([]),Ce=Object(d.useRef)(!1),be=Object(d.useRef)(),Ee=Object(d.useState)(!1),ne=Object(W.a)(Ee,2),se=ne[0],ce=ne[1];function ve(){var Ct;return Ie.current&&(Ct=new T.default(function(at){var xt=Object(P.a)(at),Zt;try{for(xt.s();!(Zt=xt.n()).done;){var nr=Zt.value;(nr.target.offsetHeight>0||nr.target.offsetWidth>0)&&Qe.current.instance.layout()}}catch(rr){xt.e(rr)}finally{xt.f()}}),Ct.observe(Ie.current)),Ct}function Ne(){F.b.warn({content:decodeURIComponent(y),key:"monaco-editor-tip"})}var ke=function(){var at=Qe.current.instance;if(I!=null&&at&&se){var xt=at.getModel();xt&&I!==xt.getValue()&&(g=!0,xt.setValue(I),at.layout(),g=!1)}};Object(d.useEffect)(function(){try{var Ct,at=Qe.current.instance;je.current&&clearTimeout(je.current),je.current=setTimeout(function(){ke()},500),at==null||((Ct=at.updateOptions)===null||Ct===void 0)||Ct.call(at,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(I.split(/\r\n|\r|\n/g).length))+3,5)})}catch(xt){debugger}},[I,se,Qe.current]),Object(d.useEffect)(function(){try{if(et&&Qe.current&&Qe.current.instance){var Ct=Qe.current.instance;Ct.changeViewZones(function(xt){var Zt=document.createElement("div");Zt.style.padding="10px 20px",Zt.style.width="calc(100% - 20px)",Zt.className="my-error-line-wrp",Zt.innerHTML=Ze,xt.addZone({afterLineNumber:et||11,heightInLines:3,domNode:Zt})});var at={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ct.addOverlayWidget(at),Ct.revealPositionInCenter({lineNumber:20,column:1})}}catch(xt){debugger}},[et,Qe.current,se]),Object(d.useEffect)(function(){var Ct;if((Ct=Qe.current)!==null&&Ct!==void 0&&Ct.instance&&se&&qe){var at=Qe.current.instance,xt=at.getModel();if(!xt)return;var Zt=function(){var lt=[],Pt=[],Kt=xt.getAllDecorations(),Yt=Object(P.a)(Kt),qt;try{for(Yt.s();!(qt=Yt.n()).done;){var K=qt.value;if(K.options.className==="highlighted-line"){var c;lt.push(K==null||((c=K.range)===null||c===void 0)?void 0:c.startLineNumber),Pt.push(K==null?void 0:K.id)}}}catch(z){Yt.e(z)}finally{Yt.f()}xt.deltaDecorations(Pt,[]);var C=xt.getLineCount();!!Ye&&Ye<=C&&(at.deltaDecorations([],[{range:new w.Range(Ye,1,Ye,xt.getLineMaxColumn(Ye)),options:{isWholeLine:!0,className:"highlighted-line"}}]),at.revealLineInCenter(Ye))};Zt();var nr=function(){var lt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Pt=[],Kt=[],Yt=xt.getAllDecorations(),qt=Object(P.a)(Yt),K;try{for(qt.s();!(K=qt.n()).done;){var c=K.value;if(c.options.linesDecorationsClassName==="breakpoints"){var C;Pt.push(c==null||((C=c.range)===null||C===void 0)?void 0:C.startLineNumber),Kt.push(c==null?void 0:c.id)}}}catch(z){qt.e(z)}finally{qt.f()}if(lt)return{lines:Pt,ids:Kt};we(Pt)},rr=function(){var He=Object(O.a)(A.a.mark(function lt(Pt){var Kt;return A.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return Kt={range:new w.Range(Pt,1,Pt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},qt.next=3,xt.deltaDecorations([],[Kt]);case 3:nr();case 4:case"end":return qt.stop()}},lt)}));return function(Pt){return He.apply(this,arguments)}}(),Rt=function(){var He=Object(O.a)(A.a.mark(function lt(Pt){var Kt,Yt,qt,K,c;return A.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:Kt=[],Yt=at.getLineDecorations(Pt),qt=Object(P.a)(Yt);try{for(qt.s();!(K=qt.n()).done;)c=K.value,c.options.linesDecorationsClassName==="breakpoints"&&Kt.push(c.id)}catch($){qt.e($)}finally{qt.f()}return z.next=6,xt.deltaDecorations(Kt,[]);case 6:nr();case 7:case"end":return z.stop()}},lt)}));return function(Pt){return He.apply(this,arguments)}}(),vt=function(lt){var Pt=at.getLineDecorations(lt),Kt=Object(P.a)(Pt),Yt;try{for(Kt.s();!(Yt=Kt.n()).done;){var qt=Yt.value;if(qt.options.linesDecorationsClassName==="breakpoints")return!0}}catch(K){Kt.e(K)}finally{Kt.f()}return!1};if(!Object(i.isEqual)(Fe,nr(!0).lines)){xt.deltaDecorations(nr(!0).ids,[]);var kr=Fe.map(function(He){return{range:new w.Range(He,1,He,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});xt.deltaDecorations([],kr)}var tn=at.onDidChangeModelContent(function(He){var lt=at.getPosition();if(lt){var Pt=lt.lineNumber;xt.getLineContent(Pt).trim()===""?Rt(Pt):vt(Pt)&&(Rt(Pt),rr(Pt))}}),Tr=at.onMouseDown(function(He){var lt,Pt,Kt;if(He.target.detail&&(lt=He.target)!==null&<!==void 0&&(Pt=lt.element)!==null&&Pt!==void 0&&(Kt=Pt.className)!==null&&Kt!==void 0&&Kt.includes("line-numbers")){var Yt=He.target.position.lineNumber;if(xt.getLineContent(Yt).trim()==="")return;vt(Yt)?Rt(Yt):rr(Yt)}}),Ot=function(lt){var Pt={range:new w.Range(lt,1,lt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Xe.current=at.deltaDecorations(Xe.current,[Pt])},Lr=function(){Xe.current=at.deltaDecorations(Xe.current,[])},zr=at.onMouseMove(function(He){var lt,Pt,Kt;if(Lr(),He.target.detail&&(lt=He.target)!==null&<!==void 0&&(Pt=lt.element)!==null&&Pt!==void 0&&(Kt=Pt.className)!==null&&Kt!==void 0&&Kt.includes("line-numbers")){var Yt=He.target.position.lineNumber;if(xt.getLineContent(Yt).trim()==="")return;Ot(Yt)}}),rn=at.onMouseLeave(function(){Lr()});return function(){tn.dispose(),Tr.dispose(),zr.dispose(),rn.dispose()}}},[Qe.current,se,Fe,Ye,qe]);function ze(){var Ct=Qe.current.instance;if(Ct){var at=Ct.getSelection(),xt=Qe.current.pastePos||{},Zt=new w.Range(xt.startLineNumber||at.endLineNumber,xt.startColumn||at.endColumn,xt.endLineNumber||at.endLineNumber,xt.endColumn||at.endColumn);setTimeout(function(){Ct.executeEdits("",[{range:Zt,text:""}])},300)}}function it(Ct){(window.navigator.platform.match("Mac")?Ct.metaKey:Ct.ctrlKey)&&Ct.keyCode==83&&(Ct.preventDefault(),De())}var ct=function(){if(Ae&&Qe.current.instance){var at=Qe.current.instance.getContentHeight();Zr(at<D?D:at)}else Zr(D)};function ht(Ct){var at=document.createEvent("MouseEvents");at.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ct.dispatchEvent(at)}var Lt=function(at){var xt=at.keyCode,Zt=at.ctrlKey,nr=at.metaKey,rr=at.target,Rt=at.type;return(Rt==="paste"||(xt===67||xt===86)&&(nr||Zt))&&rr.nodeName==="TEXTAREA"&&(Ne(),at.preventDefault()),!1};function wt(Ct,at){var xt=window.URL||window.webkitURL||window,Zt=new Blob([at]),nr=document.createElementNS("http://www.w3.org/1999/xhtml","a");nr.href=xt.createObjectURL(Zt),nr.download=Ct,ht(nr)}Object(d.useEffect)(function(){ct()},[ct]),Object(d.useEffect)(function(){Ie.current&&!se&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(Ct){try{w=Ct,Qe.current.instance=w.editor.create(Ie.current,{value:I,language:k(j),theme:Pe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},le);var at=Qe.current.instance,xt=a.c._menuItems,Zt=Object(J.a)(xt).find(function(rr){return rr[0]._debugName=="EditorContext"});if(Re(at,w),setTimeout(function(){ct(),Qe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){wt(Be||"educoder.txt",at.getValue())}}),at.getDomNode().addEventListener("input",function(){st.current.autoFormat&&at.getAction("editor.action.formatDocument").run()})},500),Qe.current.subscription=at.onDidChangeModelContent(function(rr){debugger;Ce.current?clearTimeout(be.current):(ct(),he(at.getValue(),rr)),be.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||f(w,k(j)),de&&(Ie.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Lt),window.removeEventListener("paste",Lt),window.addEventListener("keydown",Lt),window.addEventListener("paste",Lt)),window.Monaco=w,Se&&at.onDidBlurEditorWidget(function(){Se(at.getValue())}),ae&&at.onDidFocusEditorText(function(){ae(at.getValue())}),de)try{window.addEventListener("paste",ze)}catch(rr){}var nr=ve();return ce(!0),function(){var rr=Qe.current.instance;rr.dispose();var Rt=rr.getModel();Rt&&Rt.dispose(),Qe.current.subscription&&Qe.current.subscription.dispose(),de&&window.removeEventListener("paste",ze),nr.unobserve(Ie.current)}}catch(rr){debugger}})},[]),Object(d.useEffect)(function(){var Ct=Qe.current.instance;if(Ct&&se)return document.addEventListener("keydown",it,!1),function(){document.removeEventListener("keydown",it)}},[De,se]),Object(d.useEffect)(function(){var Ct=Qe.current.instance;if(Ct&&se){var at=k(j);w.editor.setModelLanguage(Ct.getModel(),at)}},[j,se]),Object(d.useEffect)(function(){var Ct=Qe.current.instance;Ct&&se&&w.editor.setTheme(Pe)},[Pe,se]),Object(d.useEffect)(function(){var Ct=Qe.current.instance;st.current=Y,Ct&&se&&(Ct.updateOptions(Object(ue.a)({},Y)),setTimeout(function(){Ct.getModel().updateOptions(Object(ue.a)({},Y))},200))},[JSON.stringify(Y),se]),Object(d.useEffect)(function(){var Ct=Qe.current.instance;Ct&&se&&Ct.layout()},[L,D,se]);var ft=Object(d.useState)(l(L)),zt=Object(W.a)(ft,2),Ft=zt[0],Jt=zt[1],Ht=Object(d.useState)(l(D)),kt=Object(W.a)(Ht,2),Ur=kt[0],Zr=kt[1],bt=Object(ue.a)(Object(ue.a)({},M),{},{width:Ft,height:Ur});return p.a.createElement("div",{className:"my-monaco-editor",ref:Ie,style:bt})};function b(h){var u=h.width,L=u===void 0?"100%":u,S=h.height,D=S===void 0?"100%":S,I=h.original,B=h.modified,j=h.language,G=h.options,M=G===void 0?{}:G,N=Object(d.useRef)(),Y=Object(d.useState)(null),ee=Object(W.a)(Y,2),le=ee[0],fe=ee[1];function Pe(Ae){var me;return N.current&&(me=new T.default(function(de){var re=Object(P.a)(de),he;try{for(re.s();!(he=re.n()).done;){var ie=he.value;(ie.target.offsetHeight>0||ie.target.offsetWidth>0)&&Ae.layout()}}catch(Re){re.e(Re)}finally{re.f()}}),me.observe(N.current)),me}Object(d.useEffect)(function(){return N.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(Ae){w=Ae;var me=w.editor.createDiffEditor(N.current,Object(ue.a)(Object(ue.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},M),{},{wordWrap:!0}));fe(me);var de=Pe(me);return function(){me.dispose();var re=me.getModel();re&&re.dispose(),de.unobserve(N.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){le&&le.setModel({original:w.editor.createModel(I,j),modified:w.editor.createModel(B,j)})},[I,B,j,le]);var Se=l(L),De=l(D),Le={width:Se,height:De};return p.a.createElement("div",{className:"my-diff-editor",ref:N,style:Le})}},ZpRC:function(pt,Te,q){"use strict";function ue(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function J(d,p){return(!p||d!=="hidden")&&d!=="visible"&&d!=="clip"}function O(d,p){if(d.clientHeight<d.scrollHeight||d.clientWidth<d.scrollWidth){var T=getComputedStyle(d,null);return J(T.overflowY,p)||J(T.overflowX,p)||function(m){var f=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(a){return null}}(m);return!!f&&(f.clientHeight<m.scrollHeight||f.clientWidth<m.scrollWidth)}(d)}return!1}function X(d,p,T,m,f,y,a,i){return y<d&&a>p||y>d&&a<p?0:y<=d&&i<=T||a>=p&&i>=T?y-d-m:a>p&&i<T||y<d&&i>T?a-p+f:0}var F=function(d,p){var T=window,m=p.scrollMode,f=p.block,y=p.inline,a=p.boundary,i=p.skipOverflowHiddenElements,s=typeof a=="function"?a:function(we){return we!==a};if(!ue(d))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,E=[],g=d;ue(g)&&s(g);){if((g=g.parentElement)===l){E.push(g);break}g!=null&&g===document.body&&O(g)&&!O(document.documentElement)||g!=null&&O(g,i)&&E.push(g)}for(var v=T.visualViewport?T.visualViewport.width:innerWidth,k=T.visualViewport?T.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,x=window.scrollY||pageYOffset,b=d.getBoundingClientRect(),h=b.height,u=b.width,L=b.top,S=b.right,D=b.bottom,I=b.left,B=f==="start"||f==="nearest"?L:f==="end"?D:L+h/2,j=y==="center"?I+u/2:y==="end"?S:I,G=[],M=0;M<E.length;M++){var N=E[M],Y=N.getBoundingClientRect(),ee=Y.height,le=Y.width,fe=Y.top,Pe=Y.right,Se=Y.bottom,De=Y.left;if(m==="if-needed"&&L>=0&&I>=0&&D<=k&&S<=v&&L>=fe&&D<=Se&&I>=De&&S<=Pe)return G;var Le=getComputedStyle(N),Ae=parseInt(Le.borderLeftWidth,10),me=parseInt(Le.borderTopWidth,10),de=parseInt(Le.borderRightWidth,10),re=parseInt(Le.borderBottomWidth,10),he=0,ie=0,Re="offsetWidth"in N?N.offsetWidth-N.clientWidth-Ae-de:0,oe="offsetHeight"in N?N.offsetHeight-N.clientHeight-me-re:0;if(l===N)he=f==="start"?B:f==="end"?B-k:f==="nearest"?X(x,x+k,k,me,re,x+B,x+B+h,h):B-k/2,ie=y==="start"?j:y==="center"?j-v/2:y==="end"?j-v:X(w,w+v,v,Ae,de,w+j,w+j+u,u),he=Math.max(0,he+x),ie=Math.max(0,ie+w);else{he=f==="start"?B-fe-me:f==="end"?B-Se+re+oe:f==="nearest"?X(fe,Se,ee,me,re+oe,B,B+h,h):B-(fe+ee/2)+oe/2,ie=y==="start"?j-De-Ae:y==="center"?j-(De+le/2)+Re/2:y==="end"?j-Pe+de+Re:X(De,Pe,le,Ae,de+Re,j,j+u,u);var ae=N.scrollLeft,ge=N.scrollTop;B+=ge-(he=Math.max(0,Math.min(ge+he,N.scrollHeight-ee+oe))),j+=ae-(ie=Math.max(0,Math.min(ae+ie,N.scrollWidth-le+Re)))}G.push({el:N,top:he,left:ie})}return G};function P(d){return d===Object(d)&&Object.keys(d).length!==0}function W(d,p){p===void 0&&(p="auto");var T="scrollBehavior"in document.body.style;d.forEach(function(m){var f=m.el,y=m.top,a=m.left;f.scroll&&T?f.scroll({top:y,left:a,behavior:p}):(f.scrollTop=y,f.scrollLeft=a)})}function U(d){return d===!1?{block:"end",inline:"nearest"}:P(d)?d:{block:"start",inline:"nearest"}}function _(d,p){var T=!d.ownerDocument.documentElement.contains(d);if(P(p)&&typeof p.behavior=="function")return p.behavior(T?[]:F(d,p));if(T)return;var m=U(p);return W(F(d,m),m.behavior)}var A=Te.a=_},Zss7:function(pt,Te,q){var ue;(function(J){var O=/^\s+/,X=/\s+$/,F=0,P=J.round,W=J.min,U=J.max,_=J.random;function A(re,he){if(re=re||"",he=he||{},re instanceof A)return re;if(!(this instanceof A))return new A(re,he);var ie=d(re);this._originalInput=re,this._r=ie.r,this._g=ie.g,this._b=ie.b,this._a=ie.a,this._roundA=P(100*this._a)/100,this._format=he.format||ie.format,this._gradientType=he.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=ie.ok,this._tc_id=F++}A.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var re=this.toRgb();return(re.r*299+re.g*587+re.b*114)/1e3},getLuminance:function(){var re=this.toRgb(),he,ie,Re,oe,ae,ge;return he=re.r/255,ie=re.g/255,Re=re.b/255,he<=.03928?oe=he/12.92:oe=J.pow((he+.055)/1.055,2.4),ie<=.03928?ae=ie/12.92:ae=J.pow((ie+.055)/1.055,2.4),Re<=.03928?ge=Re/12.92:ge=J.pow((Re+.055)/1.055,2.4),.2126*oe+.7152*ae+.0722*ge},setAlpha:function(re){return this._a=G(re),this._roundA=P(100*this._a)/100,this},toHsv:function(){var re=f(this._r,this._g,this._b);return{h:re.h*360,s:re.s,v:re.v,a:this._a}},toHsvString:function(){var re=f(this._r,this._g,this._b),he=P(re.h*360),ie=P(re.s*100),Re=P(re.v*100);return this._a==1?"hsv("+he+", "+ie+"%, "+Re+"%)":"hsva("+he+", "+ie+"%, "+Re+"%, "+this._roundA+")"},toHsl:function(){var re=T(this._r,this._g,this._b);return{h:re.h*360,s:re.s,l:re.l,a:this._a}},toHslString:function(){var re=T(this._r,this._g,this._b),he=P(re.h*360),ie=P(re.s*100),Re=P(re.l*100);return this._a==1?"hsl("+he+", "+ie+"%, "+Re+"%)":"hsla("+he+", "+ie+"%, "+Re+"%, "+this._roundA+")"},toHex:function(re){return a(this._r,this._g,this._b,re)},toHexString:function(re){return"#"+this.toHex(re)},toHex8:function(re){return i(this._r,this._g,this._b,this._a,re)},toHex8String:function(re){return"#"+this.toHex8(re)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(M(this._r,255)*100)+"%",g:P(M(this._g,255)*100)+"%",b:P(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(M(this._r,255)*100)+"%, "+P(M(this._g,255)*100)+"%, "+P(M(this._b,255)*100)+"%)":"rgba("+P(M(this._r,255)*100)+"%, "+P(M(this._g,255)*100)+"%, "+P(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:B[a(this._r,this._g,this._b,!0)]||!1},toFilter:function(re){var he="#"+s(this._r,this._g,this._b,this._a),ie=he,Re=this._gradientType?"GradientType = 1, ":"";if(re){var oe=A(re);ie="#"+s(oe._r,oe._g,oe._b,oe._a)}return"progid:DXImageTransform.Microsoft.gradient("+Re+"startColorstr="+he+",endColorstr="+ie+")"},toString:function(re){var he=!!re;re=re||this._format;var ie=!1,Re=this._a<1&&this._a>=0,oe=!he&&Re&&(re==="hex"||re==="hex6"||re==="hex3"||re==="hex4"||re==="hex8"||re==="name");return oe?re==="name"&&this._a===0?this.toName():this.toRgbString():(re==="rgb"&&(ie=this.toRgbString()),re==="prgb"&&(ie=this.toPercentageRgbString()),(re==="hex"||re==="hex6")&&(ie=this.toHexString()),re==="hex3"&&(ie=this.toHexString(!0)),re==="hex4"&&(ie=this.toHex8String(!0)),re==="hex8"&&(ie=this.toHex8String()),re==="name"&&(ie=this.toName()),re==="hsl"&&(ie=this.toHslString()),re==="hsv"&&(ie=this.toHsvString()),ie||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(re,he){var ie=re.apply(null,[this].concat([].slice.call(he)));return this._r=ie._r,this._g=ie._g,this._b=ie._b,this.setAlpha(ie._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(E,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(re,he){return re.apply(null,[this].concat([].slice.call(he)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(D,arguments)},splitcomplement:function(){return this._applyCombination(L,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},A.fromRatio=function(re,he){if(typeof re=="object"){var ie={};for(var Re in re)re.hasOwnProperty(Re)&&(Re==="a"?ie[Re]=re[Re]:ie[Re]=Pe(re[Re]));re=ie}return A(re,he)};function d(re){var he={r:0,g:0,b:0},ie=1,Re=null,oe=null,ae=null,ge=!1,we=!1;return typeof re=="string"&&(re=me(re)),typeof re=="object"&&(Ae(re.r)&&Ae(re.g)&&Ae(re.b)?(he=p(re.r,re.g,re.b),ge=!0,we=String(re.r).substr(-1)==="%"?"prgb":"rgb"):Ae(re.h)&&Ae(re.s)&&Ae(re.v)?(Re=Pe(re.s),oe=Pe(re.v),he=y(re.h,Re,oe),ge=!0,we="hsv"):Ae(re.h)&&Ae(re.s)&&Ae(re.l)&&(Re=Pe(re.s),ae=Pe(re.l),he=m(re.h,Re,ae),ge=!0,we="hsl"),re.hasOwnProperty("a")&&(ie=re.a)),ie=G(ie),{ok:ge,format:re.format||we,r:W(255,U(he.r,0)),g:W(255,U(he.g,0)),b:W(255,U(he.b,0)),a:ie}}function p(re,he,ie){return{r:M(re,255)*255,g:M(he,255)*255,b:M(ie,255)*255}}function T(re,he,ie){re=M(re,255),he=M(he,255),ie=M(ie,255);var Re=U(re,he,ie),oe=W(re,he,ie),ae,ge,we=(Re+oe)/2;if(Re==oe)ae=ge=0;else{var _e=Re-oe;ge=we>.5?_e/(2-Re-oe):_e/(Re+oe);switch(Re){case re:ae=(he-ie)/_e+(he<ie?6:0);break;case he:ae=(ie-re)/_e+2;break;case ie:ae=(re-he)/_e+4;break}ae/=6}return{h:ae,s:ge,l:we}}function m(re,he,ie){var Re,oe,ae;re=M(re,360),he=M(he,100),ie=M(ie,100);function ge(Fe,Ue,Be){return Be<0&&(Be+=1),Be>1&&(Be-=1),Be<1/6?Fe+(Ue-Fe)*6*Be:Be<1/2?Ue:Be<2/3?Fe+(Ue-Fe)*(2/3-Be)*6:Fe}if(he===0)Re=oe=ae=ie;else{var we=ie<.5?ie*(1+he):ie+he-ie*he,_e=2*ie-we;Re=ge(_e,we,re+1/3),oe=ge(_e,we,re),ae=ge(_e,we,re-1/3)}return{r:Re*255,g:oe*255,b:ae*255}}function f(re,he,ie){re=M(re,255),he=M(he,255),ie=M(ie,255);var Re=U(re,he,ie),oe=W(re,he,ie),ae,ge,we=Re,_e=Re-oe;if(ge=Re===0?0:_e/Re,Re==oe)ae=0;else{switch(Re){case re:ae=(he-ie)/_e+(he<ie?6:0);break;case he:ae=(ie-re)/_e+2;break;case ie:ae=(re-he)/_e+4;break}ae/=6}return{h:ae,s:ge,v:we}}function y(re,he,ie){re=M(re,360)*6,he=M(he,100),ie=M(ie,100);var Re=J.floor(re),oe=re-Re,ae=ie*(1-he),ge=ie*(1-oe*he),we=ie*(1-(1-oe)*he),_e=Re%6,Fe=[ie,ge,ae,ae,we,ie][_e],Ue=[we,ie,ie,ge,ae,ae][_e],Be=[ae,ae,we,ie,ie,ge][_e];return{r:Fe*255,g:Ue*255,b:Be*255}}function a(re,he,ie,Re){var oe=[fe(P(re).toString(16)),fe(P(he).toString(16)),fe(P(ie).toString(16))];return Re&&oe[0].charAt(0)==oe[0].charAt(1)&&oe[1].charAt(0)==oe[1].charAt(1)&&oe[2].charAt(0)==oe[2].charAt(1)?oe[0].charAt(0)+oe[1].charAt(0)+oe[2].charAt(0):oe.join("")}function i(re,he,ie,Re,oe){var ae=[fe(P(re).toString(16)),fe(P(he).toString(16)),fe(P(ie).toString(16)),fe(Se(Re))];return oe&&ae[0].charAt(0)==ae[0].charAt(1)&&ae[1].charAt(0)==ae[1].charAt(1)&&ae[2].charAt(0)==ae[2].charAt(1)&&ae[3].charAt(0)==ae[3].charAt(1)?ae[0].charAt(0)+ae[1].charAt(0)+ae[2].charAt(0)+ae[3].charAt(0):ae.join("")}function s(re,he,ie,Re){var oe=[fe(Se(Re)),fe(P(re).toString(16)),fe(P(he).toString(16)),fe(P(ie).toString(16))];return oe.join("")}A.equals=function(re,he){return!re||!he?!1:A(re).toRgbString()==A(he).toRgbString()},A.random=function(){return A.fromRatio({r:_(),g:_(),b:_()})};function l(re,he){he=he===0?0:he||10;var ie=A(re).toHsl();return ie.s-=he/100,ie.s=N(ie.s),A(ie)}function E(re,he){he=he===0?0:he||10;var ie=A(re).toHsl();return ie.s+=he/100,ie.s=N(ie.s),A(ie)}function g(re){return A(re).desaturate(100)}function v(re,he){he=he===0?0:he||10;var ie=A(re).toHsl();return ie.l+=he/100,ie.l=N(ie.l),A(ie)}function k(re,he){he=he===0?0:he||10;var ie=A(re).toRgb();return ie.r=U(0,W(255,ie.r-P(255*-(he/100)))),ie.g=U(0,W(255,ie.g-P(255*-(he/100)))),ie.b=U(0,W(255,ie.b-P(255*-(he/100)))),A(ie)}function w(re,he){he=he===0?0:he||10;var ie=A(re).toHsl();return ie.l-=he/100,ie.l=N(ie.l),A(ie)}function x(re,he){var ie=A(re).toHsl(),Re=(ie.h+he)%360;return ie.h=Re<0?360+Re:Re,A(ie)}function b(re){var he=A(re).toHsl();return he.h=(he.h+180)%360,A(he)}function h(re){var he=A(re).toHsl(),ie=he.h;return[A(re),A({h:(ie+120)%360,s:he.s,l:he.l}),A({h:(ie+240)%360,s:he.s,l:he.l})]}function u(re){var he=A(re).toHsl(),ie=he.h;return[A(re),A({h:(ie+90)%360,s:he.s,l:he.l}),A({h:(ie+180)%360,s:he.s,l:he.l}),A({h:(ie+270)%360,s:he.s,l:he.l})]}function L(re){var he=A(re).toHsl(),ie=he.h;return[A(re),A({h:(ie+72)%360,s:he.s,l:he.l}),A({h:(ie+216)%360,s:he.s,l:he.l})]}function S(re,he,ie){he=he||6,ie=ie||30;var Re=A(re).toHsl(),oe=360/ie,ae=[A(re)];for(Re.h=(Re.h-(oe*he>>1)+720)%360;--he;)Re.h=(Re.h+oe)%360,ae.push(A(Re));return ae}function D(re,he){he=he||6;for(var ie=A(re).toHsv(),Re=ie.h,oe=ie.s,ae=ie.v,ge=[],we=1/he;he--;)ge.push(A({h:Re,s:oe,v:ae})),ae=(ae+we)%1;return ge}A.mix=function(re,he,ie){ie=ie===0?0:ie||50;var Re=A(re).toRgb(),oe=A(he).toRgb(),ae=ie/100,ge={r:(oe.r-Re.r)*ae+Re.r,g:(oe.g-Re.g)*ae+Re.g,b:(oe.b-Re.b)*ae+Re.b,a:(oe.a-Re.a)*ae+Re.a};return A(ge)},A.readability=function(re,he){var ie=A(re),Re=A(he);return(J.max(ie.getLuminance(),Re.getLuminance())+.05)/(J.min(ie.getLuminance(),Re.getLuminance())+.05)},A.isReadable=function(re,he,ie){var Re=A.readability(re,he),oe,ae;ae=!1,oe=de(ie);switch(oe.level+oe.size){case"AAsmall":case"AAAlarge":ae=Re>=4.5;break;case"AAlarge":ae=Re>=3;break;case"AAAsmall":ae=Re>=7;break}return ae},A.mostReadable=function(re,he,ie){var Re=null,oe=0,ae,ge,we,_e;ie=ie||{},ge=ie.includeFallbackColors,we=ie.level,_e=ie.size;for(var Fe=0;Fe<he.length;Fe++)ae=A.readability(re,he[Fe]),ae>oe&&(oe=ae,Re=A(he[Fe]));return A.isReadable(re,Re,{level:we,size:_e})||!ge?Re:(ie.includeFallbackColors=!1,A.mostReadable(re,["#fff","#000"],ie))};var I=A.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},B=A.hexNames=j(I);function j(re){var he={};for(var ie in re)re.hasOwnProperty(ie)&&(he[re[ie]]=ie);return he}function G(re){return re=parseFloat(re),(isNaN(re)||re<0||re>1)&&(re=1),re}function M(re,he){ee(re)&&(re="100%");var ie=le(re);return re=W(he,U(0,parseFloat(re))),ie&&(re=parseInt(re*he,10)/100),J.abs(re-he)<1e-6?1:re%he/parseFloat(he)}function N(re){return W(1,U(0,re))}function Y(re){return parseInt(re,16)}function ee(re){return typeof re=="string"&&re.indexOf(".")!=-1&&parseFloat(re)===1}function le(re){return typeof re=="string"&&re.indexOf("%")!=-1}function fe(re){return re.length==1?"0"+re:""+re}function Pe(re){return re<=1&&(re=re*100+"%"),re}function Se(re){return J.round(parseFloat(re)*255).toString(16)}function De(re){return Y(re)/255}var Le=function(){var re="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",ie="(?:"+he+")|(?:"+re+")",Re="[\\s|\\(]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")\\s*\\)?",oe="[\\s|\\(]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")\\s*\\)?";return{CSS_UNIT:new RegExp(ie),rgb:new RegExp("rgb"+Re),rgba:new RegExp("rgba"+oe),hsl:new RegExp("hsl"+Re),hsla:new RegExp("hsla"+oe),hsv:new RegExp("hsv"+Re),hsva:new RegExp("hsva"+oe),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ae(re){return!!Le.CSS_UNIT.exec(re)}function me(re){re=re.replace(O,"").replace(X,"").toLowerCase();var he=!1;if(I[re])re=I[re],he=!0;else if(re=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ie;return(ie=Le.rgb.exec(re))?{r:ie[1],g:ie[2],b:ie[3]}:(ie=Le.rgba.exec(re))?{r:ie[1],g:ie[2],b:ie[3],a:ie[4]}:(ie=Le.hsl.exec(re))?{h:ie[1],s:ie[2],l:ie[3]}:(ie=Le.hsla.exec(re))?{h:ie[1],s:ie[2],l:ie[3],a:ie[4]}:(ie=Le.hsv.exec(re))?{h:ie[1],s:ie[2],v:ie[3]}:(ie=Le.hsva.exec(re))?{h:ie[1],s:ie[2],v:ie[3],a:ie[4]}:(ie=Le.hex8.exec(re))?{r:Y(ie[1]),g:Y(ie[2]),b:Y(ie[3]),a:De(ie[4]),format:he?"name":"hex8"}:(ie=Le.hex6.exec(re))?{r:Y(ie[1]),g:Y(ie[2]),b:Y(ie[3]),format:he?"name":"hex"}:(ie=Le.hex4.exec(re))?{r:Y(ie[1]+""+ie[1]),g:Y(ie[2]+""+ie[2]),b:Y(ie[3]+""+ie[3]),a:De(ie[4]+""+ie[4]),format:he?"name":"hex8"}:(ie=Le.hex3.exec(re))?{r:Y(ie[1]+""+ie[1]),g:Y(ie[2]+""+ie[2]),b:Y(ie[3]+""+ie[3]),format:he?"name":"hex"}:!1}function de(re){var he,ie;return re=re||{level:"AA",size:"small"},he=(re.level||"AA").toUpperCase(),ie=(re.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),ie!=="small"&&ie!=="large"&&(ie="small"),{level:he,size:ie}}pt.exports?pt.exports=A:!(ue=function(){return A}.call(Te,q,Te,pt),ue!==void 0&&(pt.exports=ue))})(Math)},bT9E:function(pt,Te,q){"use strict";q.d(Te,"a",function(){return J});var ue=q("VTBJ");function J(O,X){var F=Object(ue.a)({},O);return Array.isArray(X)&&X.forEach(function(P){delete F[P]}),F}},c5Ni:function(pt,Te,q){},dejd:function(pt,Te,q){},dmUQ:function(pt,Te,q){"use strict";var ue=q("Ff2n"),J=q("rePB"),O=q("1OyB"),X=q("vuIU"),F=q("Ji7U"),P=q("md7G"),W=q("foSv"),U=q("q1tI"),_=q.n(U),A=q("TSYQ"),d=q.n(A),p=q("4IlW");function T(h,u){var L=Object.keys(h);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(h);u&&(S=S.filter(function(D){return Object.getOwnPropertyDescriptor(h,D).enumerable})),L.push.apply(L,S)}return L}function m(h){for(var u=1;u<arguments.length;u++){var L=arguments[u]!=null?arguments[u]:{};u%2?T(Object(L),!0).forEach(function(S){Object(J.a)(h,S,L[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(L)):T(Object(L)).forEach(function(S){Object.defineProperty(h,S,Object.getOwnPropertyDescriptor(L,S))})}return h}function f(h){var u=y();return function(){var S=Object(W.a)(h),D;if(u){var I=Object(W.a)(this).constructor;D=Reflect.construct(S,arguments,I)}else D=S.apply(this,arguments);return Object(P.a)(this,D)}}function y(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(h){return!1}}function a(){}function i(h){h.preventDefault()}var s=function(u){return u.replace(/[^\w.-]+/g,"")},l=200,E=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(u){return u!=null},k=function(u,L){return L===u||typeof L=="number"&&typeof u=="number"&&isNaN(L)&&isNaN(u)},w=function(h){Object(F.a)(L,h);var u=f(L);function L(S){var D;Object(O.a)(this,L),D=u.call(this,S),D.onKeyDown=function(j){var G=D.props,M=G.onKeyDown,N=G.onPressEnter;if(j.keyCode===p.a.UP){var Y=D.getRatio(j);D.up(j,Y,null),D.stop()}else if(j.keyCode===p.a.DOWN){var ee=D.getRatio(j);D.down(j,ee,null),D.stop()}else j.keyCode===p.a.ENTER&&N&&N(j);if(D.recordCursorPosition(),D.lastKeyCode=j.keyCode,M){for(var le=arguments.length,fe=new Array(le>1?le-1:0),Pe=1;Pe<le;Pe++)fe[Pe-1]=arguments[Pe];M.apply(void 0,[j].concat(fe))}},D.onKeyUp=function(j){var G=D.props.onKeyUp;if(D.stop(),D.recordCursorPosition(),G){for(var M=arguments.length,N=new Array(M>1?M-1:0),Y=1;Y<M;Y++)N[Y-1]=arguments[Y];G.apply(void 0,[j].concat(N))}},D.onChange=function(j){var G=D.props.onChange;D.state.focused&&(D.inputting=!0),D.rawInput=D.props.parser(D.getValueFromEvent(j)),D.setState({inputValue:D.rawInput}),G(D.toNumber(D.rawInput))},D.onMouseUp=function(){var j=D.props.onMouseUp;D.recordCursorPosition(),j&&j.apply(void 0,arguments)},D.onFocus=function(){var j;D.setState({focused:!0}),(j=D.props).onFocus.apply(j,arguments)},D.onBlur=function(){var j=D.props.onBlur;D.inputting=!1,D.setState({focused:!1});var G=D.getCurrentValidValue(D.state.inputValue),M=D.setValue(G,a);if(j){var N=D.input.value,Y=D.getInputDisplayValue({focus:!1,value:M});D.input.value=Y&&Number(Y),j.apply(void 0,arguments),D.input.value=N}},D.getRatio=function(j){var G=1;return j.metaKey||j.ctrlKey?G=.1:j.shiftKey&&(G=10),G},D.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},D.getPrecision=function(j){if(v(D.props.precision))return D.props.precision;var G=String(j);if(G.indexOf("e-")>=0)return parseInt(G.slice(G.indexOf("e-")+2),10);var M=0;return G.indexOf(".")>=0&&(M=G.length-G.indexOf(".")-1),M},D.getInputDisplayValue=function(j){var G=j||D.state,M=G.focused,N=G.inputValue,Y=G.value,ee;M?ee=N:ee=D.toPrecisionAsStep(Y),ee==null&&(ee="");var le=D.formatWrapper(ee);return v(D.props.decimalSeparator)&&(le=le.toString().replace(".",D.props.decimalSeparator)),le},D.recordCursorPosition=function(){try{D.cursorStart=D.input.selectionStart,D.cursorEnd=D.input.selectionEnd,D.currentValue=D.input.value,D.cursorBefore=D.input.value.substring(0,D.cursorStart),D.cursorAfter=D.input.value.substring(D.cursorEnd)}catch(j){}},D.restoreByAfter=function(j){if(j===void 0)return!1;var G=D.input.value,M=G.lastIndexOf(j);if(M===-1)return!1;var N=D.cursorBefore.length;return D.lastKeyCode===p.a.DELETE&&D.cursorBefore.charAt(N-1)===j[0]?(D.fixCaret(N,N),!0):M+j.length===G.length?(D.fixCaret(M,M),!0):!1},D.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(G,M){var N=j.substring(M);return D.restoreByAfter(N)})},D.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},D.stop=function(){D.autoStepTimer&&clearTimeout(D.autoStepTimer)},D.down=function(j,G,M){D.pressingUpOrDown=!0,D.step("down",j,G,M)},D.up=function(j,G,M){D.pressingUpOrDown=!0,D.step("up",j,G,M)},D.saveInput=function(j){D.input=j};var I=S.value;I===void 0&&(I=S.defaultValue),D.state={focused:S.autoFocus};var B=D.getValidValue(D.toNumber(I));return D.state=m(m({},D.state),{},{inputValue:D.toPrecisionAsStep(B),value:B}),D}return Object(X.a)(L,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(D){var I=this.props,B=I.value,j=I.onChange,G=I.max,M=I.min,N=this.state.focused;if(D){if(!k(D.value,B)||!k(D.max,G)||!k(D.min,M)){var Y=N?B:this.getValidValue(B),ee;this.pressingUpOrDown?ee=Y:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:ee})}var le="value"in this.props?B:this.state.value;"max"in this.props&&D.max!==G&&typeof le=="number"&&le>G&&j&&j(G),"min"in this.props&&D.min!==M&&typeof le=="number"&&le<M&&j&&j(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var fe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(fe=this.cursorStart):fe=this.input.value.length,this.fixCaret(fe,fe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Pe){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(D){var I=D;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(D){var I=D.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(D){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(D);return isNaN(j)?D:(j<I&&(j=I),j>B&&(j=B),j)}},{key:"setValue",value:function(D,I){var B=this.props.precision,j=this.isNotCompleteNumber(parseFloat(D))?null:parseFloat(D),G=this.state.value,M=G===void 0?null:G,N=this.state.inputValue,Y=N===void 0?null:N,ee=typeof j=="number"?j.toFixed(B):"".concat(j),le=j!==M||ee!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},I)):this.setState({value:j,inputValue:this.toPrecisionAsStep(D)},I),le&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(D){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,j=B.precision,G=B.step;if(v(j))return j;var M=this.getPrecision(I),N=this.getPrecision(G),Y=this.getPrecision(D);return D?Math.max(Y,M+N):M+N}},{key:"getPrecisionFactor",value:function(D){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(D,I);return Math.pow(10,B)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(D){return this.props.formatter?this.props.formatter(D):D}},{key:"toPrecisionAsStep",value:function(D){if(this.isNotCompleteNumber(D)||D==="")return D;var I=Math.abs(this.getMaxPrecision(D));return isNaN(I)?D.toString():Number(D).toFixed(I)}},{key:"toNumber",value:function(D){var I=this.props.precision,B=this.state.focused,j=D&&D.length>16&&B;return this.isNotCompleteNumber(D)||j?D:v(I)?Math.round(D*Math.pow(10,I))/Math.pow(10,I):Number(D)}},{key:"upStep",value:function(D,I){var B=this.props.step,j=this.getPrecisionFactor(D,I),G=Math.abs(this.getMaxPrecision(D,I)),M=((j*D+j*B*I)/j).toFixed(G);return this.toNumber(M)}},{key:"downStep",value:function(D,I){var B=this.props.step,j=this.getPrecisionFactor(D,I),G=Math.abs(this.getMaxPrecision(D,I)),M=((j*D-j*B*I)/j).toFixed(G);return this.toNumber(M)}},{key:"step",value:function(D,I){var B=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,G=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var M=this.props;if(M.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var Y=this["".concat(D,"Step")](N,j),ee=Y>M.max||Y<M.min;if(Y>M.max?Y=M.max:Y<M.min&&(Y=M.min),this.setValue(Y,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){B[D](I,j,!0)},G?l:E)}},{key:"fixCaret",value:function(D,I){if(D===void 0||I===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,j=this.input.selectionEnd;(D!==B||I!==j)&&this.input.setSelectionRange(D,I)}catch(G){}}},{key:"render",value:function(){var D,I=this.props,B=I.prefixCls,j=I.disabled,G=I.readOnly,M=I.useTouch,N=I.autoComplete,Y=I.upHandler,ee=I.downHandler,le=I.className,fe=I.max,Pe=I.min,Se=I.style,De=I.title,Le=I.onMouseEnter,Ae=I.onMouseLeave,me=I.onMouseOver,de=I.onMouseOut,re=I.required,he=I.onClick,ie=I.tabIndex,Re=I.type,oe=I.placeholder,ae=I.id,ge=I.inputMode,we=I.pattern,_e=I.step,Fe=I.maxLength,Ue=I.autoFocus,Be=I.name,et=I.onPaste,Je=I.onInput,Ze=Object(ue.a)(I,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ye=this.state,dt=Ye.value,qe=Ye.focused,ot=d()(B,(D={},Object(J.a)(D,le,!!le),Object(J.a)(D,"".concat(B,"-disabled"),j),Object(J.a)(D,"".concat(B,"-focused"),qe),D)),Ie={};Object.keys(Ze).forEach(function(ve){(ve.substr(0,5)==="data-"||ve.substr(0,5)==="aria-"||ve==="role")&&(Ie[ve]=Ze[ve])});var Qe=!G&&!j,st=this.getInputDisplayValue(null),je=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=fe),Xe=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=Pe),Ce=je||j||G,be=Xe||j||G,Ee=d()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(J.a)({},"".concat(B,"-handler-up-disabled"),Ce)),ne=d()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(J.a)({},"".concat(B,"-handler-down-disabled"),be)),se=M?{onTouchStart:Ce?a:this.up,onTouchEnd:this.stop}:{onMouseDown:Ce?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ce=M?{onTouchStart:be?a:this.down,onTouchEnd:this.stop}:{onMouseDown:be?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:ot,style:Se,title:De,onMouseEnter:Le,onMouseLeave:Ae,onMouseOver:me,onMouseOut:de,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(B,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},se,{role:"button","aria-label":"Increase Value","aria-disabled":Ce,className:Ee}),Y||_.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:i})),_.a.createElement("span",Object.assign({unselectable:"on"},ce,{role:"button","aria-label":"Decrease Value","aria-disabled":be,className:ne}),ee||_.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:i}))),_.a.createElement("div",{className:"".concat(B,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Pe,"aria-valuemax":fe,"aria-valuenow":dt,required:re,type:Re,placeholder:oe,onPaste:et,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:ie,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Qe?this.onKeyDown:a,onKeyUp:Qe?this.onKeyUp:a,autoFocus:Ue,maxLength:Fe,readOnly:G,disabled:j,max:fe,min:Pe,step:_e,name:Be,title:De,id:ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(st),pattern:we,inputMode:ge,onInput:Je},Ie))))}}]),L}(_.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:s,required:!1,autoComplete:"off"};var x=w,b=Te.a=x},fjLI:function(pt,Te,q){"use strict";q.d(Te,"e",function(){return A}),q.d(Te,"a",function(){return d}),q.d(Te,"c",function(){return p}),q.d(Te,"d",function(){return m}),q.d(Te,"b",function(){return f});var ue=q("8HAY"),J=q("Cg/j"),O=q("T8No"),X=q("nnTU"),F=q("MI8n"),P=function(){var y=function(a,i){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var E in l)l.hasOwnProperty(E)&&(s[E]=l[E])},y(a,i)};return function(a,i){y(a,i);function s(){this.constructor=a}a.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),W=function(y,a,i,s){var l=arguments.length,E=l<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,i):s,g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(y,a,i,s);else for(var v=y.length-1;v>=0;v--)(g=y[v])&&(E=(l<3?g(E):l>3?g(a,i,E):g(a,i))||E);return l>3&&E&&Object.defineProperty(a,i,E),E},U=function(y,a){return function(i,s){a(i,s,y)}},_=function(){for(var y=0,a=0,i=arguments.length;a<i;a++)y+=arguments[a].length;for(var s=Array(y),l=0,a=0;a<i;a++)for(var E=arguments[a],g=0,v=E.length;g<v;g++,l++)s[l]=E[g];return s};function A(y){return y.command!==void 0}var d=Object(J.c)("menuService"),p=new(function(){function y(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new F.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return y.prototype.addCommand=function(a){var i=this;return this._commands.set(a.id,a),this._onDidChangeMenu.fire(0),{dispose:function(){i._commands.delete(a.id)&&i._onDidChangeMenu.fire(0)}}},y.prototype.getCommand=function(a){return this._commands.get(a)},y.prototype.getCommands=function(){var a=new Map;return this._commands.forEach(function(i,s){return a.set(s,i)}),a},y.prototype.appendMenuItem=function(a,i){var s=this,l=this._menuItems.get(a);return l?l.push(i):(l=[i],this._menuItems.set(a,l)),this._onDidChangeMenu.fire(a),{dispose:function(){var E=l.indexOf(i);E>=0&&(l.splice(E,1),s._onDidChangeMenu.fire(a))}}},y.prototype.getMenuItems=function(a){var i=(this._menuItems.get(a)||[]).slice(0);return a===0&&this._appendImplicitItems(i),i},y.prototype._appendImplicitItems=function(a){for(var i=new Set,s=a.filter(function(w){return A(w)}),l=0,E=s;l<E.length;l++){var g=E[l],v=g.command,k=g.alt;i.add(v.id),k&&i.add(k.id)}this._commands.forEach(function(w,x){i.has(x)||a.push({command:w})})},y}()),T=function(y){P(a,y);function a(i,s,l){var E=y.call(this,i,s)||this;return E._commandService=l,E}return a.prototype.run=function(){for(var i,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return(i=this._commandService).executeCommand.apply(i,_([this.id],s))},a=W([U(2,X.b)],a),a}(ue.a),m=function(y){P(a,y);function a(i){var s=this;return typeof i.title=="string"?s=y.call(this,"",i.title,"submenu")||this:s=y.call(this,"",i.title.value,"submenu")||this,s.item=i,s}return a}(ue.a),f=function(y){P(a,y);function a(i,s,l,E,g){var v=this;return typeof i.title=="string"?v=y.call(this,i.id,i.title,g)||this:v=y.call(this,i.id,i.title.value,g)||this,v._cssClass=void 0,v._enabled=!i.precondition||E.contextMatchesRules(i.precondition),v._checked=Boolean(i.toggled&&E.contextMatchesRules(i.toggled)),v._options=l||{},v.item=i,v.alt=s?new a(s,void 0,v._options,E,g):void 0,v}return a.prototype.dispose=function(){this.alt&&this.alt.dispose(),y.prototype.dispose.call(this)},a.prototype.run=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var l=[];return this._options.arg&&(l=_(l,[this._options.arg])),this._options.shouldForwardArgs&&(l=_(l,i)),y.prototype.run.apply(this,l)},a=W([U(3,O.c),U(4,X.b)],a),a}(T)},gnOq:function(pt,Te,q){"use strict";q.r(Te);var ue=q("+L6B"),J=q("2/Rp"),O=q("5NDa"),X=q("5rEg"),F=q("sPJy"),P=q("bE4q"),W=q("k1fw"),U=q("9og8"),_=q("y8nQ"),A=q("Vl3Y"),d=q("tJVT"),p=q("WmNS"),T=q.n(p),m=q("q1tI"),f=q.n(m),y=q("9kvl"),a=q("55Ip"),i=q("Ot1p"),s=q("XYT7"),l=q("we55"),E=q.n(l),g=q("500L"),v=q("1vsH"),k=function(x){var b,h=x.shixunHomeworks,u=x.newCourse,L=x.globalSetting,S=x.loading,D=x.dispatch,I=x.match,B=A.a.useForm(),j=Object(d.a)(B,1),G=j[0],M=Object(m.useState)({}),N=Object(d.a)(M,2),Y=N[0],ee=N[1],le=Object(m.useState)(),fe=Object(d.a)(le,2),Pe=fe[0],Se=fe[1],De=Object(m.useRef)(),Le=h.commonHomeWorkAddDefaultData;Object(m.useEffect)(function(){var de;setTimeout(function(){document.body.scrollIntoView()},300);var re=I.params,he=re.coursesId,ie=re.categoryId;De.current=(de=I.params)===null||de===void 0?void 0:de.courseId,Se(!!De.current),De.current&&Ae(),D({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:ie,coursesId:he,type:1}})},[]);var Ae=function(){var de=Object(U.a)(T.a.mark(function re(){var he;return T.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:return Re.next=2,D({type:"newCourse/getEditCourseData",payload:{id:De.current}});case 2:he=Re.sent,he&&(G.setFieldsValue({name:he.name}),G.setFieldsValue({intro:he.description}),G.setFieldsValue({notice:he.learning_notes}),ee({name:he.name,intro:he.description,notice:he.learning_notes}));case 4:case"end":return Re.stop()}},re)}));return function(){return de.apply(this,arguments)}}(),me=function(){var de=Object(U.a)(T.a.mark(function re(he){var ie,Re,oe,ae,ge,we,_e;return T.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return ie=Object(W.a)({},Y),ie.attachment_ids&&(ie.attachment_ids=ie==null||((Re=ie.attachment_ids)===null||Re===void 0)?void 0:Re.map(function(Be){return Be.response.id})),ie.reference_attachment_ids&&(ie.reference_attachment_ids=ie==null||((oe=ie.reference_attachment_ids)===null||oe===void 0)?void 0:oe.map(function(Be){return Be.response.id})),ae=I.params,ge=ae.coursesId,we=ae.categoryId,Ue.next=6,Object(s.a)(Object(W.a)(Object(W.a)({coursesId:ge,category:we},ie),{},{base_on_project:!0,type:1}));case 6:_e=Ue.sent,(_e==null?void 0:_e.status)===0&&(Object(v.Y)(["\u6559\u5B66\u8BFE\u5802","\u56FE\u6587\u4F5C\u4E1A","\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"]),y.d.push("/classrooms/".concat(I.params.coursesId,"/common_homework/").concat(_e.homework_id,"/detail")));case 8:case"end":return Ue.stop()}},re)}));return function(he){return de.apply(this,arguments)}}();return f.a.createElement("section",{className:E.a.bg},Le.course_name&&f.a.createElement("section",{className:"animated fadeIn"},f.a.createElement("aside",{className:"mt10"},Le.category&&f.a.createElement(P.a,{separator:">"},f.a.createElement(P.a.Item,null,f.a.createElement(a.a,{to:"/classrooms/".concat(Le.course_id,"/common_homework")},Le.course_name)),f.a.createElement(P.a.Item,null,f.a.createElement(a.a,{to:"/classrooms/".concat(Le.course_id,"/common_homework")},Le.category.category_name)),f.a.createElement(P.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),f.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"),f.a.createElement(A.a,{form:G,className:E.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",G.getFieldsValue()),ee(Object(W.a)({},G.getFieldsValue()))},onFinish:me},f.a.createElement("div",{className:E.a.fieldWrap},f.a.createElement(A.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},f.a.createElement(X.a,{maxLength:60,suffix:"".concat(((b=Y.name)===null||b===void 0?void 0:b.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),f.a.createElement("div",{className:E.a.mdWrap},f.a.createElement(A.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},f.a.createElement(i.a,{watch:!0,defaultValue:Y.intro})),f.a.createElement("div",null,f.a.createElement(A.a.Item,{name:"attachment_ids"},f.a.createElement(g.b,null)))),f.a.createElement("div",{className:E.a.mdWrap},f.a.createElement(A.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},f.a.createElement(i.a,{watch:!0,defaultValue:Y.notice})),f.a.createElement("div",null,f.a.createElement(A.a.Item,{name:"reference_attachment_ids"},f.a.createElement(g.b,null)))),f.a.createElement("div",{className:E.a.backgroundFa},f.a.createElement("div",{className:"pt40 mb30"},f.a.createElement(A.a.Item,null,f.a.createElement(J.a,{size:"large",type:"primary",className:"".concat(E.a.button," mr20"),htmlType:"submit",loading:S["newCourse/editCourse"]||S["newCourse/submitCourse"]},"\u63D0\u4EA4"),f.a.createElement(J.a,{size:"large",type:"primary",ghost:!0,className:E.a.button,onClick:function(){return y.d.push("/classrooms/".concat(I.params.coursesId,"/common_homework"))}},"\u53D6\u6D88"))))))};Te.default=Object(y.a)(function(w){var x=w.shixunHomeworks,b=w.newCourse,h=w.loading,u=w.globalSetting;return{shixunHomeworks:x,newCourse:b,globalSetting:u,loading:h.effects}})(k)},h78n:function(pt,Te,q){"use strict";q.d(Te,"a",function(){return D});var ue=q("q1tI"),J=q.n(ue),O=q("TSYQ"),X=q.n(O),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(j){var G=j.map(function(){return Object(ue.useRef)()}),M=Object(ue.useRef)();return Object(ue.useEffect)(function(){var N=Date.now(),Y=!1;Object.keys(G).forEach(function(ee){var le=G[ee].current;if(!le)return;Y=!0;var fe=le.style;fe.transitionDuration=".3s, .3s, .3s, .06s",M.current&&N-M.current<100&&(fe.transitionDuration="0s, 0s")}),Y&&(M.current=Date.now())}),[G]};function W(){return W=Object.assign||function(B){for(var j=1;j<arguments.length;j++){var G=arguments[j];for(var M in G)Object.prototype.hasOwnProperty.call(G,M)&&(B[M]=G[M])}return B},W.apply(this,arguments)}function U(B,j){return T(B)||p(B,j)||A(B,j)||_()}function _(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(B,j){if(!B)return;if(typeof B=="string")return d(B,j);var G=Object.prototype.toString.call(B).slice(8,-1);if(G==="Object"&&B.constructor&&(G=B.constructor.name),G==="Map"||G==="Set")return Array.from(B);if(G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G))return d(B,j)}function d(B,j){(j==null||j>B.length)&&(j=B.length);for(var G=0,M=new Array(j);G<j;G++)M[G]=B[G];return M}function p(B,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var G=[],M=!0,N=!1,Y=void 0;try{for(var ee=B[Symbol.iterator](),le;!(M=(le=ee.next()).done)&&!(G.push(le.value),j&&G.length===j);M=!0);}catch(fe){N=!0,Y=fe}finally{try{!M&&ee.return!=null&&ee.return()}finally{if(N)throw Y}}return G}function T(B){if(Array.isArray(B))return B}function m(B,j){if(B==null)return{};var G=f(B,j),M,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);for(N=0;N<Y.length;N++){if(M=Y[N],j.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,M))continue;G[M]=B[M]}}return G}function f(B,j){if(B==null)return{};var G={},M=Object.keys(B),N,Y;for(Y=0;Y<M.length;Y++){if(N=M[Y],j.indexOf(N)>=0)continue;G[N]=B[N]}return G}var y=function(j){var G=j.className,M=j.percent,N=j.prefixCls,Y=j.strokeColor,ee=j.strokeLinecap,le=j.strokeWidth,fe=j.style,Pe=j.trailColor,Se=j.trailWidth,De=j.transition,Le=m(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Le.gapPosition;var Ae=Array.isArray(M)?M:[M],me=Array.isArray(Y)?Y:[Y],de=P(Ae),re=U(de,1),he=re[0],ie=le/2,Re=100-le/2,oe="M ".concat(ee==="round"?ie:0,",").concat(ie,`
|
|
L `).concat(ee==="round"?Re:100,",").concat(ie),ae="0 0 100 ".concat(le),ge=0;return J.a.createElement("svg",W({className:X()("".concat(N,"-line"),G),viewBox:ae,preserveAspectRatio:"none",style:fe},Le),J.a.createElement("path",{className:"".concat(N,"-line-trail"),d:oe,strokeLinecap:ee,stroke:Pe,strokeWidth:Se||le,fillOpacity:"0"}),Ae.map(function(we,_e){var Fe={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(ge,"px"),transition:De||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=me[_e]||me[me.length-1];return ge+=we,J.a.createElement("path",{key:_e,className:"".concat(N,"-line-path"),d:oe,strokeLinecap:ee,stroke:Ue,strokeWidth:le,fillOpacity:"0",ref:he[_e],style:Fe})}))};y.defaultProps=F;var a=y;function i(){return i=Object.assign||function(B){for(var j=1;j<arguments.length;j++){var G=arguments[j];for(var M in G)Object.prototype.hasOwnProperty.call(G,M)&&(B[M]=G[M])}return B},i.apply(this,arguments)}function s(B,j){return k(B)||v(B,j)||E(B,j)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(B,j){if(!B)return;if(typeof B=="string")return g(B,j);var G=Object.prototype.toString.call(B).slice(8,-1);if(G==="Object"&&B.constructor&&(G=B.constructor.name),G==="Map"||G==="Set")return Array.from(B);if(G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G))return g(B,j)}function g(B,j){(j==null||j>B.length)&&(j=B.length);for(var G=0,M=new Array(j);G<j;G++)M[G]=B[G];return M}function v(B,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var G=[],M=!0,N=!1,Y=void 0;try{for(var ee=B[Symbol.iterator](),le;!(M=(le=ee.next()).done)&&!(G.push(le.value),j&&G.length===j);M=!0);}catch(fe){N=!0,Y=fe}finally{try{!M&&ee.return!=null&&ee.return()}finally{if(N)throw Y}}return G}function k(B){if(Array.isArray(B))return B}function w(B,j){if(B==null)return{};var G=x(B,j),M,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);for(N=0;N<Y.length;N++){if(M=Y[N],j.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,M))continue;G[M]=B[M]}}return G}function x(B,j){if(B==null)return{};var G={},M=Object.keys(B),N,Y;for(Y=0;Y<M.length;Y++){if(N=M[Y],j.indexOf(N)>=0)continue;G[N]=B[N]}return G}var b=0;function h(B){return+B.replace("%","")}function u(B){return Array.isArray(B)?B:[B]}function L(B,j,G,M){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,ee=50-M/2,le=0,fe=-ee,Pe=0,Se=-2*ee;switch(Y){case"left":le=-ee,fe=0,Pe=2*ee,Se=0;break;case"right":le=ee,fe=0,Pe=-2*ee,Se=0;break;case"bottom":fe=ee,Se=2*ee;break;default:}var De="M 50,50 m ".concat(le,",").concat(fe,`
|
|
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Pe,",").concat(-Se,`
|
|
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Pe,",").concat(Se),Le=Math.PI*2*ee,Ae={stroke:G,strokeDasharray:"".concat(j/100*(Le-N),"px ").concat(Le,"px"),strokeDashoffset:"-".concat(N/2+B/100*(Le-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:De,pathStyle:Ae}}var S=function(j){var G=j.prefixCls,M=j.strokeWidth,N=j.trailWidth,Y=j.gapDegree,ee=j.gapPosition,le=j.trailColor,fe=j.strokeLinecap,Pe=j.style,Se=j.className,De=j.strokeColor,Le=j.percent,Ae=w(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(ue.useMemo)(function(){return b+=1,b},[]),de=L(0,100,le,M,Y,ee),re=de.pathString,he=de.pathStyle,ie=u(Le),Re=u(De),oe=Re.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),ae=P(ie),ge=s(ae,1),we=ge[0],_e=function(){var Ue=0;return ie.map(function(Be,et){var Je=Re[et]||Re[Re.length-1],Ze=Object.prototype.toString.call(Je)==="[object Object]"?"url(#".concat(G,"-gradient-").concat(me,")"):"",Ye=L(Ue,Be,Je,M,Y,ee);return Ue+=Be,J.a.createElement("path",{key:et,className:"".concat(G,"-circle-path"),d:Ye.pathString,stroke:Ze,strokeLinecap:fe,strokeWidth:M,opacity:Be===0?0:1,fillOpacity:"0",style:Ye.pathStyle,ref:we[et]})})};return J.a.createElement("svg",i({className:X()("".concat(G,"-circle"),Se),viewBox:"0 0 100 100",style:Pe},Ae),oe&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(G,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(oe).sort(function(Fe,Ue){return h(Fe)-h(Ue)}).map(function(Fe,Ue){return J.a.createElement("stop",{key:Ue,offset:Fe,stopColor:oe[Fe]})}))),J.a.createElement("path",{className:"".concat(G,"-circle-trail"),d:re,stroke:le,strokeLinecap:fe,strokeWidth:N||M,fillOpacity:"0",style:he}),_e().reverse())};S.defaultProps=F;var D=S,I={Line:a,Circle:D}},kSUc:function(pt,Te,q){},lZu9:function(pt,Te,q){(function(ue){ue(q("VrN/"),q("1eCo"),q("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(J,O){var X=ue.getMode(J,"text/html"),F=X.name=="null";function P(M){if(ue.findModeByName){var N=ue.findModeByName(M);N&&(M=N.mime||N.mimes[0])}var Y=ue.getMode(J,M);return Y.name=="null"?null:Y}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var 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 U in W)W.hasOwnProperty(U)&&O.tokenTypeOverrides[U]&&(W[U]=O.tokenTypeOverrides[U]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,d=/^\[(x| )\](?=\s)/i,p=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,T=/^ {0,3}(?:\={1,}|-{2,})\s*$/,m=/^[^#!\[\]*_\\<>` "'(~:]+/,f=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,a=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,i=" ";function s(M,N,Y){return N.f=N.inline=Y,Y(M,N)}function l(M,N,Y){return N.f=N.block=Y,Y(M,N)}function E(M){return!M||!/\S/.test(M.string)}function g(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==k){var N=F;if(!N){var Y=ue.innerMode(X,M.htmlState);N=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}N&&(M.f=h,M.block=v,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function v(M,N){var Y=M.column()===N.indentation,ee=E(N.prevLine.stream),le=N.indentedCode,fe=N.prevLine.hr,Pe=N.list!==!1,Se=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var De=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Pe)){for(N.list=null;De<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=De-N.listStack[N.listStack.length-1])}var Le=!ee&&!fe&&!N.prevLine.header&&(!Pe||!le)&&!N.prevLine.fencedCodeEnd,Ae=(N.list===!1||fe||ee)&&N.indentation<=Se&&M.match(_),me=null;if(N.indentationDiff>=4&&(le||N.prevLine.fencedCodeEnd||N.prevLine.header||ee))return M.skipToEnd(),N.indentedCode=!0,W.code;if(M.eatSpace())return null;if(Y&&N.indentation<=Se&&(me=M.match(p))&&me[1].length<=6)return N.quote=0,N.header=me[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,x(N);if(N.indentation<=Se&&M.eat(">"))return N.quote=Y?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),M.eatSpace(),x(N);if(!Ae&&!N.setext&&Y&&N.indentation<=Se&&(me=M.match(A))){var de=me[1]?"ol":"ul";return N.indentation=De+M.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,O.taskLists&&M.match(d,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+de]),x(N)}else{if(Y&&N.indentation<=Se&&(me=M.match(f,!0)))return N.quote=0,N.fencedEndRE=new RegExp(me[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&P(me[2]||O.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ue.startState(N.localMode)),N.f=N.block=w,O.highlightFormatting&&(N.formatting="code-block"),N.code=-1,x(N);if(N.setext||(!Le||!Pe)&&!N.quote&&N.list===!1&&!N.code&&!Ae&&!y.test(M.string)&&(me=M.lookAhead(1))&&(me=me.match(T)))return N.setext?(N.header=N.setext,N.setext=0,M.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=me[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,x(N);if(Ae)return M.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,W.hr;if(M.peek()==="[")return s(M,N,I)}return s(M,N,N.inline)}function k(M,N){var Y=X.token(M,N.htmlState);if(!F){var ee=ue.innerMode(X,N.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||N.md_inside&&M.current().indexOf(">")>-1)&&(N.f=h,N.block=v,N.htmlState=null)}return Y}function w(M,N){var Y=N.listStack[N.listStack.length-1]||0,ee=N.indentation<Y,le=Y+3;if(N.fencedEndRE&&N.indentation<=le&&(ee||M.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var fe;return ee||(fe=x(N)),N.localMode=N.localState=null,N.block=v,N.f=h,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ee?l(M,N,N.block):fe}else return N.localMode?N.localMode.token(M,N.localState):(M.skipToEnd(),W.code)}function x(M){var N=[];if(M.formatting){N.push(W.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var Y=0;Y<M.formatting.length;Y++)N.push(W.formatting+"-"+M.formatting[Y]),M.formatting[Y]==="header"&&N.push(W.formatting+"-"+M.formatting[Y]+"-"+M.header),M.formatting[Y]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?N.push(W.formatting+"-"+M.formatting[Y]+"-"+M.quote):N.push("error"))}if(M.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(M.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(M.linkHref?N.push(W.linkHref,"url"):(M.strong&&N.push(W.strong),M.em&&N.push(W.em),M.strikethrough&&N.push(W.strikethrough),M.emoji&&N.push(W.emoji),M.linkText&&N.push(W.linkText),M.code&&N.push(W.code),M.image&&N.push(W.image),M.imageAltText&&N.push(W.imageAltText,"link"),M.imageMarker&&N.push(W.imageMarker)),M.header&&N.push(W.header,W.header+"-"+M.header),M.quote&&(N.push(W.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?N.push(W.quote+"-"+M.quote):N.push(W.quote+"-"+O.maxBlockquoteDepth)),M.list!==!1){var ee=(M.listStack.length-1)%3;ee?ee===1?N.push(W.list2):N.push(W.list3):N.push(W.list1)}return M.trailingSpaceNewLine?N.push("trailing-space-new-line"):M.trailingSpace&&N.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function b(M,N){return M.match(m,!0)?x(N):void 0}function h(M,N){var Y=N.text(M,N);if(typeof Y!="undefined")return Y;if(N.list)return N.list=null,x(N);if(N.taskList){var ee=M.match(d,!0)[1]===" ";return ee?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,x(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&M.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),x(N);var le=M.next();if(N.linkTitle){N.linkTitle=!1;var fe=le;le==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Pe="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(M.match(new RegExp(Pe),!0))return W.linkHref}if(le==="`"){var Se=N.formatting;O.highlightFormatting&&(N.formatting="code"),M.eatWhile("`");var De=M.current().length;if(N.code==0&&(!N.quote||De==1))return N.code=De,x(N);if(De==N.code){var Le=x(N);return N.code=0,Le}else return N.formatting=Se,x(N)}else if(N.code)return x(N);if(le==="\\"&&(M.next(),O.highlightFormatting)){var Ae=x(N),me=W.formatting+"-escape";return Ae?Ae+" "+me:me}if(le==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),x(N);if(le==="["&&N.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),x(N);if(le==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var Ae=x(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=L,Ae}if(le==="["&&!N.image)return N.linkText&&M.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),x(N);if(le==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var Ae=x(N);return N.linkText=!1,N.inline=N.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?L:h,Ae}if(le==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=u,O.highlightFormatting&&(N.formatting="link");var Ae=x(N);return Ae?Ae+=" ":Ae="",Ae+W.linkInline}if(le==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=u,O.highlightFormatting&&(N.formatting="link");var Ae=x(N);return Ae?Ae+=" ":Ae="",Ae+W.linkEmail}if(O.xml&&le==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var de=M.string.indexOf(">",M.pos);if(de!=-1){var re=M.string.substring(M.start,de);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(N.md_inside=!0)}return M.backUp(1),N.htmlState=ue.startState(X),l(M,N,k)}if(O.xml&&le==="<"&&M.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(le==="*"||le==="_"){for(var he=1,ie=M.pos==1?" ":M.string.charAt(M.pos-2);he<3&&M.eat(le);)he++;var Re=M.peek()||" ",oe=!/\s/.test(Re)&&(!a.test(Re)||/\s/.test(ie)||a.test(ie)),ae=!/\s/.test(ie)&&(!a.test(ie)||/\s/.test(Re)||a.test(Re)),ge=null,we=null;if(he%2&&(!N.em&&oe&&(le==="*"||!ae||a.test(ie))?ge=!0:N.em==le&&ae&&(le==="*"||!oe||a.test(Re))&&(ge=!1)),he>1&&(!N.strong&&oe&&(le==="*"||!ae||a.test(ie))?we=!0:N.strong==le&&ae&&(le==="*"||!oe||a.test(Re))&&(we=!1)),we!=null||ge!=null){O.highlightFormatting&&(N.formatting=ge==null?"strong":we==null?"em":"strong em"),ge===!0&&(N.em=le),we===!0&&(N.strong=le);var Le=x(N);return ge===!1&&(N.em=!1),we===!1&&(N.strong=!1),Le}}else if(le===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return x(N);M.backUp(1)}if(O.strikethrough){if(le==="~"&&M.eatWhile(le)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var Le=x(N);return N.strikethrough=!1,Le}else if(M.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),x(N)}else if(le===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return x(N);M.backUp(2)}}if(O.emoji&&le===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var _e=x(N);return N.emoji=!1,_e}return le===" "&&(M.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),x(N)}function u(M,N){var Y=M.next();if(Y===">"){N.f=N.inline=h,O.highlightFormatting&&(N.formatting="link");var ee=x(N);return ee?ee+=" ":ee="",ee+W.linkInline}return M.match(/^[^>]+/,!0),W.linkInline}function L(M,N){if(M.eatSpace())return null;var Y=M.next();return Y==="("||Y==="["?(N.f=N.inline=D(Y==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,x(N)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function D(M){return function(N,Y){var ee=N.next();if(ee===M){Y.f=Y.inline=h,O.highlightFormatting&&(Y.formatting="link-string");var le=x(Y);return Y.linkHref=!1,le}return N.match(S[M]),Y.linkHref=!0,x(Y)}}function I(M,N){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=B,M.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,x(N)):s(M,N,h)}function B(M,N){if(M.match(/^\]:/,!0)){N.f=N.inline=j,O.highlightFormatting&&(N.formatting="link");var Y=x(N);return N.linkText=!1,Y}return M.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function j(M,N){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?N.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=h,W.linkHref+" url")}var G={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:h,text:b,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&ue.copyState(X,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?ue.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,N){if(N.formatting=!1,M!=N.thisLine.stream){if(N.header=0,N.hr=!1,M.match(/^\s*$/,!0))return g(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:M},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=k)){var Y=M.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(N.indentation=Y,N.indentationDiff=null,Y>0)return null}}return N.f(M,N)},innerMode:function(M){return M.block==k?{state:M.htmlState,mode:X}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:G}},indent:function(M,N,Y){return M.block==k&&X.indent?X.indent(M.htmlState,N,Y):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,N,Y):ue.Pass},blankLine:g,getType:x,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return G},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},nnTU:function(pt,Te,q){"use strict";q.d(Te,"b",function(){return U}),q.d(Te,"a",function(){return _});var ue=q("pmY6"),J=q("746U"),O=q("Cg/j"),X=q("MI8n"),F=q("24hK"),P=q("QDVR"),W=function(){for(var A=0,d=0,p=arguments.length;d<p;d++)A+=arguments[d].length;for(var T=Array(A),m=0,d=0;d<p;d++)for(var f=arguments[d],y=0,a=f.length;y<a;y++,m++)T[m]=f[y];return T},U=Object(O.c)("commandService"),_=new(function(){function A(){this._commands=new Map,this._onDidRegisterCommand=new X.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return A.prototype.registerCommand=function(d,p){var T=this;if(!d)throw new Error("invalid command");if(typeof d=="string"){if(!p)throw new Error("invalid command");return this.registerCommand({id:d,handler:p})}if(d.description){for(var m=[],f=0,y=d.description.args;f<y.length;f++){var a=y[f];m.push(a.constraint)}var i=d.handler;d.handler=function(v){for(var k=[],w=1;w<arguments.length;w++)k[w-1]=arguments[w];return Object(J.m)(k,m),i.apply(void 0,W([v],k))}}var s=d.id,l=this._commands.get(s);l||(l=new F.a,this._commands.set(s,l));var E=l.unshift(d),g=Object(ue.h)(function(){E();var v=T._commands.get(s);(v==null?void 0:v.isEmpty())&&T._commands.delete(s)});return this._onDidRegisterCommand.fire(s),g},A.prototype.registerCommandAlias=function(d,p){return _.registerCommand(d,function(T){for(var m,f=[],y=1;y<arguments.length;y++)f[y-1]=arguments[y];return(m=T.get(U)).executeCommand.apply(m,W([p],f))})},A.prototype.getCommand=function(d){var p=this._commands.get(d);return!p||p.isEmpty()?void 0:p.iterator().next().value},A.prototype.getCommands=function(){for(var d=new Map,p=0,T=Object(P.d)(this._commands);p<T.length;p++){var m=T[p],f=this.getCommand(m);f&&d.set(m,f)}return d},A}())},osHv:function(pt,Te,q){(function(ue){ue(q("VrN/"))})(function(ue){"use strict";var J=ue.Pos;function O(a,i){return a.line-i.line||a.ch-i.ch}var X="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",F=X+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+X+"]["+F+"]*)","g");function W(a,i,s,l){this.line=i,this.ch=s,this.cm=a,this.text=a.getLine(i),this.min=l?Math.max(l.from,a.firstLine()):a.firstLine(),this.max=l?Math.min(l.to-1,a.lastLine()):a.lastLine()}function U(a,i){var s=a.cm.getTokenTypeAt(J(a.line,i));return s&&/\btag\b/.test(s)}function _(a){return a.line>=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function A(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function d(a){for(;;){var i=a.text.indexOf(">",a.ch);if(i==-1){if(_(a))continue;return}if(!U(a,i+1)){a.ch=i+1;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function p(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(A(a))continue;return}if(!U(a,i+1)){a.ch=i;continue}P.lastIndex=i,a.ch=i;var s=P.exec(a.text);if(s&&s.index==i)return s}}function T(a){for(;;){P.lastIndex=a.ch;var i=P.exec(a.text);if(!i){if(_(a))continue;return}if(!U(a,i.index+1)){a.ch=i.index+1;continue}return a.ch=i.index+i[0].length,i}}function m(a){for(;;){var i=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(i==-1){if(A(a))continue;return}if(!U(a,i+1)){a.ch=i;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function f(a,i){for(var s=[];;){var l=T(a),E,g=a.line,v=a.ch-(l?l[0].length:0);if(!l||!(E=d(a)))return;if(E=="selfClose")continue;if(l[1]){for(var k=s.length-1;k>=0;--k)if(s[k]==l[2]){s.length=k;break}if(k<0&&(!i||i==l[2]))return{tag:l[2],from:J(g,v),to:J(a.line,a.ch)}}else s.push(l[2])}}function y(a,i){for(var s=[];;){var l=m(a);if(!l)return;if(l=="selfClose"){p(a);continue}var E=a.line,g=a.ch,v=p(a);if(!v)return;if(v[1])s.push(v[2]);else{for(var k=s.length-1;k>=0;--k)if(s[k]==v[2]){s.length=k;break}if(k<0&&(!i||i==v[2]))return{tag:v[2],from:J(a.line,a.ch),to:J(E,g)}}}}ue.registerHelper("fold","xml",function(a,i){for(var s=new W(a,i.line,0);;){var l=T(s);if(!l||s.line!=i.line)return;var E=d(s);if(!E)return;if(!l[1]&&E!="selfClose"){var g=J(s.line,s.ch),v=f(s,l[2]);return v&&O(v.from,g)>0?{from:g,to:v.from}:null}}}),ue.findMatchingTag=function(a,i,s){var l=new W(a,i.line,i.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var E=d(l),g=E&&J(l.line,l.ch),v=E&&p(l);if(!E||!v||O(l,i)>0)return;var k={from:J(l.line,l.ch),to:g,tag:v[2]};return E=="selfClose"?{open:k,close:null,at:"open"}:v[1]?{open:y(l,v[2]),close:k,at:"close"}:(l=new W(a,g.line,g.ch,s),{open:k,close:f(l,v[2]),at:"open"})},ue.findEnclosingTag=function(a,i,s,l){for(var E=new W(a,i.line,i.ch,s);;){var g=y(E,l);if(!g)break;var v=new W(a,i.line,i.ch,s),k=f(v,g.tag);if(k)return{open:g,close:k}}},ue.scanForClosingTag=function(a,i,s,l){var E=new W(a,i.line,i.ch,l?{from:0,to:l}:null);return f(E,s)}})},p5ED:function(pt,Te,q){"use strict";var ue=q("+L6B"),J=q("2/Rp"),O=q("5Dmo"),X=q("3S7+"),F=q("k1fw"),P=q("9og8"),W=q("tJVT"),U=q("WmNS"),_=q.n(U),A=q("q1tI"),d=q.n(A),p=q("vHTk"),T=q.n(p),m=q("yEEn"),f=q("ZW9T"),y=q("1vsH"),a=q("V0Rq"),i=q("m3rI");Te.a=function(s){var l,E,g,v,k,w,x=s.editOffice,b=x===void 0?"view":x,h=s.name,u=s.data,L=s.theme,S=s.type,D=s.filename,I=s.monacoEditor,B=s.className,j=s.style,G=s.close,M=s.onClose,N=s.hasMask,Y=s.disabledDownload,ee=s.onImgDimensions,le=s.otherData,fe=Object(A.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Pe=Object(W.a)(fe,2),Se=Pe[0],De=Pe[1],Le=Object(A.useState)(""),Ae=Object(W.a)(Le,2),me=Ae[0],de=Ae[1],re=Object(A.useState)(),he=Object(W.a)(re,2),ie=he[0],Re=he[1],oe=window.ENV==="build"?"/react/build":"",ae=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,ge,we=1024*1024,_e=10*we,Fe=Object(A.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&S!=="txt"&&(u=i.a.API_SERVER+u),S==="office"&&(ge=Object(y.P)(u).filesize,ge>_e&&(S="other")),D&&(I.filename=D),Object(A.useEffect)(function(){var Je,Ze,Ye=(Je=document.cookie)===null||Je===void 0||((Ze=Je.replace(/\s/g,""))===null||Ze===void 0)?void 0:Ze.split(";");Ye==null||Ye.map(function(dt){var qe=dt.split("=");qe[0]==="_educoder_session"&&de(qe[1])})},[]),Object(A.useEffect)(function(){S==="office"&&Ue()},[S,u]);var Ue=function(){var Je=Object(P.a)(_.a.mark(function Ze(){var Ye,dt,qe;return _.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return console.log("data:",u),Ye=u,u.startsWith("http")||(Ye=location.origin+Ye),dt=new URL(Ye).pathname.split("/").pop(),Ie.next=6,Object(a.U)({attachment_id:dt});case 6:qe=Ie.sent,Re(qe);case 8:case"end":return Ie.stop()}},Ze)}));return function(){return Je.apply(this,arguments)}}(),Be=function(){if(u.startsWith("http")||u.startsWith("blob:")){et();return}Object(y.x)(D||"educoder",u,D)},et=function(){Object(y.v)(D||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(F.a)({},j||{}),className:"".concat(N&&T.a.bgBlack," ").concat(S?T.a.wrp:"hide")},G&&d.a.createElement("div",{className:T.a.close,ref:Fe},!!ee&&d.a.createElement(X.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return Fe.current}},d.a.createElement("span",{onClick:function(){M(),ee()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!Y&&d.a.createElement(X.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Fe.current}},d.a.createElement("span",{onClick:et},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(X.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Fe.current}},d.a.createElement("span",{className:"",onClick:M},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(T.a[B]," ").concat(B," ").concat(T.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&d.a.createElement(f.b,I)),S==="audio"&&d.a.createElement("audio",{src:"".concat(((E=u)===null||E===void 0?void 0:E.indexOf("http://"))>-1||((g=u)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),S==="video"&&d.a.createElement(d.a.Fragment,null,((v=u)===null||v===void 0?void 0:v.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),S==="office"&&ie&&d.a.createElement("iframe",{src:"".concat(oe,"/office.html?key=").concat(ie.key,"&url=").concat(ae+ie.url,"&callbackUrl=").concat(ae+ie.callbackUrl,"&fileType=").concat(ie.fileType,"&title=").concat(ie.title,"&model=").concat(b,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!Y)}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(le.key,"&url=").concat(i.a.API_SERVER+le.url,"&callbackUrl=").concat(i.a.API_SERVER+le.callbackUrl,"&fileType=").concat(le.fileType,"&title=").concat(le.title,"&model=").concat(le.model)}),S==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),S==="pdf"&&d.a.createElement("embed",{className:T.a.embed,src:u}),S==="image"&&d.a.createElement("img",{src:"".concat(((k=u)===null||k===void 0?void 0:k.indexOf("http://"))>-1||((w=u)===null||w===void 0?void 0:w.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)}),S==="other"&&d.a.createElement("div",null,d.a.createElement(J.a,{type:"primary",size:"large",onClick:Be},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&d.a.createElement(J.a,{type:"primary",size:"large",onClick:Be},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(pt,Te,q){},pmY6:function(pt,Te,q){"use strict";q.d(Te,"g",function(){return F}),q.d(Te,"f",function(){return P}),q.d(Te,"e",function(){return W}),q.d(Te,"h",function(){return U}),q.d(Te,"b",function(){return _}),q.d(Te,"a",function(){return A}),q.d(Te,"d",function(){return d}),q.d(Te,"c",function(){return p});var ue=!1,J="__is_disposable_tracked__";function O(T){if(!ue)return;if(T&&T!==A.None)try{T[J]=!0}catch(m){}}function X(T){if(!ue)return T;var m=new Error("Potentially leaked disposable").stack;return setTimeout(function(){T[J]||console.log(m)},3e3),T}function F(T){return typeof T.dispose=="function"&&T.dispose.length===0}function P(T){return Array.isArray(T)?(T.forEach(function(m){m&&(O(m),m.dispose())}),[]):T?(O(T),T.dispose(),T):void 0}function W(){for(var T=[],m=0;m<arguments.length;m++)T[m]=arguments[m];return T.forEach(O),X({dispose:function(){return P(T)}})}function U(T){var m=X({dispose:function(){O(m),T()}});return m}var _=function(){function T(){this._toDispose=new Set,this._isDisposed=!1}return T.prototype.dispose=function(){if(this._isDisposed)return;O(this),this._isDisposed=!0,this.clear()},T.prototype.clear=function(){this._toDispose.forEach(function(m){return m.dispose()}),this._toDispose.clear()},T.prototype.add=function(m){if(!m)return m;if(m===this)throw new Error("Cannot register a disposable on itself!");return O(m),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(m),m},T}(),A=function(){function T(){this._store=new _,X(this)}return T.prototype.dispose=function(){O(this),this._store.dispose()},T.prototype._register=function(m){if(m===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(m)},T.None=Object.freeze({dispose:function(){}}),T}(),d=function(){function T(){this._isDisposed=!1,X(this)}return Object.defineProperty(T.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(m){if(this._isDisposed||m===this._value)return;this._value&&this._value.dispose(),m&&O(m),this._value=m},enumerable:!0,configurable:!0}),T.prototype.clear=function(){this.value=void 0},T.prototype.dispose=function(){this._isDisposed=!0,O(this),this._value&&this._value.dispose(),this._value=void 0},T}(),p=function(){function T(m){this.object=m}return T.prototype.dispose=function(){},T}()},"rAM+":function(pt,Te,q){"use strict";q.d(Te,"a",function(){return J});var ue=q("Qw5x");function J(O,X){var F;if(typeof Symbol=="undefined"||O[Symbol.iterator]==null){if(Array.isArray(O)||(F=Object(ue.a)(O))||X&&O&&typeof O.length=="number"){F&&(O=F);var P=0,W=function(){};return{s:W,n:function(){return P>=O.length?{done:!0}:{done:!1,value:O[P++]}},e:function(p){throw p},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 U=!0,_=!1,A;return{s:function(){F=O[Symbol.iterator]()},n:function(){var p=F.next();return U=p.done,p},e:function(p){_=!0,A=p},f:function(){try{!U&&F.return!=null&&F.return()}finally{if(_)throw A}}}}},rUJ1:function(pt,Te){const q=/[&<>"']/,ue=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,X={"&":"&","<":"<",">":">",'"':""","'":"'"},F=w=>X[w];function P(w,x){if(x){if(q.test(w))return w.replace(ue,F)}else if(J.test(w))return w.replace(O,F);return w}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(w){return w.replace(W,(x,b)=>(b=b.toLowerCase(),b==="colon"?":":b.charAt(0)==="#"?b.charAt(1)==="x"?String.fromCharCode(parseInt(b.substring(2),16)):String.fromCharCode(+b.substring(1)):""))}const _=/(^|[^\[])\^/g;function A(w,x){w=w.source||w,x=x||"";const b={replace:(h,u)=>(u=u.source||u,u=u.replace(_,"$1"),w=w.replace(h,u),b),getRegex:()=>new RegExp(w,x)};return b}const d=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(w,x,b){if(w){let h;try{h=decodeURIComponent(U(b)).replace(d,"").toLowerCase()}catch(u){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}x&&!p.test(b)&&(b=i(x,b));try{b=encodeURI(b).replace(/%25/g,"%")}catch(h){return null}return b}const m={},f=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(w,x){m[" "+w]||(f.test(w)?m[" "+w]=w+"/":m[" "+w]=g(w,"/",!0)),w=m[" "+w];const b=w.indexOf(":")===-1;return x.substring(0,2)==="//"?b?x:w.replace(y,"$1")+x:x.charAt(0)==="/"?b?x:w.replace(a,"$1")+x:w+x}const s={exec:function(){}};function l(w){let x=1,b,h;for(;x<arguments.length;x++){b=arguments[x];for(h in b)Object.prototype.hasOwnProperty.call(b,h)&&(w[h]=b[h])}return w}function E(w,x){const b=w.replace(/\|/g,(L,S,D)=>{let I=!1,B=S;for(;--B>=0&&D[B]==="\\";)I=!I;return I?"|":" |"}),h=b.split(/ \|/);let u=0;if(h.length>x)h.splice(x);else for(;h.length<x;)h.push("");for(;u<h.length;u++)h[u]=h[u].trim().replace(/\\\|/g,"|");return h}function g(w,x,b){const h=w.length;if(h===0)return"";let u=0;for(;u<h;){const L=w.charAt(h-u-1);if(L===x&&!b)u++;else if(L!==x&&b)u++;else break}return w.substr(0,h-u)}function v(w,x){if(w.indexOf(x[1])===-1)return-1;const b=w.length;let h=0,u=0;for(;u<b;u++)if(w[u]==="\\")u++;else if(w[u]===x[0])h++;else if(w[u]===x[1]&&(h--,h<0))return u;return-1}function k(w){w&&w.sanitize&&!w.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}pt.exports={escape:P,unescape:U,edit:A,cleanUrl:T,resolveUrl:i,noopTest:s,merge:l,splitCells:E,rtrim:g,findClosingBracket:v,checkSanitizeDeprecation:k}},ulZh:function(pt,Te,q){typeof window!="undefined"&&function(J,O){pt.exports=O()}(this,function(){return function(ue){var J={};function O(X){if(J[X])return J[X].exports;var F=J[X]={i:X,l:!1,exports:{}};return ue[X].call(F.exports,F,F.exports,O),F.l=!0,F.exports}return O.m=ue,O.c=J,O.d=function(X,F,P){O.o(X,F)||Object.defineProperty(X,F,{enumerable:!0,get:P})},O.r=function(X){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(X,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(X,"__esModule",{value:!0})},O.t=function(X,F){if(F&1&&(X=O(X)),F&8)return X;if(F&4&&typeof X=="object"&&X&&X.__esModule)return X;var P=Object.create(null);if(O.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:X}),F&2&&typeof X!="string")for(var W in X)O.d(P,W,function(U){return X[U]}.bind(null,W));return P},O.n=function(X){var F=X&&X.__esModule?function(){return X.default}:function(){return X};return O.d(F,"a",F),F},O.o=function(X,F){return Object.prototype.hasOwnProperty.call(X,F)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,J,O){"use strict";var X=Object.prototype.hasOwnProperty,F="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(F=!1));function W(d,p,T){this.fn=d,this.context=p,this.once=T||!1}function U(d,p,T,m,f){if(typeof T!="function")throw new TypeError("The listener must be a function");var y=new W(T,m||d,f),a=F?F+p:p;return d._events[a]?d._events[a].fn?d._events[a]=[d._events[a],y]:d._events[a].push(y):(d._events[a]=y,d._eventsCount++),d}function _(d,p){--d._eventsCount===0?d._events=new P:delete d._events[p]}function A(){this._events=new P,this._eventsCount=0}A.prototype.eventNames=function(){var p=[],T,m;if(this._eventsCount===0)return p;for(m in T=this._events)X.call(T,m)&&p.push(F?m.slice(1):m);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(T)):p},A.prototype.listeners=function(p){var T=F?F+p:p,m=this._events[T];if(!m)return[];if(m.fn)return[m.fn];for(var f=0,y=m.length,a=new Array(y);f<y;f++)a[f]=m[f].fn;return a},A.prototype.listenerCount=function(p){var T=F?F+p:p,m=this._events[T];return m?m.fn?1:m.length:0},A.prototype.emit=function(p,T,m,f,y,a){var i=F?F+p:p;if(!this._events[i])return!1;var s=this._events[i],l=arguments.length,E,g;if(s.fn){s.once&&this.removeListener(p,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,T),!0;case 3:return s.fn.call(s.context,T,m),!0;case 4:return s.fn.call(s.context,T,m,f),!0;case 5:return s.fn.call(s.context,T,m,f,y),!0;case 6:return s.fn.call(s.context,T,m,f,y,a),!0}for(g=1,E=new Array(l-1);g<l;g++)E[g-1]=arguments[g];s.fn.apply(s.context,E)}else{var v=s.length,k;for(g=0;g<v;g++){s[g].once&&this.removeListener(p,s[g].fn,void 0,!0);switch(l){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,T);break;case 3:s[g].fn.call(s[g].context,T,m);break;case 4:s[g].fn.call(s[g].context,T,m,f);break;default:if(!E)for(k=1,E=new Array(l-1);k<l;k++)E[k-1]=arguments[k];s[g].fn.apply(s[g].context,E)}}}return!0},A.prototype.on=function(p,T,m){return U(this,p,T,m,!1)},A.prototype.once=function(p,T,m){return U(this,p,T,m,!0)},A.prototype.removeListener=function(p,T,m,f){var y=F?F+p:p;if(!this._events[y])return this;if(!T)return _(this,y),this;var a=this._events[y];if(a.fn)a.fn===T&&(!f||a.once)&&(!m||a.context===m)&&_(this,y);else{for(var i=0,s=[],l=a.length;i<l;i++)(a[i].fn!==T||f&&!a[i].once||m&&a[i].context!==m)&&s.push(a[i]);s.length?this._events[y]=s.length===1?s[0]:s:_(this,y)}return this},A.prototype.removeAllListeners=function(p){var T;return p?(T=F?F+p:p,this._events[T]&&_(this,T)):(this._events=new P,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=F,A.EventEmitter=A,ue.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,J,O){(function(X){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(A,d,p){if(p=p||{},A=A.trim(),d=d.trim(),!d){if(!p.alwaysNormalize)return A;var T=_.parseURL(A);if(!T)throw new Error("Error trying to parse base URL.");return T.path=_.normalizePath(T.path),_.buildURLFromParts(T)}var m=_.parseURL(d);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return p.alwaysNormalize?(m.path=_.normalizePath(m.path),_.buildURLFromParts(m)):d;var f=_.parseURL(A);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var y=P.exec(f.path);f.netLoc=y[1],f.path=y[2]}f.netLoc&&!f.path&&(f.path="/");var a={scheme:f.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(a.netLoc=f.netLoc,m.path[0]!=="/"))if(!m.path)a.path=f.path,m.params||(a.params=f.params,m.query||(a.query=f.query));else{var i=f.path,s=i.substring(0,i.lastIndexOf("/")+1)+m.path;a.path=_.normalizePath(s)}return a.path===null&&(a.path=p.alwaysNormalize?_.normalizePath(m.path):m.path),_.buildURLFromParts(a)},parseURL:function(A){var d=F.exec(A);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(W,"");A.length!==(A=A.replace(U,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};ue.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,J,O){function X(p){var T={};function m(y){if(T[y])return T[y].exports;var a=T[y]={i:y,l:!1,exports:{}};return p[y].call(a.exports,a,a.exports,m),a.l=!0,a.exports}m.m=p,m.c=T,m.i=function(y){return y},m.d=function(y,a,i){m.o(y,a)||Object.defineProperty(y,a,{configurable:!1,enumerable:!0,get:i})},m.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},m.n=function(y){var a=y&&y.__esModule?function(){return y.default}:function(){return y};return m.d(a,"a",a),a},m.o=function(y,a){return Object.prototype.hasOwnProperty.call(y,a)},m.p="/",m.oe=function(y){throw console.error(y),y};var f=m(m.s=ENTRY_MODULE);return f.default||f}var F="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function W(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(p){return!isNaN(1*p)}function _(p,T,m){var f={};f[m]=[];var y=T.toString(),a=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return f;for(var i=a[1],s=new RegExp("(\\\\n|\\W)"+W(i)+P,"g"),l;l=s.exec(y);){if(l[3]==="dll-reference")continue;f[m].push(l[3])}for(s=new RegExp("\\("+W(i)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+P,"g");l=s.exec(y);)p[l[2]]||(f[m].push(l[1]),p[l[2]]=O(l[1]).m),f[l[2]]=f[l[2]]||[],f[l[2]].push(l[4]);for(var E=Object.keys(f),g=0;g<E.length;g++)for(var v=0;v<f[E[g]].length;v++)U(f[E[g]][v])&&(f[E[g]][v]=1*f[E[g]][v]);return f}function A(p){var T=Object.keys(p);return T.reduce(function(m,f){return m||p[f].length>0},!1)}function d(p,T){for(var m={main:[T]},f={main:[]},y={main:{}};A(m);)for(var a=Object.keys(m),i=0;i<a.length;i++){var s=a[i],l=m[s],E=l.pop();if(y[s]=y[s]||{},y[s][E]||!p[s][E])continue;y[s][E]=!0,f[s]=f[s]||[],f[s].push(E);for(var g=_(p,p[s][E],s),v=Object.keys(g),k=0;k<v.length;k++)m[v[k]]=m[v[k]]||[],m[v[k]]=m[v[k]].concat(g[v[k]])}return f}ue.exports=function(p,T){T=T||{};var m={main:O.m},f=T.all?{main:Object.keys(m.main)}:d(m,p),y="";Object.keys(f).filter(function(E){return E!=="main"}).forEach(function(E){for(var g=0;f[E][g];)g++;f[E].push(g),m[E][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+E+" = ("+X.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+f[E].map(function(v){return""+JSON.stringify(v)+": "+m[E][v].toString()}).join(",")+`});
|
|
`}),y=y+"new (("+X.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+f.main.map(function(E){return""+JSON.stringify(E)+": "+m.main[E].toString()}).join(",")+"}))(self);";var a=new window.Blob([y],{type:"text/javascript"});if(T.bare)return a;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,s=i.createObjectURL(a),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"hlsDefaultConfig",function(){return k}),O.d(J,"mergeConfig",function(){return x}),O.d(J,"enableStreamingMode",function(){return b});var X=O("./src/controller/abr-controller.ts"),F=O("./src/controller/audio-stream-controller.ts"),P=O("./src/controller/audio-track-controller.ts"),W=O("./src/controller/subtitle-stream-controller.ts"),U=O("./src/controller/subtitle-track-controller.ts"),_=O("./src/controller/buffer-controller.ts"),A=O("./src/controller/timeline-controller.ts"),d=O("./src/controller/cap-level-controller.ts"),p=O("./src/controller/fps-controller.ts"),T=O("./src/controller/eme-controller.ts"),m=O("./src/controller/cmcd-controller.ts"),f=O("./src/utils/xhr-loader.ts"),y=O("./src/utils/fetch-loader.ts"),a=O("./src/utils/cues.ts"),i=O("./src/utils/mediakeys-helper.ts"),s=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(h){for(var u=1;u<arguments.length;u++){var L=arguments[u];for(var S in L)Object.prototype.hasOwnProperty.call(L,S)&&(h[S]=L[S])}return h},l.apply(this,arguments)}function E(h,u){var L=Object.keys(h);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(h);u&&(S=S.filter(function(D){return Object.getOwnPropertyDescriptor(h,D).enumerable})),L.push.apply(L,S)}return L}function g(h){for(var u=1;u<arguments.length;u++){var L=arguments[u]!=null?arguments[u]:{};u%2?E(Object(L),!0).forEach(function(S){v(h,S,L[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(L)):E(Object(L)).forEach(function(S){Object.defineProperty(h,S,Object.getOwnPropertyDescriptor(L,S))})}return h}function v(h,u,L){return u in h?Object.defineProperty(h,u,{value:L,enumerable:!0,configurable:!0,writable:!0}):h[u]=L,h}var k=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:f.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:X.default,bufferController:_.default,capLevelController:d.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},w()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:U.default,timelineController:A.TimelineController,audioStreamController:F.default,audioTrackController:P.default,emeController:T.default,cmcdController:m.default});function w(){return{cueHandler:a.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function x(h,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},h,u)}function b(h){var u=h.loader;if(u!==y.default&&u!==f.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var L=Object(y.fetchSupported)();L&&(h.loader=y.default,h.progressive=!0,h.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/polyfills/number.ts"),F=O("./src/utils/ewma-bandwidth-estimator.ts"),P=O("./src/events.ts"),W=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),_=O("./src/types/loader.ts"),A=O("./src/utils/logger.ts");function d(m,f){for(var y=0;y<f.length;y++){var a=f[y];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(m,a.key,a)}}function p(m,f,y){return f&&d(m.prototype,f),y&&d(m,y),m}var T=function(){function m(y){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=y;var a=y.config;this.bwEstimator=new F.default(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate),this.registerListeners()}var f=m.prototype;return f.registerListeners=function(){var a=this.hls;a.on(P.Events.FRAG_LOADING,this.onFragLoading,this),a.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(P.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var a=this.hls;a.off(P.Events.FRAG_LOADING,this.onFragLoading,this),a.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(P.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},f.onFragLoading=function(a,i){var s=i.frag;if(s.type===_.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=i.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},f.onLevelLoaded=function(a,i){var s=this.hls.config;i.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},f._abandonRulesCheck=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,E=s.config,g=s.media;if(!a||!g)return;var v=i?i.stats:a.stats,k=i?i.duration:a.duration;if(v.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||g.paused||!g.playbackRate||!g.readyState)return;var w=performance.now()-v.loading.start,x=Math.abs(g.playbackRate);if(w<=500*k/x)return;var b=s.levels,h=s.minAutoLevel,u=b[a.level],L=v.total||Math.max(v.loaded,Math.round(k*u.maxBitrate/8)),S=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/w),D=(L-v.loaded)/S,I=g.currentTime,B=(W.BufferHelper.bufferInfo(g,I,E.maxBufferHole).end-I)/x;if(B>=2*k/x||D<=B)return;var j=Number.POSITIVE_INFINITY,G;for(G=a.level-1;G>h;G--){var M=b[G].maxBitrate;if(j=k*M/(8*.8*S),j<B)break}if(j>=D)return;var N=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+a.sn+(i?" part "+i.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+G+`
|
|
Current BW estimate: `+(Object(X.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+D.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=G,this.bwEstimator.sample(w,v.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:i,stats:v})},f.onFragLoaded=function(a,i){var s=i.frag,l=i.part;if(s.type===_.PlaylistLevelType.MAIN&&Object(X.isFiniteNumber)(s.sn)){var E=l?l.stats:s.stats,g=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[s.level],k=(v.loaded?v.loaded.bytes:0)+E.loaded,w=(v.loaded?v.loaded.duration:0)+g;v.loaded={bytes:k,duration:w},v.realBitrate=Math.round(8*k/w)}if(s.bitrateTest){var x={stats:E,frag:s,part:l,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,x),s.bitrateTest=!1}}},f.onFragBuffered=function(a,i){var s=i.frag,l=i.part,E=l?l.stats:s.stats;if(E.aborted)return;if(s.type!==_.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=E.parsing.end-E.loading.start;this.bwEstimator.sample(g,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},f.onError=function(a,i){switch(i.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},f.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},f.getNextABRAutoLevel=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.maxAutoLevel,E=s.config,g=s.minAutoLevel,v=s.media,k=i?i.duration:a?a.duration:0,w=v?v.currentTime:0,x=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,b=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,h=(W.BufferHelper.bufferInfo(v,w,E.maxBufferHole).end-w)/x,u=this.findBestLevel(b,g,l,h,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(u>=0)return u;A.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var L=k?Math.min(k,E.maxStarvationDelay):E.maxStarvationDelay,S=E.abrBandWidthFactor,D=E.abrBandWidthUpFactor;if(!h){var I=this.bitrateTestDelay;if(I){var B=k?Math.min(k,E.maxLoadingDelay):E.maxLoadingDelay;L=B-I,A.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*L)+" ms"),S=D=1}}return u=this.findBestLevel(b,g,l,h+L,S,D),Math.max(u,0)},f.findBestLevel=function(a,i,s,l,E,g){for(var v,k=this.fragCurrent,w=this.partCurrent,x=this.lastLoadedFragLevel,b=this.hls.levels,h=b[x],u=!!(h!=null&&(v=h.details)!==null&&v!==void 0&&v.live),L=h==null?void 0:h.codecSet,S=w?w.duration:k?k.duration:0,D=s;D>=i;D--){var I=b[D];if(!I||L&&I.codecSet!==L)continue;var B=I.details,j=(w?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||S,G=void 0;D<=x?G=E*a:G=g*a;var M=b[D].maxBitrate,N=M*j/G;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+D+"/"+Math.round(G)+"/"+M+"/"+j+"/"+l+"/"+N),G>M&&(!N||u&&!this.bitrateTestDelay||N<l))return D}return-1},p(m,[{key:"nextAutoLevel",get:function(){var a=this._nextAutoLevel,i=this.bwEstimator;if(a!==-1&&(!i||!i.canEstimate()))return a;var s=this.getNextABRAutoLevel();return a!==-1&&(s=Math.min(a,s)),s},set:function(a){this._nextAutoLevel=a}}]),m}();J.default=T},"./src/controller/audio-stream-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),P=O("./src/events.ts"),W=O("./src/utils/buffer-helper.ts"),U=O("./src/controller/fragment-tracker.ts"),_=O("./src/types/level.ts"),A=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),p=O("./src/demux/chunk-cache.ts"),T=O("./src/demux/transmuxer-interface.ts"),m=O("./src/types/transmuxer.ts"),f=O("./src/controller/fragment-finders.ts"),y=O("./src/utils/discontinuities.ts"),a=O("./src/errors.ts"),i=O("./src/utils/logger.ts");function s(){return s=Object.assign||function(k){for(var w=1;w<arguments.length;w++){var x=arguments[w];for(var b in x)Object.prototype.hasOwnProperty.call(x,b)&&(k[b]=x[b])}return k},s.apply(this,arguments)}function l(k,w){k.prototype=Object.create(w.prototype),k.prototype.constructor=k,E(k,w)}function E(k,w){return E=Object.setPrototypeOf||function(b,h){return b.__proto__=h,b},E(k,w)}var g=100,v=function(k){l(w,k);function w(b,h){var u;return u=k.call(this,b,h,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var x=w.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var h=this.hls;h.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(P.Events.ERROR,this.onError,this),h.on(P.Events.BUFFER_RESET,this.onBufferReset,this),h.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var h=this.hls;h.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(P.Events.ERROR,this.onError,this),h.off(P.Events.BUFFER_RESET,this.onBufferReset,this),h.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onInitPtsFound=function(h,u){var L=u.frag,S=u.id,D=u.initPTS;if(S==="main"){var I=L.cc;this.initPTS[L.cc]=D,this.log("InitPTS for cc: "+I+" found from main: "+D),this.videoTrackCC=I,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},x.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=F.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,u>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},x.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var h,u=this.levels,L=this.trackId,S=u==null||((h=u[L])===null||h===void 0)?void 0:h.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var D,I=performance.now(),B=this.retryDate;(!B||I>=B||(D=this.media)!==null&&D!==void 0&&D.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var G=j.frag,M=j.part,N=j.cache,Y=j.complete;if(this.initPTS[G.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var ee=N.flush(),le={frag:G,part:M,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(le),Y&&k.prototype._handleFragmentLoadComplete.call(this,le)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+G.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),Pe=W.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),Se=Object(f.fragmentWithinToleranceTest)(Pe.end,this.config.maxFragLookUpTolerance,G);Se<0&&(i.logger.log("Waiting fragment cc ("+G.cc+") @ "+G.start+" cancelled because another fragment at "+Pe.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},x.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},x.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:h,L=u.buffered;!this.loadedmetadata&&L.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},x.doTickIdle=function(){var h,u,L=this.hls,S=this.levels,D=this.media,I=this.trackId,B=L.config;if(!S||!S[I])return;if(!D&&(this.startFragRequested||!B.startFragPrefetch))return;var j=S[I],G=j.details;if(!G||G.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(G)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(M===null)return;var N=M.len,Y=this.getMaxBufferLength(),ee=this.audioSwitch;if(N>=Y&&!ee)return;if(!ee&&this._streamEnded(M,G)){L.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var le=G.fragments,fe=le[0].start,Pe=M.end;if(ee){var Se=this.getLoadPosition();Pe=Se,G.PTSKnown&&Se<fe&&((M.end>fe||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),D.currentTime=fe+.05))}var De=this.getNextFragment(Pe,G);if(!De){this.bufferFlushed=!0;return}((h=De.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((u=De.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(De,G):this.loadFragment(De,G,Pe)},x.getMaxBufferLength=function(){var h=k.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return u===null?h:Math.max(h,u.len)},x.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},x.onAudioTracksUpdated=function(h,u){var L=u.audioTracks;this.resetTransmuxer(),this.levels=L.map(function(S){return new _.Level(S)})},x.onAudioTrackSwitching=function(h,u){var L=!!u.url;this.trackId=u.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),L?this.setInterval(g):this.resetTransmuxer(),L?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},x.onLevelLoaded=function(h,u){this.mainDetails=u.details},x.onAudioTrackLoaded=function(h,u){var L,S=this.levels,D=u.details,I=u.id;if(!S){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+D.startSN+","+D.endSN+"],duration:"+D.totalduration);var B=S[I],j=0;if(D.live||(L=B.details)!==null&&L!==void 0&&L.live){var G=this.mainDetails;if(D.fragments[0]||(D.deltaUpdateFailed=!0),D.deltaUpdateFailed||!G)return;!B.details&&D.hasProgramDateTime&&G.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(D,G),j=D.fragments[0].start):j=this.alignPlaylists(D,B.details)}B.details=D,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!D.live)&&this.setStartPosition(B.details,j),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(D)&&(this.state=F.State.IDLE),this.tick()},x._handleFragmentLoadProgress=function(h){var u,L=h.frag,S=h.part,D=h.payload,I=this.config,B=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+L.sn+" of level "+L.level+" will not be buffered");return}var G=j[B];console.assert(G,"Audio track is defined on fragment load progress");var M=G.details;console.assert(M,"Audio track details are defined on fragment load progress");var N=I.defaultAudioCodec||G.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new T.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[L.cc],le=(u=L.initSegment)===null||u===void 0?void 0:u.data;if(ee!==void 0){var fe=!1,Pe=S?S.index:-1,Se=Pe!==-1,De=new m.ChunkMetadata(L.level,L.sn,L.stats.chunkCount,D.byteLength,Pe,Se);Y.push(D,le,N,"",L,S,M.totalduration,fe,De,ee)}else{i.logger.log("Unknown video PTS for cc "+L.cc+", waiting for video PTS before demuxing audio frag "+L.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+B);var Le=this.waitingData=this.waitingData||{frag:L,part:S,cache:new p.default,complete:!1},Ae=Le.cache;Ae.push(new Uint8Array(D)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},x._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,h)},x.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},x.onBufferCreated=function(h,u){var L=u.tracks.audio;L&&(this.mediaBuffer=L.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},x.onFragBuffered=function(h,u){var L=u.frag,S=u.part;if(L.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(L)){this.warn("Fragment "+L.sn+(S?" p: "+S.index:"")+" of level "+L.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}L.sn!=="initSegment"&&(this.fragPrevious=L,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(L,S)},x.onError=function(h,u){switch(u.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,u);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=u.fatal?F.State.ERROR:F.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var L=!0,S=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);S&&S.len>.5&&(L=!this.reduceMaxBufferLength(S.len)),L&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},x.onBufferFlushed=function(h,u){var L=u.type;L===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},x._handleTransmuxComplete=function(h){var u,L="audio",S=this.hls,D=h.remuxResult,I=h.chunkMeta,B=this.getCurrentContext(I);if(!B){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var j=B.frag,G=B.part,M=D.audio,N=D.text,Y=D.id3,ee=D.initSegment;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,j,I),S.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:L,tracks:ee.tracks})),M){var le=M.startPTS,fe=M.endPTS,Pe=M.startDTS,Se=M.endDTS;G&&(G.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:fe,startDTS:Pe,endDTS:Se}),j.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,le,fe,Pe,Se),this.bufferFragmentData(M,j,G,I)}if(Y!=null&&(u=Y.samples)!==null&&u!==void 0&&u.length){var De=s({frag:j,id:L},Y);S.trigger(P.Events.FRAG_PARSING_METADATA,De)}if(N){var Le=s({frag:j,id:L},N);S.trigger(P.Events.FRAG_PARSING_USERDATA,Le)}},x._bufferInitSegment=function(h,u,L){if(this.state!==F.State.PARSING)return;h.video&&delete h.video;var S=h.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,h);var D=S.initSegment;if(D!=null&&D.byteLength){var I={type:"audio",frag:u,part:null,chunkMeta:L,parent:u.type,data:D};this.hls.trigger(P.Events.BUFFER_APPENDING,I)}this.tick()},x.loadFragment=function(h,u,L){var S=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||S===U.FragmentState.NOT_LOADED||S===U.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):u.live&&!Object(X.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,h,u,L)))},x.completeAudioSwitch=function(){var h=this.hls,u=this.media,L=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:L})},w}(F.default);J.default=v},"./src/controller/audio-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/errors.ts"),P=O("./src/controller/base-playlist-controller.ts"),W=O("./src/types/loader.ts");function U(T,m){for(var f=0;f<m.length;f++){var y=m[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(T,y.key,y)}}function _(T,m,f){return m&&U(T.prototype,m),f&&U(T,f),T}function A(T,m){T.prototype=Object.create(m.prototype),T.prototype.constructor=T,d(T,m)}function d(T,m){return d=Object.setPrototypeOf||function(y,a){return y.__proto__=a,y},d(T,m)}var p=function(T){A(m,T);function m(y){var a;return a=T.call(this,y,"[audio-track-controller]")||this,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.trackName="",a.selectDefaultTrack=!0,a.registerListeners(),a}var f=m.prototype;return f.registerListeners=function(){var a=this.hls;a.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(X.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var a=this.hls;a.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(X.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},f.onManifestParsed=function(a,i){this.tracks=i.audioTracks||[]},f.onAudioTrackLoaded=function(a,i){var s=i.id,l=i.details,E=this.tracksInGroup[s];if(!E){this.warn("Invalid audio track id "+s);return}var g=E.details;E.details=i.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,i,g))},f.onLevelLoading=function(a,i){this.switchLevel(i.level)},f.onLevelSwitching=function(a,i){this.switchLevel(i.level)},f.switchLevel=function(a){var i=this.hls.levels[a];if(!(i!=null&&i.audioGroupIds))return;var s=i.audioGroupIds[i.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(g){return!s||g.groupId===s});this.selectDefaultTrack&&!l.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var E={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(X.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},f.onError=function(a,i){if(T.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===W.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},f.setAudioTrack=function(a){var i=this.tracksInGroup;if(a<0||a>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=i[this.trackId];this.log("Now switching to audio-track index "+a);var l=i[a],E=l.id,g=l.groupId,v=g===void 0?"":g,k=l.name,w=l.type,x=l.url;if(this.trackId=a,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(X.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:v,name:k,type:w,url:x}),l.details&&!l.details.live)return;var b=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(b)},f.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,s=this.findTrackId(i)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},f.findTrackId=function(a){for(var i=this.tracksInGroup,s=0;s<i.length;s++){var l=i[s];if((!this.selectDefaultTrack||l.default)&&(!a||a===l.name))return l.id}return-1},f.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var s=i.id,l=i.groupId,E=i.url;if(a)try{E=a.addDirectives(E)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(X.Events.AUDIO_TRACK_LOADING,{url:E,id:s,groupId:l,deliveryDirectives:a||null})}},_(m,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}}]),m}(P.default);J.default=p},"./src/controller/base-playlist-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return _});var X=O("./src/polyfills/number.ts"),F=O("./src/types/level.ts"),P=O("./src/controller/level-helper.ts"),W=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),_=function(){function A(p,T){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,T+":"),this.warn=W.logger.warn.bind(W.logger,T+":"),this.hls=p}var d=A.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(T,m){m.fatal&&m.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},d.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},d.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},d.stopLoad=function(){this.canLoad=!1,this.clearTimer()},d.switchParams=function(T,m){var f=m==null?void 0:m.renditionReports;if(f)for(var y=0;y<f.length;y++){var a=f[y],i=""+a.URI;if(i===T.substr(-i.length)){var s=parseInt(a["LAST-MSN"]),l=parseInt(a["LAST-PART"]);if(m&&this.hls.config.lowLatencyMode){var E=Math.min(m.age-m.partTarget,m.targetduration);l!==void 0&&E>m.partTarget&&(l+=1)}if(Object(X.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object(X.isFiniteNumber)(l)?l:void 0,F.HlsSkip.No)}}},d.loadPlaylist=function(T){},d.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},d.playlistLoaded=function(T,m,f){var y=this,a=m.details,i=m.stats,s=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(a.advancedDateTime=Date.now()-s,a.live||f!=null&&f.live){if(a.reloaded(f),f&&this.log("live playlist "+T+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),f&&a.fragments.length>0&&Object(P.mergeDetails)(f,a),!this.canLoad||!a.live)return;var l,E=void 0,g=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var v=this.hls.config.lowLatencyMode,k=a.lastPartSn,w=a.endSN,x=a.lastPartIndex,b=x!==-1,h=k===w,u=v?0:x;b?(E=h?w+1:k,g=h?u:x+1):E=w+1;var L=a.age,S=L+a.ageHeader,D=Math.min(S-a.partTarget,a.targetduration*1.5);if(D>0){if(f&&D>f.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+f.tuneInGoal+" to: "+D+" with playlist age: "+a.age),D=0;else{var I=Math.floor(D/a.targetduration);if(E+=I,g!==void 0){var B=Math.round(D%a.targetduration/a.partTarget);g+=B}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+D+" skip sn "+I+" to part "+g)}a.tuneInGoal=D}if(l=this.getDeliveryDirectives(a,m.deliveryDirectives,E,g),v||!h){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(a,m.deliveryDirectives,E,g);var j=Object(P.computeReloadInterval)(a,i);E!==void 0&&a.canBlockReload&&(j-=a.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(l)},j)}else this.clearTimer()},d.getDeliveryDirectives=function(T,m,f,y){var a=Object(F.getSkipValue)(T,f);return m!=null&&m.skip&&T.deltaUpdateFailed&&(f=m.msn,y=m.part,a=F.HlsSkip.No),new F.HlsUrlParameters(f,y,a)},d.retryLoadingOrFail=function(T){var m=this,f=this.hls.config,y=this.retryCount<f.levelLoadingMaxRetry;if(y){var a;if(this.retryCount++,T.details.indexOf("LoadTimeOut")>-1&&(a=T.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+T.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*f.levelLoadingRetryDelay,f.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return m.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return y},A}()},"./src/controller/base-stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"State",function(){return w}),O.d(J,"default",function(){return x});var X=O("./src/polyfills/number.ts"),F=O("./src/task-loop.ts"),P=O("./src/controller/fragment-tracker.ts"),W=O("./src/utils/buffer-helper.ts"),U=O("./src/utils/logger.ts"),_=O("./src/events.ts"),A=O("./src/errors.ts"),d=O("./src/types/transmuxer.ts"),p=O("./src/utils/mp4-tools.ts"),T=O("./src/utils/discontinuities.ts"),m=O("./src/controller/fragment-finders.ts"),f=O("./src/controller/level-helper.ts"),y=O("./src/loader/fragment-loader.ts"),a=O("./src/crypt/decrypter.ts"),i=O("./src/utils/time-ranges.ts"),s=O("./src/types/loader.ts");function l(b,h){for(var u=0;u<h.length;u++){var L=h[u];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(b,L.key,L)}}function E(b,h,u){return h&&l(b.prototype,h),u&&l(b,u),b}function g(b){if(b===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b}function v(b,h){b.prototype=Object.create(h.prototype),b.prototype.constructor=b,k(b,h)}function k(b,h){return k=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},k(b,h)}var w={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},x=function(b){v(h,b);function h(L,S,D){var I;return I=b.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=w.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=D,I.log=U.logger.log.bind(U.logger,D+":"),I.warn=U.logger.warn.bind(U.logger,D+":"),I.hls=L,I.fragmentLoader=new y.default(L.config),I.fragmentTracker=S,I.config=L.config,I.decrypter=new a.default(L,L.config),L.on(_.Events.KEY_LOADED,I.onKeyLoaded,g(I)),I}var u=h.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(S){},u.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=w.STOPPED},u._streamEnded=function(S,D){var I=this.fragCurrent,B=this.fragmentTracker;if(!D.live&&I&&I.sn===D.endSN&&!S.nextStart){var j=B.getState(I);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},u.onMediaAttached=function(S,D){var I=this.media=this.mediaBuffer=D.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(B.startPosition)},u.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var S=this.config,D=this.fragCurrent,I=this.media,B=this.mediaBuffer,j=this.state,G=I?I.currentTime:0,M=W.BufferHelper.bufferInfo(B||I,G,S.maxBufferHole);if(this.log("media seeking to "+(Object(X.isFiniteNumber)(G)?G.toFixed(3):G)+", state: "+j),j===w.ENDED)this.resetLoadingState();else if(D&&!M.len){var N=S.maxFragLookUpTolerance,Y=D.start-N,ee=D.start+D.duration+N,le=G>ee;(G<Y||le)&&(le&&D.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),D.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=G),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=G),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(S,D){if(this.state!==w.KEY_LOADING||D.frag!==this.fragCurrent||!this.levels)return;this.state=w.IDLE;var I=this.levels[D.frag.level].details;I&&this.loadFragment(D.frag,I,D.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),b.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=w.STOPPED,this.hls.off(_.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,b.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(S,D){this.log("Loading key for "+S.sn+" of ["+D.startSN+"-"+D.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=w.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(_.Events.KEY_LOADING,{frag:S})},u.loadFragment=function(S,D,I){this._loadFragForPlayback(S,D,I)},u._loadFragForPlayback=function(S,D,I){var B=this,j=function(M){if(B.fragContextChanged(S)){B.warn("Fragment "+S.sn+(M.part?" p: "+M.part.index:"")+" of level "+S.level+" was dropped during download."),B.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,B._handleFragmentLoadProgress(M)};this._doFragLoad(S,D,I,j).then(function(G){if(!G)return;B.fragLoadError=0;var M=B.state;if(B.fragContextChanged(S)){(M===w.FRAG_LOADING||M===w.BACKTRACKING||!B.fragCurrent&&M===w.PARSING)&&(B.fragmentTracker.removeFragment(S),B.state=w.IDLE);return}if("payload"in G&&(B.log("Loaded fragment "+S.sn+" of level "+S.level),B.hls.trigger(_.Events.FRAG_LOADED,G),B.state===w.BACKTRACKING)){B.fragmentTracker.backtrack(S,G),B.resetFragmentLoading(S);return}B._handleFragmentLoadComplete(G)}).catch(function(G){B.warn(G),B.resetFragmentLoading(S)})},u.flushMainBuffer=function(S,D,I){if(I===void 0&&(I=null),!(S-D))return;var B={startOffset:S,endOffset:D,type:I};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,B)},u._loadInitSegment=function(S){var D=this;this._doFragLoad(S).then(function(I){if(!I||D.fragContextChanged(S)||!D.levels)throw new Error("init load aborted");return I}).then(function(I){var B=D.hls,j=I.payload,G=S.decryptdata;if(j&&j.byteLength>0&&G&&G.key&&G.iv&&G.method==="AES-128"){var M=self.performance.now();return D.decrypter.webCryptoDecrypt(new Uint8Array(j),G.key.buffer,G.iv.buffer).then(function(N){var Y=self.performance.now();return B.trigger(_.Events.FRAG_DECRYPTED,{frag:S,payload:N,stats:{tstart:M,tdecrypt:Y}}),I.payload=N,I})}return I}).then(function(I){var B=D.fragCurrent,j=D.hls,G=D.levels;if(!G)throw new Error("init load aborted, missing levels");var M=G[S.level].details;console.assert(M,"Level details are defined when init segment is loaded");var N=S.stats;D.state=w.IDLE,D.fragLoadError=0,S.data=new Uint8Array(I.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),I.frag===B&&j.trigger(_.Events.FRAG_BUFFERED,{stats:N,frag:B,part:null,id:S.type}),D.tick()}).catch(function(I){D.warn(I),D.resetFragmentLoading(S)})},u.fragContextChanged=function(S){var D=this.fragCurrent;return!S||!D||S.level!==D.level||S.sn!==D.sn||S.urlId!==D.urlId},u.fragBufferedComplete=function(S,D){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(D?" part: "+D.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+i.default.toString(W.BufferHelper.getBuffered(I))),this.state=w.IDLE,this.tick()},u._handleFragmentLoadComplete=function(S){var D=this.transmuxer;if(!D)return;var I=S.frag,B=S.part,j=S.partsLoaded,G=!j||j.length===0||j.some(function(N){return!N}),M=new d.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,B?B.index:-1,!G);D.flush(M)},u._handleFragmentLoadProgress=function(S){},u._doFragLoad=function(S,D,I,B){var j=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(S.start,I||0),this.config.lowLatencyMode&&D){var G=D.partList;if(G&&B){I>S.end&&D.fragmentHint&&(S=D.fragmentHint);var M=this.getNextPart(G,S,I);if(M>-1){var N=G[M];return this.log("Loading part sn: "+S.sn+" p: "+N.index+" cc: "+S.cc+" of playlist ["+D.startSN+"-"+D.endSN+"] parts [0-"+M+"-"+(G.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=w.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,part:G[M],targetBufferTime:I}),this.doFragPartsLoad(S,G,M,B).catch(function(Y){return j.handleFragLoadError(Y)})}else if(!S.url||this.loadedEndOfParts(G,I))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(D?"of ["+D.startSN+"-"+D.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(I.toFixed(3))),Object(X.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=w.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,targetBufferTime:I}),this.fragmentLoader.load(S,B).catch(function(Y){return j.handleFragLoadError(Y)})},u.doFragPartsLoad=function(S,D,I,B){var j=this;return new Promise(function(G,M){var N=[],Y=function ee(le){var fe=D[le];j.fragmentLoader.loadPart(S,fe,B).then(function(Pe){N[fe.index]=Pe;var Se=Pe.part;j.hls.trigger(_.Events.FRAG_LOADED,Pe);var De=D[le+1];if(De&&De.fragment===S)ee(le+1);else return G({frag:S,part:Se,partsLoaded:N})}).catch(M)};Y(I)})},u.handleFragLoadError=function(S){var D=S.data;return D&&D.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(D.frag,D.part):this.hls.trigger(_.Events.ERROR,D),null},u._handleTransmuxerFlush=function(S){var D=this.getCurrentContext(S);if(!D||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var I=D.frag,B=D.part,j=D.level,G=self.performance.now();I.stats.parsing.end=G,B&&(B.stats.parsing.end=G),this.updateLevelTiming(I,B,j,S.partial)},u.getCurrentContext=function(S){var D=this.levels,I=S.level,B=S.sn,j=S.part;if(!D||!D[I])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+I+". The current chunk will not be buffered."),null;var G=D[I],M=j>-1?Object(f.getPartWith)(G,B,j):null,N=M?M.fragment:Object(f.getFragmentWithSN)(G,B,this.fragCurrent);return N?{frag:N,part:M,level:G}:null},u.bufferFragmentData=function(S,D,I,B){if(!S||this.state!==w.PARSING)return;var j=S.data1,G=S.data2,M=j;if(j&&G&&(M=Object(p.appendUint8Array)(j,G)),!M||!M.length)return;var N={type:S.type,frag:D,part:I,chunkMeta:B,parent:D.type,data:M};this.hls.trigger(_.Events.BUFFER_APPENDING,N),S.dropped&&S.independent&&!I&&this.flushBufferGap(D)},u.flushBufferGap=function(S){var D=this.media;if(!D)return;if(!W.BufferHelper.isBuffered(D,D.currentTime)){this.flushMainBuffer(0,S.start);return}var I=D.currentTime,B=W.BufferHelper.bufferInfo(D,I,0),j=S.duration,G=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),M=Math.max(Math.min(S.start-G,B.end-G),I+G);S.start-M>G&&this.flushMainBuffer(M,S.start)},u.getFwdBufferInfo=function(S,D){var I=this.config,B=this.getLoadPosition();if(!Object(X.isFiniteNumber)(B))return null;var j=W.BufferHelper.bufferInfo(S,B,I.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var G=this.fragmentTracker.getBufferedFrag(B,D);if(G&&j.nextStart<G.end)return W.BufferHelper.bufferInfo(S,B,Math.max(j.nextStart,I.maxBufferHole))}return j},u.getMaxBufferLength=function(S){var D=this.config,I;return S?I=Math.max(8*D.maxBufferSize/S,D.maxBufferLength):I=D.maxBufferLength,Math.min(I,D.maxMaxBufferLength)},u.reduceMaxBufferLength=function(S){var D=this.config,I=S||D.maxBufferLength;return D.maxMaxBufferLength>=I?(D.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+D.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(S,D){var I,B,j=D.fragments,G=j.length;if(!G)return null;var M=this.config,N=j[0].start,Y;if(D.live){var ee=M.initialLiveManifestSize;if(G<ee)return this.warn("Not enough fragments to start playback (have: "+G+", need: "+ee+")"),null;!D.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(D,j),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:S)}else S<=N&&(Y=j[0]);if(!Y){var le=M.lowLatencyMode?D.partEnd:D.fragmentEnd;Y=this.getFragmentAtPosition(S,le,D)}return(I=Y)!==null&&I!==void 0&&I.initSegment&&!((B=Y)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},u.getNextPart=function(S,D,I){for(var B=-1,j=!1,G=!0,M=0,N=S.length;M<N;M++){var Y=S[M];if(G=G&&!Y.independent,B>-1&&I<Y.start)break;var ee=Y.loaded;!ee&&(j||Y.independent||G)&&Y.fragment===D&&(B=M),j=ee}return B},u.loadedEndOfParts=function(S,D){var I=S[S.length-1];return I&&D>I.start&&I.loaded},u.getInitialLiveFragment=function(S,D){var I=this.fragPrevious,B=null;if(I){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),B=Object(m.findFragmentByPDT)(D,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var j=I.sn+1;if(j>=S.startSN&&j<=S.endSN){var G=D[j-S.startSN];I.cc===G.cc&&(B=G,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(m.findFragWithCC)(D,I.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(B=this.getFragmentAtPosition(M,this.bitrateTest?S.fragmentEnd:S.edge,S))}return B},u.getFragmentAtPosition=function(S,D,I){var B=this.config,j=this.fragPrevious,G=I.fragments,M=I.endSN,N=I.fragmentHint,Y=B.maxFragLookUpTolerance,ee=!!(B.lowLatencyMode&&I.partList&&N);ee&&N&&!this.bitrateTest&&(G=G.concat(N),M=N.sn);var le;if(S<D){var fe=S>D-Y?0:Y;le=Object(m.findFragmentByPTS)(j,G,S,fe)}else le=G[G.length-1];if(le){var Pe=le.sn-I.startSN,Se=j&&le.level===j.level,De=G[Pe+1],Le=this.fragmentTracker.getState(le);if(Le===P.FragmentState.BACKTRACKED){le=null;for(var Ae=Pe;G[Ae]&&this.fragmentTracker.getState(G[Ae])===P.FragmentState.BACKTRACKED;)j?le=G[Ae--]:le=G[--Ae];le||(le=De)}else j&&le.sn===j.sn&&!ee&&(Se&&(le.sn<M&&this.fragmentTracker.getState(De)!==P.FragmentState.OK?(this.log("SN "+le.sn+" just loaded, load next one: "+De.sn),le=De):le=null))}return le},u.synchronizeToLiveEdge=function(S){var D=this.config,I=this.media;if(!I)return;var B=this.hls.liveSyncPosition,j=I.currentTime,G=S.fragments[0].start,M=S.edge,N=j>=G-D.maxFragLookUpTolerance&&j<=M;if(B!==null&&I.duration>B&&(j<B||!N)){var Y=D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:D.liveMaxLatencyDurationCount*S.targetduration;(!N&&I.readyState<4||j<M-Y)&&(this.loadedmetadata||(this.nextLoadPosition=B),I.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+B.toFixed(3)),I.currentTime=B))}},u.alignPlaylists=function(S,D){var I=this.levels,B=this.levelLastLoaded,j=this.fragPrevious,G=B!==null?I[B]:null,M=S.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var N=S.fragments[0].start,Y=!D,ee=S.alignedSliding&&Object(X.isFiniteNumber)(N);if(Y||!ee&&!N){Object(T.alignStream)(j,G,S);var le=S.fragments[0].start;return this.log("Live playlist sliding: "+le.toFixed(2)+" start-sn: "+(D?D.startSN:"na")+"->"+S.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+M),le}return N},u.waitForCdnTuneIn=function(S){var D=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*D)},u.setStartPosition=function(S,D){var I=this.startPosition;if(I<D&&(I=-1),I===-1||this.lastCurrentTime===-1){var B=S.startTimeOffset;Object(X.isFiniteNumber)(B)?(I=D+B,B<0&&(I+=S.totalduration),I=Math.min(Math.max(D,I),D+S.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+I),this.startPosition=I):S.live?I=this.hls.liveSyncPosition||D:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},u.getLoadPosition=function(){var S=this.media,D=0;return this.loadedmetadata&&S?D=S.currentTime:this.nextLoadPosition&&(D=this.nextLoadPosition),D},u.handleFragLoadAborted=function(S,D){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(D?" part"+D.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},u.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=w.IDLE)},u.onFragmentOrKeyLoadError=function(S,D){if(D.fatal)return;var I=D.frag;if(!I||I.type!==S)return;var B=this.fragCurrent;console.assert(B&&I.sn===B.sn&&I.level===B.level&&I.urlId===B.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var G=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+S+" "+I.level+" failed to load, retrying in "+G+"ms"),this.retryDate=self.performance.now()+G,this.fragLoadError++,this.state=w.FRAG_LOADING_WAITING_RETRY}else D.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=w.IDLE):(U.logger.error(D.details+" reaches max retry, redispatch as fatal ..."),D.fatal=!0,this.hls.stopLoad(),this.state=w.ERROR)},u.afterBufferFlushed=function(S,D,I){if(!S)return;var B=W.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(D,B,I),this.state===w.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=w.IDLE},u.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var D=this.levels?this.levels[S].details:null;if(D!=null&&D.live)return this.startPosition=-1,this.setStartPosition(D,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(S,D,I,B){var j=this,G=I.details;console.assert(!!G,"level.details must be defined");var M=Object.keys(S.elementaryStreams).reduce(function(N,Y){var ee=S.elementaryStreams[Y];if(ee){var le=ee.endPTS-ee.startPTS;if(le<=0)return j.warn("Could not parse fragment "+S.sn+" "+Y+" duration reliably ("+le+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var fe=B?0:Object(f.updateFragPTSDTS)(G,S,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return j.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:G,level:I,drift:fe,type:Y,frag:S,start:ee.startPTS,end:ee.endPTS}),!0}return N},!1);M?(this.state=w.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:S,part:D})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(h,[{key:"state",get:function(){return this._state},set:function(S){var D=this._state;D!==S&&(this._state=S,this.log(D+"->"+S))}}]),h}(F.default)},"./src/controller/buffer-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return m});var X=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),P=O("./src/utils/logger.ts"),W=O("./src/errors.ts"),U=O("./src/utils/buffer-helper.ts"),_=O("./src/utils/mediasource-helper.ts"),A=O("./src/loader/fragment.ts"),d=O("./src/controller/buffer-operation-queue.ts"),p=Object(_.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,m=function(){function f(a){var i=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=i.hls,l=i.media,E=i.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:l})),E&&E.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=a,this._initSourceBuffer(),this.registerListeners()}var y=f.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var i=this.hls;i.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(F.Events.BUFFER_RESET,this.onBufferReset,this),i.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(F.Events.BUFFER_EOS,this.onBufferEos,this),i.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(F.Events.FRAG_PARSED,this.onFragParsed,this),i.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var i=this.hls;i.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(F.Events.BUFFER_RESET,this.onBufferReset,this),i.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(F.Events.BUFFER_EOS,this.onBufferEos,this),i.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(F.Events.FRAG_PARSED,this.onFragParsed,this),i.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(i,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(i,s){var l=this.media=s.media;if(l&&p){var E=this.mediaSource=new p;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(E),this._objectUrl=l.src}},y.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(E){P.logger.warn("[buffer-controller]: onMediaDetaching: "+E.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(l&&self.URL.revokeObjectURL(l),i.src===l?(i.removeAttribute("src"),i.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(F.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(s){var l=i.sourceBuffer[s];try{l&&(i.removeBufferListeners(s),i.mediaSource&&i.mediaSource.removeSourceBuffer(l),i.sourceBuffer[s]=void 0)}catch(E){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",E)}}),this._initSourceBuffer()},y.onBufferCodecs=function(i,s){var l=this,E=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(E){var v=l.tracks[g];if(v&&typeof v.buffer.changeType=="function"){var k=s[g],w=k.codec,x=k.levelCodec,b=k.container,h=(v.levelCodec||v.codec).replace(T,"$1"),u=(x||w).replace(T,"$1");if(h!==u){var L=b+";codecs="+(x||w);l.appendChangeType(g,L)}}}else l.pendingTracks[g]=s[g]}),E)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(i,s){var l=this,E=this.operationQueue,g={execute:function(){var k=l.sourceBuffer[i];k&&(P.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),k.changeType(s)),E.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(k){P.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",k)}};E.append(g,i)},y.onBufferAppending=function(i,s){var l=this,E=this.hls,g=this.operationQueue,v=this.tracks,k=s.data,w=s.type,x=s.frag,b=s.part,h=s.chunkMeta,u=h.buffering[w],L=self.performance.now();u.start=L;var S=x.stats.buffering,D=b?b.stats.buffering:null;S.start===0&&(S.start=L),D&&D.start===0&&(D.start=L);var I=v.audio,B=w==="audio"&&h.id===1&&(I==null?void 0:I.container)==="audio/mpeg",j={execute:function(){if(u.executeStart=self.performance.now(),B){var M=l.sourceBuffer[w];if(M){var N=x.start-M.timestampOffset;Math.abs(N)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+x.start+" (delta: "+N+") sn: "+x.sn+")"),M.timestampOffset=x.start)}}l.appendExecutor(k,w)},onStart:function(){},onComplete:function(){var M=self.performance.now();u.executeEnd=u.end=M,S.first===0&&(S.first=M),D&&D.first===0&&(D.first=M);var N=l.sourceBuffer,Y={};for(var ee in N)Y[ee]=U.BufferHelper.getBuffered(N[ee]);l.appendError=0,l.hls.trigger(F.Events.BUFFER_APPENDED,{type:w,frag:x,part:b,chunkMeta:h,parent:x.type,timeRanges:Y})},onError:function(M){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",M);var N={type:W.ErrorTypes.MEDIA_ERROR,parent:x.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=W.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,N.details=W.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>E.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),E.trigger(F.Events.ERROR,N)}};g.append(j,w)},y.onBufferFlushing=function(i,s){var l=this,E=this.operationQueue,g=function(k){return{execute:l.removeExecutor.bind(l,k,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(F.Events.BUFFER_FLUSHED,{type:k})},onError:function(x){P.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",x)}}};s.type?E.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){E.append(g(v),v)})},y.onFragParsed=function(i,s){var l=this,E=s.frag,g=s.part,v=[],k=g?g.elementaryStreams:E.elementaryStreams;k[A.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(k[A.ElementaryStreamTypes.AUDIO]&&v.push("audio"),k[A.ElementaryStreamTypes.VIDEO]&&v.push("video"));var w=function(){var b=self.performance.now();E.stats.buffering.end=b,g&&(g.stats.buffering.end=b);var h=g?g.stats:E.stats;l.hls.trigger(F.Events.FRAG_BUFFERED,{frag:E,part:g,stats:h,id:E.type})};v.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(w,v)},y.onFragChanged=function(i,s){this.flushBackBuffer()},y.onBufferEos=function(i,s){var l=this,E=this.getSourceBufferTypes().reduce(function(g,v){var k=l.sourceBuffer[v];return(!s.type||s.type===v)&&(k&&!k.ended&&(k.ended=!0,P.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),g&&!!(!k||k.ended)},!0);E&&this.blockBuffers(function(){var g=l.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},y.onLevelUpdated=function(i,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var i=this.hls,s=this.details,l=this.media,E=this.sourceBuffer;if(!l||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var v=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(X.isFiniteNumber)(v)||v<0)return;var k=l.currentTime,w=s.levelTargetDuration,x=Math.max(v,w),b=Math.floor(k/w)*w-x;g.forEach(function(h){var u=E[h];if(u){var L=U.BufferHelper.getBuffered(u);L.length>0&&b>L.start(0)&&(i.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:b}),s.live&&i.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:b}),i.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:b,type:h}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,s=this.hls,l=this.media,E=this.mediaSource,g=i.fragments[0].start+i.totalduration,v=l.duration,k=Object(X.isFiniteNumber)(E.duration)?E.duration:0;i.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(i)):(g>k&&g>v||!Object(X.isFiniteNumber)(v))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),E.duration=g)},y.updateSeekableRange=function(i){var s=this.mediaSource,l=i.fragments,E=l.length;if(E&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,l[0].start),v=Math.max(g,g+i.totalduration);s.setLiveSeekableRange(g,v)}},y.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,E=Object.keys(l).length;if(E&&!i||E===2){this.createSourceBuffers(l),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(F.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}g.forEach(function(v){s.executeNext(v)})}},y.createSourceBuffers=function(i){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var E=0;for(var g in i)if(!s[g]){var v=i[g];if(!v)throw Error("source buffer exists for track "+g+", however track does not");var k=v.levelCodec||v.codec,w=v.container+";codecs="+k;P.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var x=s[g]=l.addSourceBuffer(w),b=g;this.addBufferListener(b,"updatestart",this._onSBUpdateStart),this.addBufferListener(b,"updateend",this._onSBUpdateEnd),this.addBufferListener(b,"error",this._onSBUpdateError),this.tracks[g]={buffer:x,codec:k,container:v.container,levelCodec:v.levelCodec,id:v.id},E++}catch(h){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:w})}}E&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(i){var s=this.operationQueue,l=s.current(i);l.onStart()},y._onSBUpdateEnd=function(i){var s=this.operationQueue,l=s.current(i);l.onComplete(),s.shiftAndExecuteNext(i)},y._onSBUpdateError=function(i,s){P.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(s)},y.removeExecutor=function(i,s,l){var E=this.media,g=this.mediaSource,v=this.operationQueue,k=this.sourceBuffer,w=k[i];if(!E||!g||!w){P.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(i);return}var x=Object(X.isFiniteNumber)(E.duration)?E.duration:Infinity,b=Object(X.isFiniteNumber)(g.duration)?g.duration:Infinity,h=Math.max(0,s),u=Math.min(l,x,b);u>h?(P.logger.log("[buffer-controller]: Removing ["+h+","+u+"] from the "+i+" SourceBuffer"),console.assert(!w.updating,i+" sourceBuffer must not be updating"),w.remove(h,u)):v.shiftAndExecuteNext(i)},y.appendExecutor=function(i,s){var l=this.operationQueue,E=this.sourceBuffer,g=E[s];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(i)},y.blockBuffers=function(i,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var E=this.operationQueue,g=s.map(function(v){return E.appendBlocker(v)});Promise.all(g).then(function(){i(),s.forEach(function(v){var k=l.sourceBuffer[v];(!k||!k.updating)&&E.shiftAndExecuteNext(v)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(i,s,l){var E=this.sourceBuffer[i];if(!E)return;var g=l.bind(this,i);this.listeners[i].push({event:s,listener:g}),E.addEventListener(s,g)},y.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(l){s.removeEventListener(l.event,l.listener)})},f}()},"./src/controller/buffer-operation-queue.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return F});var X=O("./src/utils/logger.ts"),F=function(){function P(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var W=P.prototype;return W.append=function(_,A){var d=this.queues[A];d.push(_),d.length===1&&this.buffers[A]&&this.executeNext(A)},W.insertAbort=function(_,A){var d=this.queues[A];d.unshift(_),this.executeNext(A)},W.appendBlocker=function(_){var A,d=new Promise(function(T){A=T}),p={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,_),d},W.executeNext=function(_){var A=this.buffers,d=this.queues,p=A[_],T=d[_];if(T.length){var m=T[0];try{m.execute()}catch(f){X.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),m.onError(f),(!p||!p.updating)&&(T.shift(),this.executeNext(_))}}},W.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},W.current=function(_){return this.queues[_][0]},P}()},"./src/controller/cap-level-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts");function F(U,_){for(var A=0;A<_.length;A++){var d=_[A];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(U,d.key,d)}}function P(U,_,A){return _&&F(U.prototype,_),A&&F(U,A),U}var W=function(){function U(A){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=U.prototype;return _.setStreamController=function(d){this.streamController=d},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var d=this.hls;d.on(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var d=this.hls;d.off(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(d,p){U.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},_.onMediaAttaching=function(d,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},_.onManifestParsed=function(d,p){var T=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,T.config.capLevelToPlayerSize&&p.video&&this.startCapping()},_.onBufferCodecs=function(d,p){var T=this.hls;T.config.capLevelToPlayerSize&&p.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(d.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},_.getMaxLevel=function(d){var p=this,T=this.hls.levels;if(!T.length)return-1;var m=T.filter(function(f,y){return U.isLevelAllowed(y,p.restrictedLevels)&&y<=d});return this.clientRect=null,U.getMaxLevelByMediaSize(m,this.mediaWidth,this.mediaHeight)},_.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()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,p={width:0,height:0};if(d){var T=d.getBoundingClientRect();p.width=T.width,p.height=T.height,!p.width&&!p.height&&(p.width=T.right-T.left||d.width||0,p.height=T.bottom-T.top||d.height||0)}return this.clientRect=p,p},U.isLevelAllowed=function(d,p){return p===void 0&&(p=[]),p.indexOf(d)===-1},U.getMaxLevelByMediaSize=function(d,p,T){if(!d||!d.length)return-1;for(var m=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},f=d.length-1,y=0;y<d.length;y+=1){var a=d[y];if((a.width>=p||a.height>=T)&&m(a,d[y+1])){f=y;break}}return f},P(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(p){}return d}}]),U}();J.default=W},"./src/controller/cmcd-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return m});var X=O("./src/events.ts"),F=O("./src/types/cmcd.ts"),P=O("./src/utils/buffer-helper.ts"),W=O("./src/utils/logger.ts");function U(f,y){for(var a=0;a<y.length;a++){var i=y[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(f,i.key,i)}}function _(f,y,a){return y&&U(f.prototype,y),a&&U(f,a),f}function A(f,y){var a=typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(a)return(a=a.call(f)).next.bind(a);if(Array.isArray(f)||(a=d(f))||y&&f&&typeof f.length=="number"){a&&(f=a);var i=0;return function(){return i>=f.length?{done:!0}:{done:!1,value:f[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d(f,y){if(!f)return;if(typeof f=="string")return p(f,y);var a=Object.prototype.toString.call(f).slice(8,-1);if(a==="Object"&&f.constructor&&(a=f.constructor.name),a==="Map"||a==="Set")return Array.from(f);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return p(f,y)}function p(f,y){(y==null||y>f.length)&&(y=f.length);for(var a=0,i=new Array(y);a<y;a++)i[a]=f[a];return i}function T(){return T=Object.assign||function(f){for(var y=1;y<arguments.length;y++){var a=arguments[y];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(f[i]=a[i])}return f},T.apply(this,arguments)}var m=function(){function f(a){var i=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(E){try{i.apply(E,{ot:F.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(g){W.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(E){try{var g=E.frag,v=i.hls.levels[g.level],k=i.getObjectType(g),w={d:g.duration*1e3,ot:k};(k===F.CMCDObjectType.VIDEO||k===F.CMCDObjectType.AUDIO||k==F.CMCDObjectType.MUXED)&&(w.br=v.bitrate/1e3,w.tb=i.getTopBandwidth(k),w.bl=i.getBufferLength(k)),i.apply(E,w)}catch(x){W.logger.warn("Could not generate segment CMCD data.",x)}},this.hls=a;var s=this.config=a.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||f.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var y=f.prototype;return y.registerListeners=function(){var i=this.hls;i.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(X.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var i=this.hls;i.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(X.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(i,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(i,s){var l,E;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(E=s.tracks.video)===null||E===void 0?void 0:E.buffer},y.createData=function(){var i;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(i,s){s===void 0&&(s={}),T(s,this.createData());var l=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var E=f.toHeaders(s);if(!Object.keys(E).length)return;i.headers||(i.headers={}),T(i.headers,E)}else{var g=f.toQuery(s);if(!g)return;i.url=f.appendQueryToUri(i.url,g)}},y.getObjectType=function(i){var s=i.type;return s==="subtitle"?F.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?F.CMCDObjectType.INIT:s==="audio"?F.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(i){for(var s=0,l=i===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,E=A(l),g;!(g=E()).done;){var v=g.value;v.bitrate>s&&(s=v.bitrate)}return s>0?s:NaN},y.getBufferLength=function(i){var s=this.hls.media,l=i===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var E=P.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return E.len*1e3},y.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,l=i||this.config.loader;return function(){function E(v){this.loader=void 0,this.loader=new l(v)}var g=E.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(k,w,x){s(k),this.loader.load(k,w,x)},_(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},y.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,l=i||this.config.loader;return function(){function E(v){this.loader=void 0,this.loader=new l(v)}var g=E.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(k,w,x){s(k),this.loader.load(k,w,x)},_(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},f.uuid=function(){var i=URL.createObjectURL(new Blob),s=i.toString();return URL.revokeObjectURL(i),s.substr(s.lastIndexOf("/")+1)},f.serialize=function(i){for(var s=[],l=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},E=function(B){return Math.round(B)},g=function(B){return E(B/100)*100},v=function(B){return encodeURIComponent(B)},k={br:E,d:E,bl:g,dl:g,mtp:g,nor:v,rtp:g,tb:E},w=Object.keys(i||{}).sort(),x=A(w),b;!(b=x()).done;){var h=b.value,u=i[h];if(!l(u))continue;if(h==="v"&&u===1)continue;if(h=="pr"&&u===1)continue;var L=k[h];L&&(u=L(u));var S=typeof u,D=void 0;h==="ot"||h==="sf"||h==="st"?D=h+"="+u:S==="boolean"?D=h:S==="number"?D=h+"="+u:D=h+"="+JSON.stringify(u),s.push(D)}return s.join(",")},f.toHeaders=function(i){for(var s=Object.keys(i),l={},E=["Object","Request","Session","Status"],g=[{},{},{},{}],v={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},k=0,w=s;k<w.length;k++){var x=w[k],b=v[x]!=null?v[x]:1;g[b][x]=i[x]}for(var h=0;h<g.length;h++){var u=f.serialize(g[h]);u&&(l["CMCD-"+E[h]]=u)}return l},f.toQuery=function(i){return"CMCD="+encodeURIComponent(f.serialize(i))},f.appendQueryToUri=function(i,s){if(!s)return i;var l=i.includes("?")?"&":"?";return""+i+l+s},f}()},"./src/controller/eme-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),W=O("./src/utils/mediakeys-helper.ts");function U(m,f){for(var y=0;y<f.length;y++){var a=f[y];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(m,a.key,a)}}function _(m,f,y){return f&&U(m.prototype,f),y&&U(m,y),m}var A=3,d=function(f,y,a){var i={audioCapabilities:[],videoCapabilities:[]};return f.forEach(function(s){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:a.audioRobustness||""})}),y.forEach(function(s){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:a.videoRobustness||""})}),[i]},p=function(f,y,a,i){switch(f){case W.KeySystems.WIDEVINE:return d(y,a,i);default:throw new Error("Unknown key-system: "+f)}},T=function(){function m(y){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=y,this._config=y.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var f=m.prototype;return f.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},f._registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},f._unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},f.getLicenseServerUrl=function(a){switch(a){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+a+'"')},f._attemptKeySystemAccess=function(a,i,s){var l=this,E=p(a,i,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(a,E);this.mediaKeysPromise=g.then(function(v){return l._onMediaKeySystemAccessObtained(a,v)}),g.catch(function(v){P.logger.error('Failed to obtain key-system "'+a+'" access:',v)})},f._onMediaKeySystemAccessObtained=function(a,i){var s=this;P.logger.log('Access for key-system "'+a+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:a};this._mediaKeysList.push(l);var E=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(g){return l.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+a+'"'),s._onMediaKeysCreated(),g});return E.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),E},f._onMediaKeysCreated=function(){var a=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),a._onNewMediaKeySession(i.mediaKeysSession))})},f._onNewMediaKeySession=function(a){var i=this;P.logger.log("New key-system session "+a.sessionId),a.addEventListener("message",function(s){i._onKeySessionMessage(a,s.message)},!1)},f._onKeySessionMessage=function(a,i){P.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),a.update(s)})},f.onMediaEncrypted=function(a){var i=this;if(P.logger.log('Media is encrypted using "'+a.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(E){if(!i._media)return;i._attemptSetMediaKeys(E),i._generateRequestWithPreferredKeySession(a.initDataType,a.initData)};this.mediaKeysPromise.then(s).catch(s)},f._attemptSetMediaKeys=function(a){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},f._generateRequestWithPreferredKeySession=function(a,i){var s=this,l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var E=l.mediaKeysSession;if(!E){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+a+'" init data type'),l.mediaKeysSessionInitialized=!0,E.generateRequest(a,i).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),s.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},f._createLicenseXhr=function(a,i,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,a,i,s);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,l,a),E=void 0}catch(g){P.logger.error(g)}try{l.readyState||l.open("POST",a,!0),E&&E.call(this.hls,l,a)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return l},f._onLicenseRequestReadyStageChange=function(a,i,s,l){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var E=a.response,g=this._licenseResponseCallback;if(g)try{E=g.call(this.hls,a,i)}catch(k){P.logger.error(k)}l(E)}else{if(P.logger.error("License Request XHR failed ("+i+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=A-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,l)}break}},f._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},f._requestLicense=function(a,i){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),E=this._createLicenseXhr(l,a,i);P.logger.log("Sending license request to URL: "+l);var g=this._generateLicenseRequestChallenge(s,a);E.send(g)}catch(v){P.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},f.onMediaAttached=function(a,i){if(!this._emeEnabled)return;var s=i.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},f.onMediaDetached=function(){var a=this._media,i=this._mediaKeysList;if(!a)return;a.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return a.setMediaKeys(null)}).catch(function(){})},f.onManifestParsed=function(a,i){if(!this._emeEnabled)return;var s=i.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),l=i.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,l)},_(m,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),m}();J.default=T},"./src/controller/fps-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/utils/logger.ts"),P=function(){function W(_){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=_,this.registerListeners()}var U=W.prototype;return U.setStreamController=function(A){this.streamController=A},U.registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(A,d){var p=this.hls.config;if(p.capLevelOnFPSDrop){var T=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=T,T&&typeof T.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(A,d,p){var T=performance.now();if(d){if(this.lastTime){var m=T-this.lastTime,f=p-this.lastDroppedFrames,y=d-this.lastDecodedFrames,a=1e3*f/m,i=this.hls;if(i.trigger(X.Events.FPS_DROP,{currentDropped:f,currentDecoded:y,totalDroppedFrames:p}),a>0&&f>i.config.fpsDroppedMonitoringThreshold*y){var s=i.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=s)&&(s=s-1,i.trigger(X.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=p,this.lastDecodedFrames=d}},U.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var d=A.getVideoPlaybackQuality();this.checkFPS(A,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},W}();J.default=P},"./src/controller/fragment-finders.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"findFragmentByPDT",function(){return P}),O.d(J,"findFragmentByPTS",function(){return W}),O.d(J,"fragmentWithinToleranceTest",function(){return U}),O.d(J,"pdtWithinToleranceTest",function(){return _}),O.d(J,"findFragWithCC",function(){return A});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/binary-search.ts");function P(d,p,T){if(p===null||!Array.isArray(d)||!d.length||!Object(X.isFiniteNumber)(p))return null;var m=d[0].programDateTime;if(p<(m||0))return null;var f=d[d.length-1].endProgramDateTime;if(p>=(f||0))return null;T=T||0;for(var y=0;y<d.length;++y){var a=d[y];if(_(p,T,a))return a}return null}function W(d,p,T,m){T===void 0&&(T=0),m===void 0&&(m=0);var f=null;if(d?f=p[d.sn-p[0].sn+1]||null:T===0&&p[0].start===0&&(f=p[0]),f&&U(T,m,f)===0)return f;var y=F.default.search(p,U.bind(null,T,m));return y||f}function U(d,p,T){d===void 0&&(d=0),p===void 0&&(p=0);var m=Math.min(p,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-m<=d?1:T.start-m>d&&T.start?-1:0}function _(d,p,T){var m=Math.min(p,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,f=T.endProgramDateTime||0;return f-m>d}function A(d,p){return F.default.search(d,function(T){return T.cc<p?1:T.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"FragmentState",function(){return P}),O.d(J,"FragmentTracker",function(){return W});var X=O("./src/events.ts"),F=O("./src/types/loader.ts"),P;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(P||(P={}));var W=function(){function A(p){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=p,this._registerListeners()}var d=A.prototype;return d._registerListeners=function(){var T=this.hls;T.on(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on(X.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var T=this.hls;T.off(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off(X.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(T,m){if(m===F.PlaylistLevelType.MAIN){var f=this.activeFragment,y=this.activeParts;if(!f)return null;if(y)for(var a=y.length;a--;){var i=y[a],s=i?i.end:f.appendedPTS;if(i.start<=T&&s!==void 0&&T<=s)return a>9&&(this.activeParts=y.slice(a-9)),i}else if(f.start<=T&&f.appendedPTS!==void 0&&T<=f.appendedPTS)return f}return this.getBufferedFrag(T,m)},d.getBufferedFrag=function(T,m){for(var f=this.fragments,y=Object.keys(f),a=y.length;a--;){var i=f[y[a]];if((i==null?void 0:i.body.type)===m&&i.buffered){var s=i.body;if(s.start<=T&&T<=s.end)return s}}return null},d.detectEvictedFragments=function(T,m,f){var y=this;Object.keys(this.fragments).forEach(function(a){var i=y.fragments[a];if(!i)return;if(!i.buffered){i.body.type===f&&y.removeFragment(i.body);return}var s=i.range[T];if(!s)return;s.time.some(function(l){var E=!y.isTimeBuffered(l.startPTS,l.endPTS,m);return E&&y.removeFragment(i.body),E})})},d.detectPartialFragments=function(T){var m=this,f=this.timeRanges,y=T.frag,a=T.part;if(!f||y.sn==="initSegment")return;var i=_(y),s=this.fragments[i];if(!s)return;Object.keys(f).forEach(function(l){var E=y.elementaryStreams[l];if(!E)return;var g=f[l],v=a!==null||E.partial===!0;s.range[l]=m.getBufferedTimes(y,a,v,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},d.fragBuffered=function(T){var m=_(T),f=this.fragments[m];f&&(f.backtrack=f.loaded=null,f.buffered=!0)},d.getBufferedTimes=function(T,m,f,y){for(var a={time:[],partial:f},i=m?m.start:T.start,s=m?m.end:T.end,l=T.minEndPTS||s,E=T.maxStartPTS||i,g=0;g<y.length;g++){var v=y.start(g)-this.bufferPadding,k=y.end(g)+this.bufferPadding;if(E>=v&&l<=k){a.time.push({startPTS:Math.max(i,y.start(g)),endPTS:Math.min(s,y.end(g))});break}else if(i<k&&s>v)a.partial=!0,a.time.push({startPTS:Math.max(i,y.start(g)),endPTS:Math.min(s,y.end(g))});else if(s<=v)break}return a},d.getPartialFragment=function(T){var m=null,f,y,a,i=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(E){var g=l[E];if(!g)return;U(g)&&(y=g.body.start-s,a=g.body.end+s,T>=y&&T<=a&&(f=Math.min(T-y,a-T),i<=f&&(m=g.body,i=f)))}),m},d.getState=function(T){var m=_(T),f=this.fragments[m];return f?f.buffered?U(f)?P.PARTIAL:P.OK:f.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},d.backtrack=function(T,m){var f=_(T),y=this.fragments[f];if(!y||y.backtrack)return null;var a=y.backtrack=m||y.loaded;return y.loaded=null,a},d.getBacktrackData=function(T){var m=_(T),f=this.fragments[m];if(f){var y,a=f.backtrack;if(a!=null&&(y=a.payload)!==null&&y!==void 0&&y.byteLength)return a;this.removeFragment(T)}return null},d.isTimeBuffered=function(T,m,f){for(var y,a,i=0;i<f.length;i++){if(y=f.start(i)-this.bufferPadding,a=f.end(i)+this.bufferPadding,T>=y&&m<=a)return!0;if(m<=y)return!1}return!1},d.onFragLoaded=function(T,m){var f=m.frag,y=m.part;if(f.sn==="initSegment"||f.bitrateTest||y)return;var a=_(f);this.fragments[a]={body:f,loaded:m,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(T,m){var f=this,y=m.frag,a=m.part,i=m.timeRanges;if(y.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=y,a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(l){var E=i[l];if(f.detectEvictedFragments(l,E),!a)for(var g=0;g<E.length;g++)y.appendedPTS=Math.max(E.end(g),y.appendedPTS||0)})},d.onFragBuffered=function(T,m){this.detectPartialFragments(m)},d.hasFragment=function(T){var m=_(T);return!!this.fragments[m]},d.removeFragmentsInRange=function(T,m,f){var y=this;Object.keys(this.fragments).forEach(function(a){var i=y.fragments[a];if(!i)return;if(i.buffered){var s=i.body;s.type===f&&s.start<m&&s.end>T&&y.removeFragment(s)}})},d.removeFragment=function(T){var m=_(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[m]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function U(A){var d,p;return A.buffered&&(((d=A.range.video)===null||d===void 0?void 0:d.partial)||((p=A.range.audio)===null||p===void 0?void 0:p.partial))}function _(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"STALL_MINIMUM_DURATION_MS",function(){return U}),O.d(J,"MAX_START_GAP_JUMP",function(){return _}),O.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),O.d(J,"SKIP_BUFFER_RANGE_START",function(){return d}),O.d(J,"default",function(){return p});var X=O("./src/utils/buffer-helper.ts"),F=O("./src/errors.ts"),P=O("./src/events.ts"),W=O("./src/utils/logger.ts"),U=250,_=2,A=.1,d=.05,p=function(){function T(f,y,a,i){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=f,this.media=y,this.fragmentTracker=a,this.hls=i}var m=T.prototype;return m.destroy=function(){this.hls=this.fragmentTracker=this.media=null},m.poll=function(y){var a=this.config,i=this.media,s=this.stalled,l=i.currentTime,E=i.seeking,g=this.seeking&&!E,v=!this.seeking&&E;if(this.seeking=E,l!==y){if(this.moved=!0,s!==null){if(this.stallReported){var k=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||g)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!X.BufferHelper.getBuffered(i).length)return;var w=X.BufferHelper.bufferInfo(i,l,0),x=w.len>0,b=w.nextStart||0;if(!x&&!b)return;if(E){var h=w.len>_,u=!b||b-l>_&&!this.fragmentTracker.getPartialFragment(l);if(h||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var L,S=Math.max(b,w.start||0)-l,D=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=D==null||((L=D.details)===null||L===void 0)?void 0:L.live,B=I?D.details.targetduration*2:_;if(S>0&&S<=B){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var G=j-s;!E&&G>=U&&this._reportStall(w.len);var M=X.BufferHelper.bufferInfo(i,l,a.maxBufferHole);this._tryFixBufferStall(M,G)},m._tryFixBufferStall=function(y,a){var i=this.config,s=this.fragmentTracker,l=this.media,E=l.currentTime,g=s.getPartialFragment(E);if(g){var v=this._trySkipBufferHole(g);if(v)return}y.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},m._reportStall=function(y){var a=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+y+")"),a.trigger(P.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},m._trySkipBufferHole=function(y){for(var a=this.config,i=this.hls,s=this.media,l=s.currentTime,E=0,g=X.BufferHelper.getBuffered(s),v=0;v<g.length;v++){var k=g.start(v);if(l+a.maxBufferHole>=E&&l<k){var w=Math.max(k+d,s.currentTime+A);return W.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+w),this.moved=!0,this.stalled=null,s.currentTime=w,y&&i.trigger(P.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+w,frag:y}),w}E=g.end(v)}return 0},m._tryNudgeBuffer=function(){var y=this.config,a=this.hls,i=this.media,s=i.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<y.nudgeMaxRetry){var E=s+l*y.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+E),i.currentTime=E,a.trigger(P.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+y.nudgeMaxRetry+" nudges"),a.trigger(P.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},T}()},"./src/controller/id3-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),P=O("./src/demux/id3.ts"),W=.25,U=function(){function _(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var A=_.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var p=this.hls;p.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var p=this.hls;p.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(p,T){this.media=T.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(p){if(!this.media)return;for(var T=0;T<p.length;T++){var m=p[T];if(m.kind==="metadata"&&m.label==="id3")return Object(F.sendAddTrackEvent)(m,this.media),m}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(p,T){if(!this.media)return;var m=T.frag,f=T.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<f.length;a++){var i=P.getID3Frames(f[a].data);if(i){var s=f[a].pts,l=a<f.length-1?f[a+1].pts:m.end,E=l-s;E<=0&&(l=s+W);for(var g=0;g<i.length;g++){var v=i[g];if(!P.isTimeStampFrame(v)){var k=new y(s,l,"");k.value=v,this.id3Track.addCue(k)}}}}},A.onBufferFlushing=function(p,T){var m=T.startOffset,f=T.endOffset,y=T.type;if(!y||y==="audio"){var a=this.id3Track;a&&Object(F.removeCuesInRange)(a,m,f)}},_}();J.default=U},"./src/controller/latency-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return _});var X=O("./src/errors.ts"),F=O("./src/events.ts"),P=O("./src/utils/logger.ts");function W(A,d){for(var p=0;p<d.length;p++){var T=d[p];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(A,T.key,T)}}function U(A,d,p){return d&&W(A.prototype,d),p&&W(A,p),A}var _=function(){function A(p){var T=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return T.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var d=A.prototype;return d.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},d.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},d.onMediaAttached=function(T,m){this.media=m.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},d.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},d.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},d.onLevelUpdated=function(T,m){var f=m.details;this.levelDetails=f,f.advanced&&this.timeupdate(),!f.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(T,m){if(m.details!==X.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var T=this.media,m=this.levelDetails;if(!T||!m)return;this.currentTime=T.currentTime;var f=this.computeLatency();if(f===null)return;this._latency=f;var y=this.config,a=y.lowLatencyMode,i=y.maxLiveSyncPlaybackRate;if(!a||i===1)return;var s=this.targetLatency;if(s===null)return;var l=f-s,E=Math.min(this.maxLatency,s+m.targetduration),g=l<E;if(m.live&&g&&l>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,i)),k=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;T.playbackRate=Math.min(v,Math.max(1,k))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)},d.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},d.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},U(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var T=this.config,m=this.levelDetails;return T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:m?T.liveMaxLatencyDurationCount*m.targetduration:0}},{key:"targetLatency",get:function(){var T=this.levelDetails;if(T===null)return null;var m=T.holdBack,f=T.partHoldBack,y=T.targetduration,a=this.config,i=a.liveSyncDuration,s=a.liveSyncDurationCount,l=a.lowLatencyMode,E=this.hls.userConfig,g=l&&f||m;(E.liveSyncDuration||E.liveSyncDurationCount||g===0)&&(g=i!==void 0?i:s*y);var v=y,k=1;return g+Math.min(this.stallCount*k,v)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),m=this.targetLatency,f=this.levelDetails;if(T===null||m===null||f===null)return null;var y=f.edge,a=T-m-this.edgeStalled,i=y-f.totalduration,s=y-(this.config.lowLatencyMode&&f.partTarget||f.targetduration);return Math.min(Math.max(i,a),s)}},{key:"drift",get:function(){var T=this.levelDetails;return T===null?1:T.drift}},{key:"edgeStalled",get:function(){var T=this.levelDetails;if(T===null)return 0;var m=(this.config.lowLatencyMode&&T.partTarget||T.targetduration)*3;return Math.max(T.age-m,0)}},{key:"forwardBufferLength",get:function(){var T=this.media,m=this.levelDetails;if(!T||!m)return 0;var f=T.buffered.length;return f?T.buffered.end(f-1):m.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return a});var X=O("./src/types/level.ts"),F=O("./src/events.ts"),P=O("./src/errors.ts"),W=O("./src/utils/codecs.ts"),U=O("./src/controller/level-helper.ts"),_=O("./src/controller/base-playlist-controller.ts"),A=O("./src/types/loader.ts");function d(){return d=Object.assign||function(i){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var E in l)Object.prototype.hasOwnProperty.call(l,E)&&(i[E]=l[E])}return i},d.apply(this,arguments)}function p(i,s){for(var l=0;l<s.length;l++){var E=s[l];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(i,E.key,E)}}function T(i,s,l){return s&&p(i.prototype,s),l&&p(i,l),i}function m(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,f(i,s)}function f(i,s){return f=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},f(i,s)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(i){m(s,i);function s(E){var g;return g=i.call(this,E,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var l=s.prototype;return l._registerListeners=function(){var g=this.hls;g.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(F.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var g=this.hls;g.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(F.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},l.startLoad=function(){var g=this._levels;g.forEach(function(v){v.loadError=0}),i.prototype.startLoad.call(this)},l.onManifestLoaded=function(g,v){var k=[],w=[],x=[],b,h={},u,L=!1,S=!1,D=!1;if(v.levels.forEach(function(G){var M=G.attrs;L=L||!!(G.width&&G.height),S=S||!!G.videoCodec,D=D||!!G.audioCodec,y&&G.audioCodec&&G.audioCodec.indexOf("mp4a.40.34")!==-1&&(G.audioCodec=void 0);var N=G.bitrate+"-"+G.attrs.RESOLUTION+"-"+G.attrs.CODECS;u=h[N],u?u.url.push(G.url):(u=new X.Level(G),h[N]=u,k.push(u)),M&&(M.AUDIO&&Object(U.addGroupId)(u,"audio",M.AUDIO),M.SUBTITLES&&Object(U.addGroupId)(u,"text",M.SUBTITLES))}),(L||S)&&D&&(k=k.filter(function(G){var M=G.videoCodec,N=G.width,Y=G.height;return!!M||!!(N&&Y)})),k=k.filter(function(G){var M=G.audioCodec,N=G.videoCodec;return(!M||Object(W.isCodecSupportedInMp4)(M,"audio"))&&(!N||Object(W.isCodecSupportedInMp4)(N,"video"))}),v.audioTracks&&(w=v.audioTracks.filter(function(G){return!G.audioCodec||Object(W.isCodecSupportedInMp4)(G.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(w)),v.subtitles&&(x=v.subtitles,Object(U.assignTrackIdsByGroup)(x)),k.length>0){b=k[0].bitrate,k.sort(function(G,M){return G.bitrate-M.bitrate}),this._levels=k;for(var I=0;I<k.length;I++)if(k[I].bitrate===b){this._firstLevel=I,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+b);break}var B=D&&!S,j={levels:k,audioTracks:w,subtitleTracks:x,firstLevel:this._firstLevel,stats:v.stats,audio:D,video:S,altAudio:!B&&w.some(function(G){return!!G.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(g,v){if(i.prototype.onError.call(this,g,v),v.fatal)return;var k=v.context,w=this._levels[this.currentLevelIndex];if(k&&(k.type===A.PlaylistContextType.AUDIO_TRACK&&w.audioGroupIds&&k.groupId===w.audioGroupIds[w.urlId]||k.type===A.PlaylistContextType.SUBTITLE_TRACK&&w.textGroupIds&&k.groupId===w.textGroupIds[w.urlId])){this.redundantFailover(this.currentLevelIndex);return}var x=!1,b=!0,h;switch(v.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(v.frag){var u=this._levels[v.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=v.frag.level)):h=v.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(b=!1),h=k.level),x=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:h=v.level,x=!0;break}h!==void 0&&this.recoverLevel(v,h,x,b)},l.recoverLevel=function(g,v,k,w){var x=g.details,b=this._levels[v];if(b.loadError++,k){var h=this.retryLoadingOrFail(g);if(h)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var u=b.url.length;if(u>1&&b.loadError<u)g.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var L=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==L&&this._levels[L].loadError===0&&(this.warn(x+": switch to "+L),g.levelRetry=!0,this.hls.nextAutoLevel=L)}}},l.redundantFailover=function(g){var v=this._levels[g],k=v.url.length;if(k>1){var w=(v.urlId+1)%k;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(x){x.urlId=w}),this.level=g}},l.onFragLoaded=function(g,v){var k=v.frag;if(k!==void 0&&k.type===A.PlaylistLevelType.MAIN){var w=this._levels[k.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},l.onLevelLoaded=function(g,v){var k,w=v.level,x=v.details,b=this._levels[w];if(!b){var h;this.warn("Invalid level index "+w),(h=v.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(x.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(b.fragmentError===0&&(b.loadError=0,this.retryCount=0),this.playlistLoaded(w,v,b.details)):(k=v.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(x.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(g,v){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var w=-1,x=this.hls.audioTracks[v.id].groupId,b=0;b<k.audioGroupIds.length;b++)if(k.audioGroupIds[b]===x){w=b;break}w!==k.urlId&&(k.urlId=w,this.startLoad())}},l.loadPlaylist=function(g){var v=this.currentLevelIndex,k=this._levels[v];if(this.canLoad&&k&&k.url.length>0){var w=k.urlId,x=k.url[w];if(g)try{x=g.addDirectives(x)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("Attempt loading level index "+v+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+w+" "+x),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:x,level:v,id:w,deliveryDirectives:g||null})}},l.removeLevel=function(g,v){var k=function(b,h){return h!==v},w=this._levels.filter(function(x,b){return b!==g?!0:x.url.length>1&&v!==void 0?(x.url=x.url.filter(k),x.audioGroupIds&&(x.audioGroupIds=x.audioGroupIds.filter(k)),x.textGroupIds&&(x.textGroupIds=x.textGroupIds.filter(k)),x.urlId=0,!0):!1}).map(function(x,b){var h=x.details;return h!=null&&h.fragments&&h.fragments.forEach(function(u){u.level=b}),x});this._levels=w,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:w})},T(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var v,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===g&&(v=k[g])!==null&&v!==void 0&&v.details)return;if(g<0||g>=k.length){var w=g<0;if(this.hls.trigger(F.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:w,reason:"invalid level idx"}),w)return;g=Math.min(g,k.length-1)}this.clearTimer();var x=this.currentLevelIndex,b=k[x],h=k[g];this.log("switching to level "+g+" from "+x),this.currentLevelIndex=g;var u=d({},h,{level:g,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete u._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,u);var L=h.details;if(!L||L.live){var S=this.switchParams(h.uri,b==null?void 0:b.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(_.default)},"./src/controller/level-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"addGroupId",function(){return P}),O.d(J,"assignTrackIdsByGroup",function(){return W}),O.d(J,"updatePTS",function(){return U}),O.d(J,"updateFragPTSDTS",function(){return A}),O.d(J,"mergeDetails",function(){return d}),O.d(J,"mapPartIntersection",function(){return p}),O.d(J,"mapFragmentIntersection",function(){return T}),O.d(J,"adjustSliding",function(){return m}),O.d(J,"addSliding",function(){return f}),O.d(J,"computeReloadInterval",function(){return y}),O.d(J,"getFragmentWithSN",function(){return a}),O.d(J,"getPartWith",function(){return i});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts");function P(s,l,E){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(E);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(E);break}}function W(s){var l={};s.forEach(function(E){var g=E.groupId||"";E.id=l[g]=l[g]||0,l[g]++})}function U(s,l,E){var g=s[l],v=s[E];_(g,v)}function _(s,l){var E=l.startPTS;if(Object(X.isFiniteNumber)(E)){var g=0,v;l.sn>s.sn?(g=E-s.start,v=s):(g=s.start-E,v=l),v.duration!==g&&(v.duration=g)}else if(l.sn>s.sn){var k=s.cc===l.cc;k&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function A(s,l,E,g,v,k){var w=g-E;w<=0&&(F.logger.warn("Fragment should have a positive duration",l),g=E+l.duration,k=v+l.duration);var x=E,b=g,h=l.startPTS,u=l.endPTS;if(Object(X.isFiniteNumber)(h)){var L=Math.abs(h-E);Object(X.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(L,l.deltaPTS):l.deltaPTS=L,x=Math.max(E,h),E=Math.min(E,h),v=Math.min(v,l.startDTS),b=Math.min(g,u),g=Math.max(g,u),k=Math.max(k,l.endDTS)}l.duration=g-E;var S=E-l.start;l.appendedPTS=g,l.start=l.startPTS=E,l.maxStartPTS=x,l.startDTS=v,l.endPTS=g,l.minEndPTS=b,l.endDTS=k;var D=l.sn;if(!s||D<s.startSN||D>s.endSN)return 0;var I,B=D-s.startSN,j=s.fragments;for(j[B]=l,I=B;I>0;I--)_(j[I],j[I-1]);for(I=B;I<j.length-1;I++)_(j[I],j[I+1]);return s.fragmentHint&&_(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function d(s,l){for(var E=null,g=s.fragments,v=g.length-1;v>=0;v--){var k=g[v].initSegment;if(k){E=k;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var w=0,x;if(T(s,l,function(I,B){I.relurl&&(w=I.cc-B.cc),Object(X.isFiniteNumber)(I.startPTS)&&Object(X.isFiniteNumber)(I.endPTS)&&(B.start=B.startPTS=I.startPTS,B.startDTS=I.startDTS,B.appendedPTS=I.appendedPTS,B.maxStartPTS=I.maxStartPTS,B.endPTS=I.endPTS,B.endDTS=I.endDTS,B.minEndPTS=I.minEndPTS,B.duration=I.endPTS-I.startPTS,B.duration&&(x=B),l.PTSKnown=l.alignedSliding=!0),B.elementaryStreams=I.elementaryStreams,B.loader=I.loader,B.stats=I.stats,B.urlId=I.urlId,I.initSegment&&(B.initSegment=I.initSegment,E=I.initSegment)}),E){var b=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;b.forEach(function(I){var B;(!I.initSegment||I.initSegment.relurl===((B=E)===null||B===void 0?void 0:B.relurl))&&(I.initSegment=E)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(I){return!I}),l.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=l.skippedSegments;h--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var u=l.fragments;if(w){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var L=0;L<u.length;L++)u[L].cc+=w}l.skippedSegments&&(l.startCC=l.fragments[0].cc),p(s.partList,l.partList,function(I,B){B.elementaryStreams=I.elementaryStreams,B.stats=I.stats}),x?A(l,x,x.startPTS,x.endPTS,x.startDTS,x.endDTS):m(s,l),u.length&&(l.totalduration=l.edge-u[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var S=l.advancedDateTime;if(l.advanced&&S){var D=l.edge;l.driftStart||(l.driftStartTime=S,l.driftStart=D),l.driftEndTime=S,l.driftEnd=D}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function p(s,l,E){if(s&&l)for(var g=0,v=0,k=s.length;v<=k;v++){var w=s[v],x=l[v+g];w&&x&&w.index===x.index&&w.fragment.sn===x.fragment.sn?E(w,x):g--}}function T(s,l,E){for(var g=l.skippedSegments,v=Math.max(s.startSN,l.startSN)-l.startSN,k=(s.fragmentHint?1:0)+(g?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,w=l.startSN-s.startSN,x=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,b=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,h=v;h<=k;h++){var u=b[w+h],L=x[h];g&&!L&&h<g&&(L=l.fragments[h]=u),u&&L&&E(u,L)}}function m(s,l){var E=l.startSN+l.skippedSegments-s.startSN,g=s.fragments;if(E<0||E>=g.length)return;f(l,g[E].start)}function f(s,l){if(l){for(var E=s.fragments,g=s.skippedSegments;g<E.length;g++)E[g].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function y(s,l){var E=1e3*s.levelTargetDuration,g=E/2,v=s.age,k=v>0&&v<E*3,w=l.loading.end-l.loading.start,x,b=s.availabilityDelay;if(s.updated===!1)if(k){var h=333*s.misses;x=Math.max(Math.min(g,w*2),h),s.availabilityDelay=(s.availabilityDelay||0)+x}else x=g;else k?(b=Math.min(b||E/2,v),s.availabilityDelay=b,x=b+E-v):x=E-w;return Math.round(x)}function a(s,l,E){if(!s||!s.details)return null;var g=s.details,v=g.fragments[l-g.startSN];return v||(v=g.fragmentHint,v&&v.sn===l?v:l<g.startSN&&E&&E.sn===l?E:null)}function i(s,l,E){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var v=g.length;v--;){var k=g[v];if(k.index===E&&k.fragment.sn===l)return k}return null}},"./src/controller/stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return g});var X=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),P=O("./src/is-supported.ts"),W=O("./src/events.ts"),U=O("./src/utils/buffer-helper.ts"),_=O("./src/controller/fragment-tracker.ts"),A=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),p=O("./src/demux/transmuxer-interface.ts"),T=O("./src/types/transmuxer.ts"),m=O("./src/controller/gap-controller.ts"),f=O("./src/errors.ts"),y=O("./src/utils/logger.ts");function a(v,k){for(var w=0;w<k.length;w++){var x=k[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,x.key,x)}}function i(v,k,w){return k&&a(v.prototype,k),w&&a(v,w),v}function s(v,k){v.prototype=Object.create(k.prototype),v.prototype.constructor=v,l(v,k)}function l(v,k){return l=Object.setPrototypeOf||function(x,b){return x.__proto__=b,x},l(v,k)}var E=100,g=function(v){s(k,v);function k(x,b){var h;return h=v.call(this,x,b,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var w=k.prototype;return w._registerListeners=function(){var b=this.hls;b.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),b.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),b.on(W.Events.ERROR,this.onError,this),b.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),b.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),b.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var b=this.hls;b.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),b.off(W.Events.ERROR,this.onError,this),b.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),b.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),b.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},w.startLoad=function(b){if(this.levels){var h=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var L=u.startLevel;L===-1&&(u.config.testBandwidth?(L=0,this.bitrateTest=!0):L=u.nextAutoLevel),this.level=u.nextLoadLevel=L,this.loadedmetadata=!1}h>0&&b===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),b=h),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=b,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},w.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},w.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var b,h=this.levels,u=this.level,L=h==null||((b=h[u])===null||b===void 0)?void 0:b.details;if(L&&(!L.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(L))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var S,D=self.performance.now(),I=this.retryDate;(!I||D>=I||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},w.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var b,h,u=this.hls,L=this.levelLastLoaded,S=this.levels,D=this.media,I=u.config,B=u.nextLoadLevel;if(L===null||!D&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[B])return;var j=S[B];this.level=u.nextLoadLevel=B;var G=j.details;if(!G||this.state===F.State.WAITING_LEVEL||G.live&&this.levelLastLoaded!==B){this.state=F.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:D,A.PlaylistLevelType.MAIN);if(M===null)return;var N=M.len,Y=this.getMaxBufferLength(j.maxBitrate);if(N>=Y)return;if(this._streamEnded(M,G)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ee),this.state=F.State.ENDED;return}var le=M.end,fe=this.getNextFragment(le,G);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var Pe=fe.sn-G.startSN;Pe>1&&(fe=G.fragments[Pe-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===_.FragmentState.OK&&this.nextLoadPosition>le){var Se=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(D,Se,A.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,G)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((b=fe.decryptdata)===null||b===void 0?void 0:b.keyFormat)==="identity"&&!((h=fe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(fe,G):this.loadFragment(fe,G,le)},w.loadFragment=function(b,h,u){var L,S=this.fragmentTracker.getState(b);if(this.fragCurrent=b,S===_.FragmentState.BACKTRACKED){var D=this.fragmentTracker.getBacktrackData(b);if(D){this._handleFragmentLoadProgress(D),this._handleFragmentLoadComplete(D);return}else S=_.FragmentState.NOT_LOADED}S===_.FragmentState.NOT_LOADED||S===_.FragmentState.PARTIAL?b.sn==="initSegment"?this._loadInitSegment(b):this.bitrateTest?(b.bitrateTest=!0,this.log("Fragment "+b.sn+" of level "+b.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(b)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,b,h,u)):S===_.FragmentState.APPENDING?this.reduceMaxBufferLength(b.duration)&&this.fragmentTracker.removeFragment(b):((L=this.media)===null||L===void 0?void 0:L.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(b){var h=this.fragmentTracker.getAppendedFrag(b,A.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},w.getBufferedFrag=function(b){return this.fragmentTracker.getBufferedFrag(b,A.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(b){return b?this.getBufferedFrag(b.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var b=this.levels,h=this.media;if(h!=null&&h.readyState){var u,L=this.getAppendedFrag(h.currentTime);if(L&&L.start>1&&this.flushMainBuffer(0,L.start-1),!h.paused&&b){var S=this.hls.nextLoadLevel,D=b[S],I=this.fragLastKbps;I&&this.fragCurrent?u=this.fragCurrent.duration*D.maxBitrate/(1e3*I)+1:u=0}else u=0;var B=this.getBufferedFrag(h.currentTime+u);if(B){var j=this.followingBufferedFrag(B);if(j){this.abortCurrentFrag();var G=j.maxStartPTS?j.maxStartPTS:j.start,M=j.duration,N=Math.max(B.end,G+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},w.abortCurrentFrag=function(){var b=this.fragCurrent;this.fragCurrent=null,b!=null&&b.loader&&b.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},w.flushMainBuffer=function(b,h){v.prototype.flushMainBuffer.call(this,b,h,this.altAudio?"video":null)},w.onMediaAttached=function(b,h){v.prototype.onMediaAttached.call(this,b,h);var u=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new m.default(this.config,u,this.fragmentTracker,this.hls)},w.onMediaDetaching=function(){var b=this.media;b&&(b.removeEventListener("playing",this.onvplaying),b.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},w.onMediaPlaying=function(){this.tick()},w.onMediaSeeked=function(){var b=this.media,h=b?b.currentTime:null;Object(X.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},w.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},w.onManifestParsed=function(b,h){var u=!1,L=!1,S;h.levels.forEach(function(D){S=D.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(u=!0),S.indexOf("mp4a.40.5")!==-1&&(L=!0))}),this.audioCodecSwitch=u&&L&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},w.onLevelLoading=function(b,h){var u=this.levels;if(!u||this.state!==F.State.IDLE)return;var L=u[h.level];(!L.details||L.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(L.details))&&(this.state=F.State.WAITING_LEVEL)},w.onLevelLoaded=function(b,h){var u,L=this.levels,S=h.level,D=h.details,I=D.totalduration;if(!L){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+D.startSN+","+D.endSN+"], cc ["+D.startCC+", "+D.endCC+"] duration:"+I);var B=this.fragCurrent;B&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==h.level&&B.loader&&(this.state=F.State.IDLE,B.loader.abort()));var j=L[S],G=0;if(D.live||(u=j.details)!==null&&u!==void 0&&u.live){if(D.fragments[0]||(D.deltaUpdateFailed=!0),D.deltaUpdateFailed)return;G=this.alignPlaylists(D,j.details)}if(j.details=D,this.levelLastLoaded=S,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:D,level:S}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(D))return;this.state=F.State.IDLE}this.startFragRequested?D.live&&this.synchronizeToLiveEdge(D):this.setStartPosition(D,G),this.tick()},w._handleFragmentLoadProgress=function(b){var h,u=b.frag,L=b.part,S=b.payload,D=this.levels;if(!D){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var I=D[u.level],B=I.details;if(!B){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var j=I.videoCodec,G=B.PTSKnown||!B.live,M=(h=u.initSegment)===null||h===void 0?void 0:h.data,N=this._getAudioCodec(I),Y=this.transmuxer=this.transmuxer||new p.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=L?L.index:-1,le=ee!==-1,fe=new T.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,S.byteLength,ee,le),Pe=this.initPTS[u.cc];Y.push(S,M,N,j,u,L,B.totalduration,G,fe,Pe)},w.onAudioTrackSwitching=function(b,h){var u=this.altAudio,L=!!h.url,S=h.id;if(!L){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var D=this.fragCurrent;D!=null&&D.loader&&(this.log("Switching to main audio track, cancel main fragment load"),D.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;u&&I.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:S})}},w.onAudioTrackSwitched=function(b,h){var u=h.id,L=!!this.hls.audioTracks[u].url;if(L){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=L,this.tick()},w.onBufferCreated=function(b,h){var u=h.tracks,L,S,D=!1;for(var I in u){var B=u[I];if(B.id==="main"){if(S=I,L=B,I==="video"){var j=u[I];j&&(this.videoBuffer=j.buffer)}}else D=!0}D&&L?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=L.buffer):this.mediaBuffer=this.media},w.onFragBuffered=function(b,h){var u=h.frag,L=h.part;if(u&&u.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(L?" p: "+L.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var S=L?L.stats:u.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,L)},w.onError=function(b,h){switch(h.details){case f.ErrorDetails.FRAG_LOAD_ERROR:case f.ErrorDetails.FRAG_LOAD_TIMEOUT:case f.ErrorDetails.KEY_LOAD_ERROR:case f.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,h);break;case f.ErrorDetails.LEVEL_LOAD_ERROR:case f.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=F.State.ERROR):!h.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case f.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var u=!0,L=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);L&&L.len>.5&&(u=!this.reduceMaxBufferLength(L.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.checkBuffer=function(){var b=this.media,h=this.gapController;if(!b||!h||!b.readyState)return;var u=U.BufferHelper.getBuffered(b);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=b.currentTime},w.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(b,h){var u=h.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var L=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(L,u,A.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(b,h){this.levels=h.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.seekToStartPos=function(){var b=this.media,h=b.currentTime,u=this.startPosition;if(u>=0&&h<u){if(b.seeking){y.logger.log("could not seek to "+u+", already seeking at "+h);return}var L=U.BufferHelper.getBuffered(b),S=L.length?L.start(0):0,D=S-u;D>0&&(D<this.config.maxBufferHole||D<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+D+" to match buffer start"),u+=D,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+h),b.currentTime=u}},w._getAudioCodec=function(b){var h=this.config.defaultAudioCodec||b.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},w._loadBitrateTestFrag=function(b){var h=this;this._doFragLoad(b).then(function(u){var L=h.hls;if(!u||L.nextLoadLevel||h.fragContextChanged(b))return;h.fragLoadError=0,h.state=F.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var S=b.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),L.trigger(W.Events.FRAG_LOADED,u)})},w._handleTransmuxComplete=function(b){var h,u="main",L=this.hls,S=b.remuxResult,D=b.chunkMeta,I=this.getCurrentContext(D);if(!I){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var B=I.frag,j=I.part,G=I.level,M=S.video,N=S.text,Y=S.id3,ee=S.initSegment,le=this.altAudio?void 0:S.audio;if(this.fragContextChanged(B))return;if(this.state=F.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(G,ee.tracks,B,D),L.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:u,tracks:ee.tracks}));var fe=ee.initPTS,Pe=ee.timescale;Object(X.isFiniteNumber)(fe)&&(this.initPTS[B.cc]=fe,L.trigger(W.Events.INIT_PTS_FOUND,{frag:B,id:u,initPTS:fe,timescale:Pe}))}if(M&&S.independent!==!1){if(G.details){var Se=M.startPTS,De=M.endPTS,Le=M.startDTS,Ae=M.endDTS;if(j)j.elementaryStreams[M.type]={startPTS:Se,endPTS:De,startDTS:Le,endDTS:Ae};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<Se){this.backtrack(B);return}B.setElementaryStreamInfo(M.type,B.start,De,B.start,Ae,!0)}B.setElementaryStreamInfo(M.type,Se,De,Le,Ae),this.bufferFragmentData(M,B,j,D)}}else if(S.independent===!1){this.backtrack(B);return}if(le){var de=le.startPTS,re=le.endPTS,he=le.startDTS,ie=le.endDTS;j&&(j.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:re,startDTS:he,endDTS:ie}),B.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,de,re,he,ie),this.bufferFragmentData(le,B,j,D)}if(Y!=null&&(h=Y.samples)!==null&&h!==void 0&&h.length){var Re={frag:B,id:u,samples:Y.samples};L.trigger(W.Events.FRAG_PARSING_METADATA,Re)}if(N){var oe={frag:B,id:u,samples:N.samples};L.trigger(W.Events.FRAG_PARSING_USERDATA,oe)}},w._bufferInitSegment=function(b,h,u,L){var S=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var D=h.audio,I=h.video,B=h.audiovideo;if(D){var j=b.audioCodec,G=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),D.metadata.channelCount!==1&&G.indexOf("firefox")===-1&&(j="mp4a.40.5")),G.indexOf("android")!==-1&&D.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),b.audioCodec&&b.audioCodec!==j&&this.log('Swapping manifest audio codec "'+b.audioCodec+'" for "'+j+'"'),D.levelCodec=j,D.id="main",this.log("Init audio buffer, container:"+D.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(b.audioCodec||"")+"/"+D.codec+"]")}I&&(I.levelCodec=b.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(b.videoCodec||"")+"/"+I.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(b.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(M){var N=h[M],Y=N.initSegment;Y!=null&&Y.byteLength&&S.hls.trigger(W.Events.BUFFER_APPENDING,{type:M,data:Y,frag:u,part:null,chunkMeta:L,parent:u.type})}),this.tick()},w.backtrack=function(b){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(b);var h=this.fragmentTracker.backtrack(b);this.fragPrevious=null,this.nextLoadPosition=b.start,h?this.resetFragmentLoading(b):this.state=F.State.BACKTRACKING},w.checkFragmentChanged=function(){var b=this.media,h=null;if(b&&b.readyState>1&&b.seeking===!1){var u=b.currentTime;if(U.BufferHelper.isBuffered(b,u)?h=this.getAppendedFrag(u):U.BufferHelper.isBuffered(b,u+.1)&&(h=this.getAppendedFrag(u+.1)),h){var L=this.fragPlaying,S=h.level;(!L||h.sn!==L.sn||L.level!==S||h.urlId!==L.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:h}),(!L||L.level!==S)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=h)}}},i(k,[{key:"nextLevel",get:function(){var b=this.nextBufferedFrag;return b?b.level:-1}},{key:"currentLevel",get:function(){var b=this.media;if(b){var h=this.getAppendedFrag(b.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var b=this.media;if(b){var h=this.getAppendedFrag(b.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"SubtitleStreamController",function(){return s});var X=O("./src/events.ts"),F=O("./src/utils/logger.ts"),P=O("./src/utils/buffer-helper.ts"),W=O("./src/controller/fragment-finders.ts"),U=O("./src/utils/discontinuities.ts"),_=O("./src/controller/level-helper.ts"),A=O("./src/controller/fragment-tracker.ts"),d=O("./src/controller/base-stream-controller.ts"),p=O("./src/types/loader.ts"),T=O("./src/types/level.ts");function m(l,E){for(var g=0;g<E.length;g++){var v=E[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(l,v.key,v)}}function f(l,E,g){return E&&m(l.prototype,E),g&&m(l,g),l}function y(l,E){l.prototype=Object.create(E.prototype),l.prototype.constructor=l,a(l,E)}function a(l,E){return a=Object.setPrototypeOf||function(v,k){return v.__proto__=k,v},a(l,E)}var i=500,s=function(l){y(E,l);function E(v,k){var w;return w=l.call(this,v,k,"[subtitle-stream-controller]")||this,w.levels=[],w.currentTrackId=-1,w.tracksBuffered=[],w.mainDetails=null,w._registerListeners(),w}var g=E.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var k=this.hls;k.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(X.Events.ERROR,this.onError,this),k.on(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var k=this.hls;k.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(X.Events.ERROR,this.onError,this),k.off(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(i),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(k,w){this.mainDetails=w.details},g.onSubtitleFragProcessed=function(k,w){var x=w.frag,b=w.success;if(this.fragPrevious=x,this.state=d.State.IDLE,!b)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var u,L=x.start,S=0;S<h.length;S++)if(L>=h[S].start&&L<=h[S].end){u=h[S];break}var D=x.start+x.duration;u?u.end=D:(u={start:L,end:D},h.push(u)),this.fragmentTracker.fragBuffered(x)},g.onBufferFlushing=function(k,w){var x=w.startOffset,b=w.endOffset;if(x===0&&b!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,u=this.levels;if(!u.length||!u[h]||!u[h].details)return;var L=u[h].details,S=L.targetduration,D=b-S;if(D<=0)return;w.endOffsetSubtitles=Math.max(0,D),this.tracksBuffered.forEach(function(I){for(var B=0;B<I.length;){if(I[B].end<=D){I.shift();continue}else if(I[B].start<D)I[B].start=D;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(x,D,p.PlaylistLevelType.SUBTITLE)}},g.onError=function(k,w){var x,b=w.frag;if(!b||b.type!==p.PlaylistLevelType.SUBTITLE)return;(x=this.fragCurrent)!==null&&x!==void 0&&x.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},g.onSubtitleTracksUpdated=function(k,w){var x=this,b=w.subtitleTracks;this.tracksBuffered=[],this.levels=b.map(function(h){return new T.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){x.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(k,w){if(this.currentTrackId=w.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var x=this.levels[this.currentTrackId];x!=null&&x.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,x&&this.setInterval(i)},g.onSubtitleTrackLoaded=function(k,w){var x,b=w.details,h=w.id,u=this.currentTrackId,L=this.levels;if(!L.length)return;var S=L[u];if(h>=L.length||h!==u||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,b.live||(x=S.details)!==null&&x!==void 0&&x.live){var D=this.mainDetails;if(b.deltaUpdateFailed||!D)return;var I=D.fragments[0];if(!S.details)b.hasProgramDateTime&&D.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(b,D):I&&Object(_.addSliding)(b,I.start);else{var B=this.alignPlaylists(b,S.details);B===0&&I&&Object(_.addSliding)(b,I.start)}}if(S.details=b,this.levelLastLoaded=h,this.tick(),b.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var j=Object(W.findFragmentByPTS)(null,b.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},g._handleFragmentLoadComplete=function(k){var w=k.frag,x=k.payload,b=w.decryptdata,h=this.hls;if(this.fragContextChanged(w))return;if(x&&x.byteLength>0&&b&&b.key&&b.iv&&b.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(x),b.key.buffer,b.iv.buffer).then(function(L){var S=performance.now();h.trigger(X.Events.FRAG_DECRYPTED,{frag:w,payload:L,stats:{tstart:u,tdecrypt:S}})})}},g.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var k,w=this.currentTrackId,x=this.levels;if(!x.length||!x[w]||!x[w].details)return;var b=x[w].details,h=b.targetduration,u=this.config,L=this.media,S=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,L.currentTime-h,u.maxBufferHole),D=S.end,I=S.len,B=this.getMaxBufferLength()+h;if(I>B)return;console.assert(b,"Subtitle track details are defined on idle subtitle stream controller tick");var j=b.fragments,G=j.length,M=b.edge,N,Y=this.fragPrevious;if(D<M){var ee=u.maxFragLookUpTolerance;Y&&b.hasProgramDateTime&&(N=Object(W.findFragmentByPDT)(j,Y.endProgramDateTime,ee)),N||(N=Object(W.findFragmentByPTS)(Y,j,D,ee),!N&&Y&&Y.start<j[0].start&&(N=j[0]))}else N=j[G-1];(k=N)!==null&&k!==void 0&&k.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=d.State.KEY_LOADING,this.hls.trigger(X.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===A.FragmentState.NOT_LOADED&&this.loadFragment(N,b,D)}},g.loadFragment=function(k,w,x){this.fragCurrent=k,l.prototype.loadFragment.call(this,k,w,x)},f(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),P=O("./src/controller/base-playlist-controller.ts"),W=O("./src/types/loader.ts");function U(m,f){for(var y=0;y<f.length;y++){var a=f[y];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(m,a.key,a)}}function _(m,f,y){return f&&U(m.prototype,f),y&&U(m,y),m}function A(m,f){m.prototype=Object.create(f.prototype),m.prototype.constructor=m,d(m,f)}function d(m,f){return d=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},d(m,f)}var p=function(m){A(f,m);function f(a){var i;return i=m.call(this,a,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}var y=f.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,m.prototype.destroy.call(this)},y.registerListeners=function(){var i=this.hls;i.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(X.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var i=this.hls;i.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(X.Events.ERROR,this.onError,this)},y.onMediaAttached=function(i,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},y.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},y.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var i=T(this.media.textTracks);i.forEach(function(s){Object(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(i,s){this.tracks=s.subtitleTracks},y.onSubtitleTrackLoaded=function(i,s){var l=s.id,E=s.details,g=this.trackId,v=this.tracksInGroup[g];if(!v){this.warn("Invalid subtitle track id "+l);return}var k=v.details;v.details=s.details,this.log("subtitle track "+l+" loaded ["+E.startSN+"-"+E.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,k))},y.onLevelLoading=function(i,s){this.switchLevel(s.level)},y.onLevelSwitching=function(i,s){this.switchLevel(s.level)},y.switchLevel=function(i){var s=this.hls.levels[i];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(w){return!l||w.groupId===l});this.tracksInGroup=g;var v=this.findTrackId(E==null?void 0:E.name)||this.findTrackId();this.groupId=l;var k={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(X.Events.SUBTITLE_TRACKS_UPDATED,k),v!==-1&&this.setSubtitleTrack(v,E)}},y.findTrackId=function(i){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var E=s[l];if((!this.selectDefaultTrack||E.default)&&(!i||i===E.name))return E.id}return-1},y.onError=function(i,s){if(m.prototype.onError.call(this,i,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)},y.loadPlaylist=function(i){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,E=s.groupId,g=s.url;if(i)try{g=i.addDirectives(g)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(X.Events.SUBTITLE_TRACK_LOADING,{url:g,id:l,groupId:E,deliveryDirectives:i||null})}},y.toggleTrackModes=function(i){var s=this,l=this.media,E=this.subtitleDisplay,g=this.trackId;if(!l)return;var v=T(l.textTracks),k=v.filter(function(b){return b.groupId===s.groupId});if(i===-1)[].slice.call(v).forEach(function(b){b.mode="disabled"});else{var w=k[g];w&&(w.mode="disabled")}var x=k[i];x&&(x.mode=E?"showing":"hidden")},y.setSubtitleTrack=function(i,s){var l,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(l=E[i])!==null&&l!==void 0&&l.details)||i<-1||i>=E.length)return;this.clearTimer();var g=E[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,g){var v=g.id,k=g.groupId,w=k===void 0?"":k,x=g.name,b=g.type,h=g.url;this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:w,name:x,type:b,url:h});var u=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(u)}else this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:i})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,s=T(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")i=l;else if(s[l].mode==="showing"){i=l;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},_(f,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,s)}}]),f}(P.default);function T(m){for(var f=[],y=0;y<m.length;y++){var a=m[y];a.kind==="subtitles"&&a.label&&f.push(m[y])}return f}J.default=p},"./src/controller/timeline-controller.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"TimelineController",function(){return T});var X=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),P=O("./src/utils/cea-608-parser.ts"),W=O("./src/utils/output-filter.ts"),U=O("./src/utils/webvtt-parser.ts"),_=O("./src/utils/texttrack-utils.ts"),A=O("./src/utils/imsc1-ttml-parser.ts"),d=O("./src/types/loader.ts"),p=O("./src/utils/logger.ts"),T=function(){function a(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new W.default(this,"textTrack1"),E=new W.default(this,"textTrack2"),g=new W.default(this,"textTrack3"),v=new W.default(this,"textTrack4");this.cea608Parser1=new P.default(1,l,E),this.cea608Parser2=new P.default(3,g,v)}s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(F.Events.FRAG_LOADING,this.onFragLoading,this),s.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var i=a.prototype;return i.destroy=function(){var l=this.hls;l.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(F.Events.FRAG_LOADING,this.onFragLoading,this),l.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(l,E,g,v,k){for(var w=!1,x=k.length;x--;){var b=k[x],h=f(b[0],b[1],E,g);if(h>=0&&(b[0]=Math.min(b[0],E),b[1]=Math.max(b[1],g),w=!0,h/(g-E)>.5))return}if(w||k.push([E,g]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,E,g,v)}else{var L=this.Cues.newCue(null,E,g,v);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:L,track:l})}},i.onInitPtsFound=function(l,E){var g=this,v=E.frag,k=E.id,w=E.initPTS,x=E.timescale,b=this.unparsedVttFrags;k==="main"&&(this.initPTS[v.cc]=w,this.timescale[v.cc]=x),b.length&&(this.unparsedVttFrags=[],b.forEach(function(h){g.onFragLoaded(F.Events.FRAG_LOADED,h)}))},i.getExistingTrack=function(l){var E=this.media;if(E)for(var g=0;g<E.textTracks.length;g++){var v=E.textTracks[g];if(v[l])return v}return null},i.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},i.createNativeTrack=function(l){if(this.captionsTracks[l])return;var E=this.captionsProperties,g=this.captionsTracks,v=this.media,k=E[l],w=k.label,x=k.languageCode,b=this.getExistingTrack(l);if(b)g[l]=b,Object(_.clearCurrentCues)(g[l]),Object(_.sendAddTrackEvent)(g[l],v);else{var h=this.createTextTrack("captions",w,x);h&&(h[l]=!0,g[l]=h)}},i.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var E=this.captionsProperties[l];if(!E)return;var g=E.label,v={_id:l,label:g,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[l]=v,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},i.createTextTrack=function(l,E,g){var v=this.media;return v?v.addTextTrack(l,E,g):void 0},i.onMediaAttaching=function(l,E){this.media=E.media,this._cleanTracks()},i.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(E){Object(_.clearCurrentCues)(l[E]),delete l[E]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},i._cleanTracks=function(){var l=this.media;if(!l)return;var E=l.textTracks;if(E)for(var g=0;g<E.length;g++)Object(_.clearCurrentCues)(E[g])},i.onSubtitleTracksUpdated=function(l,E){var g=this;this.textTracks=[];var v=E.subtitleTracks||[],k=v.some(function(h){return h.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var w=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var x=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,u){var L;if(u<x.length){for(var S=null,D=0;D<x.length;D++)if(m(x[D],h)){S=x[D];break}S&&(L=S)}L?Object(_.clearCurrentCues)(L):(L=g.createTextTrack("subtitles",h.name,h.lang),L&&(L.mode="disabled")),L&&(L.groupId=h.groupId,g.textTracks.push(L))})}else if(!w&&this.tracks&&this.tracks.length){var b=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:b})}}},i.onManifestLoaded=function(l,E){var g=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(v){var k=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!k)return;var w="textTrack"+k[1],x=g.captionsProperties[w];if(!x)return;x.label=v.name,v.lang&&(x.languageCode=v.lang),x.media=v})},i.onFragLoading=function(l,E){var g=this.cea608Parser1,v=this.cea608Parser2,k=this.lastSn,w=this.lastPartIndex;if(!this.enabled||!(g&&v))return;if(E.frag.type===d.PlaylistLevelType.MAIN){var x,b,h=E.frag.sn,u=(x=E==null||((b=E.part)===null||b===void 0)?void 0:b.index)!=null?x:-1;h===k+1||h===k&&u===w+1||(g.reset(),v.reset()),this.lastSn=h,this.lastPartIndex=u}},i.onFragLoaded=function(l,E){var g=E.frag,v=E.payload,k=this.initPTS,w=this.unparsedVttFrags;if(g.type===d.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(X.isFiniteNumber)(k[g.cc])){w.push(E),k.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var x=g.decryptdata;if(x==null||x.key==null||x.method!=="AES-128"){var b=this.tracks[g.level],h=this.vttCCs;h[g.cc]||(h[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),b&&b.textCodec===A.IMSC1_CODEC?this._parseIMSC1(g,v):this._parseVTTs(g,v,h)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(l,E){var g=this,v=this.hls;Object(A.parseIMSC1)(E,this.initPTS[l.cc],this.timescale[l.cc],function(k){g._appendCues(k,l.level),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(k){p.logger.log("Failed to parse IMSC1: "+k),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:k})})},i._parseVTTs=function(l,E,g){var v=this,k=this.hls;Object(U.parseWebVTT)(E,this.initPTS[l.cc],this.timescale[l.cc],g,l.cc,l.start,function(w){v._appendCues(w,l.level),k.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(w){v._fallbackToIMSC1(l,E),p.logger.log("Failed to parse VTT cue: "+w),k.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:w})})},i._fallbackToIMSC1=function(l,E){var g=this,v=this.tracks[l.level];v.textCodec||Object(A.parseIMSC1)(E,this.initPTS[l.cc],this.timescale[l.cc],function(){v.textCodec=A.IMSC1_CODEC,g._parseIMSC1(l,E)},function(){v.textCodec="wvtt"})},i._appendCues=function(l,E){var g=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[E];if(v.mode==="disabled")return;l.forEach(function(x){return Object(_.addCueToTrack)(v,x)})}else{var k=this.tracks[E],w=k.default?"default":"subtitles"+E;g.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:l,track:w})}},i.onFragDecrypted=function(l,E){var g=E.frag;if(g.type===d.PlaylistLevelType.SUBTITLE){if(!Object(X.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(F.Events.FRAG_LOADED,E)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(l,E){var g=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(g&&v))return;for(var k=0;k<E.samples.length;k++){var w=E.samples[k].bytes;if(w){var x=this.extractCea608Data(w);g.addData(E.samples[k].pts,x[0]),v.addData(E.samples[k].pts,x[1])}}},i.onBufferFlushing=function(l,E){var g=E.startOffset,v=E.endOffset,k=E.endOffsetSubtitles,w=E.type,x=this.media;if(!x||x.currentTime<v)return;if(!w||w==="video"){var b=this.captionsTracks;Object.keys(b).forEach(function(u){return Object(_.removeCuesInRange)(b[u],g,v)})}if(this.config.renderTextTracksNatively&&(g===0&&k!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(u){return Object(_.removeCuesInRange)(h[u],g,k)})}},i.extractCea608Data=function(l){for(var E=l[0]&31,g=2,v=[[],[]],k=0;k<E;k++){var w=l[g++],x=127&l[g++],b=127&l[g++],h=(4&w)!==0,u=3&w;if(x===0&&b===0)continue;h&&((u===0||u===1)&&(v[u].push(x),v[u].push(b)))}return v},a}();function m(a,i){return a&&a.label===i.name&&!(a.textTrack1||a.textTrack2)}function f(a,i,s,l){return Math.min(i,l)-Math.max(a,s)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return X});var X=function(){function F(W,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=U}var P=F.prototype;return P.decrypt=function(U,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,U)},F}()},"./src/crypt/aes-decryptor.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"removePadding",function(){return F}),O.d(J,"default",function(){return P});var X=O("./src/utils/typed-array.ts");function F(W){var U=W.byteLength,_=U&&new DataView(W.buffer).getUint8(U-1);return _?Object(X.sliceUint8)(W,0,U-_):W}var P=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 U=W.prototype;return U.uint8ArrayToUint32Array_=function(A){for(var d=new DataView(A),p=new Uint32Array(4),T=0;T<4;T++)p[T]=d.getUint32(T*4);return p},U.initTable=function(){var A=this.sBox,d=this.invSBox,p=this.subMix,T=p[0],m=p[1],f=p[2],y=p[3],a=this.invSubMix,i=a[0],s=a[1],l=a[2],E=a[3],g=new Uint32Array(256),v=0,k=0,w=0;for(w=0;w<256;w++)w<128?g[w]=w<<1:g[w]=w<<1^283;for(w=0;w<256;w++){var x=k^k<<1^k<<2^k<<3^k<<4;x=x>>>8^x&255^99,A[v]=x,d[x]=v;var b=g[v],h=g[b],u=g[h],L=g[x]*257^x*16843008;T[v]=L<<24|L>>>8,m[v]=L<<16|L>>>16,f[v]=L<<8|L>>>24,y[v]=L,L=u*16843009^h*65537^b*257^v*16843008,i[x]=L<<24|L>>>8,s[x]=L<<16|L>>>16,l[x]=L<<8|L>>>24,E[x]=L,v?(v=b^g[g[g[u^b]]],k^=g[g[k]]):v=k=1}},U.expandKey=function(A){for(var d=this.uint8ArrayToUint32Array_(A),p=!0,T=0;T<d.length&&p;)p=d[T]===this.key[T],T++;if(p)return;this.key=d;var m=this.keySize=d.length;if(m!==4&&m!==6&&m!==8)throw new Error("Invalid aes key size="+m);var f=this.ksRows=(m+6+1)*4,y,a,i=this.keySchedule=new Uint32Array(f),s=this.invKeySchedule=new Uint32Array(f),l=this.sBox,E=this.rcon,g=this.invSubMix,v=g[0],k=g[1],w=g[2],x=g[3],b,h;for(y=0;y<f;y++){if(y<m){b=i[y]=d[y];continue}h=b,y%m===0?(h=h<<8|h>>>24,h=l[h>>>24]<<24|l[h>>>16&255]<<16|l[h>>>8&255]<<8|l[h&255],h^=E[y/m|0]<<24):m>6&&y%m===4&&(h=l[h>>>24]<<24|l[h>>>16&255]<<16|l[h>>>8&255]<<8|l[h&255]),i[y]=b=(i[y-m]^h)>>>0}for(a=0;a<f;a++)y=f-a,a&3?h=i[y]:h=i[y-4],a<4||y<=4?s[a]=h:s[a]=v[l[h>>>24]]^k[l[h>>>16&255]]^w[l[h>>>8&255]]^x[l[h&255]],s[a]=s[a]>>>0},U.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},U.decrypt=function(A,d,p){for(var T=this.keySize+6,m=this.invKeySchedule,f=this.invSBox,y=this.invSubMix,a=y[0],i=y[1],s=y[2],l=y[3],E=this.uint8ArrayToUint32Array_(p),g=E[0],v=E[1],k=E[2],w=E[3],x=new Int32Array(A),b=new Int32Array(x.length),h,u,L,S,D,I,B,j,G,M,N,Y,ee,le,fe=this.networkToHostOrderSwap;d<x.length;){for(G=fe(x[d]),M=fe(x[d+1]),N=fe(x[d+2]),Y=fe(x[d+3]),D=G^m[0],I=Y^m[1],B=N^m[2],j=M^m[3],ee=4,le=1;le<T;le++)h=a[D>>>24]^i[I>>16&255]^s[B>>8&255]^l[j&255]^m[ee],u=a[I>>>24]^i[B>>16&255]^s[j>>8&255]^l[D&255]^m[ee+1],L=a[B>>>24]^i[j>>16&255]^s[D>>8&255]^l[I&255]^m[ee+2],S=a[j>>>24]^i[D>>16&255]^s[I>>8&255]^l[B&255]^m[ee+3],D=h,I=u,B=L,j=S,ee=ee+4;h=f[D>>>24]<<24^f[I>>16&255]<<16^f[B>>8&255]<<8^f[j&255]^m[ee],u=f[I>>>24]<<24^f[B>>16&255]<<16^f[j>>8&255]<<8^f[D&255]^m[ee+1],L=f[B>>>24]<<24^f[j>>16&255]<<16^f[D>>8&255]<<8^f[I&255]^m[ee+2],S=f[j>>>24]<<24^f[D>>16&255]<<16^f[I>>8&255]<<8^f[B&255]^m[ee+3],b[d]=fe(h^g),b[d+1]=fe(S^v),b[d+2]=fe(L^k),b[d+3]=fe(u^w),g=G,v=M,k=N,w=Y,d=d+4}return b.buffer},W}()},"./src/crypt/decrypter.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return d});var X=O("./src/crypt/aes-crypto.ts"),F=O("./src/crypt/fast-aes-key.ts"),P=O("./src/crypt/aes-decryptor.ts"),W=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),_=O("./src/utils/typed-array.ts"),A=16,d=function(){function p(m,f,y){var a=y===void 0?{}:y,i=a.removePKCS7Padding,s=i===void 0?!0:i;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=m,this.config=f,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var T=p.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var f=this.currentResult;if(!f){this.reset();return}var y=new Uint8Array(f);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(y):y},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(f,y,a,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(f),y,a);var s=this.flush();s&&i(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(f),y,a).then(i)},T.softwareDecrypt=function(f,y,a){var i=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(f=Object(U.appendUint8Array)(l,f),this.remainderData=null);var E=this.getValidChunk(f);if(!E.length)return null;i&&(a=i);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(y);var v=s;return this.currentResult=g.decrypt(E.buffer,0,a),this.currentIV=Object(_.sliceUint8)(E,-16).buffer,v||null},T.webCryptoDecrypt=function(f,y,a){var i=this,s=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new F.default(s,y)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var E=new X.default(s,a);return E.decrypt(f.buffer,l)}).catch(function(l){return i.onWebCryptoError(l,f,y,a)})},T.onWebCryptoError=function(f,y,a,i){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",f),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,a,i)},T.getValidChunk=function(f){var y=f,a=f.length-f.length%A;return a!==f.length&&(y=Object(_.sliceUint8)(f,0,a),this.remainderData=Object(_.sliceUint8)(f,a)),y},T.logOnce=function(f){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+f),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return X});var X=function(){function F(W,U){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=U}var P=F.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/adts.ts"),P=O("./src/utils/logger.ts"),W=O("./src/demux/id3.ts");function U(d,p){d.prototype=Object.create(p.prototype),d.prototype.constructor=d,_(d,p)}function _(d,p){return _=Object.setPrototypeOf||function(m,f){return m.__proto__=f,m},_(d,p)}var A=function(d){U(p,d);function p(m,f){var y;return y=d.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=m,y.config=f,y}var T=p.prototype;return T.resetInitSegment=function(f,y,a){d.prototype.resetInitSegment.call(this,f,y,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:f,duration:a,inputTimeScale:9e4,dropped:0}},p.probe=function(f){if(!f)return!1;for(var y=W.getID3Data(f,0)||[],a=y.length,i=f.length;a<i;a++)if(F.probe(f,a))return P.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(f,y){return F.canParse(f,y)},T.appendFrame=function(f,y,a){F.initTrackConfig(f,this.observer,y,a,f.manifestCodec);var i=F.appendFrame(f,y,a,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},p}(X.default);A.minProbeByteLength=9,J.default=A},"./src/demux/adts.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"getAudioConfig",function(){return W}),O.d(J,"isHeaderPattern",function(){return U}),O.d(J,"getHeaderLength",function(){return _}),O.d(J,"getFullFrameLength",function(){return A}),O.d(J,"canGetFrameLength",function(){return d}),O.d(J,"isHeader",function(){return p}),O.d(J,"canParse",function(){return T}),O.d(J,"probe",function(){return m}),O.d(J,"initTrackConfig",function(){return f}),O.d(J,"getFrameDuration",function(){return y}),O.d(J,"parseFrameHeader",function(){return a}),O.d(J,"appendFrame",function(){return i});var X=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),P=O("./src/events.ts");function W(s,l,E,g){var v,k,w,x,b=navigator.userAgent.toLowerCase(),h=g,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((l[E+2]&192)>>>6)+1;var L=(l[E+2]&60)>>>2;if(L>u.length-1){s.trigger(P.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+L});return}return w=(l[E+2]&1)<<2,w|=(l[E+3]&192)>>>6,X.logger.log("manifest codec:"+g+", ADTS type:"+v+", samplingIndex:"+L),/firefox/i.test(b)?L>=6?(v=5,x=new Array(4),k=L-3):(v=2,x=new Array(2),k=L):b.indexOf("android")!==-1?(v=2,x=new Array(2),k=L):(v=5,x=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&L>=6?k=L-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(L>=6&&w===1||/vivaldi/i.test(b))||!g&&w===1)&&(v=2,x=new Array(2)),k=L)),x[0]=v<<3,x[0]|=(L&14)>>1,x[1]|=(L&1)<<7,x[1]|=w<<3,v===5&&(x[1]|=(k&14)>>1,x[2]=(k&1)<<7,x[2]|=2<<2,x[3]=0),{config:x,samplerate:u[L],channelCount:w,codec:"mp4a.40."+v,manifestCodec:h}}function U(s,l){return s[l]===255&&(s[l+1]&246)===240}function _(s,l){return s[l+1]&1?7:9}function A(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function d(s,l){return l+5<s.length}function p(s,l){return l+1<s.length&&U(s,l)}function T(s,l){return d(s,l)&&U(s,l)&&A(s,l)<=s.length-l}function m(s,l){if(p(s,l)){var E=_(s,l);if(l+E>=s.length)return!1;var g=A(s,l);if(g<=E)return!1;var v=l+g;return v===s.length||p(s,v)}return!1}function f(s,l,E,g,v){if(!s.samplerate){var k=W(l,E,g,v);if(!k)return;s.config=k.config,s.samplerate=k.samplerate,s.channelCount=k.channelCount,s.codec=k.codec,s.manifestCodec=k.manifestCodec,X.logger.log("parsed codec:"+s.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function y(s){return 1024*9e4/s}function a(s,l,E,g,v){var k=_(s,l),w=A(s,l);if(w-=k,w>0){var x=E+g*v;return{headerLength:k,frameLength:w,stamp:x}}}function i(s,l,E,g,v){var k=y(s.samplerate),w=a(l,E,g,v,k);if(w){var x=w.frameLength,b=w.headerLength,h=w.stamp,u=b+x,L=Math.max(0,E+u-l.length),S;L?(S=new Uint8Array(u-b),S.set(l.subarray(E+b,l.length),0)):S=l.subarray(E+b,E+u);var D={unit:S,pts:h};return L||s.samples.push(D),{sample:D,length:u,missing:L}}}},"./src/demux/base-audio-demuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"initPTSFn",function(){return A});var X=O("./src/polyfills/number.ts"),F=O("./src/demux/id3.ts"),P=O("./src/demux/dummy-demuxed-track.ts"),W=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/typed-array.ts"),_=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=d.prototype;return p.resetInitSegment=function(m,f,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(m,f){return!1},p.appendFrame=function(m,f,y){},p.demux=function(m,f){this.cachedData&&(m=Object(W.appendUint8Array)(this.cachedData,m),this.cachedData=null);var y=F.getID3Data(m,0),a=y?y.length:0,i,s,l=this._audioTrack,E=this._id3Track,g=y?F.getTimeStamp(y):void 0,v=m.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(g,f)),y&&y.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),s=this.initPTS;a<v;){if(this.canParse(m,a)){var k=this.appendFrame(l,m,a);k?(this.frameIndex++,s=k.sample.pts,a+=k.length,i=a):a=v}else F.canParse(m,a)?(y=F.getID3Data(m,a),E.samples.push({pts:s,dts:s,data:y}),a+=y.length,i=a):a++;if(a===v&&i!==v){var w=Object(U.sliceUint8)(m,i);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,w):this.cachedData=w}}return{audioTrack:l,avcTrack:Object(P.dummyTrack)(),id3Track:E,textTrack:Object(P.dummyTrack)()}},p.demuxSampleAes=function(m,f,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(m){var f=this.cachedData;return f&&(this.cachedData=null,this.demux(f,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},p.destroy=function(){},d}(),A=function(p,T){return Object(X.isFiniteNumber)(p)?p*90:T*9e4};J.default=_},"./src/demux/chunk-cache.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return X});var X=function(){function P(){this.chunks=[],this.dataLength=0}var W=P.prototype;return W.push=function(_){this.chunks.push(_),this.dataLength+=_.length},W.flush=function(){var _=this.chunks,A=this.dataLength,d;if(_.length)_.length===1?d=_[0]:d=F(_,A);else return new Uint8Array(0);return this.reset(),d},W.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function F(P,W){for(var U=new Uint8Array(W),_=0,A=0;A<P.length;A++){var d=P[A];U.set(d,_),_+=d.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"dummyTrack",function(){return X});function X(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/logger.ts"),F=function(){function P(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var W=P.prototype;return W.loadWord=function(){var _=this.data,A=this.bytesAvailable,d=_.byteLength-A,p=new Uint8Array(4),T=Math.min(4,A);if(T===0)throw new Error("no bytes available");p.set(_.subarray(d,d+T)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},W.skipBits=function(_){var A;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,A=_>>3,_-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},W.readBits=function(_){var A=Math.min(this.bitsAvailable,_),d=this.word>>>32-A;return _>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=_-A,A>0&&this.bitsAvailable?d<<A|this.readBits(A):d},W.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},W.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>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(_){for(var A=8,d=8,p,T=0;T<_;T++)d!==0&&(p=this.readEG(),d=(A+p+256)%256),A=d===0?A:d},W.readSPS=function(){var _=0,A=0,d=0,p=0,T,m,f,y=this.readUByte.bind(this),a=this.readBits.bind(this),i=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),E=this.skipEG.bind(this),g=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);y();var k=y();if(a(5),l(3),y(),g(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var w=i();if(w===3&&l(1),g(),g(),l(1),s())for(m=w!==3?8:12,f=0;f<m;f++)s()&&(f<6?v(16):v(64))}g();var x=i();if(x===0)i();else if(x===1)for(l(1),E(),E(),T=i(),f=0;f<T;f++)E();g(),l(1);var b=i(),h=i(),u=a(1);u===0&&l(1),l(1),s()&&(_=i(),A=i(),d=i(),p=i());var L=[1,1];if(s()&&s()){var S=y();switch(S){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:{L=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((b+1)*16-_*2-A*2),height:(2-u)*(h+1)*16-(u?2:4)*(d+p),pixelRatio:L}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();J.default=F},"./src/demux/id3.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isHeader",function(){return X}),O.d(J,"isFooter",function(){return F}),O.d(J,"getID3Data",function(){return P}),O.d(J,"canParse",function(){return U}),O.d(J,"getTimeStamp",function(){return _}),O.d(J,"isTimeStampFrame",function(){return A}),O.d(J,"getID3Frames",function(){return p}),O.d(J,"decodeFrame",function(){return T}),O.d(J,"utf8ArrayToStr",function(){return i}),O.d(J,"testables",function(){return s});var X=function(v,k){return k+10<=v.length&&(v[k]===73&&v[k+1]===68&&v[k+2]===51&&(v[k+3]<255&&v[k+4]<255&&(v[k+6]<128&&v[k+7]<128&&v[k+8]<128&&v[k+9]<128)))},F=function(v,k){return k+10<=v.length&&(v[k]===51&&v[k+1]===68&&v[k+2]===73&&(v[k+3]<255&&v[k+4]<255&&(v[k+6]<128&&v[k+7]<128&&v[k+8]<128&&v[k+9]<128)))},P=function(v,k){for(var w=k,x=0;X(v,k);){x+=10;var b=W(v,k+6);x+=b,F(v,k+10)&&(x+=10),k+=x}return x>0?v.subarray(w,w+x):void 0},W=function(v,k){var w=0;return w=(v[k]&127)<<21,w|=(v[k+1]&127)<<14,w|=(v[k+2]&127)<<7,w|=v[k+3]&127,w},U=function(v,k){return X(v,k)&&W(v,k+6)+10<=v.length-k},_=function(v){for(var k=p(v),w=0;w<k.length;w++){var x=k[w];if(A(x))return a(x)}return},A=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},d=function(v){var k=String.fromCharCode(v[0],v[1],v[2],v[3]),w=W(v,4),x=10;return{type:k,size:w,data:v.subarray(x,x+w)}},p=function(v){for(var k=0,w=[];X(v,k);){var x=W(v,k+6);k+=10;for(var b=k+x;k+8<b;){var h=d(v.subarray(k)),u=T(h);u&&w.push(u),k+=h.size+10}F(v,k)&&(k+=10)}return w},T=function(v){return v.type==="PRIV"?m(v):v.type[0]==="W"?y(v):f(v)},m=function(v){if(v.size<2)return;var k=i(v.data,!0),w=new Uint8Array(v.data.subarray(k.length+1));return{key:v.type,info:k,data:w.buffer}},f=function(v){if(v.size<2)return;if(v.type==="TXXX"){var k=1,w=i(v.data.subarray(k),!0);k+=w.length+1;var x=i(v.data.subarray(k));return{key:v.type,info:w,data:x}}var b=i(v.data.subarray(1));return{key:v.type,data:b}},y=function(v){if(v.type==="WXXX"){if(v.size<2)return;var k=1,w=i(v.data.subarray(k),!0);k+=w.length+1;var x=i(v.data.subarray(k));return{key:v.type,info:w,data:x}}var b=i(v.data);return{key:v.type,data:b}},a=function(v){if(v.data.byteLength===8){var k=new Uint8Array(v.data),w=k[3]&1,x=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return x/=45,w&&(x+=4772185884e-2),Math.round(x)}return},i=function(v,k){k===void 0&&(k=!1);var w=E();if(w){var x=w.decode(v);if(k){var b=x.indexOf("\0");return b!==-1?x.substring(0,b):x}return x.replace(/\0/g,"")}for(var h=v.length,u,L,S,D="",I=0;I<h;){if(u=v[I++],u===0&&k)return D;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:D+=String.fromCharCode(u);break;case 12:case 13:L=v[I++],D+=String.fromCharCode((u&31)<<6|L&63);break;case 14:L=v[I++],S=v[I++],D+=String.fromCharCode((u&15)<<12|(L&63)<<6|(S&63)<<0);break;default:}}return D},s={decodeTextFrame:f},l;function E(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/id3.ts"),P=O("./src/utils/logger.ts"),W=O("./src/demux/mpegaudio.ts");function U(d,p){d.prototype=Object.create(p.prototype),d.prototype.constructor=d,_(d,p)}function _(d,p){return _=Object.setPrototypeOf||function(m,f){return m.__proto__=f,m},_(d,p)}var A=function(d){U(p,d);function p(){return d.apply(this,arguments)||this}var T=p.prototype;return T.resetInitSegment=function(f,y,a){d.prototype.resetInitSegment.call(this,f,y,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:f,duration:a,inputTimeScale:9e4,dropped:0}},p.probe=function(f){if(!f)return!1;for(var y=F.getID3Data(f,0)||[],a=y.length,i=f.length;a<i;a++)if(W.probe(f,a))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(f,y){return W.canParse(f,y)},T.appendFrame=function(f,y,a){return this.initPTS===null?void 0:W.appendFrame(f,y,a,this.initPTS,this.frameIndex)},p}(X.default);A.minProbeByteLength=4,J.default=A},"./src/demux/mp4demuxer.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/mp4-tools.ts"),F=O("./src/demux/dummy-demuxed-track.ts"),P=function(){function W(_,A){this.remainderData=null,this.config=void 0,this.config=A}var U=W.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},W.probe=function(A){return Object(X.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},U.demux=function(A){var d=A,p=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(X.appendUint8Array)(this.remainderData,A));var T=Object(X.segmentValidRange)(d);this.remainderData=T.remainder,p.samples=T.valid||new Uint8Array}else p.samples=d;return{audioTrack:Object(F.dummyTrack)(),avcTrack:p,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},U.flush=function(){var A=Object(F.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:A,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},U.demuxSampleAes=function(A,d,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},W}();P.minProbeByteLength=1024,J.default=P},"./src/demux/mpegaudio.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"appendFrame",function(){return _}),O.d(J,"parseHeader",function(){return A}),O.d(J,"isHeaderPattern",function(){return d}),O.d(J,"isHeader",function(){return p}),O.d(J,"canParse",function(){return T}),O.d(J,"probe",function(){return m});var X=null,F=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[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]],U=[0,1,1,4];function _(f,y,a,i,s){if(a+24>y.length)return;var l=A(y,a);if(l&&a+l.frameLength<=y.length){var E=l.samplesPerFrame*9e4/l.sampleRate,g=i+s*E,v={unit:y.subarray(a,a+l.frameLength),pts:g,dts:g};return f.config=[],f.channelCount=l.channelCount,f.samplerate=l.sampleRate,f.samples.push(v),{sample:v,length:l.frameLength,missing:0}}}function A(f,y){var a=f[y+1]>>3&3,i=f[y+1]>>1&3,s=f[y+2]>>4&15,l=f[y+2]>>2&3;if(a!==1&&s!==0&&s!==15&&l!==3){var E=f[y+2]>>1&1,g=f[y+3]>>6,v=a===3?3-i:i===3?3:4,k=F[v*14+s-1]*1e3,w=a===3?0:a===2?1:2,x=P[w*3+l],b=g===3?1:2,h=W[a][i],u=U[i],L=h*8*u,S=Math.floor(h*k/x+E)*u;if(X===null){var D=navigator.userAgent||"",I=D.match(/Chrome\/(\d+)/i);X=I?parseInt(I[1]):0}var B=!!X&&X<=87;return B&&i===2&&k>=224e3&&g===0&&(f[y+3]=f[y+3]|128),{sampleRate:x,channelCount:b,frameLength:S,samplesPerFrame:L}}}function d(f,y){return f[y]===255&&(f[y+1]&224)===224&&(f[y+1]&6)!==0}function p(f,y){return y+1<f.length&&d(f,y)}function T(f,y){var a=4;return d(f,y)&&a<=f.length-y}function m(f,y){if(y+1<f.length&&d(f,y)){var a=4,i=A(f,y),s=a;i!=null&&i.frameLength&&(s=i.frameLength);var l=y+s;return l===f.length||p(f,l)}return!1}},"./src/demux/sample-aes.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/crypt/decrypter.ts"),F=O("./src/demux/tsdemuxer.ts"),P=function(){function W(_,A,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new X.default(_,A,{removePKCS7Padding:!1})}var U=W.prototype;return U.decryptBuffer=function(A,d){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,d)},U.decryptAacSample=function(A,d,p,T){var m=A[d].unit,f=m.subarray(16,m.length-m.length%16),y=f.buffer.slice(f.byteOffset,f.byteOffset+f.length),a=this;this.decryptBuffer(y,function(i){var s=new Uint8Array(i);m.set(s,16),T||a.decryptAacSamples(A,d+1,p)})},U.decryptAacSamples=function(A,d,p){for(;;d++){if(d>=A.length){p();return}if(A[d].unit.length<32)continue;var T=this.decrypter.isSync();if(this.decryptAacSample(A,d,p,T),!T)return}},U.getAvcEncryptedData=function(A){for(var d=Math.floor((A.length-48)/160)*16+16,p=new Int8Array(d),T=0,m=32;m<=A.length-16;m+=160,T+=16)p.set(A.subarray(m,m+16),T);return p},U.getAvcDecryptedUnit=function(A,d){for(var p=new Uint8Array(d),T=0,m=32;m<=A.length-16;m+=160,T+=16)A.set(p.subarray(T,T+16),m);return A},U.decryptAvcSample=function(A,d,p,T,m,f){var y=Object(F.discardEPB)(m.data),a=this.getAvcEncryptedData(y),i=this;this.decryptBuffer(a.buffer,function(s){m.data=i.getAvcDecryptedUnit(y,s),f||i.decryptAvcSamples(A,d,p+1,T)})},U.decryptAvcSamples=function(A,d,p,T){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,p=0){if(d>=A.length){T();return}for(var m=A[d].units;!(p>=m.length);p++){var f=m[p];if(f.data.length<=48||f.type!==1&&f.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(A,d,p,T,f,y),!y)return}}},W}();J.default=P},"./src/demux/transmuxer-interface.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return m});var X=O("./node_modules/webworkify-webpack/index.js"),F=O.n(X),P=O("./src/events.ts"),W=O("./src/demux/transmuxer.ts"),U=O("./src/utils/logger.ts"),_=O("./src/errors.ts"),A=O("./src/utils/mediasource-helper.ts"),d=O("./node_modules/eventemitter3/index.js"),p=O.n(d),T=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},m=function(){function f(a,i,s,l){var E=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=a,this.id=i,this.onTransmuxComplete=s,this.onFlush=l;var g=a.config,v=function(h,u){u=u||{},u.frag=E.frag,u.id=E.id,a.trigger(h,u)};this.observer=new d.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,v),this.observer.on(P.Events.ERROR,v);var k={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var x;try{x=this.worker=X("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),x.addEventListener("message",this.onwmsg),x.onerror=function(b){a.trigger(P.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(b.message+" ("+b.filename+":"+b.lineno+")")})},x.postMessage({cmd:"init",typeSupported:k,vendor:w,id:i,config:JSON.stringify(g)})}catch(b){U.logger.warn("Error in worker:",b),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),x&&self.URL.revokeObjectURL(x.objectURL),this.transmuxer=new W.default(this.observer,k,g,w,i),this.worker=null}}else this.transmuxer=new W.default(this.observer,k,g,w,i)}var y=f.prototype;return y.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},y.push=function(i,s,l,E,g,v,k,w,x,b){var h=this;x.transmuxing.start=self.performance.now();var u=this.transmuxer,L=this.worker,S=v?v.start:g.start,D=g.decryptdata,I=this.frag,B=!(I&&g.cc===I.cc),j=!(I&&x.level===I.level),G=I?x.sn-I.sn:-1,M=this.part?x.part-this.part.index:1,N=!j&&(G===1||G===0&&M===1),Y=self.performance.now();(j||G||g.stats.parsing.start===0)&&(g.stats.parsing.start=Y),v&&(M||!N)&&(v.stats.parsing.start=Y);var ee=new W.TransmuxState(B,N,w,j,S);if(!N||B){U.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+x.sn+" p: "+x.part+" level: "+x.level+" id: "+x.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+w+`
|
|
timeOffset: `+S);var le=new W.TransmuxConfig(l,E,s,k,b);this.configureTransmuxer(le)}if(this.frag=g,this.part=v,L)L.postMessage({cmd:"demux",data:i,decryptdata:D,chunkMeta:x,state:ee},i instanceof ArrayBuffer?[i]:[]);else if(u){var fe=u.push(i,D,x,ee);Object(W.isPromise)(fe)?fe.then(function(Pe){h.handleTransmuxComplete(Pe)}):this.handleTransmuxComplete(fe)}},y.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:i});else if(l){var g=l.flush(i);Object(W.isPromise)(g)?g.then(function(v){s.handleFlushResult(v,i)}):this.handleFlushResult(g,i)}},y.handleFlushResult=function(i,s){var l=this;i.forEach(function(E){l.handleTransmuxComplete(E)}),this.onFlush(s)},y.onWorkerMessage=function(i){var s=i.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},y.configureTransmuxer=function(i){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:i}):l&&l.configure(i)},y.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},f}()},"./src/demux/transmuxer-worker.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return _});var X=O("./src/demux/transmuxer.ts"),F=O("./src/events.ts"),P=O("./src/utils/logger.ts"),W=O("./node_modules/eventemitter3/index.js"),U=O.n(W);function _(m){var f=new W.EventEmitter,y=function(i,s){m.postMessage({event:i,data:s})};f.on(F.Events.FRAG_DECRYPTED,y),f.on(F.Events.ERROR,y),m.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);m.transmuxer=new X.default(f,i.typeSupported,s,i.vendor,i.id),Object(P.enableLogs)(s.debug),y("init",null);break}case"configure":{m.transmuxer.configure(i.config);break}case"demux":{var l=m.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(X.isPromise)(l)?l.then(function(v){A(m,v)}):A(m,l);break}case"flush":{var E=i.chunkMeta,g=m.transmuxer.flush(E);Object(X.isPromise)(g)?g.then(function(v){p(m,v,E)}):p(m,g,E);break}default:break}})}function A(m,f){if(T(f.remuxResult))return;var y=[],a=f.remuxResult,i=a.audio,s=a.video;i&&d(y,i),s&&d(y,s),m.postMessage({event:"transmuxComplete",data:f},y)}function d(m,f){f.data1&&m.push(f.data1.buffer),f.data2&&m.push(f.data2.buffer)}function p(m,f,y){f.forEach(function(a){A(m,a)}),m.postMessage({event:"flush",data:y})}function T(m){return!m.audio&&!m.video&&!m.text&&!m.id3&&!m.initSegment}},"./src/demux/transmuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s}),O.d(J,"isPromise",function(){return g}),O.d(J,"TransmuxConfig",function(){return v}),O.d(J,"TransmuxState",function(){return k});var X=O("./src/events.ts"),F=O("./src/errors.ts"),P=O("./src/crypt/decrypter.ts"),W=O("./src/demux/aacdemuxer.ts"),U=O("./src/demux/mp4demuxer.ts"),_=O("./src/demux/tsdemuxer.ts"),A=O("./src/demux/mp3demuxer.ts"),d=O("./src/remux/mp4-remuxer.ts"),p=O("./src/remux/passthrough-remuxer.ts"),T=O("./src/demux/chunk-cache.ts"),m=O("./src/utils/mp4-tools.ts"),f=O("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(w){f.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var a=[{demux:_.default,remux:d.default},{demux:U.default,remux:p.default},{demux:W.default,remux:d.default},{demux:A.default,remux:d.default}],i=1024;a.forEach(function(w){var x=w.demux;i=Math.max(i,x.minProbeByteLength)});var s=function(){function w(b,h,u,L,S){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new T.default,this.observer=b,this.typeSupported=h,this.config=u,this.vendor=L,this.id=S}var x=w.prototype;return x.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},x.push=function(h,u,L,S){var D=this,I=L.transmuxing;I.executeStart=y();var B=new Uint8Array(h),j=this.cache,G=this.config,M=this.currentTransmuxState,N=this.transmuxConfig;S&&(this.currentTransmuxState=S);var Y=l(B,u);if(Y&&Y.method==="AES-128"){var ee=this.getDecrypter();if(G.enableSoftwareAES){var le=ee.softwareDecrypt(B,Y.key.buffer,Y.iv.buffer);if(!le)return I.executeEnd=y(),E(L);B=new Uint8Array(le)}else return this.decryptionPromise=ee.webCryptoDecrypt(B,Y.key.buffer,Y.iv.buffer).then(function(ge){var we=D.push(ge,null,L);return D.decryptionPromise=null,we}),this.decryptionPromise}var fe=S||M,Pe=fe.contiguous,Se=fe.discontinuity,De=fe.trackSwitch,Le=fe.accurateTimeOffset,Ae=fe.timeOffset,me=N.audioCodec,de=N.videoCodec,re=N.defaultInitPts,he=N.duration,ie=N.initSegmentData;if((Se||De)&&this.resetInitSegment(ie,me,de,he),Se&&this.resetInitialTimestamp(re),Pe||this.resetContiguity(),this.needsProbing(B,Se,De)){if(j.dataLength){var Re=j.flush();B=Object(m.appendUint8Array)(Re,B)}this.configureTransmuxer(B,N)}var oe=this.transmux(B,Y,Ae,Le,L),ae=this.currentTransmuxState;return ae.contiguous=!0,ae.discontinuity=!1,ae.trackSwitch=!1,I.executeEnd=y(),oe},x.flush=function(h){var u=this,L=h.transmuxing;L.executeStart=y();var S=this.decrypter,D=this.cache,I=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return u.flush(h)});var j=[],G=I.timeOffset;if(S){var M=S.flush();M&&j.push(this.push(M,null,h))}var N=D.dataLength;D.reset();var Y=this.demuxer,ee=this.remuxer;if(!Y||!ee)return N>=i&&this.observer.emit(X.Events.ERROR,X.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),L.executeEnd=y(),[E(h)];var le=Y.flush(G);return g(le)?le.then(function(fe){return u.flushRemux(j,fe,h),j}):(this.flushRemux(j,le,h),j)},x.flushRemux=function(h,u,L){var S=u.audioTrack,D=u.avcTrack,I=u.id3Track,B=u.textTrack,j=this.currentTransmuxState,G=j.accurateTimeOffset,M=j.timeOffset;f.logger.log("[transmuxer.ts]: Flushed fragment "+L.sn+(L.part>-1?" p: "+L.part:"")+" of level "+L.level);var N=this.remuxer.remux(S,D,I,B,M,G,!0,this.id);h.push({remuxResult:N,chunkMeta:L}),L.transmuxing.executeEnd=y()},x.resetInitialTimestamp=function(h){var u=this.demuxer,L=this.remuxer;if(!u||!L)return;u.resetTimeStamp(h),L.resetTimeStamp(h)},x.resetContiguity=function(){var h=this.demuxer,u=this.remuxer;if(!h||!u)return;h.resetContiguity(),u.resetNextTimestamp()},x.resetInitSegment=function(h,u,L,S){var D=this.demuxer,I=this.remuxer;if(!D||!I)return;D.resetInitSegment(u,L,S),I.resetInitSegment(h,u,L)},x.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},x.transmux=function(h,u,L,S,D){var I;return u&&u.method==="SAMPLE-AES"?I=this.transmuxSampleAes(h,u,L,S,D):I=this.transmuxUnencrypted(h,L,S,D),I},x.transmuxUnencrypted=function(h,u,L,S){var D=this.demuxer.demux(h,u,!1,!this.config.progressive),I=D.audioTrack,B=D.avcTrack,j=D.id3Track,G=D.textTrack,M=this.remuxer.remux(I,B,j,G,u,L,!1,this.id);return{remuxResult:M,chunkMeta:S}},x.transmuxSampleAes=function(h,u,L,S,D){var I=this;return this.demuxer.demuxSampleAes(h,u,L).then(function(B){var j=I.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,L,S,!1,I.id);return{remuxResult:j,chunkMeta:D}})},x.configureTransmuxer=function(h,u){for(var L=this.config,S=this.observer,D=this.typeSupported,I=this.vendor,B=u.audioCodec,j=u.defaultInitPts,G=u.duration,M=u.initSegmentData,N=u.videoCodec,Y,ee=0,le=a.length;ee<le;ee++)if(a[ee].demux.probe(h)){Y=a[ee];break}Y||(f.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:U.default,remux:p.default});var fe=this.demuxer,Pe=this.remuxer,Se=Y.remux,De=Y.demux;(!Pe||!(Pe instanceof Se))&&(this.remuxer=new Se(S,L,D,I)),(!fe||!(fe instanceof De))&&(this.demuxer=new De(S,L,D),this.probe=De.probe),this.resetInitSegment(M,B,N,G),this.resetInitialTimestamp(j)},x.needsProbing=function(h,u,L){return!this.demuxer||!this.remuxer||u||L},x.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new P.default(this.observer,this.config)),h},w}();function l(w,x){var b=null;return w.byteLength>0&&x!=null&&x.key!=null&&x.iv!==null&&x.method!=null&&(b=x),b}var E=function(x){return{remuxResult:{},chunkMeta:x}};function g(w){return"then"in w&&w.then instanceof Function}var v=function(x,b,h,u,L){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=x,this.videoCodec=b,this.initSegmentData=h,this.duration=u,this.defaultInitPts=L},k=function(x,b,h,u,L){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=x,this.contiguous=b,this.accurateTimeOffset=h,this.trackSwitch=u,this.timeOffset=L}},"./src/demux/tsdemuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"discardEPB",function(){return E});var X=O("./src/demux/adts.ts"),F=O("./src/demux/mpegaudio.ts"),P=O("./src/demux/exp-golomb.ts"),W=O("./src/demux/id3.ts"),U=O("./src/demux/sample-aes.ts"),_=O("./src/events.ts"),A=O("./src/utils/mp4-tools.ts"),d=O("./src/utils/logger.ts"),p=O("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},m=function(){function g(k,w,x){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=k,this.config=w,this.typeSupported=x}g.probe=function(w){var x=g.syncOffset(w);return x<0?!1:(x&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+x+", junk ahead ?"),!0)},g.syncOffset=function(w){for(var x=Math.min(1e3,w.length-3*188),b=0;b<x;){if(w[b]===71&&w[b+188]===71&&w[b+2*188]===71)return b;b++}return-1},g.createTrack=function(w,x){return{container:w==="video"||w==="audio"?"video/mp2t":void 0,type:w,id:T[w],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:w==="audio"?x:void 0}};var v=g.prototype;return v.resetInitSegment=function(w,x,b){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",b),this._audioTrack=g.createTrack("audio",b),this._id3Track=g.createTrack("id3",b),this._txtTrack=g.createTrack("text",b),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=w,this.videoCodec=x,this._duration=b},v.resetTimeStamp=function(){},v.resetContiguity=function(){var w=this._audioTrack,x=this._avcTrack,b=this._id3Track;w&&(w.pesData=null),x&&(x.pesData=null),b&&(b.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(w,x,b,h){b===void 0&&(b=!1),h===void 0&&(h=!1),b||(this.sampleAes=null);var u,L=this._avcTrack,S=this._audioTrack,D=this._id3Track,I=L.pid,B=L.pesData,j=S.pid,G=D.pid,M=S.pesData,N=D.pesData,Y=!1,ee=this.pmtParsed,le=this._pmtId,fe=w.length;if(this.remainderData&&(w=Object(A.appendUint8Array)(this.remainderData,w),fe=w.length,this.remainderData=null),fe<188&&!h)return this.remainderData=w,{audioTrack:S,avcTrack:L,id3Track:D,textTrack:this._txtTrack};var Pe=Math.max(0,g.syncOffset(w));fe-=(fe+Pe)%188,fe<w.byteLength&&!h&&(this.remainderData=new Uint8Array(w.buffer,fe,w.buffer.byteLength-fe));for(var Se=Pe;Se<fe;Se+=188)if(w[Se]===71){var De=!!(w[Se+1]&64),Le=((w[Se+1]&31)<<8)+w[Se+2],Ae=(w[Se+3]&48)>>4,me=void 0;if(Ae>1){if(me=Se+5+w[Se+4],me===Se+188)continue}else me=Se+4;switch(Le){case I:De&&(B&&(u=i(B))&&this.parseAVCPES(u,!1),B={data:[],size:0}),B&&(B.data.push(w.subarray(me,Se+188)),B.size+=Se+188-me);break;case j:De&&(M&&(u=i(M))&&(S.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),M={data:[],size:0}),M&&(M.data.push(w.subarray(me,Se+188)),M.size+=Se+188-me);break;case G:De&&(N&&(u=i(N))&&this.parseID3PES(u),N={data:[],size:0}),N&&(N.data.push(w.subarray(me,Se+188)),N.size+=Se+188-me);break;case 0:De&&(me+=w[me]+1),le=this._pmtId=y(w,me);break;case le:{De&&(me+=w[me]+1);var de=a(w,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,b);I=de.avc,I>0&&(L.pid=I),j=de.audio,j>0&&(S.pid=j,S.isAAC=de.isAAC),G=de.id3,G>0&&(D.pid=G),Y&&!ee&&(d.logger.log("reparse from beginning"),Y=!1,Se=Pe-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});L.pesData=B,S.pesData=M,D.pesData=N;var re={audioTrack:S,avcTrack:L,id3Track:D,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(re),re},v.flush=function(){var w=this.remainderData;this.remainderData=null;var x;return w?x=this.demux(w,-1,!1,!0):x={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(x),this.sampleAes?this.decrypt(x,this.sampleAes):x},v.extractRemainingSamples=function(w){var x=w.audioTrack,b=w.avcTrack,h=w.id3Track,u=b.pesData,L=x.pesData,S=h.pesData,D;u&&(D=i(u))?(this.parseAVCPES(D,!0),b.pesData=null):b.pesData=u,L&&(D=i(L))?(x.isAAC?this.parseAACPES(D):this.parseMPEGPES(D),x.pesData=null):(L!=null&&L.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),x.pesData=L),S&&(D=i(S))?(this.parseID3PES(D),h.pesData=null):h.pesData=S},v.demuxSampleAes=function(w,x,b){var h=this.demux(w,b,!0,!this.config.progressive),u=this.sampleAes=new U.default(this.observer,this.config,x);return this.decrypt(h,u)},v.decrypt=function(w,x){return new Promise(function(b){var h=w.audioTrack,u=w.avcTrack;h.samples&&h.isAAC?x.decryptAacSamples(h.samples,0,function(){u.samples?x.decryptAvcSamples(u.samples,0,0,function(){b(w)}):b(w)}):u.samples&&x.decryptAvcSamples(u.samples,0,0,function(){b(w)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(w,x){var b=this,h=this._avcTrack,u=this.parseAVCNALu(w.data),L=!1,S=this.avcSample,D,I=!1;w.data=null,S&&u.length&&!h.audFound&&(s(S,h),S=this.avcSample=f(!1,w.pts,w.dts,"")),u.forEach(function(B){switch(B.type){case 1:{D=!0,S||(S=b.avcSample=f(!0,w.pts,w.dts,"")),L&&(S.debug+="NDR "),S.frame=!0;var j=B.data;if(I&&j.length>4){var G=new P.default(j).readSliceType();(G===2||G===4||G===7||G===9)&&(S.key=!0)}break}case 5:D=!0,S||(S=b.avcSample=f(!0,w.pts,w.dts,"")),L&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{D=!0,L&&S&&(S.debug+="SEI ");var M=new P.default(E(B.data));M.readUByte();for(var N=0,Y=0,ee=!1,le=0;!ee&&M.bytesAvailable>1;){N=0;do le=M.readUByte(),N+=le;while(le===255);Y=0;do le=M.readUByte(),Y+=le;while(le===255);if(N===4&&M.bytesAvailable!==0){ee=!0;var fe=M.readUByte();if(fe===181){var Pe=M.readUShort();if(Pe===49){var Se=M.readUInt();if(Se===1195456820){var De=M.readUByte();if(De===3){for(var Le=M.readUByte(),Ae=M.readUByte(),me=31&Le,de=[Le,Ae],re=0;re<me;re++)de.push(M.readUByte()),de.push(M.readUByte()),de.push(M.readUByte());l(b._txtTrack.samples,{type:3,pts:w.pts,bytes:de})}}}}}else if(N===5&&M.bytesAvailable!==0){if(ee=!0,Y>16){for(var he=[],ie=0;ie<16;ie++)he.push(M.readUByte().toString(16)),(ie===3||ie===5||ie===7||ie===9)&&he.push("-");for(var Re=Y-16,oe=new Uint8Array(Re),ae=0;ae<Re;ae++)oe[ae]=M.readUByte();l(b._txtTrack.samples,{pts:w.pts,payloadType:N,uuid:he.join(""),userData:Object(W.utf8ArrayToStr)(oe),userDataBytes:oe})}}else if(Y<M.bytesAvailable)for(var ge=0;ge<Y;ge++)M.readUByte()}break}case 7:if(D=!0,I=!0,L&&S&&(S.debug+="SPS "),!h.sps){var we=new P.default(B.data),_e=we.readSPS();h.width=_e.width,h.height=_e.height,h.pixelRatio=_e.pixelRatio,h.sps=[B.data],h.duration=b._duration;for(var Fe=B.data.subarray(1,4),Ue="avc1.",Be=0;Be<3;Be++){var et=Fe[Be].toString(16);et.length<2&&(et="0"+et),Ue+=et}h.codec=Ue}break;case 8:D=!0,L&&S&&(S.debug+="PPS "),h.pps||(h.pps=[B.data]);break;case 9:D=!1,h.audFound=!0,S&&s(S,h),S=b.avcSample=f(!1,w.pts,w.dts,L?"AUD ":"");break;case 12:D=!1;break;default:D=!1,S&&(S.debug+="unknown NAL "+B.type+" ");break}if(S&&D){var Je=S.units;Je.push(B)}}),x&&S&&(s(S,h),this.avcSample=null)},v.getLastNalUnit=function(){var w,x=this.avcSample,b;if(!x||x.units.length===0){var h=this._avcTrack.samples;x=h[h.length-1]}if((w=x)!==null&&w!==void 0&&w.units){var u=x.units;b=u[u.length-1]}return b},v.parseAVCNALu=function(w){var x=w.byteLength,b=this._avcTrack,h=b.naluState||0,u=h,L=[],S=0,D,I,B,j=-1,G=0;for(h===-1&&(j=0,G=w[0]&31,h=0,S=1);S<x;){if(D=w[S++],!h){h=D?0:1;continue}if(h===1){h=D?0:2;continue}if(!D)h=3;else if(D===1){if(j>=0){var M={data:w.subarray(j,S-h-1),type:G};L.push(M)}else{var N=this.getLastNalUnit();if(N&&(u&&S<=4-u&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-u))),I=S-h-1,I>0)){var Y=new Uint8Array(N.data.byteLength+I);Y.set(N.data,0),Y.set(w.subarray(0,I),N.data.byteLength),N.data=Y,N.state=0}}S<x?(B=w[S]&31,j=S,G=B,h=0):h=-1}else h=0}if(j>=0&&h>=0){var ee={data:w.subarray(j,x),type:G,state:h};L.push(ee)}if(L.length===0){var le=this.getLastNalUnit();if(le){var fe=new Uint8Array(le.data.byteLength+w.byteLength);fe.set(le.data,0),fe.set(w,le.data.byteLength),le.data=fe}}return b.naluState=h,L},v.parseAACPES=function(w){var x=0,b=this._audioTrack,h=this.aacOverFlow,u=w.data;if(h){this.aacOverFlow=null;var L=h.sample.unit.byteLength,S=Math.min(h.missing,L),D=L-S;h.sample.unit.set(u.subarray(0,S),D),b.samples.push(h.sample),x=h.missing}var I,B;for(I=x,B=u.length;I<B-1&&!X.isHeader(u,I);I++);if(I!==x){var j,G;if(I<B-1?(j="AAC PES did not start with ADTS header,offset:"+I,G=!1):(j="no ADTS header found in AAC PES",G=!0),d.logger.warn("parsing error:"+j),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:G,reason:j}),G)return}X.initTrackConfig(b,this.observer,u,I,this.audioCodec);var M;if(w.pts!==void 0)M=w.pts;else if(h){var N=X.getFrameDuration(b.samplerate);M=h.sample.pts+N}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;I<B;)if(X.isHeader(u,I)){if(I+5<B){var ee=X.appendFrame(b,u,I,M,Y);if(ee)if(ee.missing)this.aacOverFlow=ee;else{I+=ee.length,Y++;continue}}break}else I++},v.parseMPEGPES=function(w){var x=w.data,b=x.length,h=0,u=0,L=w.pts;if(L===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<b;)if(F.isHeader(x,u)){var S=F.appendFrame(this._audioTrack,x,u,L,h);if(S)u+=S.length,h++;else break}else u++},v.parseID3PES=function(w){if(w.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(w)},g}();m.minProbeByteLength=188;function f(g,v,k,w){return{key:g,frame:!1,pts:v,dts:k,units:[],debug:w,length:0}}function y(g,v){return(g[v+10]&31)<<8|g[v+11]}function a(g,v,k,w){var x={audio:-1,avc:-1,id3:-1,isAAC:!0},b=(g[v+1]&15)<<8|g[v+2],h=v+3+b-4,u=(g[v+10]&15)<<8|g[v+11];for(v+=12+u;v<h;){var L=(g[v+1]&31)<<8|g[v+2];switch(g[v]){case 207:if(!w){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:x.audio===-1&&(x.audio=L);break;case 21:x.id3===-1&&(x.id3=L);break;case 219:if(!w){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:x.avc===-1&&(x.avc=L);break;case 3:case 4:k?x.audio===-1&&(x.audio=L,x.isAAC=!1):d.logger.log("MPEG audio found, not supported in this browser");break;case 36:d.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((g[v+3]&15)<<8|g[v+4])+5}return x}function i(g){var v=0,k,w,x,b,h,u=g.data;if(!g||g.size===0)return null;for(;u[0].length<19&&u.length>1;){var L=new Uint8Array(u[0].length+u[1].length);L.set(u[0]),L.set(u[1],u[0].length),u[0]=L,u.splice(1,1)}k=u[0];var S=(k[0]<<16)+(k[1]<<8)+k[2];if(S===1){if(w=(k[4]<<8)+k[5],w&&w>g.size-6)return null;var D=k[7];D&192&&(b=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,D&64?(h=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,b-h>60*9e4&&(d.logger.warn(Math.round((b-h)/9e4)+"s delta between PTS and DTS, align them"),b=h)):h=b),x=k[8];var I=x+9;if(g.size<=I)return null;g.size-=I;for(var B=new Uint8Array(g.size),j=0,G=u.length;j<G;j++){k=u[j];var M=k.byteLength;if(I)if(I>M){I-=M;continue}else k=k.subarray(I),M-=I,I=0;B.set(k,v),v+=M}return w&&(w-=x+3),{data:B,pts:b,dts:h,len:w}}return null}function s(g,v){if(g.units.length&&g.frame){if(g.pts===void 0){var k=v.samples,w=k.length;if(w){var x=k[w-1];g.pts=x.pts,g.dts=x.dts}else{v.dropped++;return}}v.samples.push(g)}g.debug.length&&d.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function l(g,v){var k=g.length;if(k>0){if(v.pts>=g[k-1].pts)g.push(v);else for(var w=k-1;w>=0;w--)if(v.pts<g[w].pts){g.splice(w,0,v);break}}else g.push(v)}function E(g){for(var v=g.byteLength,k=[],w=1;w<v-2;)g[w]===0&&g[w+1]===0&&g[w+2]===3?(k.push(w+2),w+=2):w++;if(k.length===0)return g;var x=v-k.length,b=new Uint8Array(x),h=0;for(w=0;w<x;h++,w++)h===k[0]&&(h++,k.shift()),b[w]=g[h];return b}J.default=m},"./src/errors.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ErrorTypes",function(){return X}),O.d(J,"ErrorDetails",function(){return F});var X;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(X||(X={}));var F;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"Events",function(){return X});var X;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(X||(X={}))},"./src/hls.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return g});var X=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(X),P=O("./src/loader/playlist-loader.ts"),W=O("./src/loader/key-loader.ts"),U=O("./src/controller/id3-track-controller.ts"),_=O("./src/controller/latency-controller.ts"),A=O("./src/controller/level-controller.ts"),d=O("./src/controller/fragment-tracker.ts"),p=O("./src/controller/stream-controller.ts"),T=O("./src/is-supported.ts"),m=O("./src/utils/logger.ts"),f=O("./src/config.ts"),y=O("./node_modules/eventemitter3/index.js"),a=O.n(y),i=O("./src/events.ts"),s=O("./src/errors.ts");function l(v,k){for(var w=0;w<k.length;w++){var x=k[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,x.key,x)}}function E(v,k,w){return k&&l(v.prototype,k),w&&l(v,w),v}var g=function(){v.isSupported=function(){return Object(T.isSupported)()};function v(w){w===void 0&&(w={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var x=this.config=Object(f.mergeConfig)(v.DefaultConfig,w);this.userConfig=w,Object(m.enableLogs)(x.debug),this._autoLevelCapping=-1,x.progressive&&Object(f.enableStreamingMode)(x);var b=x.abrController,h=x.bufferController,u=x.capLevelController,L=x.fpsController,S=this.abrController=new b(this),D=this.bufferController=new h(this),I=this.capLevelController=new u(this),B=new L(this),j=new P.default(this),G=new W.default(this),M=new U.default(this),N=this.levelController=new A.default(this),Y=new d.FragmentTracker(this),ee=this.streamController=new p.default(this,Y);I.setStreamController(ee),B.setStreamController(ee);var le=[N,ee];this.networkControllers=le;var fe=[j,G,S,D,I,B,M,Y];this.audioTrackController=this.createController(x.audioTrackController,null,le),this.createController(x.audioStreamController,Y,le),this.subtitleTrackController=this.createController(x.subtitleTrackController,null,le),this.createController(x.subtitleStreamController,Y,le),this.createController(x.timelineController,null,fe),this.emeController=this.createController(x.emeController,null,fe),this.cmcdController=this.createController(x.cmcdController,null,fe),this.latencyController=this.createController(_.default,null,fe),this.coreComponents=fe}var k=v.prototype;return k.createController=function(x,b,h){if(x){var u=b?new x(this,b):new x(this);return h&&h.push(u),u}return null},k.on=function(x,b,h){h===void 0&&(h=this),this._emitter.on(x,b,h)},k.once=function(x,b,h){h===void 0&&(h=this),this._emitter.once(x,b,h)},k.removeAllListeners=function(x){this._emitter.removeAllListeners(x)},k.off=function(x,b,h,u){h===void 0&&(h=this),this._emitter.off(x,b,h,u)},k.listeners=function(x){return this._emitter.listeners(x)},k.emit=function(x,b,h){return this._emitter.emit(x,b,h)},k.trigger=function(x,b){if(this.config.debug)return this.emit(x,x,b);try{return this.emit(x,x,b)}catch(h){m.logger.error("An internal error happened while handling event "+x+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:x,error:h})}return!1},k.listenerCount=function(x){return this._emitter.listenerCount(x)},k.destroy=function(){m.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(x){return x.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(x){return x.destroy()}),this.coreComponents.length=0},k.attachMedia=function(x){m.logger.log("attachMedia"),this._media=x,this.trigger(i.Events.MEDIA_ATTACHING,{media:x})},k.detachMedia=function(){m.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(x){this.stopLoad();var b=this.media,h=this.url,u=this.url=X.buildAbsoluteURL(self.location.href,x,{alwaysNormalize:!0});m.logger.log("loadSource:"+u),b&&h&&h!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(b)),this.trigger(i.Events.MANIFEST_LOADING,{url:x})},k.startLoad=function(x){x===void 0&&(x=-1),m.logger.log("startLoad("+x+")"),this.networkControllers.forEach(function(b){b.startLoad(x)})},k.stopLoad=function(){m.logger.log("stopLoad"),this.networkControllers.forEach(function(x){x.stopLoad()})},k.swapAudioCodec=function(){m.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){m.logger.log("recoverMediaError");var x=this._media;this.detachMedia(),x&&this.attachMedia(x)},k.removeLevel=function(x,b){b===void 0&&(b=0),this.levelController.removeLevel(x,b)},E(v,[{key:"levels",get:function(){var x=this.levelController.levels;return x||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(x){m.logger.log("set currentLevel:"+x),this.loadLevel=x,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(x){m.logger.log("set nextLevel:"+x),this.levelController.manualLevel=x,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(x){m.logger.log("set loadLevel:"+x),this.levelController.manualLevel=x}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(x){this.levelController.nextLoadLevel=x}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(x){m.logger.log("set firstLevel:"+x),this.levelController.firstLevel=x}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(x){m.logger.log("set startLevel:"+x),x!==-1&&(x=Math.max(x,this.minAutoLevel)),this.levelController.startLevel=x}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(x){var b=!!x;b!==this.config.capLevelToPlayerSize&&(b?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=b)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(x){this._autoLevelCapping!==x&&(m.logger.log("set autoLevelCapping:"+x),this._autoLevelCapping=x)}},{key:"bandwidthEstimate",get:function(){var x=this.abrController.bwEstimator;return x?x.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var x=this.levels,b=this.config.minAutoBitrate;if(!x)return 0;for(var h=x.length,u=0;u<h;u++)if(x[u].maxBitrate>b)return u;return 0}},{key:"maxAutoLevel",get:function(){var x=this.levels,b=this.autoLevelCapping,h;return b===-1&&x&&x.length?h=x.length-1:h=b,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(x){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,x)}},{key:"audioTracks",get:function(){var x=this.audioTrackController;return x?x.audioTracks:[]}},{key:"audioTrack",get:function(){var x=this.audioTrackController;return x?x.audioTrack:-1},set:function(x){var b=this.audioTrackController;b&&(b.audioTrack=x)}},{key:"subtitleTracks",get:function(){var x=this.subtitleTrackController;return x?x.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var x=this.subtitleTrackController;return x?x.subtitleTrack:-1},set:function(x){var b=this.subtitleTrackController;b&&(b.subtitleTrack=x)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var x=this.subtitleTrackController;return x?x.subtitleDisplay:!1},set:function(x){var b=this.subtitleTrackController;b&&(b.subtitleDisplay=x)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(x){this.config.lowLatencyMode=x}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return i.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:f.hlsDefaultConfig},set:function(x){v.defaultConfig=x}}]),v}();g.defaultConfig=void 0},"./src/is-supported.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isSupported",function(){return P}),O.d(J,"changeTypeSupported",function(){return W});var X=O("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var U=Object(X.getMediaSource)();if(!U)return!1;var _=F(),A=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!A&&!!d}function W(){var U,_=F();return typeof(_==null||((U=_.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return m}),O.d(J,"LoadError",function(){return y});var X=O("./src/polyfills/number.ts"),F=O("./src/errors.ts");function P(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,d(a,i)}function W(a){var i=typeof Map=="function"?new Map:void 0;return W=function(l){if(l===null||!A(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(l))return i.get(l);i.set(l,E)}function E(){return U(l,arguments,p(this).constructor)}return E.prototype=Object.create(l.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),d(E,l)},W(a)}function U(a,i,s){return _()?U=Reflect.construct:U=function(E,g,v){var k=[null];k.push.apply(k,g);var w=Function.bind.apply(E,k),x=new w;return v&&d(x,v.prototype),x},U.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function A(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function d(a,i){return d=Object.setPrototypeOf||function(l,E){return l.__proto__=E,l},d(a,i)}function p(a){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},p(a)}var T=Math.pow(2,17),m=function(){function a(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var i=a.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(l,E){var g=this,v=l.url;if(!v)return Promise.reject(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var k=this.config,w=k.fLoader,x=k.loader;return new Promise(function(b,h){g.loader&&g.loader.destroy();var u=g.loader=l.loader=w?new w(k):new x(k),L=f(l),S={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:T};l.stats=u.stats,u.load(L,S,{onSuccess:function(I,B,j,G){g.resetLoader(l,u),b({frag:l,part:null,payload:I.data,networkDetails:G})},onError:function(I,B,j){g.resetLoader(l,u),h(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:I,networkDetails:j}))},onAbort:function(I,B,j){g.resetLoader(l,u),h(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(I,B,j){g.resetLoader(l,u),h(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(I,B,j,G){E&&E({frag:l,part:null,payload:j,networkDetails:G})}})})},i.loadPart=function(l,E,g){var v=this;this.abort();var k=this.config,w=k.fLoader,x=k.loader;return new Promise(function(b,h){v.loader&&v.loader.destroy();var u=v.loader=l.loader=w?new w(k):new x(k),L=f(l,E),S={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:T};E.stats=u.stats,u.load(L,S,{onSuccess:function(I,B,j,G){v.resetLoader(l,u),v.updateStatsFromPart(l,E);var M={frag:l,part:E,payload:I.data,networkDetails:G};g(M),b(M)},onError:function(I,B,j){v.resetLoader(l,u),h(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:E,response:I,networkDetails:j}))},onAbort:function(I,B,j){l.stats.aborted=E.stats.aborted,v.resetLoader(l,u),h(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:E,networkDetails:j}))},onTimeout:function(I,B,j){v.resetLoader(l,u),h(new y({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:E,networkDetails:j}))}})})},i.updateStatsFromPart=function(l,E){var g=l.stats,v=E.stats,k=v.total;if(g.loaded+=v.loaded,k){var w=Math.round(l.duration/E.duration),x=Math.min(Math.round(g.loaded/k),w),b=w-x,h=b*Math.round(g.loaded/x);g.total=g.loaded+h}else g.total=Math.max(g.loaded,g.total);var u=g.loading,L=v.loading;u.start?u.first+=L.first-L.start:(u.start=L.start,u.first=L.first),u.end=L.end},i.resetLoader=function(l,E){l.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},a}();function f(a,i){i===void 0&&(i=null);var s=i||a,l={frag:a,part:i,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},E=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(X.isFiniteNumber)(E)&&Object(X.isFiniteNumber)(g)&&(l.rangeStart=E,l.rangeEnd=g),l}var y=function(a){P(i,a);function i(s){for(var l,E=arguments.length,g=new Array(E>1?E-1:0),v=1;v<E;v++)g[v-1]=arguments[v];return l=a.call.apply(a,[this].concat(g))||this,l.data=void 0,l.data=s,l}return i}(W(Error))},"./src/loader/fragment.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ElementaryStreamTypes",function(){return m}),O.d(J,"BaseSegment",function(){return f}),O.d(J,"Fragment",function(){return y}),O.d(J,"Part",function(){return a});var X=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),P=O.n(F),W=O("./src/utils/logger.ts"),U=O("./src/loader/level-key.ts"),_=O("./src/loader/load-stats.ts");function A(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,d(i,s)}function d(i,s){return d=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},d(i,s)}function p(i,s){for(var l=0;l<s.length;l++){var E=s[l];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(i,E.key,E)}}function T(i,s,l){return s&&p(i.prototype,s),l&&p(i,l),i}var m;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(m||(m={}));var f=function(){function i(l){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[m.AUDIO]=null,E[m.VIDEO]=null,E[m.AUDIOVIDEO]=null,E),this.baseurl=l}var s=i.prototype;return s.setByteRange=function(E,g){var v=E.split("@",2),k=[];v.length===1?k[0]=g?g.byteRangeEndOffset:0:k[0]=parseInt(v[1]),k[1]=parseInt(v[0])+k[0],this._byteRange=k},T(i,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(E){this._url=E}}]),i}(),y=function(i){A(s,i);function s(E,g){var v;return v=i.call(this,g)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new _.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=E,v}var l=s.prototype;return l.createInitializationVector=function(g){for(var v=new Uint8Array(16),k=12;k<16;k++)v[k]=g>>8*(15-k)&255;return v},l.setDecryptDataFromLevelKey=function(g,v){var k=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(k=U.LevelKey.fromURI(g.uri),k.method=g.method,k.iv=this.createInitializationVector(v),k.keyFormat="identity"),k},l.setElementaryStreamInfo=function(g,v,k,w,x,b){b===void 0&&(b=!1);var h=this.elementaryStreams,u=h[g];if(!u){h[g]={startPTS:v,endPTS:k,startDTS:w,endDTS:x,partial:b};return}u.startPTS=Math.min(u.startPTS,v),u.endPTS=Math.max(u.endPTS,k),u.startDTS=Math.min(u.startDTS,w),u.endDTS=Math.max(u.endDTS,x)},l.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[m.AUDIO]=null,g[m.VIDEO]=null,g[m.AUDIOVIDEO]=null},T(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(X.isFiniteNumber)(this.programDateTime))return null;var g=Object(X.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(f),a=function(i){A(s,i);function s(l,E,g,v,k){var w;w=i.call(this,g)||this,w.fragOffset=0,w.duration=0,w.gap=!1,w.independent=!1,w.relurl=void 0,w.fragment=void 0,w.index=void 0,w.stats=new _.LoadStats,w.duration=l.decimalFloatingPoint("DURATION"),w.gap=l.bool("GAP"),w.independent=l.bool("INDEPENDENT"),w.relurl=l.enumeratedString("URI"),w.fragment=E,w.index=v;var x=l.enumeratedString("BYTERANGE");return x&&w.setByteRange(x,k),k&&(w.fragOffset=k.fragOffset+k.duration),w}return T(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),s}(f)},"./src/loader/key-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return W});var X=O("./src/events.ts"),F=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),W=function(){function U(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var _=U.prototype;return _._registerListeners=function(){this.hls.on(X.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(X.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var p=this.loaders[d];p&&p.destroy()}this.loaders={}},_.onKeyLoading=function(d,p){var T=p.frag,m=T.type,f=this.loaders[m];if(!T.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=T.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(f&&(P.logger.warn("abort previous key loader for type:"+m),f.abort()),!y){P.logger.warn("key uri is falsy");return}var i=a.loader,s=T.loader=this.loaders[m]=new i(a);this.decrypturl=y,this.decryptkey=null;var l={url:y,frag:T,responseType:"arraybuffer"},E={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,E,g)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger(X.Events.KEY_LOADED,{frag:T}))},_.loadsuccess=function(d,p,T){var m=T.frag;if(!m.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=m.decryptdata.key=new Uint8Array(d.data),m.loader=null,delete this.loaders[m.type],this.hls.trigger(X.Events.KEY_LOADED,{frag:m})},_.loaderror=function(d,p){var T=p.frag,m=T.loader;m&&m.abort(),delete this.loaders[T.type],this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:d})},_.loadtimeout=function(d,p){var T=p.frag,m=T.loader;m&&m.abort(),delete this.loaders[T.type],this.hls.trigger(X.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:T})},U}()},"./src/loader/level-details.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"LevelDetails",function(){return U});var X=O("./src/polyfills/number.ts");function F(_,A){for(var d=0;d<A.length;d++){var p=A[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(_,p.key,p)}}function P(_,A,d){return A&&F(_.prototype,A),d&&F(_,d),_}var W=10,U=function(){function _(d){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=d}var A=_.prototype;return A.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-p.lastPartSn,m=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!m||!!T,this.advanced=this.endSN>p.endSN||T>0||T===0&&m>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},P(_,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(X.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var T=this.driftEnd-this.driftStart;return T*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.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 p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"LevelKey",function(){return U});var X=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(X);function P(_,A){for(var d=0;d<A.length;d++){var p=A[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(_,p.key,p)}}function W(_,A,d){return A&&P(_.prototype,A),d&&P(_,d),_}var U=function(){_.fromURL=function(d,p){return new _(d,p)},_.fromURI=function(d){return new _(d)};function _(A,d){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,d?this._uri=Object(X.buildAbsoluteURL)(A,d,{alwaysNormalize:!0}):this._uri=A}return W(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"LoadStats",function(){return X});var X=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s});var X=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),P=O.n(F),W=O("./src/loader/fragment.ts"),U=O("./src/loader/level-details.ts"),_=O("./src/loader/level-key.ts"),A=O("./src/utils/attr-list.ts"),d=O("./src/utils/logger.ts"),p=O("./src/utils/codecs.ts"),T=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,m=/#EXT-X-MEDIA:(.*)/g,f=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function i(k){var w,x;return a.test((w=(x=F.parseURL(k))===null||x===void 0?void 0:x.path)!=null?w:"")}var s=function(){function k(){}return k.findGroup=function(x,b){for(var h=0;h<x.length;h++){var u=x[h];if(u.id===b)return u}},k.convertAVC1ToAVCOTI=function(x){var b=x.split(".");if(b.length>2){var h=b.shift()+".";return h+=parseInt(b.shift()).toString(16),h+=("000"+parseInt(b.shift()).toString(16)).substr(-4),h}return x},k.resolve=function(x,b){return F.buildAbsoluteURL(b,x,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(x,b){var h=[],u={},L=!1;T.lastIndex=0;for(var S;(S=T.exec(x))!=null;)if(S[1]){var D=new A.AttrList(S[1]),I={attrs:D,bitrate:D.decimalInteger("AVERAGE-BANDWIDTH")||D.decimalInteger("BANDWIDTH"),name:D.NAME,url:k.resolve(S[2],b)},B=D.decimalResolution("RESOLUTION");B&&(I.width=B.width,I.height=B.height),l((D.CODECS||"").split(/[ ,]+/).filter(function(G){return G}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=k.convertAVC1ToAVCOTI(I.videoCodec)),h.push(I)}else if(S[3]){var j=new A.AttrList(S[3]);j["DATA-ID"]&&(L=!0,u[j["DATA-ID"]]=j)}return{levels:h,sessionData:L?u:null}},k.parseMasterPlaylistMedia=function(x,b,h,u){u===void 0&&(u=[]);var L,S=[],D=0;for(m.lastIndex=0;(L=m.exec(x))!==null;){var I=new A.AttrList(L[1]);if(I.TYPE===h){var B={attrs:I,bitrate:0,id:D++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:h,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?k.resolve(I.URI,b):""};if(u.length){var j=k.findGroup(u,B.groupId)||u[0];E(B,j,"audioCodec"),E(B,j,"textCodec")}S.push(B)}}return S},k.parseLevelPlaylist=function(x,b,h,u,L){var S=new U.LevelDetails(b),D=S.fragments,I=null,B=0,j=0,G=0,M=0,N=null,Y=new W.Fragment(u,b),ee,le,fe,Pe=-1,Se=!1;for(f.lastIndex=0,S.m3u8=x;(ee=f.exec(x))!==null;){Se&&(Se=!1,Y=new W.Fragment(u,b),Y.start=G,Y.sn=B,Y.cc=M,Y.level=h,I&&(Y.initSegment=I,Y.rawProgramDateTime=I.rawProgramDateTime));var De=ee[1];if(De){Y.duration=parseFloat(De);var Le=(" "+ee[2]).slice(1);Y.title=Le||null,Y.tagList.push(Le?["INF",De,Le]:["INF",De])}else if(ee[3])Object(X.isFiniteNumber)(Y.duration)&&(Y.start=G,fe&&(Y.levelkey=fe),Y.sn=B,Y.level=h,Y.cc=M,Y.urlId=L,D.push(Y),Y.relurl=(" "+ee[3]).slice(1),v(Y,N),N=Y,G+=Y.duration,B++,j=0,Se=!0);else if(ee[4]){var Ae=(" "+ee[4]).slice(1);N?Y.setByteRange(Ae,N):Y.setByteRange(Ae)}else if(ee[5])Y.rawProgramDateTime=(" "+ee[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Pe===-1&&(Pe=D.length);else{if(ee=ee[0].match(y),!ee){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(le=1;le<ee.length&&!(typeof ee[le]!="undefined");le++);var me=(" "+ee[le]).slice(1),de=(" "+ee[le+1]).slice(1),re=ee[le+2]?(" "+ee[le+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":S.type=de.toUpperCase();break;case"MEDIA-SEQUENCE":B=S.startSN=parseInt(de);break;case"SKIP":{var he=new A.AttrList(de),ie=he.decimalInteger("SKIPPED-SEGMENTS");if(Object(X.isFiniteNumber)(ie)){S.skippedSegments=ie;for(var Re=ie;Re--;)D.unshift(null);B+=ie}var oe=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");oe&&(S.recentlyRemovedDateranges=oe.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(de);break;case"VERSION":S.version=parseInt(de);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(de||re)&&Y.tagList.push(re?[de,re]:[de]);break;case"DIS":M++;case"GAP":Y.tagList.push([me]);break;case"BITRATE":Y.tagList.push([me,de]);break;case"DISCONTINUITY-SEQ":M=parseInt(de);break;case"KEY":{var ae,ge=new A.AttrList(de),we=ge.enumeratedString("METHOD"),_e=ge.URI,Fe=ge.hexadecimalInteger("IV"),Ue=ge.enumeratedString("KEYFORMATVERSIONS"),Be=ge.enumeratedString("KEYID"),et=(ae=ge.enumeratedString("KEYFORMAT"))!=null?ae:"identity",Je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Je.indexOf(et)>-1){d.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;we&&(fe=_.LevelKey.fromURL(b,_e),_e&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(fe.method=we,fe.keyFormat=et,Be&&(fe.keyID=Be),Ue&&(fe.keyFormatVersions=Ue),fe.iv=Fe));break}case"START":{var Ze=new A.AttrList(de),Ye=Ze.decimalFloatingPoint("TIME-OFFSET");Object(X.isFiniteNumber)(Ye)&&(S.startTimeOffset=Ye);break}case"MAP":{var dt=new A.AttrList(de);Y.relurl=dt.URI,dt.BYTERANGE&&Y.setByteRange(dt.BYTERANGE),Y.level=h,Y.sn="initSegment",fe&&(Y.levelkey=fe),Y.initSegment=null,I=Y,Se=!0;break}case"SERVER-CONTROL":{var qe=new A.AttrList(de);S.canBlockReload=qe.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=qe.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&qe.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=qe.optionalFloat("PART-HOLD-BACK",0),S.holdBack=qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ot=new A.AttrList(de);S.partTarget=ot.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ie=S.partList;Ie||(Ie=S.partList=[]);var Qe=j>0?Ie[Ie.length-1]:void 0,st=j++,je=new W.Part(new A.AttrList(de),Y,b,st,Qe);Ie.push(je),Y.duration+=je.duration;break}case"PRELOAD-HINT":{var Xe=new A.AttrList(de);S.preloadHint=Xe;break}case"RENDITION-REPORT":{var Ce=new A.AttrList(de);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Ce);break}default:d.logger.warn("line parsed but not handled: "+ee);break}}}N&&!N.relurl?(D.pop(),G-=N.duration,S.partList&&(S.fragmentHint=N)):S.partList&&(v(Y,N),Y.cc=M,S.fragmentHint=Y);var be=D.length,Ee=D[0],ne=D[be-1];if(G+=S.skippedSegments*S.targetduration,G>0&&be&&ne){S.averagetargetduration=G/be;var se=ne.sn;S.endSN=se!=="initSegment"?se:0,Ee&&(S.startCC=Ee.cc,Ee.initSegment||S.fragments.every(function(ce){return ce.relurl&&i(ce.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new W.Fragment(u,b),Y.relurl=ne.relurl,Y.level=h,Y.sn="initSegment",Ee.initSegment=Y,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(G+=S.fragmentHint.duration),S.totalduration=G,S.endCC=M,Pe>0&&g(D,Pe),S},k}();function l(k,w){["video","audio","text"].forEach(function(x){var b=k.filter(function(u){return Object(p.isCodecType)(u,x)});if(b.length){var h=b.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});w[x+"Codec"]=h.length>0?h[0]:b[0],k=k.filter(function(u){return b.indexOf(u)===-1})}}),w.unknownCodecs=k}function E(k,w,x){var b=w[x];b&&(k[x]=b)}function g(k,w){for(var x=k[w],b=w;b--;){var h=k[b];if(!h)return;h.programDateTime=x.programDateTime-h.duration*1e3,x=h}}function v(k,w){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):w!=null&&w.programDateTime&&(k.programDateTime=w.endProgramDateTime),Object(X.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),P=O("./src/errors.ts"),W=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),_=O("./src/loader/m3u8-parser.ts"),A=O("./src/types/loader.ts"),d=O("./src/utils/attr-list.ts");function p(f){var y=f.type;switch(y){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function T(f,y){var a=f.url;return(a===void 0||a.indexOf("data:")===0)&&(a=y.url),a}var m=function(){function f(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var y=f.prototype;return y.registerListeners=function(){var i=this.hls;i.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var i=this.hls;i.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(i){var s=this.hls.config,l=s.pLoader,E=s.loader,g=l||E,v=new g(s);return i.loader=v,this.loaders[i.type]=v,v},y.getInternalLoader=function(i){return this.loaders[i.type]},y.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},y.destroyInternalLoaders=function(){for(var i in this.loaders){var s=this.loaders[i];s&&s.destroy(),this.resetInternalLoader(i)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(i,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},y.onLevelLoading=function(i,s){var l=s.id,E=s.level,g=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:null,level:E,responseType:"text",type:A.PlaylistContextType.LEVEL,url:g,deliveryDirectives:v})},y.onAudioTrackLoading=function(i,s){var l=s.id,E=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:E,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:v})},y.onSubtitleTrackLoading=function(i,s){var l=s.id,E=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:l,groupId:E,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:v})},y.load=function(i){var s,l=this.hls.config,E=this.getInternalLoader(i);if(E){var g=E.context;if(g&&g.url===i.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),E.abort()}var v,k,w,x;switch(i.type){case A.PlaylistContextType.MANIFEST:v=l.manifestLoadingMaxRetry,k=l.manifestLoadingTimeOut,w=l.manifestLoadingRetryDelay,x=l.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:v=0,k=l.levelLoadingTimeOut;break;default:v=l.levelLoadingMaxRetry,k=l.levelLoadingTimeOut,w=l.levelLoadingRetryDelay,x=l.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var b;if(i.type===A.PlaylistContextType.LEVEL&&i.level!==null?b=this.hls.levels[i.level].details:i.type===A.PlaylistContextType.AUDIO_TRACK&&i.id!==null?b=this.hls.audioTracks[i.id].details:i.type===A.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(b=this.hls.subtitleTracks[i.id].details),b){var h=b.partTarget,u=b.targetduration;h&&u&&(k=Math.min(Math.max(h*3,u*.8)*1e3,k))}}var L={timeout:k,maxRetry:v,retryDelay:w,maxRetryDelay:x,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(i,L,S)},y.loadsuccess=function(i,s,l,E){if(E===void 0&&(E=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,s,l,E);return}this.resetInternalLoader(l.type);var g=i.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",E);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,l,E):this.handleMasterPlaylist(i,s,l,E)},y.loaderror=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,i)},y.loadtimeout=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},y.handleMasterPlaylist=function(i,s,l,E){var g=this.hls,v=i.data,k=T(i,l),w=_.default.parseMasterPlaylist(v,k),x=w.levels,b=w.sessionData;if(!x.length){this.handleManifestParsingError(i,l,"no level found in manifest",E);return}var h=x.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),u=x.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),L=_.default.parseMasterPlaylistMedia(v,k,"AUDIO",h),S=_.default.parseMasterPlaylistMedia(v,k,"SUBTITLES",u),D=_.default.parseMasterPlaylistMedia(v,k,"CLOSED-CAPTIONS");if(L.length){var I=L.some(function(B){return!B.url});!I&&x[0].audioCodec&&!x[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}g.trigger(F.Events.MANIFEST_LOADED,{levels:x,audioTracks:L,subtitles:S,captions:D,url:k,stats:s,networkDetails:E,sessionData:b})},y.handleTrackOrLevelPlaylist=function(i,s,l,E){var g=this.hls,v=l.id,k=l.level,w=l.type,x=T(i,l),b=Object(X.isFiniteNumber)(v)?v:0,h=Object(X.isFiniteNumber)(k)?k:b,u=p(l),L=_.default.parseLevelPlaylist(i.data,x,h,u,b);if(!L.fragments.length){g.trigger(F.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:x,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(w===A.PlaylistContextType.MANIFEST){var S={attrs:new d.AttrList({}),bitrate:0,details:L,name:"",url:x};g.trigger(F.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:x,stats:s,networkDetails:E,sessionData:null})}if(s.parsing.end=performance.now(),L.needSidxRanges){var D,I=(D=L.fragments[0].initSegment)===null||D===void 0?void 0:D.url;this.load({url:I,isSidxRequest:!0,type:w,level:k,levelDetails:L,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=L,this.handlePlaylistLoaded(i,s,l,E)},y.handleSidxRequest=function(i,s){var l=Object(U.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var E=l.references,g=s.levelDetails;E.forEach(function(v,k){var w=v.info,x=g.fragments[k];x.byteRange.length===0&&x.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),x.initSegment&&x.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(i,s,l,E){this.hls.trigger(F.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:s,networkDetails:E})},y.handleNetworkError=function(i,s,l,E){l===void 0&&(l=!1),W.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var g=P.ErrorDetails.UNKNOWN,v=!1,k=this.getInternalLoader(i);switch(i.type){case A.PlaylistContextType.MANIFEST:g=l?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case A.PlaylistContextType.LEVEL:g=l?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case A.PlaylistContextType.AUDIO_TRACK:g=l?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:g=l?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}k&&this.resetInternalLoader(i.type);var w={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:v,url:i.url,loader:k,context:i,networkDetails:s};E&&(w.response=E),this.hls.trigger(F.Events.ERROR,w)},y.handlePlaylistLoaded=function(i,s,l,E){var g=l.type,v=l.level,k=l.id,w=l.groupId,x=l.loader,b=l.levelDetails,h=l.deliveryDirectives;if(!(b!=null&&b.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",E);return}if(!x)return;b.live&&(x.getCacheAge&&(b.ageHeader=x.getCacheAge()||0),(!x.getCacheAge||isNaN(b.ageHeader))&&(b.ageHeader=0));switch(g){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:b,level:v||0,id:k||0,stats:s,networkDetails:E,deliveryDirectives:h});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:b,id:k||0,groupId:w||"",stats:s,networkDetails:E,deliveryDirectives:h});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:b,id:k||0,groupId:w||"",stats:s,networkDetails:E,deliveryDirectives:h});break}},f}();J.default=m},"./src/polyfills/number.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isFiniteNumber",function(){return X}),O.d(J,"MAX_SAFE_INTEGER",function(){return F});var X=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,J,O){"use strict";O.r(J);var X=function(){function F(){}return F.getSilentFrame=function(W,U){switch(W){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(U===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(U===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},F}();J.default=X},"./src/remux/mp4-generator.ts":function(ue,J,O){"use strict";O.r(J);var X=Math.pow(2,32)-1,F=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in P.types)P.types.hasOwnProperty(U)&&(P.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var _=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:_,audio:A};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=p,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var T=new Uint8Array([105,115,111,109]),m=new Uint8Array([97,118,99,49]),f=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,T,f,T,m),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,d))},P.box=function(U){for(var _=8,A=arguments.length,d=new Array(A>1?A-1:0),p=1;p<A;p++)d[p-1]=arguments[p];for(var T=d.length,m=T;T--;)_+=d[T].byteLength;var f=new Uint8Array(_);for(f[0]=_>>24&255,f[1]=_>>16&255,f[2]=_>>8&255,f[3]=_&255,f.set(U,4),T=0,_=8;T<m;T++)f.set(d[T],_),_+=d[T].byteLength;return f},P.hdlr=function(U){return P.box(P.types.hdlr,P.HDLR_TYPES[U])},P.mdat=function(U){return P.box(P.types.mdat,U)},P.mdhd=function(U,_){_*=U;var A=Math.floor(_/(X+1)),d=Math.floor(_%(X+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,A>>24,A>>16&255,A>>8&255,A&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},P.mdia=function(U){return P.box(P.types.mdia,P.mdhd(U.timescale,U.duration),P.hdlr(U.type),P.minf(U))},P.mfhd=function(U){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},P.minf=function(U){return U.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(U)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(U))},P.moof=function(U,_,A){return P.box(P.types.moof,P.mfhd(U),P.traf(A,_))},P.moov=function(U){for(var _=U.length,A=[];_--;)A[_]=P.trak(U[_]);return P.box.apply(null,[P.types.moov,P.mvhd(U[0].timescale,U[0].duration)].concat(A).concat(P.mvex(U)))},P.mvex=function(U){for(var _=U.length,A=[];_--;)A[_]=P.trex(U[_]);return P.box.apply(null,[P.types.mvex].concat(A))},P.mvhd=function(U,_){_*=U;var A=Math.floor(_/(X+1)),d=Math.floor(_%(X+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,A>>24,A>>16&255,A>>8&255,A&255,d>>24,d>>16&255,d>>8&255,d&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,p)},P.sdtp=function(U){var _=U.samples||[],A=new Uint8Array(4+_.length),d,p;for(d=0;d<_.length;d++)p=_[d].flags,A[d+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return P.box(P.types.sdtp,A)},P.stbl=function(U){return P.box(P.types.stbl,P.stsd(U),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(U){var _=[],A=[],d,p,T;for(d=0;d<U.sps.length;d++)p=U.sps[d],T=p.byteLength,_.push(T>>>8&255),_.push(T&255),_=_.concat(Array.prototype.slice.call(p));for(d=0;d<U.pps.length;d++)p=U.pps[d],T=p.byteLength,A.push(T>>>8&255),A.push(T&255),A=A.concat(Array.prototype.slice.call(p));var m=P.box(P.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|U.sps.length].concat(_).concat([U.pps.length]).concat(A))),f=U.width,y=U.height,a=U.pixelRatio[0],i=U.pixelRatio[1];return P.box(P.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,f>>8&255,f&255,y>>8&255,y&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),m,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255])))},P.esds=function(U){var _=U.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(U.config).concat([6,1,2]))},P.mp4a=function(U){var _=U.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),P.box(P.types.esds,P.esds(U)))},P.mp3=function(U){var _=U.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},P.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(U)):P.box(P.types.stsd,P.STSD,P.mp4a(U)):P.box(P.types.stsd,P.STSD,P.avc1(U))},P.tkhd=function(U){var _=U.id,A=U.duration*U.timescale,d=U.width,p=U.height,T=Math.floor(A/(X+1)),m=Math.floor(A%(X+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,m>>24,m>>16&255,m>>8&255,m&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,d>>8&255,d&255,0,0,p>>8&255,p&255,0,0]))},P.traf=function(U,_){var A=P.sdtp(U),d=U.id,p=Math.floor(_/(X+1)),T=Math.floor(_%(X+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,T>>24,T>>16&255,T>>8&255,T&255])),P.trun(U,A.length+16+20+8+16+8+8),A)},P.trak=function(U){return U.duration=U.duration||4294967295,P.box(P.types.trak,P.tkhd(U),P.mdia(U))},P.trex=function(U){var _=U.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(U,_){var A=U.samples||[],d=A.length,p=12+16*d,T=new Uint8Array(p),m,f,y,a,i,s;for(_+=8+p,T.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),m=0;m<d;m++)f=A[m],y=f.duration,a=f.size,i=f.flags,s=f.cts,T.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*m);return P.box(P.types.trun,T)},P.initSegment=function(U){P.types||P.init();var _=P.moov(U),A=new Uint8Array(P.FTYP.byteLength+_.byteLength);return A.set(P.FTYP),A.set(_,P.FTYP.byteLength),A},P}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,J.default=F},"./src/remux/mp4-remuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return s}),O.d(J,"normalizePts",function(){return l});var X=O("./src/polyfills/number.ts"),F=O("./src/remux/aac-helper.ts"),P=O("./src/remux/mp4-generator.ts"),W=O("./src/events.ts"),U=O("./src/errors.ts"),_=O("./src/utils/logger.ts"),A=O("./src/types/loader.ts"),d=O("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(k){for(var w=1;w<arguments.length;w++){var x=arguments[w];for(var b in x)Object.prototype.hasOwnProperty.call(x,b)&&(k[b]=x[b])}return k},p.apply(this,arguments)}var T=10*1e3,m=1024,f=1152,y=null,a=null,i=!1,s=function(){function k(x,b,h,u){if(u===void 0&&(u=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=x,this.config=b,this.typeSupported=h,this.ISGenerated=!1,y===null){var L=navigator.userAgent||"",S=L.match(/Chrome\/(\d+)/i);y=S?parseInt(S[1]):0}if(a===null){var D=navigator.userAgent.match(/Safari\/(\d+)/i);a=D?parseInt(D[1]):0}i=!!y&&y<75||!!a&&a<600}var w=k.prototype;return w.destroy=function(){},w.resetTimeStamp=function(b){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=b},w.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},w.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},w.getVideoStartPts=function(b){var h=!1,u=b.reduce(function(L,S){var D=S.pts-L;return D<-4294967296?(h=!0,l(L,S.pts)):D>0?L:S.pts},b[0].pts);return h&&_.logger.debug("PTS rollover detected"),u},w.remux=function(b,h,u,L,S,D,I,B){var j,G,M,N,Y,ee,le=S,fe=S,Pe=b.pid>-1,Se=h.pid>-1,De=h.samples.length,Le=b.samples.length>0,Ae=De>1,me=(!Pe||Le)&&(!Se||Ae)||this.ISGenerated||I;if(me){this.ISGenerated||(M=this.generateIS(b,h,S));var de=this.isVideoContiguous,re=-1;if(Ae&&(re=E(h.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,re>0){_.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+De+" video samples due to a missing keyframe");var he=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(re),h.dropped+=re,fe+=(h.samples[0].pts-he)/(h.timescale||9e4)}else re===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+De+" video samples"),ee=!1);if(this.ISGenerated){if(Le&&Ae){var ie=this.getVideoStartPts(h.samples),Re=l(b.samples[0].pts,ie)-ie,oe=Re/h.inputTimeScale;le+=Math.max(0,oe),fe+=Math.max(0,-oe)}if(Le){if(b.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(b,h,S)),G=this.remuxAudio(b,le,this.isAudioContiguous,D,Se||Ae||B===A.PlaylistLevelType.AUDIO?fe:void 0),Ae){var ae=G?G.endPTS-G.startPTS:0;h.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(b,h,S)),j=this.remuxVideo(h,fe,de,ae)}}else Ae&&(j=this.remuxVideo(h,fe,de,0));j&&(j.firstKeyFrame=re,j.independent=re!==-1)}}return this.ISGenerated&&(u.samples.length&&(Y=this.remuxID3(u,S)),L.samples.length&&(N=this.remuxText(L,S))),{audio:G,video:j,initSegment:M,independent:ee,text:N,id3:Y}},w.generateIS=function(b,h,u){var L=b.samples,S=h.samples,D=this.typeSupported,I={},B=!Object(X.isFiniteNumber)(this._initPTS),j="audio/mp4",G,M,N;if(B&&(G=M=Infinity),b.config&&L.length&&(b.timescale=b.samplerate,b.isAAC||(D.mpeg?(j="audio/mpeg",b.codec=""):D.mp3&&(b.codec="mp3")),I.audio={id:"audio",container:j,codec:b.codec,initSegment:!b.isAAC&&D.mpeg?new Uint8Array(0):P.default.initSegment([b]),metadata:{channelCount:b.channelCount}},B&&(N=b.inputTimeScale,G=M=L[0].pts-Math.round(N*u))),h.sps&&h.pps&&S.length&&(h.timescale=h.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:P.default.initSegment([h]),metadata:{width:h.width,height:h.height}},B)){N=h.inputTimeScale;var Y=this.getVideoStartPts(S),ee=Math.round(N*u);M=Math.min(M,l(S[0].dts,Y)-ee),G=Math.min(G,Y-ee)}if(Object.keys(I).length)return this.ISGenerated=!0,B&&(this._initPTS=G,this._initDTS=M),{tracks:I,initPTS:G,timescale:N}},w.remuxVideo=function(b,h,u,L){var S=b.inputTimeScale,D=b.samples,I=[],B=D.length,j=this._initPTS,G=this.nextAvcDts,M=8,N,Y,ee,le=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,Pe=0,Se=!1;if(!u||G===null){var De=h*S,Le=D[0].pts-l(D[0].dts,D[0].pts);G=De-Le}for(var Ae=0;Ae<B;Ae++){var me=D[Ae];if(me.pts=l(me.pts-j,G),me.dts=l(me.dts-j,G),me.dts>me.pts){var de=9e4*.2;Pe=Math.max(Math.min(Pe,me.pts-me.dts),-1*de)}me.dts<D[Ae>0?Ae-1:Ae].dts&&(Se=!0)}Se&&D.sort(function(Lt,wt){var ft=Lt.dts-wt.dts,zt=Lt.pts-wt.pts;return ft||zt}),Y=D[0].dts,ee=D[D.length-1].dts;var re=Math.round((ee-Y)/(B-1));if(Pe<0){if(Pe<re*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-re,!0)+" ms");for(var he=Pe,ie=0;ie<B;ie++)D[ie].dts=he=Math.max(he,D[ie].pts-re),D[ie].pts=Math.max(he,D[ie].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(Pe,!0)+" ms to overcome this issue");for(var Re=0;Re<B;Re++)D[Re].dts=D[Re].dts+Pe}Y=D[0].dts}if(u){var oe=Y-G,ae=oe>re,ge=oe<-1;if(ae||ge){ae?_.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(oe,!0)+" ms ("+oe+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-oe,!0)+" ms ("+oe+"dts) overlapping between fragments detected"),Y=G;var we=D[0].pts-oe;D[0].dts=Y,D[0].pts=we,_.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(we,!0)+"/"+Object(d.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(oe,!0)+" ms")}}i&&(Y=Math.max(0,Y));for(var _e=0,Fe=0,Ue=0;Ue<B;Ue++){for(var Be=D[Ue],et=Be.units,Je=et.length,Ze=0,Ye=0;Ye<Je;Ye++)Ze+=et[Ye].data.length;Fe+=Ze,_e+=Je,Be.length=Ze,Be.dts=Math.max(Be.dts,Y),Be.pts=Math.max(Be.pts,Be.dts,0),le=Math.min(Be.pts,le),fe=Math.max(Be.pts,fe)}ee=D[B-1].dts;var dt=Fe+4*_e+8,qe;try{qe=new Uint8Array(dt)}catch(Lt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var ot=new DataView(qe.buffer);ot.setUint32(0,dt),qe.set(P.default.types.mdat,4);for(var Ie=0;Ie<B;Ie++){for(var Qe=D[Ie],st=Qe.units,je=0,Xe=0,Ce=st.length;Xe<Ce;Xe++){var be=st[Xe],Ee=be.data,ne=be.data.byteLength;ot.setUint32(M,ne),M+=4,qe.set(Ee,M),M+=ne,je+=4+ne}if(Ie<B-1)N=D[Ie+1].dts-Qe.dts;else{var se=this.config,ce=Qe.dts-D[Ie>0?Ie-1:Ie].dts;if(se.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(se.maxBufferHole*S),Ne=(L?le+L*S:this.nextAudioPts)-Qe.pts;Ne>ve?(N=Ne-ce,N<0&&(N=ce),_.logger.log("[mp4-remuxer]: It is approximately "+Ne/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=ce}else N=ce}var ke=Math.round(Qe.pts-Qe.dts);I.push(new g(Qe.key,N,je,ke))}if(I.length&&y&&y<70){var ze=I[0].flags;ze.dependsOn=2,ze.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=G=ee+N,this.isVideoContiguous=!0;var it=P.default.moof(b.sequenceNumber++,Y,p({},b,{samples:I})),ct="video",ht={data1:it,data2:qe,startPTS:le/S,endPTS:(fe+N)/S,startDTS:Y/S,endDTS:G/S,type:ct,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:b.dropped};return b.samples=[],b.dropped=0,console.assert(qe.length,"MDAT length must not be zero"),ht},w.remuxAudio=function(b,h,u,L,S){var D=b.inputTimeScale,I=b.samplerate?b.samplerate:D,B=D/I,j=b.isAAC?m:f,G=j*B,M=this._initPTS,N=!b.isAAC&&this.typeSupported.mpeg,Y=[],ee=b.samples,le=N?0:8,fe=this.nextAudioPts||-1,Pe=h*D;if(this.isAudioContiguous=u=u||ee.length&&fe>0&&(L&&Math.abs(Pe-fe)<9e3||Math.abs(l(ee[0].pts-M,Pe)-fe)<20*G),ee.forEach(function(Ee){Ee.pts=l(Ee.pts-M,Pe)}),!u||fe<0){if(ee=ee.filter(function(Ee){return Ee.pts>=0}),!ee.length)return;S===0?fe=0:L?fe=Math.max(0,Pe):fe=ee[0].pts}if(b.isAAC)for(var Se=S!==void 0,De=this.config.maxAudioFramesDrift,Le=0,Ae=fe;Le<ee.length;Le++){var me=ee[Le],de=me.pts,re=de-Ae,he=Math.abs(1e3*re/D);if(re<=-De*G&&Se)Le===0&&(_.logger.warn("Audio frame @ "+(de/D).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/D)+" ms."),this.nextAudioPts=fe=Ae=de);else if(re>=De*G&&he<T&&Se){var ie=Math.round(re/G);Ae=de-ie*G,Ae<0&&(ie--,Ae+=G),Le===0&&(this.nextAudioPts=fe=Ae),_.logger.warn("[mp4-remuxer]: Injecting "+ie+" audio frame @ "+(Ae/D).toFixed(3)+"s due to "+Math.round(1e3*re/D)+" ms gap.");for(var Re=0;Re<ie;Re++){var oe=Math.max(Ae,0),ae=F.default.getSilentFrame(b.manifestCodec||b.codec,b.channelCount);ae||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ae=me.unit.subarray()),ee.splice(Le,0,{unit:ae,pts:oe}),Ae+=G,Le++}}me.pts=Ae,Ae+=G}for(var ge=null,we=null,_e,Fe=0,Ue=ee.length;Ue--;)Fe+=ee[Ue].unit.byteLength;for(var Be=0,et=ee.length;Be<et;Be++){var Je=ee[Be],Ze=Je.unit,Ye=Je.pts;if(we!==null){var dt=Y[Be-1];dt.duration=Math.round((Ye-we)/B)}else if(u&&b.isAAC&&(Ye=fe),ge=Ye,Fe>0){Fe+=le;try{_e=new Uint8Array(Fe)}catch(Ee){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!N){var qe=new DataView(_e.buffer);qe.setUint32(0,Fe),_e.set(P.default.types.mdat,4)}}else return;_e.set(Ze,le);var ot=Ze.byteLength;le+=ot,Y.push(new g(!0,j,ot,0)),we=Ye}var Ie=Y.length;if(!Ie)return;var Qe=Y[Y.length-1];this.nextAudioPts=fe=we+B*Qe.duration;var st=N?new Uint8Array(0):P.default.moof(b.sequenceNumber++,ge/B,p({},b,{samples:Y}));b.samples=[];var je=ge/D,Xe=fe/D,Ce="audio",be={data1:st,data2:_e,startPTS:je,endPTS:Xe,startDTS:je,endDTS:Xe,type:Ce,hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,console.assert(_e.length,"MDAT length must not be zero"),be},w.remuxEmptyAudio=function(b,h,u,L){var S=b.inputTimeScale,D=b.samplerate?b.samplerate:S,I=S/D,B=this.nextAudioPts,j=(B!==null?B:L.startDTS*S)+this._initDTS,G=L.endDTS*S+this._initDTS,M=I*m,N=Math.ceil((G-j)/M),Y=F.default.getSilentFrame(b.manifestCodec||b.codec,b.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],le=0;le<N;le++){var fe=j+le*M;ee.push({unit:Y,pts:fe,dts:fe})}return b.samples=ee,this.remuxAudio(b,h,u,!1)},w.remuxID3=function(b,h){var u=b.samples.length;if(!u)return;for(var L=b.inputTimeScale,S=this._initPTS,D=this._initDTS,I=0;I<u;I++){var B=b.samples[I];B.pts=l(B.pts-S,h*L)/L,B.dts=l(B.dts-D,h*L)/L}var j=b.samples;return b.samples=[],{samples:j}},w.remuxText=function(b,h){var u=b.samples.length;if(!u)return;for(var L=b.inputTimeScale,S=this._initPTS,D=0;D<u;D++){var I=b.samples[D];I.pts=l(I.pts-S,h*L)/L}b.samples.sort(function(j,G){return j.pts-G.pts});var B=b.samples;return b.samples=[],{samples:B}},k}();function l(k,w){var x;if(w===null)return k;for(w<k?x=-8589934592:x=8589934592;Math.abs(k-w)>4294967296;)k+=x;return k}function E(k){for(var w=0;w<k.length;w++)if(k[w].key)return w;return-1}var g=function(w,x,b,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=x,this.size=b,this.cts=h,this.flags=new v(w)},v=function(w){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=w?2:1,this.isNonSync=w?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/polyfills/number.ts"),F=O("./src/utils/mp4-tools.ts"),P=O("./src/loader/fragment.ts"),W=O("./src/utils/logger.ts"),U=function(){function d(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var p=d.prototype;return p.destroy=function(){},p.resetTimeStamp=function(m){this.initPTS=m,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(m,f,y){this.audioCodec=f,this.videoCodec=y,this.generateInitSegment(m),this.emitInitSegment=!0},p.generateInitSegment=function(m){var f=this.audioCodec,y=this.videoCodec;if(!m||!m.byteLength){this.initTracks=void 0,this.initData=void 0;return}var a=this.initData=Object(F.parseInitSegment)(m);f||(f=A(a.audio,P.ElementaryStreamTypes.AUDIO)),y||(y=A(a.video,P.ElementaryStreamTypes.VIDEO));var i={};a.audio&&a.video?i.audiovideo={container:"video/mp4",codec:f+","+y,initSegment:m,id:"main"}:a.audio?i.audio={container:"audio/mp4",codec:f,initSegment:m,id:"audio"}:a.video?i.video={container:"video/mp4",codec:y,initSegment:m,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},p.remux=function(m,f,y,a,i){var s=this.initPTS,l=this.lastEndDTS,E={audio:void 0,video:void 0,text:a,id3:y,initSegment:void 0};Object(X.isFiniteNumber)(l)||(l=this.lastEndDTS=i||0);var g=f.samples;if(!g||!g.length)return E;var v={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(g),k=this.initData),!k||!k.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(X.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=_(k,g,l));var w=Object(F.getDuration)(g,k),x=l,b=w+x;Object(F.offsetStartDTS)(k,g,s),w>0?this.lastEndDTS=b:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!k.audio,u=!!k.video,L="";h&&(L+="audio"),u&&(L+="video");var S={data1:g,startPTS:x,startDTS:x,endPTS:b,endDTS:b,type:L,hasAudio:h,hasVideo:u,nb:1,dropped:0};return E.audio=S.type==="audio"?S:void 0,E.video=S.type!=="audio"?S:void 0,E.text=a,E.id3=y,E.initSegment=v,E},d}(),_=function(p,T,m){return Object(F.getStartDTS)(p,T)-m};function A(d,p){var T=d==null?void 0:d.codec;return T&&T.length>4?T:T==="hvc1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||p===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=U},"./src/task-loop.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return X});var X=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=F.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"CMCDVersion",function(){return X}),O.d(J,"CMCDObjectType",function(){return F}),O.d(J,"CMCDStreamingFormat",function(){return P}),O.d(J,"CMCDStreamType",function(){return W});var X=1,F;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(F||(F={}));var P;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(P||(P={}));var W;(function(U){U.VOD="v",U.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"HlsSkip",function(){return P}),O.d(J,"getSkipValue",function(){return W}),O.d(J,"HlsUrlParameters",function(){return U}),O.d(J,"Level",function(){return _});function X(A,d){for(var p=0;p<d.length;p++){var T=d[p];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(A,T.key,T)}}function F(A,d,p){return d&&X(A.prototype,d),p&&X(A,p),A}var P;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(P||(P={}));function W(A,d){var p=A.canSkipUntil,T=A.canSkipDateRanges,m=A.endSN,f=d!==void 0?d-m:0;return p&&f<p?T?P.v2:P.Yes:P.No}var U=function(){function A(p,T,m){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=T,this.skip=m}var d=A.prototype;return d.addDirectives=function(T){var m=new self.URL(T);return this.msn!==void 0&&m.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&m.searchParams.set("_HLS_part",this.part.toString()),this.skip&&m.searchParams.set("_HLS_skip",this.skip),m.toString()},A}(),_=function(){function A(d){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[d.url],this.attrs=d.attrs,this.bitrate=d.bitrate,d.details&&(this.details=d.details),this.id=d.id||0,this.name=d.name,this.width=d.width||0,this.height=d.height||0,this.audioCodec=d.audioCodec,this.videoCodec=d.videoCodec,this.unknownCodecs=d.unknownCodecs,this.codecSet=[d.videoCodec,d.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return F(A,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(p){var T=p%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),A}()},"./src/types/loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"PlaylistContextType",function(){return X}),O.d(J,"PlaylistLevelType",function(){return F});var X;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(X||(X={}));var F;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"ChunkMetadata",function(){return X});var X=function(W,U,_,A,d,p){A===void 0&&(A=0),d===void 0&&(d=-1),p===void 0&&(p=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=W,this.sn=U,this.id=_,this.size=A,this.part=d,this.partial=p};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"AttrList",function(){return P});var X=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function W(_){typeof _=="string"&&(_=W.parseAttrList(_));for(var A in _)_.hasOwnProperty(A)&&(this[A]=_[A])}var U=W.prototype;return U.decimalInteger=function(A){var d=parseInt(this[A],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},U.hexadecimalInteger=function(A){if(this[A]){var d=(this[A]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var p=new Uint8Array(d.length/2),T=0;T<d.length/2;T++)p[T]=parseInt(d.slice(T*2,T*2+2),16);return p}else return null},U.hexadecimalIntegerAsNumber=function(A){var d=parseInt(this[A],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},U.decimalFloatingPoint=function(A){return parseFloat(this[A])},U.optionalFloat=function(A,d){var p=this[A];return p?parseFloat(p):d},U.enumeratedString=function(A){return this[A]},U.bool=function(A){return this[A]==="YES"},U.decimalResolution=function(A){var d=X.exec(this[A]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},W.parseAttrList=function(A){var d,p={},T='"';for(F.lastIndex=0;(d=F.exec(A))!==null;){var m=d[2];m.indexOf(T)===0&&m.lastIndexOf(T)===m.length-1&&(m=m.slice(1,-1)),p[d[1]]=m}return p},W}()},"./src/utils/binary-search.ts":function(ue,J,O){"use strict";O.r(J);var X={search:function(P,W){for(var U=0,_=P.length-1,A=null,d=null;U<=_;){A=(U+_)/2|0,d=P[A];var p=W(d);if(p>0)U=A+1;else if(p<0)_=A-1;else return d}return null}};J.default=X},"./src/utils/buffer-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"BufferHelper",function(){return P});var X=O("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function W(){}return W.isBuffered=function(_,A){try{if(_){for(var d=W.getBuffered(_),p=0;p<d.length;p++)if(A>=d.start(p)&&A<=d.end(p))return!0}}catch(T){}return!1},W.bufferInfo=function(_,A,d){try{if(_){var p=W.getBuffered(_),T=[],m;for(m=0;m<p.length;m++)T.push({start:p.start(m),end:p.end(m)});return this.bufferedInfo(T,A,d)}}catch(f){}return{len:0,start:A,end:A,nextStart:void 0}},W.bufferedInfo=function(_,A,d){A=Math.max(0,A),_.sort(function(v,k){var w=v.start-k.start;return w||k.end-v.end});var p=[];if(d)for(var T=0;T<_.length;T++){var m=p.length;if(m){var f=p[m-1].end;_[T].start-f<d?_[T].end>f&&(p[m-1].end=_[T].end):p.push(_[T])}else p.push(_[T])}else p=_;for(var y=0,a,i=A,s=A,l=0;l<p.length;l++){var E=p[l].start,g=p[l].end;if(A+d>=E&&A<g)i=E,s=g,y=s-A;else if(A+d<E){a=E;break}}return{len:y,start:i||0,end:s||0,nextStart:a}},W.getBuffered=function(_){try{return _.buffered}catch(A){return X.logger.log("failed to get media.buffered",A),F}},W}()},"./src/utils/cea-608-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"Row",function(){return s}),O.d(J,"CaptionScreen",function(){return l});var X=O("./src/utils/logger.ts"),F={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(b){var h=b;return F.hasOwnProperty(b)&&(h=F[b]),String.fromCharCode(h)},W=15,U=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},T=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],m;(function(x){x[x.ERROR=0]="ERROR",x[x.TEXT=1]="TEXT",x[x.WARNING=2]="WARNING",x[x.INFO=2]="INFO",x[x.DEBUG=3]="DEBUG",x[x.DATA=3]="DATA"})(m||(m={}));var f=function(){function x(){this.time=null,this.verboseLevel=m.ERROR}var b=x.prototype;return b.log=function(u,L){this.verboseLevel>=u&&X.logger.log(this.time+" ["+u+"] "+L)},x}(),y=function(b){for(var h=[],u=0;u<b.length;u++)h.push(b[u].toString(16));return h},a=function(){function x(h,u,L,S,D){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=u||!1,this.italics=L||!1,this.background=S||"black",this.flash=D||!1}var b=x.prototype;return b.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},b.setStyles=function(u){for(var L=["foreground","underline","italics","background","flash"],S=0;S<L.length;S++){var D=L[S];u.hasOwnProperty(D)&&(this[D]=u[D])}},b.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},b.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},b.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},b.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},x}(),i=function(){function x(h,u,L,S,D,I){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new a(u,L,S,D,I)}var b=x.prototype;return b.reset=function(){this.uchar=" ",this.penState.reset()},b.setChar=function(u,L){this.uchar=u,this.penState.copy(L)},b.setPenState=function(u){this.penState.copy(u)},b.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},b.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},b.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},x}(),s=function(){function x(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<U;u++)this.chars.push(new i);this.logger=h,this.pos=0,this.currPenState=new a}var b=x.prototype;return b.equals=function(u){for(var L=!0,S=0;S<U;S++)if(!this.chars[S].equals(u.chars[S])){L=!1;break}return L},b.copy=function(u){for(var L=0;L<U;L++)this.chars[L].copy(u.chars[L])},b.isEmpty=function(){for(var u=!0,L=0;L<U;L++)if(!this.chars[L].isEmpty()){u=!1;break}return u},b.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(m.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(m.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},b.moveCursor=function(u){var L=this.pos+u;if(u>1)for(var S=this.pos+1;S<L+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(L)},b.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},b.insertChar=function(u){u>=144&&this.backSpace();var L=P(u);if(this.pos>=U){this.logger.log(m.ERROR,"Cannot insert "+u.toString(16)+" ("+L+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(L,this.currPenState),this.moveCursor(1)},b.clearFromPos=function(u){var L;for(L=u;L<U;L++)this.chars[L].reset()},b.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},b.clearToEndOfRow=function(){this.clearFromPos(this.pos)},b.getTextString=function(){for(var u=[],L=!0,S=0;S<U;S++){var D=this.chars[S].uchar;D!==" "&&(L=!1),u.push(D)}return L?"":u.join("")},b.setPenStyles=function(u){this.currPenState.setStyles(u);var L=this.chars[this.pos];L.setPenState(this.currPenState)},x}(),l=function(){function x(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<W;u++)this.rows.push(new s(h));this.logger=h,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var b=x.prototype;return b.reset=function(){for(var u=0;u<W;u++)this.rows[u].clear();this.currRow=W-1},b.equals=function(u){for(var L=!0,S=0;S<W;S++)if(!this.rows[S].equals(u.rows[S])){L=!1;break}return L},b.copy=function(u){for(var L=0;L<W;L++)this.rows[L].copy(u.rows[L])},b.isEmpty=function(){for(var u=!0,L=0;L<W;L++)if(!this.rows[L].isEmpty()){u=!1;break}return u},b.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},b.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},b.insertChar=function(u){var L=this.rows[this.currRow];L.insertChar(u)},b.setPen=function(u){var L=this.rows[this.currRow];L.setPenStyles(u)},b.moveCursor=function(u){var L=this.rows[this.currRow];L.moveCursor(u)},b.setCursor=function(u){this.logger.log(m.INFO,"setCursor: "+u);var L=this.rows[this.currRow];L.setCursor(u)},b.setPAC=function(u){this.logger.log(m.INFO,"pacData = "+JSON.stringify(u));var L=u.row-1;if(this.nrRollUpRows&&L<this.nrRollUpRows-1&&(L=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==L){for(var S=0;S<W;S++)this.rows[S].clear();var D=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var B=I.rows[D].cueStartTime,j=this.logger.time;if(B&&j!==null&&B<j)for(var G=0;G<this.nrRollUpRows;G++)this.rows[L-this.nrRollUpRows+G+1].copy(I.rows[D+G])}}this.currRow=L;var M=this.rows[this.currRow];if(u.indent!==null){var N=u.indent,Y=Math.max(N-1,0);M.setCursor(u.indent),u.color=M.chars[Y].penState.foreground}var ee={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(ee)},b.setBkgData=function(u){this.logger.log(m.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},b.setRollUpRows=function(u){this.nrRollUpRows=u},b.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(m.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(m.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,L=this.rows.splice(u,1)[0];L.clear(),this.rows.splice(this.currRow,0,L),this.logger.log(m.INFO,"Rolling up")},b.getDisplayText=function(u){u=u||!1;for(var L=[],S="",D=-1,I=0;I<W;I++){var B=this.rows[I].getTextString();B&&(D=I+1,u?L.push("Row "+D+": '"+B+"'"):L.push(B.trim()))}return L.length>0&&(u?S="["+L.join(" | ")+"]":S=L.join(`
|
|
`)),S},b.getTextAndFormat=function(){return this.rows},x}(),E=function(){function x(h,u,L){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=h,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new l(L),this.nonDisplayedMemory=new l(L),this.lastOutputScreen=new l(L),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=L}var b=x.prototype;return b.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},b.getHandler=function(){return this.outputFilter},b.setHandler=function(u){this.outputFilter=u},b.setPAC=function(u){this.writeScreen.setPAC(u)},b.setBkgData=function(u){this.writeScreen.setBkgData(u)},b.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(m.INFO,"MODE="+u),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=u},b.insertChars=function(u){for(var L=0;L<u.length;L++)this.writeScreen.insertChar(u[L]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(m.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(m.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},b.ccRCL=function(){this.logger.log(m.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},b.ccBS=function(){if(this.logger.log(m.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},b.ccAOF=function(){},b.ccAON=function(){},b.ccDER=function(){this.logger.log(m.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},b.ccRU=function(u){this.logger.log(m.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},b.ccFON=function(){this.logger.log(m.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},b.ccRDC=function(){this.logger.log(m.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},b.ccTR=function(){this.logger.log(m.INFO,"TR"),this.setMode("MODE_TEXT")},b.ccRTD=function(){this.logger.log(m.INFO,"RTD"),this.setMode("MODE_TEXT")},b.ccEDM=function(){this.logger.log(m.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},b.ccCR=function(){this.logger.log(m.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},b.ccENM=function(){this.logger.log(m.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},b.ccEOC=function(){if(this.logger.log(m.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(m.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},b.ccTO=function(u){this.logger.log(m.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},b.ccMIDROW=function(u){var L={flash:!1};if(L.underline=u%2===1,L.italics=u>=46,L.italics)L.foreground="white";else{var S=Math.floor(u/2)-16,D=["white","green","blue","cyan","red","yellow","magenta"];L.foreground=D[S]}this.logger.log(m.INFO,"MIDROW: "+JSON.stringify(L)),this.writeScreen.setPen(L)},b.outputDataUpdate=function(u){u===void 0&&(u=!1);var L=this.logger.time;if(L===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=L:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,L,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:L),this.lastOutputScreen.copy(this.displayedMemory))},b.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},x}(),g=function(){function x(h,u,L){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new f;this.channels=[null,new E(h,u,S),new E(h+1,L,S)],this.cmdHistory=w(),this.logger=S}var b=x.prototype;return b.getHandler=function(u){return this.channels[u].getHandler()},b.setHandler=function(u,L){this.channels[u].setHandler(L)},b.addData=function(u,L){var S,D,I,B=!1;this.logger.time=u;for(var j=0;j<L.length;j+=2){if(D=L[j]&127,I=L[j+1]&127,D===0&&I===0)continue;if(this.logger.log(m.DATA,"["+y([L[j],L[j+1]])+"] -> ("+y([D,I])+")"),S=this.parseCmd(D,I),S||(S=this.parseMidrow(D,I)),S||(S=this.parsePAC(D,I)),S||(S=this.parseBackgroundAttributes(D,I)),!S&&(B=this.parseChars(D,I),B)){var G=this.currentChannel;if(G&&G>0){var M=this.channels[G];M.insertChars(B)}else this.logger.log(m.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!B&&this.logger.log(m.WARNING,"Couldn't parse cleaned data "+y([D,I])+" orig: "+y([L[j],L[j+1]]))}},b.parseCmd=function(u,L){var S=this.cmdHistory,D=(u===20||u===28||u===21||u===29)&&L>=32&&L<=47,I=(u===23||u===31)&&L>=33&&L<=35;if(!(D||I))return!1;if(k(u,L,S))return v(null,null,S),this.logger.log(m.DEBUG,"Repeated command ("+y([u,L])+") is dropped"),!0;var B=u===20||u===21||u===23?1:2,j=this.channels[B];return u===20||u===21||u===28||u===29?L===32?j.ccRCL():L===33?j.ccBS():L===34?j.ccAOF():L===35?j.ccAON():L===36?j.ccDER():L===37?j.ccRU(2):L===38?j.ccRU(3):L===39?j.ccRU(4):L===40?j.ccFON():L===41?j.ccRDC():L===42?j.ccTR():L===43?j.ccRTD():L===44?j.ccEDM():L===45?j.ccCR():L===46?j.ccENM():L===47&&j.ccEOC():j.ccTO(L-32),v(u,L,S),this.currentChannel=B,!0},b.parseMidrow=function(u,L){var S=0;if((u===17||u===25)&&L>=32&&L<=47){if(u===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(m.ERROR,"Mismatch channel in midrow parsing"),!1;var D=this.channels[S];return D?(D.ccMIDROW(L),this.logger.log(m.DEBUG,"MIDROW ("+y([u,L])+")"),!0):!1}return!1},b.parsePAC=function(u,L){var S,D=this.cmdHistory,I=(u>=17&&u<=23||u>=25&&u<=31)&&L>=64&&L<=127,B=(u===16||u===24)&&L>=64&&L<=95;if(!(I||B))return!1;if(k(u,L,D))return v(null,null,D),!0;var j=u<=23?1:2;L>=64&&L<=95?S=j===1?_[u]:d[u]:S=j===1?A[u]:p[u];var G=this.channels[j];return G?(G.setPAC(this.interpretPAC(S,L)),v(u,L,D),this.currentChannel=j,!0):!1},b.interpretPAC=function(u,L){var S,D={color:null,italics:!1,indent:null,underline:!1,row:u};return L>95?S=L-96:S=L-64,D.underline=(S&1)===1,S<=13?D.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(D.italics=!0,D.color="white"):D.indent=Math.floor((S-16)/2)*4,D},b.parseChars=function(u,L){var S,D=null,I=null;if(u>=25?(S=2,I=u-8):(S=1,I=u),I>=17&&I<=19){var B;I===17?B=L+80:I===18?B=L+112:B=L+144,this.logger.log(m.INFO,"Special char '"+P(B)+"' in channel "+S),D=[B]}else u>=32&&u<=127&&(D=L===0?[u]:[u,L]);if(D){var j=y(D);this.logger.log(m.DEBUG,"Char codes = "+j.join(",")),v(u,L,this.cmdHistory)}return D},b.parseBackgroundAttributes=function(u,L){var S=(u===16||u===24)&&L>=32&&L<=47,D=(u===23||u===31)&&L>=45&&L<=47;if(!(S||D))return!1;var I,B={};u===16||u===24?(I=Math.floor((L-32)/2),B.background=T[I],L%2===1&&(B.background=B.background+"_semi")):L===45?B.background="transparent":(B.foreground="black",L===47&&(B.underline=!0));var j=u<=23?1:2,G=this.channels[j];return G.setBkgData(B),v(u,L,this.cmdHistory),!0},b.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var L=this.channels[u];L&&L.reset()}this.cmdHistory=w()},b.cueSplitAtTime=function(u){for(var L=0;L<this.channels.length;L++){var S=this.channels[L];S&&S.cueSplitAtTime(u)}},x}();function v(x,b,h){h.a=x,h.b=b}function k(x,b,h){return h.a===x&&h.b===b}function w(){return{a:null,b:null}}J.default=g},"./src/utils/codecs.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"isCodecType",function(){return F}),O.d(J,"isCodecSupportedInMp4",function(){return P});var X={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function F(W,U){var _=X[U];return!!_&&_[W.slice(0,4)]===!0}function P(W,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/vttparser.ts"),F=O("./src/utils/webvtt-parser.ts"),P=O("./src/utils/texttrack-utils.ts"),W=/\s/,U={newCue:function(A,d,p,T){for(var m=[],f,y,a,i,s,l=self.VTTCue||self.TextTrackCue,E=0;E<T.rows.length;E++)if(f=T.rows[E],a=!0,i=0,s="",!f.isEmpty()){for(var g=0;g<f.chars.length;g++)W.test(f.chars[g].uchar)&&a?i++:(s+=f.chars[g].uchar,a=!1);f.cueStartTime=d,d===p&&(p+=1e-4),i>=16?i--:i++;var v=Object(X.fixLineBreaks)(s.trim()),k=Object(F.generateCueId)(d,p,v);(!A||!A.cues||!A.cues.getCueById(k))&&(y=new l(d,p,v),y.id=k,y.line=E+1,y.align="left",y.position=10+Math.min(80,Math.floor(i*8/32)*10),m.push(y))}return A&&m.length&&(m.sort(function(w,x){return w.line==="auto"||x.line==="auto"?0:w.line>8&&x.line>8?x.line-w.line:w.line-x.line}),m.forEach(function(w){return Object(P.addCueToTrack)(A,w)})),m}};J.default=U},"./src/utils/discontinuities.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"findFirstFragWithCC",function(){return W}),O.d(J,"shouldAlignOnDiscontinuities",function(){return U}),O.d(J,"findDiscontinuousReferenceFrag",function(){return _}),O.d(J,"adjustSlidingStart",function(){return d}),O.d(J,"alignStream",function(){return p}),O.d(J,"alignPDT",function(){return m}),O.d(J,"alignFragmentByPDTDelta",function(){return f}),O.d(J,"alignMediaPlaylistByPDT",function(){return y});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts"),P=O("./src/controller/level-helper.ts");function W(a,i){for(var s=null,l=0,E=a.length;l<E;l++){var g=a[l];if(g&&g.cc===i){s=g;break}}return s}function U(a,i,s){return!!(i.details&&(s.endCC>s.startCC||a&&a.cc<s.startCC))}function _(a,i){var s=a.fragments,l=i.fragments;if(!l.length||!s.length){F.logger.log("No fragments to align");return}var E=W(s,l[0].cc);if(!E||E&&!E.startPTS){F.logger.log("No frag in previous level to align on");return}return E}function A(a,i){if(a){var s=a.start+i;a.start=a.startPTS=s,a.endPTS=s+a.duration}}function d(a,i){for(var s=i.fragments,l=0,E=s.length;l<E;l++)A(s[l],a);i.fragmentHint&&A(i.fragmentHint,a),i.alignedSliding=!0}function p(a,i,s){if(!i)return;T(a,s,i),!s.alignedSliding&&i.details&&m(s,i.details),!s.alignedSliding&&i.details&&!s.skippedSegments&&Object(P.adjustSliding)(i.details,s)}function T(a,i,s){if(U(a,s,i)){var l=_(s.details,i);l&&Object(X.isFiniteNumber)(l.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),d(l.start,i))}}function m(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=a.fragments[0].programDateTime,E=(l-s)/1e3+i.fragments[0].start;E&&Object(X.isFiniteNumber)(E)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+E.toFixed(3)+" "+a.url+" "),d(E,a))}function f(a,i){var s=a.programDateTime;if(!s)return;var l=(s-i)/1e3;a.start=a.startPTS=l,a.endPTS=l+a.duration}function y(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=i.fragments[0].start,E=s-l*1e3;a.fragments.forEach(function(g){f(g,E)}),a.fragmentHint&&f(a.fragmentHint,E),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/ewma.ts"),F=function(){function P(U,_,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new X.default(U),this.fast_=new X.default(_)}var W=P.prototype;return W.update=function(_,A){var d=this.slow_,p=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new X.default(_,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new X.default(A,p.getEstimate(),p.getTotalWeight()))},W.sample=function(_,A){_=Math.max(_,this.minDelayMs_);var d=8*A,p=_/1e3,T=d/p;this.fast_.sample(p,T),this.slow_.sample(p,T)},W.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},P}();J.default=F},"./src/utils/ewma.ts":function(ue,J,O){"use strict";O.r(J);var X=function(){function F(W,U,_){U===void 0&&(U=0),_===void 0&&(_=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_=U,this.totalWeight_=_}var P=F.prototype;return P.sample=function(U,_){var A=Math.pow(this.alpha_,U);this.estimate_=_*(1-A)+A*this.estimate_,this.totalWeight_+=U},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},F}();J.default=X},"./src/utils/fetch-loader.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"fetchSupported",function(){return f});var X=O("./src/polyfills/number.ts"),F=O("./src/loader/load-stats.ts"),P=O("./src/demux/chunk-cache.ts");function W(l,E){l.prototype=Object.create(E.prototype),l.prototype.constructor=l,p(l,E)}function U(l){var E=typeof Map=="function"?new Map:void 0;return U=function(v){if(v===null||!d(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E!="undefined"){if(E.has(v))return E.get(v);E.set(v,k)}function k(){return _(v,arguments,T(this).constructor)}return k.prototype=Object.create(v.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),p(k,v)},U(l)}function _(l,E,g){return A()?_=Reflect.construct:_=function(k,w,x){var b=[null];b.push.apply(b,w);var h=Function.bind.apply(k,b),u=new h;return x&&p(u,x.prototype),u},_.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function d(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function p(l,E){return p=Object.setPrototypeOf||function(v,k){return v.__proto__=k,v},p(l,E)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},T(l)}function m(){return m=Object.assign||function(l){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(l[v]=g[v])}return l},m.apply(this,arguments)}function f(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var y=function(){function l(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||i,this.controller=new self.AbortController,this.stats=new F.LoadStats}var E=l.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(v,k,w){var x=this,b=this.stats;if(b.loading.start)throw new Error("Loader can only be used once.");b.loading.start=self.performance.now();var h=a(v,this.controller.signal),u=w.onProgress,L=v.responseType==="arraybuffer",S=L?"byteLength":"length";this.context=v,this.config=k,this.callbacks=w,this.request=this.fetchSetup(v,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){x.abortInternal(),w.onTimeout(b,v,x.response)},k.timeout),self.fetch(this.request).then(function(D){if(x.response=x.loader=D,!D.ok){var I=D.status,B=D.statusText;throw new s(B||"fetch, bad network response",I,D)}return b.loading.first=Math.max(self.performance.now(),b.loading.start),b.total=parseInt(D.headers.get("Content-Length")||"0"),u&&Object(X.isFiniteNumber)(k.highWaterMark)?x.loadProgressively(D,b,v,k.highWaterMark,u):L?D.arrayBuffer():D.text()}).then(function(D){var I=x.response;self.clearTimeout(x.requestTimeout),b.loading.end=Math.max(self.performance.now(),b.loading.first),b.loaded=b.total=D[S];var B={url:I.url,data:D};u&&!Object(X.isFiniteNumber)(k.highWaterMark)&&u(b,v,D,I),w.onSuccess(B,b,v,I)}).catch(function(D){if(self.clearTimeout(x.requestTimeout),b.aborted)return;var I=D.code||0;w.onError({code:I,text:D.message},v,D.details)})},E.getCacheAge=function(){var v=null;if(this.response){var k=this.response.headers.get("age");v=k?parseFloat(k):null}return v},E.loadProgressively=function(v,k,w,x,b){x===void 0&&(x=0);var h=new P.default,u=v.body.getReader(),L=function S(){return u.read().then(function(D){if(D.done)return h.dataLength&&b(k,w,h.flush(),v),Promise.resolve(new ArrayBuffer(0));var I=D.value,B=I.length;return k.loaded+=B,B<x||h.dataLength?(h.push(I),h.dataLength>=x&&b(k,w,h.flush(),v)):b(k,w,I,v),S()}).catch(function(){return Promise.reject()})};return L()},l}();function a(l,E){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(m({},l.headers))};return l.rangeEnd&&g.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),g}function i(l,E){return new self.Request(l.url,E)}var s=function(l){W(E,l);function E(g,v,k){var w;return w=l.call(this,g)||this,w.code=void 0,w.details=void 0,w.code=v,w.details=k,w}return E}(U(Error));J.default=y},"./src/utils/imsc1-ttml-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"IMSC1_CODEC",function(){return d}),O.d(J,"parseIMSC1",function(){return f});var X=O("./src/utils/mp4-tools.ts"),F=O("./src/utils/vttparser.ts"),P=O("./src/utils/vttcue.ts"),W=O("./src/demux/id3.ts"),U=O("./src/utils/timescale-conversion.ts"),_=O("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(x){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var u in h)Object.prototype.hasOwnProperty.call(h,u)&&(x[u]=h[u])}return x},A.apply(this,arguments)}var d="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,T=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,m={left:"start",center:"center",right:"end",start:"start",end:"end"};function f(x,b,h,u,L){var S=Object(X.findBox)(new Uint8Array(x),["mdat"]);if(S.length===0){L(new Error("Could not parse IMSC1 mdat"));return}var D=S[0],I=Object(W.utf8ArrayToStr)(new Uint8Array(x,D.start,D.end-D.start)),B=Object(U.toTimescaleFromScale)(b,1,h);try{u(y(I,B))}catch(j){L(j)}}function y(x,b){var h=new DOMParser,u=h.parseFromString(x,"text/xml"),L=u.getElementsByTagName("tt")[0];if(!L)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(S).reduce(function(M,N){return M[N]=L.getAttribute("ttp:"+N)||S[N],M},{}),I=L.getAttribute("xml:space")!=="preserve",B=i(a(L,"styling","style")),j=i(a(L,"layout","region")),G=a(L,"body","[begin]");return[].map.call(G,function(M){var N=s(M,I);if(!N||!M.hasAttribute("begin"))return null;var Y=v(M.getAttribute("begin"),D),ee=v(M.getAttribute("dur"),D),le=v(M.getAttribute("end"),D);if(Y===null)throw g(M);if(le===null){if(ee===null)throw g(M);le=Y+ee}var fe=new P.default(Y-b,le-b,N);fe.id=Object(_.generateCueId)(fe.startTime,fe.endTime,fe.text);var Pe=j[M.getAttribute("region")],Se=B[M.getAttribute("style")];fe.position=10,fe.size=80;var De=l(Pe,Se),Le=De.textAlign;if(Le){var Ae=m[Le];Ae&&(fe.lineAlign=Ae),fe.align=Le}return A(fe,De),fe}).filter(function(M){return M!==null})}function a(x,b,h){var u=x.getElementsByTagName(b)[0];return u?[].slice.call(u.querySelectorAll(h)):[]}function i(x){return x.reduce(function(b,h){var u=h.getAttribute("xml:id");return u&&(b[u]=h),b},{})}function s(x,b){return[].slice.call(x.childNodes).reduce(function(h,u,L){var S;return u.nodeName==="br"&&L?h+`
|
|
`:(S=u.childNodes)!==null&&S!==void 0&&S.length?s(u,b):b?h+u.textContent.trim().replace(/\s+/g," "):h+u.textContent},"")}function l(x,b){var h="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(L,S){var D=E(b,h,S)||E(x,h,S);return D&&(L[S]=D),L},{})}function E(x,b,h){return x.hasAttributeNS(b,h)?x.getAttributeNS(b,h):null}function g(x){return new Error("Could not parse ttml timestamp "+x)}function v(x,b){if(!x)return null;var h=Object(F.parseTimeStamp)(x);return h===null&&(p.test(x)?h=k(x,b):T.test(x)&&(h=w(x,b))),h}function k(x,b){var h=p.exec(x),u=(h[4]|0)+(h[5]|0)/b.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+u/b.frameRate}function w(x,b){var h=T.exec(x),u=Number(h[1]),L=h[2];switch(L){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/b.frameRate;case"t":return u/b.tickRate}return u}},"./src/utils/logger.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"enableLogs",function(){return _}),O.d(J,"logger",function(){return A});var X=function(){},F={trace:X,debug:X,log:X,warn:X,info:X,error:X},P=F;function W(d){var p=self.console[d];return p?p.bind(self.console,"["+d+"] >"):X}function U(d){for(var p=arguments.length,T=new Array(p>1?p-1:0),m=1;m<p;m++)T[m-1]=arguments[m];T.forEach(function(f){P[f]=d[f]?d[f].bind(d):W(f)})}function _(d){if(self.console&&d===!0||typeof d=="object"){U(d,"debug","log","info","warn","error");try{P.log()}catch(p){P=F}}else P=F}var A=P},"./src/utils/mediakeys-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"KeySystems",function(){return X}),O.d(J,"requestMediaKeySystemAccess",function(){return F});var X;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(X||(X={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"getMediaSource",function(){return X});function X(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"bin2str",function(){return U}),O.d(J,"readUint16",function(){return _}),O.d(J,"readUint32",function(){return A}),O.d(J,"writeUint32",function(){return d}),O.d(J,"findBox",function(){return p}),O.d(J,"parseSegmentIndex",function(){return T}),O.d(J,"parseInitSegment",function(){return m}),O.d(J,"getStartDTS",function(){return f}),O.d(J,"getDuration",function(){return y}),O.d(J,"computeRawDurationFromSamples",function(){return a}),O.d(J,"offsetStartDTS",function(){return i}),O.d(J,"segmentValidRange",function(){return s}),O.d(J,"appendUint8Array",function(){return l});var X=O("./src/utils/typed-array.ts"),F=O("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,W=[].push;function U(E){return String.fromCharCode.apply(null,E)}function _(E,g){"data"in E&&(g+=E.start,E=E.data);var v=E[g]<<8|E[g+1];return v<0?65536+v:v}function A(E,g){"data"in E&&(g+=E.start,E=E.data);var v=E[g]<<24|E[g+1]<<16|E[g+2]<<8|E[g+3];return v<0?4294967296+v:v}function d(E,g,v){"data"in E&&(g+=E.start,E=E.data),E[g]=v>>24,E[g+1]=v>>16&255,E[g+2]=v>>8&255,E[g+3]=v&255}function p(E,g){var v=[];if(!g.length)return v;var k,w,x;"data"in E?(k=E.data,w=E.start,x=E.end):(k=E,w=0,x=k.byteLength);for(var b=w;b<x;){var h=A(k,b),u=U(k.subarray(b+4,b+8)),L=h>1?b+h:x;if(u===g[0])if(g.length===1)v.push({data:k,start:b+8,end:L});else{var S=p({data:k,start:b+8,end:L},g.slice(1));S.length&&W.apply(v,S)}b=L}return v}function T(E){var g=p(E,["moov"]),v=g[0],k=v?v.end:null,w=p(E,["sidx"]);if(!w||!w[0])return null;var x=[],b=w[0],h=b.data[0],u=h===0?8:16,L=A(b,u);u+=4;var S=0,D=0;h===0?u+=8:u+=16,u+=2;var I=b.end+D,B=_(b,u);u+=2;for(var j=0;j<B;j++){var G=u,M=A(b,G);G+=4;var N=M&2147483647,Y=(M&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=A(b,G);G+=4,x.push({referenceSize:N,subsegmentDuration:ee,info:{duration:ee/L,start:I,end:I+N-1}}),I+=N,G+=4,u=G}return{earliestPresentationTime:S,timescale:L,version:h,referencesCount:B,references:x,moovEndOffset:k}}function m(E){for(var g=[],v=p(E,["moov","trak"]),k=0;k<v.length;k++){var w=v[k],x=p(w,["tkhd"])[0];if(x){var b=x.data[x.start],h=b===0?12:20,u=A(x,h),L=p(w,["mdia","mdhd"])[0];if(L){b=L.data[L.start],h=b===0?12:20;var S=A(L,h),D=p(w,["mdia","hdlr"])[0];if(D){var I=U(D.data.subarray(D.start+8,D.start+12)),B={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[I];if(B){var j=p(w,["mdia","minf","stbl","stsd"])[0],G=void 0;j&&(G=U(j.data.subarray(j.start+12,j.start+16))),g[u]={timescale:S,type:B},g[B]={timescale:S,id:u,codec:G}}}}}}var M=p(E,["moov","mvex","trex"]);return M.forEach(function(N){var Y=A(N,4),ee=g[Y];ee&&(ee.default={duration:A(N,12),flags:A(N,20)})}),g}function f(E,g){return p(g,["moof","traf"]).reduce(function(v,k){var w=p(k,["tfdt"])[0],x=w.data[w.start],b=p(k,["tfhd"]).reduce(function(h,u){var L=A(u,4),S=E[L];if(S){var D=A(w,4);x===1&&(D*=Math.pow(2,32),D+=A(w,8));var I=S.timescale||9e4,B=D/I;if(isFinite(B)&&(h===null||B<h))return B}return h},null);return b!==null&&isFinite(b)&&(v===null||b<v)?b:v},null)||0}function y(E,g){for(var v=0,k=0,w=0,x=p(E,["moof","traf"]),b=0;b<x.length;b++){var h=x[b],u=p(h,["tfhd"])[0],L=A(u,4),S=g[L];if(!S)continue;var D=S.default,I=A(u,0)|(D==null?void 0:D.flags),B=D==null?void 0:D.duration;I&8&&(I&2?B=A(u,12):B=A(u,8));for(var j=S.timescale||9e4,G=p(h,["trun"]),M=0;M<G.length;M++){if(B){var N=A(G[M],4);v=B*N}else v=a(G[M]);S.type===F.ElementaryStreamTypes.VIDEO?k+=v/j:S.type===F.ElementaryStreamTypes.AUDIO&&(w+=v/j)}}if(k===0&&w===0){var Y=T(E);if(Y!=null&&Y.references)return Y.references.reduce(function(ee,le){return ee+le.info.duration||0},0)}return k||w}function a(E){var g=A(E,0),v=8;g&1&&(v+=4),g&4&&(v+=4);for(var k=0,w=A(E,4),x=0;x<w;x++){if(g&256){var b=A(E,v);k+=b,v+=4}g&512&&(v+=4),g&1024&&(v+=4),g&2048&&(v+=4)}return k}function i(E,g,v){p(g,["moof","traf"]).forEach(function(k){p(k,["tfhd"]).forEach(function(w){var x=A(w,4),b=E[x];if(!b)return;var h=b.timescale||9e4;p(k,["tfdt"]).forEach(function(u){var L=u.data[u.start],S=A(u,4);if(L===0)d(u,4,S-v*h);else{S*=Math.pow(2,32),S+=A(u,8),S-=v*h,S=Math.max(S,0);var D=Math.floor(S/(P+1)),I=Math.floor(S%(P+1));d(u,4,D),d(u,8,I)}})})})}function s(E){var g={valid:null,remainder:null},v=p(E,["moof"]);if(v){if(v.length<2)return g.remainder=E,g}else return g;var k=v[v.length-1];return g.valid=Object(X.sliceUint8)(E,0,k.start-8),g.remainder=Object(X.sliceUint8)(E,k.start-8),g}function l(E,g){var v=new Uint8Array(E.length+g.length);return v.set(E),v.set(g,E.length),v}},"./src/utils/output-filter.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"default",function(){return X});var X=function(){function F(W,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=U}var P=F.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(U,_,A){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=_,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"sendAddTrackEvent",function(){return F}),O.d(J,"addCueToTrack",function(){return P}),O.d(J,"clearCurrentCues",function(){return W}),O.d(J,"removeCuesInRange",function(){return U}),O.d(J,"getCuesInRange",function(){return A});var X=O("./src/utils/logger.ts");function F(d,p){var T;try{T=new Event("addtrack")}catch(m){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=d,p.dispatchEvent(T)}function P(d,p){var T=d.mode;if(T==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(p.id))try{if(d.addCue(p),!d.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(f){X.logger.debug("[texttrack-utils]: "+f);var m=new self.TextTrackCue(p.startTime,p.endTime,p.text);m.id=p.id,d.addCue(m)}T==="disabled"&&(d.mode=T)}function W(d){var p=d.mode;if(p==="disabled"&&(d.mode="hidden"),d.cues)for(var T=d.cues.length;T--;)d.removeCue(d.cues[T]);p==="disabled"&&(d.mode=p)}function U(d,p,T){var m=d.mode;if(m==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var f=A(d.cues,p,T),y=0;y<f.length;y++)d.removeCue(f[y]);m==="disabled"&&(d.mode=m)}function _(d,p){if(p<d[0].startTime)return 0;var T=d.length-1;if(p>d[T].endTime)return-1;for(var m=0,f=T;m<=f;){var y=Math.floor((f+m)/2);if(p<d[y].startTime)f=y-1;else if(p>d[y].startTime&&m<T)m=y+1;else return y}return d[m].startTime-p<p-d[f].startTime?m:f}function A(d,p,T){var m=[],f=_(d,p);if(f>-1)for(var y=f,a=d.length;y<a;y++){var i=d[y];if(i.startTime>=p&&i.endTime<=T)m.push(i);else if(i.startTime>T)return m}return m}},"./src/utils/time-ranges.ts":function(ue,J,O){"use strict";O.r(J);var X={toString:function(P){for(var W="",U=P.length,_=0;_<U;_++)W+="["+P.start(_).toFixed(3)+","+P.end(_).toFixed(3)+"]";return W}};J.default=X},"./src/utils/timescale-conversion.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"toTimescaleFromBase",function(){return F}),O.d(J,"toTimescaleFromScale",function(){return P}),O.d(J,"toMsFromMpegTsClock",function(){return W}),O.d(J,"toMpegTsClockFromTimescale",function(){return U});var X=9e4;function F(_,A,d,p){d===void 0&&(d=1),p===void 0&&(p=!1);var T=_*A*d;return p?Math.round(T):T}function P(_,A,d,p){return d===void 0&&(d=1),p===void 0&&(p=!1),F(_,A,1/d,p)}function W(_,A){return A===void 0&&(A=!1),F(_,1e3,1/X,A)}function U(_,A){return A===void 0&&(A=1),F(_,X,1/A)}},"./src/utils/typed-array.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"sliceUint8",function(){return X});function X(F,P,W){return Uint8Array.prototype.slice?F.slice(P,W):new Uint8Array(Array.prototype.slice.call(F,P,W))}},"./src/utils/vttcue.ts":function(ue,J,O){"use strict";O.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var X=["","lr","rl"],F=["start","middle","end","left","right"];function P(d,p){if(typeof p!="string")return!1;if(!Array.isArray(d))return!1;var T=p.toLowerCase();return~d.indexOf(T)?T:!1}function W(d){return P(X,d)}function U(d){return P(F,d)}function _(d){for(var p=arguments.length,T=new Array(p>1?p-1:0),m=1;m<p;m++)T[m-1]=arguments[m];for(var f=1;f<arguments.length;f++){var y=arguments[f];for(var a in y)d[a]=y[a]}return d}function A(d,p,T){var m=this,f={enumerable:!0};m.hasBeenReset=!1;var y="",a=!1,i=d,s=p,l=T,E=null,g="",v=!0,k="auto",w="start",x=50,b="middle",h=50,u="middle";Object.defineProperty(m,"id",_({},f,{get:function(){return y},set:function(S){y=""+S}})),Object.defineProperty(m,"pauseOnExit",_({},f,{get:function(){return a},set:function(S){a=!!S}})),Object.defineProperty(m,"startTime",_({},f,{get:function(){return i},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");i=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"endTime",_({},f,{get:function(){return s},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");s=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"text",_({},f,{get:function(){return l},set:function(S){l=""+S,this.hasBeenReset=!0}})),Object.defineProperty(m,"region",_({},f,{get:function(){return E},set:function(S){E=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"vertical",_({},f,{get:function(){return g},set:function(S){var D=W(S);if(D===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=D,this.hasBeenReset=!0}})),Object.defineProperty(m,"snapToLines",_({},f,{get:function(){return v},set:function(S){v=!!S,this.hasBeenReset=!0}})),Object.defineProperty(m,"line",_({},f,{get:function(){return k},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"lineAlign",_({},f,{get:function(){return w},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");w=D,this.hasBeenReset=!0}})),Object.defineProperty(m,"position",_({},f,{get:function(){return x},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");x=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"positionAlign",_({},f,{get:function(){return b},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");b=D,this.hasBeenReset=!0}})),Object.defineProperty(m,"size",_({},f,{get:function(){return h},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");h=S,this.hasBeenReset=!0}})),Object.defineProperty(m,"align",_({},f,{get:function(){return u},set:function(S){var D=U(S);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");u=D,this.hasBeenReset=!0}})),m.displayState=void 0}return A.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"parseTimeStamp",function(){return P}),O.d(J,"fixLineBreaks",function(){return p}),O.d(J,"VTTParser",function(){return T});var X=O("./src/utils/vttcue.ts"),F=function(){function m(){}var f=m.prototype;return f.decode=function(a,i){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},m}();function P(m){function f(a,i,s,l){return(a|0)*3600+(i|0)*60+(s|0)+parseFloat(l||0)}var y=m.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?f(y[2],y[3],0,y[4]):f(y[1],y[2],y[3],y[4]):null}var W=function(){function m(){this.values=Object.create(null)}var f=m.prototype;return f.set=function(a,i){!this.get(a)&&i!==""&&(this.values[a]=i)},f.get=function(a,i,s){return s?this.has(a)?this.values[a]:i[s]:this.has(a)?this.values[a]:i},f.has=function(a){return a in this.values},f.alt=function(a,i,s){for(var l=0;l<s.length;++l)if(i===s[l]){this.set(a,i);break}},f.integer=function(a,i){/^-?\d+$/.test(i)&&this.set(a,parseInt(i,10))},f.percent=function(a,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var s=parseFloat(i);if(s>=0&&s<=100)return this.set(a,s),!0}return!1},m}();function U(m,f,y,a){var i=a?m.split(a):[m];for(var s in i){if(typeof i[s]!="string")continue;var l=i[s].split(y);if(l.length!==2)continue;var E=l[0],g=l[1];f(E,g)}}var _=new X.default(0,0,""),A=_.align==="middle"?"middle":"center";function d(m,f,y){var a=m;function i(){var E=P(m);if(E===null)throw new Error("Malformed timestamp: "+a);return m=m.replace(/^[^\sa-zA-Z-]+/,""),E}function s(E,g){var v=new W;U(E,function(x,b){var h;switch(x){case"region":for(var u=y.length-1;u>=0;u--)if(y[u].id===b){v.set(x,y[u].region);break}break;case"vertical":v.alt(x,b,["rl","lr"]);break;case"line":h=b.split(","),v.integer(x,h[0]),v.percent(x,h[0])&&v.set("snapToLines",!1),v.alt(x,h[0],["auto"]),h.length===2&&v.alt("lineAlign",h[1],["start",A,"end"]);break;case"position":h=b.split(","),v.percent(x,h[0]),h.length===2&&v.alt("positionAlign",h[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":v.percent(x,b);break;case"align":v.alt(x,b,["start",A,"end","left","right"]);break}},/:/,/\s/),g.region=v.get("region",null),g.vertical=v.get("vertical","");var k=v.get("line","auto");k==="auto"&&_.line===-1&&(k=-1),g.line=k,g.lineAlign=v.get("lineAlign","start"),g.snapToLines=v.get("snapToLines",!0),g.size=v.get("size",100),g.align=v.get("align",A);var w=v.get("position","auto");w==="auto"&&_.position===50&&(w=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=w}function l(){m=m.replace(/^\s+/,"")}if(l(),f.startTime=i(),l(),m.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);m=m.substr(3),l(),f.endTime=i(),l(),s(m,f)}function p(m){return m.replace(/<br(?: \/)?>/gi,`
|
|
`)}var T=function(){function m(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var f=m.prototype;return f.parse=function(a){var i=this;a&&(i.buffer+=i.decoder.decode(a,{stream:!0}));function s(){var w=i.buffer,x=0;for(w=p(w);x<w.length&&w[x]!=="\r"&&w[x]!==`
|
|
`;)++x;var b=w.substr(0,x);return w[x]==="\r"&&++x,w[x]===`
|
|
`&&++x,i.buffer=w.substr(x),b}function l(w){U(w,function(x,b){},/:/)}try{var E="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;E=s();var g=E.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var v=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;v?v=!1:E=s();switch(i.state){case"HEADER":/:/.test(E)?l(E):E||(i.state="ID");continue;case"NOTE":E||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){i.state="NOTE";break}if(!E)continue;if(i.cue=new X.default(0,0,""),i.state="CUE",E.indexOf("-->")===-1){i.cue.id=E;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{d(E,i.cue,i.regionList)}catch(w){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var k=E.indexOf("-->")!==-1;if(!E||k&&(v=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
|
|
`),i.cue.text+=E}continue;case"BADCUE":E||(i.state="ID")}}}catch(w){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},f.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=`
|
|
|
|
`,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){a.onparsingerror&&a.onparsingerror(i)}return a.onflush&&a.onflush(),this},m}()},"./src/utils/webvtt-parser.ts":function(ue,J,O){"use strict";O.r(J),O.d(J,"generateCueId",function(){return T}),O.d(J,"parseWebVTT",function(){return f});var X=O("./src/polyfills/number.ts"),F=O("./src/utils/vttparser.ts"),P=O("./src/demux/id3.ts"),W=O("./src/utils/timescale-conversion.ts"),U=O("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,A=function(a,i,s){return s===void 0&&(s=0),a.substr(s,i.length)===i},d=function(a){var i=parseInt(a.substr(-3)),s=parseInt(a.substr(-6,2)),l=parseInt(a.substr(-9,2)),E=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(X.isFiniteNumber)(i)||!Object(X.isFiniteNumber)(s)||!Object(X.isFiniteNumber)(l)||!Object(X.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*s,i+=60*1e3*l,i+=60*60*1e3*E,i},p=function(a){for(var i=5381,s=a.length;s;)i=i*33^a.charCodeAt(--s);return(i>>>0).toString()};function T(y,a,i){return p(y.toString())+p(a.toString())+p(i)}var m=function(a,i,s){var l=a[i],E=a[l.prevCC];if(!E||!E.new&&l.new){a.ccOffset=a.presentationOffset=l.start,l.new=!1;return}for(;(g=E)!==null&&g!==void 0&&g.new;){var g;a.ccOffset+=l.start-E.start,l.new=!1,l=E,E=a[l.prevCC]}a.presentationOffset=s};function f(y,a,i,s,l,E,g,v){var k=new F.VTTParser,w=Object(P.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(_,`
|
|
`).split(`
|
|
`),x=[],b=Object(W.toMpegTsClockFromTimescale)(a,i),h="00:00.000",u=0,L=0,S,D=!0,I=!1;k.oncue=function(B){var j=s[l],G=s.ccOffset,M=(u-b)/9e4;if(j!=null&&j.new&&(L!==void 0?G=s.ccOffset=j.start:m(s,l,M)),M&&(G=M-s.presentationOffset),I){var N=B.endTime-B.startTime,Y=Object(U.normalizePts)((B.startTime+G-L)*9e4,E*9e4)/9e4;B.startTime=Y,B.endTime=Y+N}var ee=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(ee)),B.id||(B.id=T(B.startTime,B.endTime,ee)),B.endTime>0&&x.push(B)},k.onparsingerror=function(B){S=B},k.onflush=function(){if(S){v(S);return}g(x)},w.forEach(function(B){if(D)if(A(B,"X-TIMESTAMP-MAP=")){D=!1,I=!0,B.substr(16).split(",").forEach(function(j){A(j,"LOCAL:")?h=j.substr(6):A(j,"MPEGTS:")&&(u=parseInt(j.substr(7)))});try{L=d(h)/1e3}catch(j){I=!1,S=j}return}else B===""&&(D=!1);k.parse(B+`
|
|
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(ue,J,O){"use strict";O.r(J);var X=O("./src/utils/logger.ts"),F=O("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,W=function(){function U(A){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=A?A.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var _=U.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},_.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(d,p,T){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=p,this.callbacks=T,this.retryDelay=p.retryDelay,this.loadInternal()},_.loadInternal=function(){var d=this.config,p=this.context;if(!d)return;var T=this.loader=new self.XMLHttpRequest,m=this.stats;m.loading.first=0,m.loaded=0;var f=this.xhrSetup;try{if(f)try{f(T,p.url)}catch(i){T.open("GET",p.url,!0),f(T,p.url)}T.readyState||T.open("GET",p.url,!0);var y=this.context.headers;if(y)for(var a in y)T.setRequestHeader(a,y[a])}catch(i){this.callbacks.onError({code:T.status,text:i.message},p,T);return}p.rangeEnd&&T.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),T.send()},_.readystatechange=function(){var d=this.context,p=this.loader,T=this.stats;if(!d||!p)return;var m=p.readyState,f=this.config;if(T.aborted)return;if(m>=2)if(self.clearTimeout(this.requestTimeout),T.loading.first===0&&(T.loading.first=Math.max(self.performance.now(),T.loading.start)),m===4){p.onreadystatechange=null,p.onprogress=null;var y=p.status;if(y>=200&&y<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var a,i;if(d.responseType==="arraybuffer"?(a=p.response,i=a.byteLength):(a=p.responseText,i=a.length),T.loaded=T.total=i,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(T,d,a,p),!this.callbacks)return;var l={url:p.responseURL,data:a};this.callbacks.onSuccess(l,T,d,p)}else T.retry>=f.maxRetry||y>=400&&y<499?(X.logger.error(y+" while loading "+d.url),this.callbacks.onError({code:y,text:p.statusText},d,p)):(X.logger.warn(y+" while loading "+d.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,f.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout)},_.loadtimeout=function(){X.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(d){var p=this.stats;p.loaded=d.loaded,d.lengthComputable&&(p.total=d.total)},_.getCacheAge=function(){var d=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");d=p?parseFloat(p):null}return d},U}();J.default=W}}).default})},vHTk:function(pt,Te,q){pt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},we55:function(pt,Te,q){pt.exports={bg:"bg___3PaSA",flexRow:"flexRow___1k1iY",flexJustifyCenter:"flexJustifyCenter___MzzvD",flexAlignEnd:"flexAlignEnd___1KYBf",flexAlignCenter:"flexAlignCenter___3XoYY",flexColumn:"flexColumn___28jeJ",formWrap:"formWrap___2IoYS",titleWrap:"titleWrap___2LenH",fieldWrap:"fieldWrap___3zhLT",mdWrap:"mdWrap___3fVSN",backgroundFa:"backgroundFa___21qxJ",button:"button___3eTeL"}},wzkS:function(pt,Te,q){"use strict";q.d(Te,"c",function(){return F}),q.d(Te,"b",function(){return P}),q.d(Te,"d",function(){return W}),q.d(Te,"a",function(){return _}),q.d(Te,"e",function(){return A});var ue=q("9og8"),J=q("WmNS"),O=q.n(J),X=q("ErOA");function F(d){return Object(X.c)("libraries/".concat(d,".json"))}function P(){return Object(X.c)("library_tags.json")}function W(d){return U.apply(this,arguments)}function U(){return U=Object(ue.a)(O.a.mark(function d(p){var T;return O.a.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,Object(X.b)("attachments/".concat(p,".json"));case 2:return T=f.sent,f.abrupt("return",T.status===0);case 4:case"end":return f.stop()}},d)})),U.apply(this,arguments)}function _(d){return Object(X.f)("libraries.json",d)}function A(d,p){return Object(X.g)("libraries/".concat(d,".json"),p)}},y5JW:function(pt,Te,q){"use strict";q.d(Te,"c",function(){return y}),q.d(Te,"a",function(){return a});var ue=q("DZo9"),J=q("8z0m"),O=q("+L6B"),X=q("2/Rp"),F=q("9og8"),P=q("k1fw"),W=q("oBTY"),U=q("miYZ"),_=q("tsqr"),A=q("WmNS"),d=q.n(A),p=q("q1tI"),T=q.n(p),m=q("m3rI"),f=q("wzkS"),y="\u3000\u3000";function a(i){var s=["Bytes","KB","MB","GB","TB"];if(i==0)return"0 Byte";var l=parseInt(""+Math.floor(Math.log(i)/Math.log(1024)),10);return(i/Math.pow(1024,l)).toFixed(1)+" "+s[l]}Te.b=function(i){var s=i.value,l=s===void 0?[]:s,E=i.action,g=i.onChange,v=i.className,k=i.maxSize,w=k===void 0?150:k,x=i.title,b=x===void 0?"\u6587\u4EF6\u4E0A\u4F20":x,h=i.accept,u=h===void 0?null:h,L={multiple:!1,fileList:l,accept:u,withCredentials:!0,beforeUpload:function(I){var B=I.size/1024/1024;return B<w?!0:(_.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(w,"MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20")),Promise.reject())},action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(I){var B=Object(W.a)(I.fileList);B=B.map(function(j){return j.name.indexOf(y)===-1&&(j.name="".concat(j.name).concat(y).concat(a(j.size))),Object(P.a)({},j)}),g(B)},onRemove:function(){var D=Object(F.a)(d.a.mark(function B(j){var G,M,N;return d.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(G=j.size/1024/1024,!(j.status==="uploading")){ee.next=3;break}return ee.abrupt("return",!0);case 3:if(G<w){ee.next=7;break}return ee.abrupt("return",!0);case 7:if(M=j.response?j.response.id:j.uid,!M){ee.next=15;break}return ee.next=11,Object(f.d)(j.response?j.response.id:j.id);case 11:return N=ee.sent,ee.abrupt("return",N);case 15:return ee.abrupt("return",!0);case 16:case"end":return ee.stop()}},B)}));function I(B){return D.apply(this,arguments)}return I}()};function S(D){D.preventDefault(),D.stopPropagation()}return T.a.createElement("div",{className:"single-upload ".concat(v||"")},T.a.createElement(J.a,L,T.a.createElement(X.a,{type:"primary",title:l.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:l.length>0,ghost:!0},b),T.a.createElement("span",{onClick:S,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",w,"M) ")))}}}]);
|