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

372 lines
971 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[149,5,6,7,17],{"+NIl":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function($,k){"use strict";function Y(A,S){A.cmdState.push(S)}function F(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function R(A){var S=A.cmdState.pop();S&&S.closeBracket()}function W(A){for(var S=A.cmdState,x=S.length-1;x>=0;x--){var d=S[x];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function B(A,S,x){return function(){this.name=A,this.bracketNo=0,this.style=S,this.styles=x,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=B("importmodule","tag",["string","builtin"]),P.documentclass=B("documentclass","tag",["","atom"]),P.usepackage=B("usepackage","tag",["atom"]),P.begin=B("begin","tag",["atom"]),P.end=B("end","tag",["atom"]),P.label=B("label","tag",["atom"]),P.ref=B("ref","tag",["atom"]),P.eqref=B("eqref","tag",["atom"]),P.cite=B("cite","tag",["atom"]),P.bibitem=B("bibitem","tag",["atom"]),P.Bibitem=B("Bibitem","tag",["atom"]),P.RBibitem=B("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function w(A,S){A.f=S}function p(A,S){var x;if(A.match(/^\\[a-zA-Z@]+/)){var d=A.current().slice(1);return x=P.hasOwnProperty(d)?P[d]:P.DEFAULT,x=new x,Y(S,x),w(S,M),x.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return w(S,function(s,u){return b(s,u,"\\]")}),"keyword";if(A.match("\\("))return w(S,function(s,u){return b(s,u,"\\)")}),"keyword";if(A.match("$$"))return w(S,function(s,u){return b(s,u,"$$")}),"keyword";if(A.match("$"))return w(S,function(s,u){return b(s,u,"$")}),"keyword";var a=A.next();if(a=="%")return A.skipToEnd(),"comment";if(a=="}"||a=="]"){if(x=F(S),x)x.closeBracket(a),w(S,M);else return"error";return"bracket"}else return a=="{"||a=="["?(x=P.DEFAULT,x=new x,Y(S,x),"bracket"):/\d/.test(a)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),x=W(S),x.name=="begin"&&(x.argument=A.current()),x.styleIdentifier())}function b(A,S,x){if(A.eatSpace())return null;if(x&&A.match(x))return w(S,p),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=A.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(A.skipToEnd(),"comment"):"error"}function M(A,S){var x=A.peek(),d;return x=="{"||x=="["?(d=F(S),d.openBracket(x),A.eat(x),w(S,p),"bracket"):/[ \t\r]/.test(x)?(A.eat(x),null):(w(S,p),R(S),p(A,S))}return{startState:function(){var A=k.inMathMode?function(S,x){return b(S,x)}:p;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,S){return S.f(A,S)},blankLine:function(A){A.f=p,A.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(B,P,w){var p=w&&w!=ne.Init;if(P&&!p)B.on("blur",F),B.on("change",R),B.on("swapDoc",R),ne.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Y(B)}),R(B);else if(!P&&p){B.off("blur",F),B.off("change",R),B.off("swapDoc",R),ne.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),$(B);var b=B.getWrapperElement();b.className=b.className.replace(" CodeMirror-empty","")}P&&!B.hasFocus()&&F(B)});function $(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function k(B){$(B);var P=B.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=B.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var w=B.getOption("placeholder");typeof w=="string"&&(w=document.createTextNode(w)),P.appendChild(w),B.display.lineSpace.insertBefore(P,B.display.lineSpace.firstChild)}function Y(B){setTimeout(function(){var P=!1,w=B.getInputField();w.nodeName=="TEXTAREA"?P=!w.value:B.lineCount()==1&&(P=!/[^\u200b]/.test(w.querySelector(".CodeMirror-line").textContent)),P?k(B):$(B)},20)}function F(B){W(B)&&k(B)}function R(B){var P=B.getWrapperElement(),w=W(B);P.className=P.className.replace(" CodeMirror-empty","")+(w?" CodeMirror-empty":""),w?k(B):$(B)}function W(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";var $={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},k={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(Y,F){var R=Y.indentUnit,W={},B=F.htmlMode?$:k;for(var P in B)W[P]=B[P];for(var P in F)W[P]=F[P];var w,p;function b(o,C){function E(U){return C.tokenize=U,U(o,C)}var m=o.next();if(m=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?E(S("atom","]]>")):null:o.match("--")?E(S("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),E(x(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),C.tokenize=S("meta","?>"),"meta"):(w=o.eat("/")?"closeTag":"openTag",C.tokenize=M,"tag bracket");if(m=="&"){var O;return o.eat("#")?o.eat("x")?O=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):O=o.eatWhile(/[\d]/)&&o.eat(";"):O=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),O?"atom":"error"}else return o.eatWhile(/[^&<]/),null}b.isInText=!0;function M(o,C){var E=o.next();if(E==">"||E=="/"&&o.eat(">"))return C.tokenize=b,w=E==">"?"endTag":"selfcloseTag","tag bracket";if(E=="=")return w="equals",null;if(E=="<"){C.tokenize=b,C.state=u,C.tagName=C.tagStart=null;var m=C.tokenize(o,C);return m?m+" tag error":"tag error"}else return/[\'\"]/.test(E)?(C.tokenize=A(E),C.stringStartCol=o.column(),C.tokenize(o,C)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(o){var C=function(E,m){for(;!E.eol();)if(E.next()==o){m.tokenize=M;break}return"string"};return C.isInAttribute=!0,C}function S(o,C){return function(E,m){for(;!E.eol();){if(E.match(C)){m.tokenize=b;break}E.next()}return o}}function x(o){return function(C,E){for(var m;(m=C.next())!=null;){if(m=="<")return E.tokenize=x(o+1),E.tokenize(C,E);if(m==">")if(o==1){E.tokenize=b;break}else return E.tokenize=x(o-1),E.tokenize(C,E)}return"meta"}}function d(o,C,E){this.prev=o.context,this.tagName=C,this.indent=o.indented,this.startOfLine=E,(W.doNotIndent.hasOwnProperty(C)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,C){for(var E;;){if(!o.context)return;if(E=o.context.tagName,!W.contextGrabbers.hasOwnProperty(E)||!W.contextGrabbers[E].hasOwnProperty(C))return;a(o)}}function u(o,C,E){return o=="openTag"?(E.tagStart=C.column(),L):o=="closeTag"?f:u}function L(o,C,E){return o=="word"?(E.tagName=C.current(),p="tag",T):W.allowMissingTagName&&o=="endTag"?(p="tag bracket",T(o,C,E)):(p="error",L)}function f(o,C,E){if(o=="word"){var m=C.current();return E.context&&E.context.tagName!=m&&W.implicitlyClosed.hasOwnProperty(E.context.tagName)&&a(E),E.context&&E.context.tagName==m||W.matchClosing===!1?(p="tag",v):(p="tag error",D)}else return W.allowMissingTagName&&o=="endTag"?(p="tag bracket",v(o,C,E)):(p="error",D)}function v(o,C,E){return o!="endTag"?(p="error",v):(a(E),u)}function D(o,C,E){return p="error",v(o,C,E)}function T(o,C,E){if(o=="word")return p="attribute",g;if(o=="endTag"||o=="selfcloseTag"){var m=E.tagName,O=E.tagStart;return E.tagName=E.tagStart=null,o=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(m)?s(E,m):(s(E,m),E.context=new d(E,m,O==E.indented)),u}return p="error",T}function g(o,C,E){return o=="equals"?c:(W.allowMissing||(p="error"),T(o,C,E))}function c(o,C,E){return o=="string"?h:o=="word"&&W.allowUnquoted?(p="string",T):(p="error",T(o,C,E))}function h(o,C,E){return o=="string"?h:T(o,C,E)}return{startState:function(o){var C={tokenize:b,state:u,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(C.baseIndent=o),C},token:function(o,C){if(!C.tagName&&o.sol()&&(C.indented=o.indentation()),o.eatSpace())return null;w=null;var E=C.tokenize(o,C);return(E||w)&&E!="comment"&&(p=null,C.state=C.state(w||E,o,C),p&&(E=p=="error"?E+" error":p)),E},indent:function(o,C,E){var m=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+R;if(m&&m.noIndent)return ne.Pass;if(o.tokenize!=M&&o.tokenize!=b)return E?E.match(/^(\s*)/)[0].length:0;if(o.tagName)return W.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+R*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var O=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(O&&O[1])for(;m;)if(m.tagName==O[2]){m=m.prev;break}else if(W.implicitlyClosed.hasOwnProperty(m.tagName))m=m.prev;else break;else if(O)for(;m;){var U=W.contextGrabbers[m.tagName];if(U&&U.hasOwnProperty(O[2]))m=m.prev;else break}for(;m&&m.prev&&!m.startOfLine;)m=m.prev;return m?m.indent+R:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(o){o.state==c&&(o.state=T)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var C=[],E=o.context;E;E=E.prev)E.tagName&&C.push(E.tagName);return C.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return f});var ne=ie("+L6B"),$=ie("2/Rp"),k=ie("2qtc"),Y=ie("kLXV"),F=ie("9og8"),R=ie("k1fw"),W=ie("miYZ"),B=ie("tsqr"),P=ie("oBTY"),w=ie("tJVT"),p=ie("DZo9"),b=ie("8z0m"),M=ie("WmNS"),A=ie.n(M),S=ie("q1tI"),x=ie.n(S),d=ie("m3rI"),a=ie("wzkS"),s=ie("y5JW"),u=ie("LtfV"),L=b.a.Dragger;function f(v){var D=[];return v&&v.length>0&&(D=v.map(function(T){return{uid:T.id,id:T.id,name:T.title+s.c+T.filesize,url:T.url,filesize:T.filesize,status:"done",response:{id:T.id}}})),D}$e.b=function(v){var D=v.value,T=v.onChange,g=v.action,c=v.className,h=v.maxSize,o=h===void 0?150:h,C=v.title,E=C===void 0?"\u4E0A\u4F20\u9644\u4EF6":C,m=v.showRemoveModal,O=m===void 0?!1:m,U=v.accept,j=U===void 0?"":U,K=v.additionalText,I=v.isDragger,N=v.number,X=N===void 0?1e3:N,q=v.aloneClear,ae=q===void 0?!1:q,he=v.restrict,Ae=he===void 0?!0:he,be=Object(S.useState)(!1),Te=Object(w.a)(be,2),Ce=Te[0],Se=Te[1],me=Object(S.useState)(D||[]),ue=Object(w.a)(me,2),te=ue[0],fe=ue[1];Object(S.useEffect)(function(){D&&(fe(Object(P.a)(D)),X===(D==null?void 0:D.length)&&Se(!0))},[D]);var se=function(){setTimeout(function(){te.pop(),fe(Object(P.a)(te))},500)},_e={multiple:!0,disabled:Ce,accept:j,withCredentials:!0,fileList:te,beforeUpload:function(Pe,Ne){var Be=Pe.size/1024/1024;return te.concat(Ne).length>X?(te.pop(),fe(Object(P.a)(te)),B.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(X,"\u4E2A\u6587\u4EF6")),ae?Promise.reject():(se(),!1)):Be<o?!0:(B.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(o,"MB).")),ae?Promise.reject():(se(),!1))},action:g||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Pe){var Ne=Object(P.a)(Pe.fileList);Ne.length>=X?Se(!0):Se(!1),fe(Object(P.a)(Ne)),Ne=Ne.map(function(Be){var We;if(Be!=null&&(We=Be.response)!==null&&We!==void 0&&We.id){var Ue;Be.url="/api/attachments/".concat(Be==null||((Ue=Be.response)===null||Ue===void 0)?void 0:Ue.id)}return Be.name.indexOf(s.c)===-1&&(Be.name="".concat(Be.name).concat(s.c).concat(Object(s.a)(Be.size))),Object(R.a)({},Be)}),console.log("info:",Pe),T(Ne)},onRemove:function(){var xe=Object(F.a)(A.a.mark(function Ne(Be){var We;return A.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(We=function(){var at=Object(F.a)(A.a.mark(function it(){var et,Ze;return A.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(et=Be.response?Be.response.id:Be.id,!et){Je.next=8;break}return Je.next=4,Object(a.d)(Be.response?Be.response.id:Be.uid);case 4:return Ze=Je.sent,Je.abrupt("return",Ze);case 8:return Je.abrupt("return",!0);case 9:case"end":return Je.stop()}},it)}));return function(){return at.apply(this,arguments)}}(),!O){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(at,it){Y.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:x.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var et=Object(F.a)(A.a.mark(function ut(){var Je;return A.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return ke.next=2,We();case 2:Je=ke.sent,B.b.success("\u5220\u9664\u6210\u529F"),at(!0);case 5:case"end":return ke.stop()}},ut)}));function Ze(){return et.apply(this,arguments)}return Ze}(),onCancel:function(){return at(!1)}})}));case 5:return Fe.next=7,We();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Ne)}));function Pe(Ne){return xe.apply(this,arguments)}return Pe}()};function Oe(xe){xe.preventDefault(),xe.stopPropagation()}return x.a.createElement("div",{className:"multi-upload ".concat(c||"")},I&&x.a.createElement(L,_e,x.a.createElement("p",{className:"ant-upload-drag-icon"},x.a.createElement(u.a,null)),x.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",x.a.createElement("br",null),x.a.createElement("span",{style:{display:Ae?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB) ")),K),!I&&x.a.createElement(b.a,_e,x.a.createElement($.a,{disabled:Ce},E),x.a.createElement("span",{onClick:Oe,style:{marginLeft:10,color:"#FA6400",display:Ae?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB) ")))}},"55Ip":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return s}),ie.d($e,"b",function(){return T});var ne=ie("Ty5D"),$=ie("dI71"),k=ie("q1tI"),Y=ie.n(k),F=ie("YS25"),R=ie("17x9"),W=ie.n(R),B=ie("wx14"),P=ie("zLVn"),w=ie("9R94"),p=function(c){Object($.a)(h,c);function h(){for(var C,E=arguments.length,m=new Array(E),O=0;O<E;O++)m[O]=arguments[O];return C=c.call.apply(c,[this].concat(m))||this,C.history=Object(F.a)(C.props),C}var o=h.prototype;return o.render=function(){return Y.a.createElement(ne.c,{history:this.history,children:this.props.children})},h}(Y.a.Component),b=function(c){Object($.a)(h,c);function h(){for(var C,E=arguments.length,m=new Array(E),O=0;O<E;O++)m[O]=arguments[O];return C=c.call.apply(c,[this].concat(m))||this,C.history=Object(F.b)(C.props),C}var o=h.prototype;return o.render=function(){return Y.a.createElement(ne.c,{history:this.history,children:this.props.children})},h}(Y.a.Component),M=function(h,o){return typeof h=="function"?h(o):h},A=function(h,o){return typeof h=="string"?Object(F.c)(h,null,null,o):h},S=function(h){return h},x=Y.a.forwardRef;typeof x=="undefined"&&(x=S);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var a=x(function(c,h){var o=c.innerRef,C=c.navigate,E=c.onClick,m=Object(P.a)(c,["innerRef","navigate","onClick"]),O=m.target,U=Object(B.a)({},m,{onClick:function(K){try{E&&E(K)}catch(I){throw K.preventDefault(),I}!K.defaultPrevented&&K.button===0&&(!O||O==="_self")&&!d(K)&&(K.preventDefault(),C())}});return S!==x?U.ref=h||o:U.ref=o,Y.a.createElement("a",U)}),s=x(function(c,h){var o=c.component,C=o===void 0?a:o,E=c.replace,m=c.to,O=c.innerRef,U=Object(P.a)(c,["component","replace","to","innerRef"]);return Y.a.createElement(ne.e.Consumer,null,function(j){j||Object(w.a)(!1);var K=j.history,I=A(M(m,j.location),j.location),N=I?K.createHref(I):"",X=Object(B.a)({},U,{href:N,navigate:function(){var ae=M(m,j.location),he=E?K.replace:K.push;he(ae)}});return S!==x?X.ref=h||O:X.innerRef=O,Y.a.createElement(C,X)})});if(!1)var u,L;var f=function(h){return h},v=Y.a.forwardRef;typeof v=="undefined"&&(v=f);function D(){for(var c=arguments.length,h=new Array(c),o=0;o<c;o++)h[o]=arguments[o];return h.filter(function(C){return C}).join(" ")}var T=v(function(c,h){var o=c["aria-current"],C=o===void 0?"page":o,E=c.activeClassName,m=E===void 0?"active":E,O=c.activeStyle,U=c.className,j=c.exact,K=c.isActive,I=c.location,N=c.sensitive,X=c.strict,q=c.style,ae=c.to,he=c.innerRef,Ae=Object(P.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Y.a.createElement(ne.e.Consumer,null,function(be){be||Object(w.a)(!1);var Te=I||be.location,Ce=A(M(ae,Te),Te),Se=Ce.pathname,me=Se&&Se.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=me?Object(ne.f)(Te.pathname,{path:me,exact:j,sensitive:N,strict:X}):null,te=!!(K?K(ue,Te):ue),fe=te?D(U,m):U,se=te?Object(B.a)({},q,{},O):q,_e=Object(B.a)({"aria-current":te&&C||null,className:fe,style:se,to:Ce},Ae);return f!==v?_e.ref=h||he:_e.innerRef=he,Y.a.createElement(s,_e)})});if(!1)var g},"7/Dv":function(lt,$e,ie){lt.exports={bg:"bg___2rJyo",flexRow:"flexRow___2xuIa",flexJustifyCenter:"flexJustifyCenter___Z3bJt",flexAlignEnd:"flexAlignEnd___v7Ww-",flexAlignCenter:"flexAlignCenter___223DA",flexColumn:"flexColumn___3CNqR",formWrap:"formWrap___2b6uL",titleWrap:"titleWrap___1CMQA",fieldWrap:"fieldWrap___2BRrD",mdWrap:"mdWrap___3UYzt",backgroundFa:"backgroundFa___32wpj",button:"button___MHDAn"}},"7Cbv":function(lt,$e,ie){"use strict";var ne=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function k(){if(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne($)}var Y=/^(?:[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(M){return typeof M=="string"&&Y.test(M)}for(var R=F,W=[],B=0;B<256;++B)W.push((B+256).toString(16).substr(1));function P(M){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(W[M[A+0]]+W[M[A+1]]+W[M[A+2]]+W[M[A+3]]+"-"+W[M[A+4]]+W[M[A+5]]+"-"+W[M[A+6]]+W[M[A+7]]+"-"+W[M[A+8]]+W[M[A+9]]+"-"+W[M[A+10]]+W[M[A+11]]+W[M[A+12]]+W[M[A+13]]+W[M[A+14]]+W[M[A+15]]).toLowerCase();if(!R(S))throw TypeError("Stringified UUID is invalid");return S}var w=P;function p(M,A,S){M=M||{};var x=M.random||(M.rng||k)();if(x[6]=x[6]&15|64,x[8]=x[8]&63|128,A){S=S||0;for(var d=0;d<16;++d)A[S+d]=x[d];return A}return w(x)}var b=$e.a=p},"7ahc":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return L});var ne=ie("k1fw"),$=ie("0Owb"),k=ie("+L6B"),Y=ie("2/Rp"),F=ie("y8nQ"),R=ie("Vl3Y"),W=ie("tJVT"),B=ie("OaEy"),P=ie("2fM7"),w=ie("q1tI"),p=ie.n(w),b=ie("VrN/"),M=ie.n(b),A=ie("p77/"),S=ie.n(A),x=ie("c5Ni"),d=ie.n(x),a=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};$e.b=function(f){var v=f.callback,D=f.onCancel,T=Object(w.useState)("python"),g=Object(W.a)(T,2),c=g[0],h=g[1];function o(E){h(u[E][1])}function C(E){v(E)}return p.a.createElement(R.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),p.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},p.a.createElement(P.a,{onChange:o},Object.keys(u).map(function(E){return p.a.createElement(a,{key:E,value:E},u[E][0])}))),p.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},p.a.createElement(L,{mode:c})),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(Y.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function L(f){var v=f.value,D=f.onChange,T=f.mode,g=f.options,c=g===void 0?{}:g,h=Object(w.useRef)(),o=Object(w.useState)(),C=Object(W.a)(o,2),E=C[0],m=C[1];return Object(w.useEffect)(function(){if(E){function O(U){var j=U.getValue();D&&D(j)}return E.on("change",O),function(){E.off("change",O)}}},[E,D]),Object(w.useEffect)(function(){E&&E.setOption("mode",T)},[E,T]),Object(w.useEffect)(function(){E&&((v!==E.getValue()||v==="")&&setTimeout(function(){E.setValue(v||" ")},300))},[E,v]),Object(w.useEffect)(function(){if(h.current&&!E){var O=M.a.fromTextArea(h.current,Object(ne.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));m(O)}},[h.current,E]),p.a.createElement("div",{className:"my-codemirror-container"},p.a.createElement("textarea",{ref:h}))}},"8EBN":function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";ne.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 $=0;$<ne.modeInfo.length;$++){var k=ne.modeInfo[$];k.mimes&&(k.mime=k.mimes[0])}ne.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.mime==Y)return R;if(R.mimes){for(var W=0;W<R.mimes.length;W++)if(R.mimes[W]==Y)return R}}if(/\+xml$/.test(Y))return ne.findModeByMIME("application/xml");if(/\+json$/.test(Y))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.ext){for(var W=0;W<R.ext.length;W++)if(R.ext[W]==Y)return R}}},ne.findModeByFileName=function(Y){for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.file&&R.file.test(Y))return R}var W=Y.lastIndexOf("."),B=W>-1&&Y.substring(W+1,Y.length);if(B)return ne.findModeByExtension(B)},ne.findModeByName=function(Y){Y=Y.toLowerCase();for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.name.toLowerCase()==Y)return R;if(R.alias){for(var W=0;W<R.alias.length;W++)if(R.alias[W].toLowerCase()==Y)return R}}}})},"8hTe":function(lt,$e,ie){lt.exports={button:"button___1wy9m"}},"9Bee":function(lt,$e,ie){"use strict";var ne=ie("DYRE"),$=ie("zeV3"),k=ie("+L6B"),Y=ie("2/Rp"),F=ie("k1fw"),R=ie("9og8"),W=ie("tJVT"),B=ie("WmNS"),P=ie.n(B),w=ie("q1tI"),p=ie.n(w),b=ie("vg9a"),M=ie("DlQD"),A=ie.n(M),S=ie("rUJ1");function x(V,l){var y=V.match(/^(\s+)(?:```)/);if(y===null)return l;var z=y[1];return l.split(`
`).map(function(Z){var G=Z.match(/^\s+/);if(G===null)return Z;var ve=Object(W.a)(G,1),ze=ve[0];return ze.length>=z.length?Z.slice(z.length):Z}).join(`
`)}var d=[],a=["<ul>"],s=new A.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){d.length=0,a=["<ul>"]}var f={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(V,l,y,z){if(l>=V.length||V[l].level<=y)return l;var Z=V[l];z.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),l++;var G=[];return l=v(V,l,Z.level,G),G.length>0&&(z.push("<ul>"),G.forEach(function(ve){z.push(ve)}),z.push("</ul>")),z.push("</li>"),l=v(V,l,y,z),l}function D(){return v(d,0,0,a),a.push("</ul>"),a.join("")}var T={heading:function(l){var y=u.exec(l);if(y)return{type:"heading",raw:y[0],depth:y[1].length,text:y[2]}},fences:function(l){var y=this.rules.block.fences.exec(l);if(y){var z=y[0],Z=x(z,y[3]||""),G=y[2]?y[2].trim():y[2];if(["latex","katex","math"].indexOf(G)>=0){var ve=h(),ze=Z;Z=ve,o[ve]={type:"block",expression:ze}}return{type:"code",raw:z,lang:G,text:Z}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,h=function(){return"__special_katext_id_".concat(c++,"__")},o={};function C(){return o}function E(){c=0,o={}}function m(V){return V=V.replace(g,function(l,y){var z=h();return o[z]={type:"inline",expression:y},z}),V}var O=s.listitem;s.listitem=function(V){return O(m(V))};var U=s.paragraph;s.paragraph=function(V){return U(m(V))};var j=s.tablecell;s.tablecell=function(V,l){return j(m(V),l)},s.code=function(V,l,y){var z=(l||"").match(/\S*/)[0];return z?["latex","katex","math"].indexOf(z)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(y?V:Object(S.escape)(V,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(y?V:Object(S.escape)(V,!0))+"</code></pre>"},s.heading=function(V,l,y){var z=this.options.headerPrefix+y.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:z,level:l,text:V}),"<h"+l+' id="'+z+'">'+V+"</h"+l+">"},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:T,renderer:s});var K=A.a,I=ie("SJMd"),N=ie("ulZh"),X=ie.n(N),q=ie("m3rI"),ae=ie("Oy/b"),he=ie("p5ED"),Ae=ie("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var be=function(V,l){return(be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,z){y.__proto__=z}||function(y,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(y[Z]=z[Z])})(V,l)};function Te(V,l){function y(){this.constructor=V}be(V,l),V.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}function Ce(V,l,y,z){return new(y||(y=Promise))(function(Z,G){function ve(ct){try{Re(z.next(ct))}catch(Ge){G(Ge)}}function ze(ct){try{Re(z.throw(ct))}catch(Ge){G(Ge)}}function Re(ct){var Ge;ct.done?Z(ct.value):(Ge=ct.value,Ge instanceof y?Ge:new y(function(Ct){Ct(Ge)})).then(ve,ze)}Re((z=z.apply(V,l||[])).next())})}function Se(V,l){var y,z,Z,G,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function ze(Re){return function(ct){return function(Ge){if(y)throw new TypeError("Generator is already executing.");for(;ve;)try{if(y=1,z&&(Z=2&Ge[0]?z.return:Ge[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,Ge[1])).done)return Z;switch(z=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,z=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=Ge;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(Ge);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=l.call(V,ve)}catch(Ct){Ge=[6,Ct],z=0}finally{y=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Re,ct])}}}function me(){for(var V=0,l=0,y=arguments.length;l<y;l++)V+=arguments[l].length;var z=Array(V),Z=0;for(l=0;l<y;l++)for(var G=arguments[l],ve=0,ze=G.length;ve<ze;ve++,Z++)z[Z]=G[ve];return z}var ue=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(l,y){for(var z=0,Z=y;z<Z.length;z++){var G=Z[z],ve=G[0],ze=G[1];l.setAttribute(ve,ze)}},V.createRect=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",l.toString()),Z.setAttribute("height",y.toString()),z&&V.setAttributes(Z,z),Z},V.createLine=function(l,y,z,Z,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",y.toString()),ve.setAttribute("x2",z.toString()),ve.setAttribute("y2",Z.toString()),G&&V.setAttributes(ve,G),ve},V.createPolygon=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",l),y&&V.setAttributes(z,y),z},V.createCircle=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(l/2).toString()),z.setAttribute("cy",(l/2).toString()),z.setAttribute("r",l.toString()),y&&V.setAttributes(z,y),z},V.createEllipse=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(l/2).toString()),Z.setAttribute("cy",(y/2).toString()),Z.setAttribute("rx",(l/2).toString()),Z.setAttribute("ry",(y/2).toString()),z&&V.setAttributes(Z,z),Z},V.createGroup=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&V.setAttributes(y,l),y},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(l,y,z,Z,G,ve,ze){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(Re,[["id",l],["orient",y],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",ve.toString()]]),Re.appendChild(ze),Re},V.createText=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),l&&V.setAttributes(y,l),y},V.createTSpan=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=l,y&&V.setAttributes(z,y),z},V.createImage=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&V.setAttributes(y,l),y},V.createPoint=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=l,z.y=y,z},V.createPath=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",l),y&&V.setAttributes(z,y),z},V}(),te=function(){function V(){}return V.addKey=function(l){V.key=l},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),fe=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return V.prototype.rasterize=function(l,y,z){var Z=this;return new Promise(function(G){var ve=z!==void 0?z:document.createElement("canvas");l===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var ze=document.createElementNS("http://www.w3.org/2000/svg","svg");ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),ze.setAttribute("width",y.width.baseVal.valueAsString),ze.setAttribute("height",y.height.baseVal.valueAsString),ze.setAttribute("viewBox","0 0 "+y.viewBox.baseVal.width.toString()+" "+y.viewBox.baseVal.height.toString()),ze.innerHTML=y.innerHTML,Z.naturalSize===!0?(ze.width.baseVal.value=l.naturalWidth,ze.height.baseVal.value=l.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(ze.width.baseVal.value=Z.width,ze.height.baseVal.value=Z.height),ve.width=ze.width.baseVal.value,ve.height=ze.height.baseVal.value;var Re=ze.outerHTML,ct=ve.getContext("2d");Z.markersOnly!==!0&&ct.drawImage(l,0,0,ve.width,ve.height);var Ge=window.URL,Ct=new Image(ve.width,ve.height);Ct.setAttribute("crossOrigin","anonymous");var Mt=new Blob([Re],{type:"image/svg+xml"}),Wt=Ge.createObjectURL(Mt);Ct.onload=function(){ct.drawImage(Ct,0,0),Ge.revokeObjectURL(Wt);var Fr=ve.toDataURL(Z.imageType,Z.imageQuality);G(Fr)},Ct.src=Wt})},V}(),se=function(){},_e=function(){function V(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},V.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new 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 xe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new xe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),Oe=function(V,l){this.selector=V,this.style=l},xe=function(V,l){this.localName=V,this.style=l},Pe=function(){function V(l,y,z,Z,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=y,this.markerItems=z,this.uiStyleSettings=Z,this.styles=G,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return V.prototype.show=function(l){var y=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var 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(G){var ve=document.createElement("div");ve.className=""+y.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",G.typeName),ve.innerHTML=G.icon,ve.addEventListener("click",function(){y.markerToolbarButtonClicked(ve,G)}),y.buttons.push(ve),y.markerButtons.push(ve)}),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 Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<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(Z,'<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()},V.prototype.addButtonClickListener=function(l){this.buttonClickListeners.push(l)},V.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},V.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},V.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var y=0;y<this.markerButtons.length;y++)y<l||y===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[y]):(y===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[y]))}},V.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")},V.prototype.resetButtonStyles=function(){var l=this;this.buttons.forEach(function(y){y.className=y.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),y.className=y.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),y.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},V.prototype.addActionButton=function(l,y,z){var Z=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=y,G.setAttribute("data-action",z),G.addEventListener("click",function(){Z.actionToolbarButtonClicked(G,z)}),z){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(G),this.buttons.push(G)},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("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 xe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("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 xe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("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+`
`))},V.prototype.markerToolbarButtonClicked=function(l,y){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("marker",y)}),this.markerButtonOverflowBlock.style.display="none"},V.prototype.actionToolbarButtonClicked=function(l,y){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("action",y)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},V.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},V.prototype.setActiveMarkerButton=function(l){var y=this.markerButtons.find(function(z){return z.getAttribute("data-type-name")===l});y&&this.setActiveButton(y)},V.prototype.setCurrentMarker=function(l){var y=this;this.currentMarker=l,this.buttons.filter(function(z){return/delete|notes/.test(z.getAttribute("data-action"))}).forEach(function(z){y.currentMarker===void 0?(z.style.fillOpacity="0.4",z.style.pointerEvents="none"):(z.style.fillOpacity="1",z.style.pointerEvents="all")})},V}(),Ne=function(){function V(l,y,z,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=y,this.uiStyleSettings=z,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return V.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new xe("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 xe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("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 xe("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
padding: `+y+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("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;
`))},V.prototype.show=function(l){var y;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((y=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},V.prototype.setPanelButtons=function(l){var y,z,Z=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((y=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&y!==void 0?y: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(G){var ve;G.uiStyleSettings=Z.uiStyleSettings;var ze=document.createElement("div");ze.className=Z.toolboxButtonStyleClass.name+" "+((ve=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:Z.toolboxButtonStyleColorsClass.name),ze.innerHTML=G.icon,ze.title=G.title,ze.addEventListener("click",function(){Z.panelButtonClick(G)}),Z.panelButtons.push(ze),Z.buttonRow.appendChild(ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},V.prototype.panelButtonClick=function(l){var y=this,z=-1;if(l!==this.activePanel){z=this.panels.indexOf(l),this.panelRow.innerHTML="";var Z=l.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){y.displayMode==="inline"?y.panelRow.style.display="none":y.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,ve){var ze,Re;G.className=y.toolboxButtonStyleClass.name+" "+(ve===z?""+((ze=y.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ze!==void 0?ze:y.toolboxActiveButtonStyleColorsClass.name):""+((Re=y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Re!==void 0?Re:y.toolboxButtonStyleColorsClass.name))})},V}(),Be=function(V,l){this.title=V,this.icon=l},We=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<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 ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=z,ve.currentColor=Z,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var G=y.getColorBox(Z);z.appendChild(G),y.colorBoxes.push(G)}),z},l.prototype.getColorBox=function(y){var z=this,Z=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-Z,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=G-2+"px",ve.style.height=G-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(G+2)/2+"px",ve.style.borderColor=y===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){z.setCurrentColor(y,ve)});var ze=document.createElement("div");return ze.style.display="inline-block",ze.style.width=G-2+"px",ze.style.height=G-2+"px",ze.style.backgroundColor=y,ze.style.borderRadius=G/2+"px",y==="transparent"&&(ze.style.fill=this.uiStyleSettings.toolboxAccentColor,ze.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>`),ve.appendChild(ze),ve},l.prototype.setCurrentColor=function(y,z){var Z=this;this.currentColor=y,this.colorBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(y)},l}(Be),Ue=function(){function V(l,y,z){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=y,this.globalSettings=z,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(V.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),V.prototype.ownsTarget=function(l){return!1},Object.defineProperty(V.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),V.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},V.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},V.prototype.pointerDown=function(l,y){},V.prototype.dblClick=function(l,y){},V.prototype.manipulate=function(l){},V.prototype.pointerUp=function(l){this.stateChanged()},V.prototype.dispose=function(){},V.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},V.prototype.getState=function(){return{typeName:V.typeName,state:this.state,notes:this.notes}},V.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},V.prototype.scale=function(l,y){},V.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},V.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},V.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},V.typeName="MarkerBase",V}(),Fe=function(){function V(){this.findGripByVisual=this.findGripByVisual.bind(this)}return V.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},V}(),at=function(){function V(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},V}(),it=function(){function V(){}return V.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},V.toSVGMatrix=function(l,y){return l.a=y.a,l.b=y.b,l.c=y.c,l.d=y.d,l.e=y.e,l.f=y.f,l},V}(),et=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(ue.createTransform()),G.setupControlBox(),G}return Te(l,V),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(y){this._visual=y;var z=ue.createTransform();this._visual.transform.baseVal.appendItem(z)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(y){return!!V.prototype.ownsTarget.call(this,y)||!!(this.controlGrips.findGripByVisual(y)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(y))},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.left=y.x,this.top=y.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Z=this.unrotatePoint(y);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.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 G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},l.prototype.pointerUp=function(y){var z=this.state;V.prototype.pointerUp.call(this,y),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(y),this._state="select",z==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(y){this.visual.style.transform="translate("+y.x+"px, "+y.y+"px)"},l.prototype.manipulate=function(y){var z=this.unrotatePoint(y);this.state==="creating"?this.resize(y):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(y)},l.prototype.resize=function(y){var z=this.manipulationStartLeft,Z=this.manipulationStartWidth,G=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:z=this.manipulationStartLeft+y.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-z;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+y.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+y.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+y.y-this.manipulationStartY}Z>=0?(this.left=z,this.width=Z):(this.left=z+Z,this.width=-Z),ve>=0?(this.top=G,this.height=ve):(this.top=G+ve,this.height=-ve),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(y){if(Math.abs(y.x-this.centerX)>.1){var z=Math.sign(y.x-this.centerX);this.rotationAngle=180*Math.atan((y.y-this.centerY)/(y.x-this.centerX))/Math.PI+90*z,this.applyRotation()}},l.prototype.applyRotation=function(){var y=this.container.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(y,0)},l.prototype.rotatePoint=function(y){if(this.rotationAngle===0)return y;var z=this.container.getCTM(),Z=ue.createPoint(y.x,y.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},l.prototype.unrotatePoint=function(y){if(this.rotationAngle===0)return y;var z=this.container.getCTM();z=z.inverse();var Z=ue.createPoint(y.x,y.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},l.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var y=ue.createTransform();y.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(y),this.container.appendChild(this.controlBox),this.controlRect=ue.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=ue.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 Fe,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var y=this.controlBox.transform.baseVal.getItem(0);y.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(y,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},l.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},l.prototype.createGrip=function(){var y=new at;return y.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(y.visual),y},l.prototype.positionGrips=function(){var y=this.controlGrips.topLeft.GRIP_SIZE,z=-y/2,Z=z,G=(this.width+this.CB_DISTANCE)/2-y/2,ve=(this.height+this.CB_DISTANCE)/2-y/2,ze=this.height+this.CB_DISTANCE-y/2,Re=this.width+this.CB_DISTANCE-y/2;this.positionGrip(this.controlGrips.topLeft.visual,z,Z),this.positionGrip(this.controlGrips.topCenter.visual,G,Z),this.positionGrip(this.controlGrips.topRight.visual,Re,Z),this.positionGrip(this.controlGrips.centerLeft.visual,z,ve),this.positionGrip(this.controlGrips.centerRight.visual,Re,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,z,ze),this.positionGrip(this.controlGrips.bottomCenter.visual,G,ze),this.positionGrip(this.controlGrips.bottomRight.visual,Re,ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,Z-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(y,z,Z){var G=y.transform.baseVal.getItem(0);G.setTranslate(z,Z),y.transform.baseVal.replaceItem(G,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:it.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:it.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;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(it.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,z.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(it.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,z.containerTransformMatrix))},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z);var Z=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:Z.x*y,y:Z.y*z});this.left=G.x,this.top=G.y,this.width=this.width*y,this.height=this.height*z,this.adjustControlBox()},l}(Ue),Ze=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual)},l.prototype.createVisual=function(){this.visual=ue.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.setSize()},l.prototype.setSize=function(){V.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(y){V.prototype.pointerUp.call(this,y),this.setSize()},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},l.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){var z=y;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize()},l.title="Rectangle marker",l}(et),ut=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=z,ve.currentWidth=Z,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.widths.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===y.currentWidth?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentWidth(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.innerText=Z.toString(),ve.style.marginRight="5px",G.appendChild(ve);var ze=document.createElement("div");ze.style.minHeight="20px",ze.style.flexGrow="2",ze.style.display="flex",ze.style.alignItems="center";var Re=document.createElement("hr");Re.style.minWidth="20px",Re.style.border="0px",Re.style.borderTop=Z+"px solid "+y.uiStyleSettings.toolboxColor,Re.style.flexGrow="2",ze.appendChild(Re),G.appendChild(ze),y.widthBoxes.push(G)}),z},l.prototype.setCurrentWidth=function(y,z){var Z=this;this.currentWidth=y,this.widthBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(Be),Je=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<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 ve.styles=[],ve.styleBoxes=[],ve.styles=z,ve.currentStyle=Z,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.styles.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/y.styles.length-5+"%",G.style.borderColor=Z===y.currentStyle?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentStyle(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var ze=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+y.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
</svg>`;ve.innerHTML=ze,G.appendChild(ve),y.styleBoxes.push(G)}),z},l.prototype.setCurrentStyle=function(y,z){var Z=this;this.currentStyle=y,this.styleBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(Be),st=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Te(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(Ze),ke=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},nt=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Te(l,V),l.prototype.ownsTarget=function(y){return!!V.prototype.ownsTarget.call(this,y)||!(!this.grip1.ownsTarget(y)&&!this.grip2.ownsTarget(y))},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.manipulationStartX=y.x,this.manipulationStartY=y.y,this.state==="new"&&(this.x1=y.x,this.y1=y.y,this.x2=y.x,this.y2=y.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")},l.prototype.pointerUp=function(y){var z=this.state;V.prototype.pointerUp.call(this,y),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(y),this._state="select",z==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(y){this.state==="creating"?this.resize(y):this.state==="move"?(this.x1=this.manipulationStartX1+y.x-this.manipulationStartX,this.y1=this.manipulationStartY1+y.y-this.manipulationStartY,this.x2=this.manipulationStartX2+y.x-this.manipulationStartX,this.y2=this.manipulationStartY2+y.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(y)},l.prototype.resize=function(y){switch(this.activeGrip){case this.grip1:this.x1=y.x,this.y1=y.y;break;case this.grip2:case void 0:this.x2=y.x,this.y2=y.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var y=new at;return y.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(y.visual),y},l.prototype.positionGrips=function(){var y=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-y/2,this.y1-y/2),this.positionGrip(this.grip2.visual,this.x2-y/2,this.y2-y/2)},l.prototype.positionGrip=function(y,z,Z){var G=y.transform.baseVal.getItem(0);G.setTranslate(z,Z),y.transform.baseVal.replaceItem(G,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.x1=z.x1,this.y1=z.y1,this.x2=z.x2,this.y2=z.y2},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.x1=this.x1*y,this.y1=this.y1*z,this.x2=this.x2*y,this.y2=this.y2*z,this.adjustVisual(),this.adjustControlBox()},l}(Ue),qe=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorLine&&y!==this.visibleLine)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(nt),Ie=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<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 ve.fonts=[],ve.fontBoxes=[],ve.fonts=z,ve.currentFont=Z,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.flexGrow="2",this.fonts.forEach(function(Z){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/y.fonts.length-5+"%",G.style.borderColor=Z===y.currentFont?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentFont(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=Z,ve.style.overflow="hidden";var ze=document.createElement("div");ze.style.whiteSpace="nowrap",ze.style.overflow="hidden",ze.style.textOverflow="ellipsis",ze.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(ze),G.appendChild(ve),y.fontBoxes.push(G)}),z},l.prototype.setCurrentFont=function(y,z){var Z=this;this.currentFont=y,this.fontBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(Be),He=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=Z.defaultColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Ie("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Te(l,V),l.prototype.ownsTarget=function(y){if(V.prototype.ownsTarget.call(this,y)||y===this.visual||y===this.textElement||y===this.bgRectangle)return!0;var z=!1;return this.textElement.childNodes.forEach(function(Z){Z===y&&(z=!0)}),z},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.isMoved=!1,this.pointerDownPoint=y,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.renderText=function(){var y=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){y.textElement.appendChild(ue.createTSpan(z.trim()===""?" ":z.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var y=this.textElement.getBBox(),z=1;if(y.width>0&&y.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/y.width,G=(1*this.height-this.height*this.padding*2/100)/y.height;z=Math.min(Z,G)}return z},l.prototype.getTextPosition=function(y){var z=this.textElement.getBBox(),Z=0,G=0;return z.width>0&&z.height>0&&(Z=(this.width-z.width*y)/2,G=this.height/2-z.height*y/2),{x:Z,y:G}},l.prototype.sizeText=function(){var y=this.textElement.getBBox(),z=this.getTextScale(),Z=this.getTextPosition(z);Z.y-=y.y*z,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+z+", "+z+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(z,z))},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(y.x-this.pointerDownPoint.x)>5||Math.abs(y.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){V.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},l.prototype.pointerUp=function(y){var z=this.state;z==="creating"&&(this._suppressMarkerCreateEvent=!0),V.prototype.pointerUp.call(this,y),this.setSize(),(z==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var y=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(y.textEditor.style.fontSize);y.textEditor.clientWidth>=Number.parseInt(y.textEditor.style.maxWidth)&&z>.9;)z-=.1,y.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=z.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(Z)),z.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){y.textEditDivClicked(y.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var y=this.getTextScale(),z=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),G={x:Z.width*y,y:Z.height*y};z.x-=G.x/2,z.y-=G.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*y,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(y){this.text=y.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){V.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),V.prototype.deselect.call(this)},l.prototype.dblClick=function(y,z){V.prototype.dblClick.call(this,y,z),this.showTextEditor()},l.prototype.setColor=function(y){this.textElement&&ue.setAttributes(this.textElement,[["fill",y]]),this.color=y,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(y)},l.prototype.setFont=function(y){this.textElement&&ue.setAttributes(this.textElement,[["font-family",y]]),this.fontFamily=y,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.color=z.color,this.fontFamily=z.fontFamily,this.padding=z.padding,this.text=z.text,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',l}(et),Ee=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=Z.defaultColor,G.lineWidth=Z.defaultStrokeWidth,G.pixelRatio=Z.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var y=ue.createTransform();this.visual.transform.baseVal.appendItem(y),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,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(y.x,y.y),this.drawing=!0):V.prototype.pointerDown.call(this,y,z)},l.prototype.manipulate=function(y){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(y.x,y.y),this.canvasContext.stroke()):V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(y){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):V.prototype.pointerUp.call(this,y)},l.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),V.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),V.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var y=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),z=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=z[0],G=z[1],ve=z[2],ze=z[3],Re=!1,ct=0;ct<this.canvasElement.height;ct++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)y.data[ct*this.canvasElement.width*4+4*Ge+3]>0&&(Re=!0,ct<G&&(G=ct),Ge<Z&&(Z=Ge),ct>ze&&(ze=ct),Ge>ve&&(ve=Ge));if(Re){this.left=Z/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(ve-Z)/this.pixelRatio,this.height=(ze-G)/this.pixelRatio;var Ct=document.createElement("canvas");Ct.width=ve-Z,Ct.height=ze-G,Ct.getContext("2d").putImageData(this.canvasContext.getImageData(Z,G,ve-Z,ze-G),0,0),this.drawingImgUrl=Ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},l.prototype.setColor=function(y){this.color=y,this.colorChanged(y)},l.prototype.setLineWidth=function(y){this.lineWidth=y},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({drawingImgUrl:this.drawingImgUrl},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){this.createVisual(),V.prototype.restoreState.call(this,y),this.drawingImgUrl=y.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',l}(et),pe=function(V){function l(y,z,Z){var G=V.call(this,y,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=z,G.setCurrentType=G.setCurrentType.bind(G),G}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2";for(var Z=function(ze){var Re="both";switch(ze){case 0:Re="both";break;case 1:Re="start";break;case 2:Re="end";break;case 3:Re="none"}var ct=document.createElement("div");if(ct.style.display="flex",ct.style.flexGrow="2",ct.style.alignItems="center",ct.style.justifyContent="space-between",ct.style.padding="5px",ct.style.borderWidth="2px",ct.style.borderStyle="solid",ct.style.borderColor=Re===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",ct.addEventListener("click",function(){y.setCurrentType(Re,ct)}),z.appendChild(ct),Re==="both"||Re==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",ct.appendChild(Ge)}var Ct=document.createElement("div");Ct.style.display="flex",Ct.style.alignItems="center",Ct.style.minHeight="20px",Ct.style.flexGrow="2";var Mt=document.createElement("hr");if(Mt.style.minWidth="20px",Mt.style.border="0px",Mt.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),Mt.style.flexGrow="2",Ct.appendChild(Mt),ct.appendChild(Ct),Re==="both"||Re==="end"){var Wt=document.createElement("div");Wt.style.display="flex",Wt.style.alignItems="center",Wt.style.minHeight="20px",Wt.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Wt.style.marginRight="5px",ct.appendChild(Wt)}G.typeBoxes.push(ct)},G=this,ve=0;ve<4;ve++)Z(ve);return z},l.prototype.setCurrentType=function(y,z){var Z=this;this.currentType=y,this.typeBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(Be),ye=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new pe("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.arrow1&&y!==this.arrow2)},l.prototype.getArrowPoints=function(y,z){var Z=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return y-Z/2+","+(z+G/2)+" "+y+","+(z-G/2)+" "+(y+Z/2)+","+(z+G/2)},l.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(V.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",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var y=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(y,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(z,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(y+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},l.prototype.setArrowType=function(y){this.arrowType=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({arrowType:this.arrowType},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.arrowType=z.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(qe),re=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor=Z.defaultFillColor,G.strokeWidth=0,G.fillPanel=new We("Color",Z.defaultColorSet,Z.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Te(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(Ze),oe=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<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 ve.opacities=[],ve.opacityBoxes=[],ve.opacities=z,ve.currentOpacity=Z,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=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(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===y.currentOpacity?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentOpacity(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.innerText=100*Z+"%",G.appendChild(ve),y.opacityBoxes.push(G)}),z},l.prototype.setCurrentOpacity=function(y,z){var Z=this;this.currentOpacity=y,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(Be),le=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=Z.defaultHighlightColor,G.strokeWidth=0,G.opacity=Z.defaultHighlightOpacity,G.fillPanel=new We("Color",Z.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new oe("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Te(l,V),l.prototype.setOpacity=function(y){this.opacity=y,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="HighlightMarker",l.title="Highlight marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',l}(re),de='<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>',Le=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=Z.defaultStrokeColor,G.bgColor=Z.defaultFillColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new We("Text color",Z.defaultColorSet,G.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>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new We("Fill color",Z.defaultColorSet,G.bgColor,de),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Ie("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new at,G.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Te(l,V),l.prototype.ownsTarget=function(y){return V.prototype.ownsTarget.call(this,y)||this.tipGrip.ownsTarget(y)||this.tip===y},l.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},l.prototype.pointerDown=function(y,z){this.state==="new"&&V.prototype.pointerDown.call(this,y,z),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(z)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):V.prototype.pointerDown.call(this,y,z)},l.prototype.pointerUp=function(y){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,V.prototype.pointerUp.call(this,y);else{var z=this.state==="creating";V.prototype.pointerUp.call(this,y),this.setTipPoints(z),this.positionTip()}},l.prototype.manipulate=function(y){if(this.tipMoving){var z=this.unrotatePoint(y);this.tipPosition={x:z.x-this.manipulationStartLeft,y:z.y-this.manipulationStartTop},this.positionTip()}else V.prototype.manipulate.call(this,y)},l.prototype.setBgColor=function(y){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",y]]),ue.setAttributes(this.tip,[["fill",y]])),this.bgColor=y,this.fillColorChanged(y)},l.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},l.prototype.setTipPoints=function(y){y===void 0&&(y=!1);var z=Math.min(this.height/2,15),Z=this.height/5;y&&(this.tipPosition={x:z+Z/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:0},this.tipBase2Position={x:z+Z,y:0}):(this.tipBase1Position={x:0,y:z},this.tipBase2Position={x:0,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-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+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:this.height},this.tipBase2Position={x:this.width-z,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-z-Z},this.tipBase2Position={x:this.width,y:this.height-z}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:this.height},this.tipBase2Position={x:z+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-z},this.tipBase2Position={x:0,y:this.height-z-Z})},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.positionTip()},l.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var y=this.tipGrip.visual.transform.baseVal.getItem(0);y.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(y,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),V.prototype.select.call(this)},l.prototype.getState=function(){var y=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.bgColor=z.bgColor,this.tipPosition=z.tipPosition,V.prototype.restoreState.call(this,y),this.createTip(),this.setTipPoints()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.tipPosition={x:this.tipPosition.x*y,y:this.tipPosition.y*z},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',l}(He),Me=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.fillColor=Z.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new We("Line color",me(Z.defaultColorSet,["transparent"]),Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new We("Fill color",me(Z.defaultColorSet,["transparent"]),G.fillColor,de),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new oe("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual)},l.prototype.createVisual=function(){this.visual=ue.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.setSize()},l.prototype.setSize=function(){V.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},l.prototype.pointerUp=function(y){V.prototype.pointerUp.call(this,y),this.setSize()},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},l.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(y),this.stateChanged()},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(y){this.opacity=y,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(et),Ye=function(V){function l(y,z,Z){return V.call(this,y,z,Z)||this}return Te(l,V),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.tip1&&y!==this.tip2)},l.prototype.createTips=function(){this.tip1=ue.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(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.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(ue.createTransform()),this.visual.appendChild(this.tip2)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(V.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.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()]]),ue.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 y=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(y,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(z,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(y+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',l}(qe),yt=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokePanel.colors=Z.defaultColorSet,G.fillColor="transparent",G}return Te(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(Me),At=function(){function V(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),V.prototype.addUndoStep=function(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},V.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},V.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},V.prototype.undo=function(){if(this.undoStack.length>1){var l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},V.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},V}(),Ke=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ut("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Je("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorCurve&&y!==this.visibleCurve&&!this.curveGrip.ownsTarget(y))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=y.x,this.curveY=y.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(z)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setupControlBox=function(){V.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,V.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){V.prototype.positionGrips.call(this);var y=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-y/2,this.curveY-y/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},l.prototype.manipulate=function(y){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+y.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+y.y-this.manipulationStartY),V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){this.activeGrip===this.curveGrip&&(this.curveX=y.x,this.curveY=y.y),V.prototype.resize.call(this,y),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual()},l.prototype.scale=function(y,z){this.curveX=this.curveX*y,this.curveY=this.curveY*z,V.prototype.scale.call(this,y,z)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.curveX=z.curveX,this.curveY=z.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',l}(nt),xt=function(){function V(l,y){y===void 0&&(y=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=y}return Object.defineProperty(V.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),V.prototype.preventDefault=function(){this._defaultPrevented=!0},V}(),mt=function(V){function l(y,z,Z){var G=V.call(this,y,!1)||this;return G.dataUrl=z,G.state=Z,G}return Te(l,V),l}(xt),ot=function(V){function l(y,z,Z){Z===void 0&&(Z=!1);var G=V.call(this,y,Z)||this;return G.marker=z,G}return Te(l,V),l}(xt),Rt=function(){function V(){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 V.prototype.addEventListener=function(l,y){this[l].push(y)},V.prototype.removeEventListener=function(l,y){var z=this[l].indexOf(y);z>-1&&this[l].splice(z,1)},V}(),Lt=function(){function V(l){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ke,this._isOpen=!1,this.undoRedoManager=new At,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 Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=V.instanceCounter++,this.styles=new _e(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(V.prototype,"ALL_MARKER_TYPES",{get:function(){return[st,Ee,ye,He,yt,Me,le,Le,Ye,re,qe,Ke]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[st,Ee,ye,He,Me,le,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"BASIC_MARKER_TYPES",{get:function(){return[st,Ee,ye,He,le]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var y=this;this._availableMarkerTypes.splice(0),l.forEach(function(z){if(typeof z=="string"){var Z=y.ALL_MARKER_TYPES.find(function(G){return G.typeName===z});Z!==void 0&&y._availableMarkerTypes.push(Z)}else y._availableMarkerTypes.push(z)})},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(l){this._zoomLevel=l,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),V.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},V.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(y){return y(new xt(l))})},V.prototype.render=function(){return Ce(this,void 0,void 0,function(){var l;return Se(this,function(y){switch(y.label){case 0:return this.setCurrentMarker(),(l=new fe).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return y.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,y.sent()]}})})},V.prototype.close=function(l){var y=this;if(l===void 0&&(l=!1),this.isOpen){var z=!1;l||this.eventListeners.beforeclose.forEach(function(Z){var G=new xt(y,!0);Z(G),G.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(Z){return Z(new xt(y))}),this.detachEvents(),this._isOpen=!1)}},V.prototype.addMarkersToToolbar=function(){for(var l,y=[],z=0;z<arguments.length;z++)y[z]=arguments[z];(l=this._availableMarkerTypes).push.apply(l,y)},V.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(y){l(y.dataUrl,y.state)})},V.prototype.removeRenderEventListener=function(l){},V.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},V.prototype.removeCloseEventListener=function(l){},V.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,y=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,z=y<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(y,z)},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.resize=function(l,y){this._isResizing=!0;var z=l/this.imageWidth,Z=y/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(y),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,Z),this._isResizing=!1},V.prototype.scaleMarkers=function(l,y){var z,Z=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(l,y):(z=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==Z._currentMarker&&G.scale(l,y)}),z!==void 0&&this.setCurrentMarker(z)},V.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"},V.prototype.setTopLeft=function(){var l=this.editingTarget.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=l.left-y.left,this.top=l.top-y.top},V.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)},V.prototype.addDefs=function(){for(var l,y=[],z=0;z<arguments.length;z++)y[z]=arguments[z];this.defs=ue.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,y)},V.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},V.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)},V.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},V.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},V.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)},V.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},V.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)},V.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},V.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")},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Pe(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 Ne(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},V.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.removeMarker=function(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.dispose()},V.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())},V.prototype.toolbarButtonClicked=function(l,y){if(l==="marker"&&y!==void 0)this.createNewMarker(y);else if(l==="action")switch(y){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()}},V.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var y=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var G=new ot(l,l._currentMarker,!0);Z(G),G.defaultPrevented&&(y=!0)}),!y){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(Z){return Z(new ot(l,z))})}}},V.prototype.clear=function(){var l=this,y=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var ze=new ot(l,void 0,!0);ve(ze),ze.defaultPrevented&&(y=!0)}),!y)){this.setCurrentMarker();for(var z=function(ve){var ze=Z.markers[ve];Z.setCurrentMarker(Z.markers[ve]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(Re){return Re(new ot(l,ze))})},Z=this,G=this.markers.length-1;G>=0;G--)z(G);this.addUndoStep()}},Object.defineProperty(V.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),V.prototype.showNotesEditor=function(){var l;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},V.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)},V.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},V.prototype.addUndoStep=function(){var l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var y=this.getState(),z=this.undoRedoManager.getLastUndoStep();if(!z||z.width===y.width&&z.height===y.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(y),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new xt(l))})}else this.undoRedoManager.replaceLastUndoStep(y),this.eventListeners.statechange.forEach(function(G){return G(new xt(l))})}},V.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},V.prototype.undoStep=function(){var l=this,y=this.undoRedoManager.undo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new xt(l))}))},V.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},V.prototype.redoStep=function(){var l=this,y=this.undoRedoManager.redo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new xt(l))}))},V.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},V.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},V.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var l,y,z=this;return Se(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return l=Z.sent(),y=this.getState(),this.eventListeners.render.forEach(function(G){return G(new mt(z,l,y))}),this.close(!0),[2]}})})},V.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var y={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(z){return y.markers.push(z.getState())}),y},V.prototype.restoreState=function(l){var y=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(z){var Z=y._availableMarkerTypes.find(function(ve){return ve.typeName===z.typeName});if(Z!==void 0){var G=y.addNewMarker(Z);G.restoreState(z),y.markers.push(G)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(z){return z(new xt(y))})},V.prototype.addNewMarker=function(l){var y=ue.createGroup();return this.markerImage.appendChild(y),new l(y,this.overlayContainer,this.settings)},V.prototype.createNewMarker=function(l){var y,z=this;(y=typeof l=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(y),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(y.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new ot(z,z._currentMarker))}))},V.prototype.markerCreated=function(l){var y=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(z){return z(new ot(y,y._currentMarker))})},V.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},V.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},V.prototype.markerStateChanged=function(l){var y=this;this.eventListeners.markerchange.forEach(function(z){return z(new ot(y,l))})},V.prototype.setCurrentMarker=function(l){var y=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(z){return z(new ot(y,y._currentMarker))})),this._currentMarker=l,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(z){return z(new ot(y,y._currentMarker))}))},V.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var y=this.markers.find(function(z){return z.ownsTarget(l.target)});y!==void 0?(this.setCurrentMarker(y),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},V.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var y=this.markers.find(function(z){return z.ownsTarget(l.target)});y!==void 0&&y!==this._currentMarker&&this.setCurrentMarker(y),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},V.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},V.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},V.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},V.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.markerImage.getBoundingClientRect();return{x:(l-z.left)/this.zoomLevel,y:(y-z.top)/this.zoomLevel}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},V.prototype.addLicenseKey=function(l){te.addKey(l)},V.prototype.addEventListener=function(l,y){this.eventListeners.addEventListener(l,y)},V.prototype.removeEventListener=function(l,y){this.eventListeners.removeEventListener(l,y)},V.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(V.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),V.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(y){return y(new xt(l))}))},V.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(y){return y(new xt(l))}))},V.instanceCounter=0,V}();/* **********************************
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 Kt=function(V,l){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,z){y.__proto__=z}||function(y,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(y[Z]=z[Z])})(V,l)};function Bt(V,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function y(){this.constructor=V}Kt(V,l),V.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}function wt(V,l,y,z){return new(y||(y=Promise))(function(Z,G){function ve(ct){try{Re(z.next(ct))}catch(Ge){G(Ge)}}function ze(ct){try{Re(z.throw(ct))}catch(Ge){G(Ge)}}function Re(ct){var Ge;ct.done?Z(ct.value):(Ge=ct.value,Ge instanceof y?Ge:new y(function(Ct){Ct(Ge)})).then(ve,ze)}Re((z=z.apply(V,l||[])).next())})}function yr(V,l){var y,z,Z,G,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function ze(Re){return function(ct){return function(Ge){if(y)throw new TypeError("Generator is already executing.");for(;ve;)try{if(y=1,z&&(Z=2&Ge[0]?z.return:Ge[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,Ge[1])).done)return Z;switch(z=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,z=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=Ge;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(Ge);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=l.call(V,ve)}catch(Ct){Ge=[6,Ct],z=0}finally{y=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Re,ct])}}}var ir=function(){function V(){}return V.addKey=function(l){V.key=l},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),gt=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(l,y){for(var z=0,Z=y;z<Z.length;z++){var G=Z[z],ve=G[0],ze=G[1];l.setAttribute(ve,ze)}},V.createRect=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",l.toString()),Z.setAttribute("height",y.toString()),z&&V.setAttributes(Z,z),Z},V.createLine=function(l,y,z,Z,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",y.toString()),ve.setAttribute("x2",z.toString()),ve.setAttribute("y2",Z.toString()),G&&V.setAttributes(ve,G),ve},V.createPolygon=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",l),y&&V.setAttributes(z,y),z},V.createCircle=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(l/2).toString()),z.setAttribute("cy",(l/2).toString()),z.setAttribute("r",l.toString()),y&&V.setAttributes(z,y),z},V.createEllipse=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(l/2).toString()),Z.setAttribute("cy",(y/2).toString()),Z.setAttribute("rx",(l/2).toString()),Z.setAttribute("ry",(y/2).toString()),z&&V.setAttributes(Z,z),Z},V.createGroup=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&V.setAttributes(y,l),y},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(l,y,z,Z,G,ve,ze){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(Re,[["id",l],["orient",y],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",ve.toString()]]),Re.appendChild(ze),Re},V.createText=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),l&&V.setAttributes(y,l),y},V.createTSpan=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=l,y&&V.setAttributes(z,y),z},V.createImage=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&V.setAttributes(y,l),y},V.createPoint=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=l,z.y=y,z},V.createPath=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",l),y&&V.setAttributes(z,y),z},V.createElement=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg",l);return y&&V.setAttributes(z,y),z},V.getHollowRectanglePath=function(l,y,z,Z,G,ve,ze,Re){return"M"+l+","+y+"V"+(y+Z)+"H"+(l+z)+"V"+y+"H"+G+"V"+ve+"H"+(G+ze)+"V"+(ve+Re)+"H"+G+"V"+y+"Z"},V}(),Gr=function(){function V(l){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},V.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new br("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new fr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new fr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),br=function(V,l){this.selector=V,this.style=l},fr=function(V,l){this.localName=V,this.style=l},Tr=function(){function V(){this.blocks=[],this.display=""}return V.prototype.addButtonBlock=function(l){l.className=this.blockClassName,l.buttonClassName=this.buttonClassName,l.buttonColorsClassName=this.buttonColorsClassName,l.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(l)},V.prototype.addElementBlock=function(l){l.className===void 0&&(l.className=this.blockClassName),this.blocks.push(l)},V.prototype.getUI=function(){var l=document.createElement("div");return l.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,l.style.display=this.display,this.blocks.forEach(function(y){return l.appendChild(y.getUI())}),l},V}(),si=function(){function V(){}return V.prototype.getUI=function(){var l=document.createElement("div");if(l.className=this.className,this.minWidth!==void 0&&(l.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"end":l.style.justifyContent="flex-end"}return l.style.whiteSpace="nowrap",l},V}(),Kr=function(V){function l(){var y=V!==null&&V.apply(this,arguments)||this;return y.buttons=[],y}return Bt(l,V),l.prototype.addButton=function(y){y.className=this.buttonClassName,y.colorsClassName=this.buttonColorsClassName,y.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(y)},l.prototype.getUI=function(){var y=V.prototype.getUI.call(this);return this.buttons.forEach(function(z){return y.appendChild(z.getUI())}),y},l}(si),It=function(){function V(l,y){this._isActive=!1,this._isHidden=!1,this._icon=l,this.title=y,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(V.prototype,"icon",{get:function(){return this._icon},set:function(l){this._icon=l,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isActive",{get:function(){return this._isActive},set:function(l){this._isActive=l,this.adjustClassName()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){var l=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return l.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},V.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,"")))},V.prototype.hide=function(){this._isHidden=!0},V}(),ft=function(V){function l(){var y=V!==null&&V.apply(this,arguments)||this;return y.elements=[],y}return Bt(l,V),l.prototype.addElement=function(y){this.elements.push(y)},l.prototype.getUI=function(){var y=V.prototype.getUI.call(this);return this.elements.forEach(function(z){return y.appendChild(z)}),y},l}(si),Ur=function(){function V(l,y){this.horizontal=l,this.vertical=y}return Object.defineProperty(V.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),V.prototype.getVerticalLength=function(l){return l/this.ratio},V.prototype.getHorizontalLength=function(l){return l*this.ratio},V}(),li=function(){function V(){}return V.getIcon=function(l,y){if(l>0&&y>0){var z=new Ur(l,y),Z=z.ratio>=1?20:z.getHorizontalLength(20),G=z.ratio<1?20:z.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var ze=gt.createDefs();ve.appendChild(ze);var Re=gt.createElement("clipPath",[["id","text-bg-clip"]]);ze.appendChild(Re);var ct=gt.createPath(gt.getHollowRectanglePath((24-Z)/2,(24-G)/2,Z,G,(24-Z)/2+2,(24-G)/2+2,Z-4,G-4));ve.appendChild(ct);var Ge=gt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(gt.createTSpan(l+":"+y)),ve.appendChild(Ge);var Ct=Ge.getBBox();gt.setAttributes(Ge,[["x",((24-Ct.width)/2).toString()],["y",((24-Ct.height)/2-Ct.y).toString()]]);var Mt=gt.createPath(gt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ct.width))/2,(24-Math.ceil(Ct.height))/2,Math.ceil(Ct.width),Math.ceil(Ct.height)));return Re.appendChild(Mt),gt.setAttributes(ct,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.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>'},V}(),wr=function(V){function l(y,z,Z){var G=V.call(this,y,z)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=Z,G}return Bt(l,V),l.prototype.setupDropdown=function(){var y=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=y.className,z.colorsClassName=y.colorsClassName,y.dropdownBlock.appendChild(z.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},l.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},l.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},l.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},l.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},l.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},l}(It),Ot=function(){function V(l,y){this.GRIP_SIZE=10,this.color=l,this.fillColor=y,this.visual=gt.createGroup(),this.visual.appendChild(gt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(gt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},V.prototype.setCenter=function(l,y){this.visual.childNodes.forEach(function(z){return gt.setAttributes(z,[["cx",l.toString()],["cy",y.toString()]])})},V}(),Vr=function(){function V(l,y,z,Z){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=l,this.canvasHeight=y,this.margin=z,this.container=Z,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(V.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(l){this._aspectRatio=l,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.gridContainer&&gt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(l){this._zoomFactor=l,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),V.prototype.open=function(){var l=this;this.cropShadeElement=gt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=gt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var y=0;y<this.numberOfGridLines;y++)this.horizontalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(z){return l.gridContainer.appendChild(z)}),this.verticalGridLines.forEach(function(z){return l.gridContainer.appendChild(z)}),this.cropRectElement=gt.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()},V.prototype.setCropRectangle=function(l){this.cropRect=l;var y=Object.assign({},this.cropRect);this.zoomFactor!==1&&(y.width=this.cropRect.width*this.zoomFactor,y.height=this.cropRect.height*this.zoomFactor,y.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-y.width/2,y.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-y.height/2),gt.setAttributes(this.cropRectElement,[["x",y.x.toString()],["y",y.y.toString()],["width",y.width.toString()],["height",y.height.toString()]]);var z=y.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,ve){var ze=y.y+z*(ve+1);gt.setAttributes(G,[["x1",""+y.x],["y1",""+ze],["x2",""+(y.x+y.width)],["y2",""+ze]])});var Z=y.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,ve){var ze=y.x+Z*(ve+1);gt.setAttributes(G,[["x1",""+ze],["y1",""+y.y],["x2",""+ze],["y2",""+(y.y+y.height)]])}),gt.setAttributes(this.cropShadeElement,[["d",gt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,y.x,y.y,y.width,y.height)]]),this.topLeftGrip.setCenter(y.x,y.y),this.topRightGrip.setCenter(y.x+y.width,y.y),this.bottomLeftGrip.setCenter(y.x,y.y+y.height),this.bottomRightGrip.setCenter(y.x+y.width,y.y+y.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},V.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)},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.container.getBoundingClientRect();return{x:l-z.left+this.margin,y:y-z.top+this.margin}},V.prototype.onPointerDown=function(l){this.container.setPointerCapture(l.pointerId),this.previousPoint=this.clientToLocalCoordinates(l.clientX,l.clientY),this.cropRectElement===l.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(l.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(l.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(l.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(l.target)&&(this.activeGrip=this.bottomRightGrip)},V.prototype.onPointerMove=function(l){if(this.isMoving)this.move(this.clientToLocalCoordinates(l.clientX,l.clientY));else if(this.activeGrip){var y=this.clientToLocalCoordinates(l.clientX,l.clientY);this.resize(y)}l.preventDefault()},V.prototype.onPointerUp=function(l){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(l.pointerId)},V.prototype.move=function(l){var y=l.x-this.previousPoint.x,z=l.y-this.previousPoint.y;this.zoomFactor!==1&&(y=-y/this.zoomFactor,z=-z/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+y),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=l},V.prototype.resize=function(l){var y=Object.assign({},this.cropRect),z=l.x-this.previousPoint.x,Z=l.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:y.x+z<this.margin&&(z=this.margin-y.x),y.x+=z,y.width=this.cropRect.x+this.cropRect.width-y.x;break;case this.bottomRightGrip:case this.topRightGrip:y.width+z>this.canvasWidth*this.zoomFactor&&(z=this.canvasWidth*this.zoomFactor-y.width),y.width+=z}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(y.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(z),y.height=this.aspectRatio.getVerticalLength(y.width)):(y.y+=Z,y.height=this.cropRect.y+this.cropRect.height-y.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?y.height=this.aspectRatio.getVerticalLength(y.width):y.height+=Z}y.width<10&&(y.x=this.cropRect.x,y.width=10),y.height<10&&(y.y=this.cropRect.y,y.height=10),this.previousPoint=l,y.x>=this.margin&&y.y>=this.margin&&y.x-this.margin+y.width<=this.canvasWidth&&y.y-this.margin+y.height<=this.canvasHeight&&(this.cropRect=y,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},V.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var l=this.cropRect.x+this.cropRect.width/2,y=this.cropRect.y+this.cropRect.height/2,z=this.aspectRatio.getHorizontalLength(this.cropRect.height),Z=this.aspectRatio.getVerticalLength(this.cropRect.width);z/this.canvasWidth<Z/this.canvasHeight?this.cropRect.width=z:this.cropRect.height=Z,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=l-this.cropRect.width/2,this.cropRect.y=y-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)}},V.prototype.getRescaledRect=function(l,y,z,Z,G,ve){var ze=z/l,Re=Z/y;return{x:(G.x-ve)*ze+ve,y:(G.y-ve)*Re+ve,width:G.width*ze,height:G.height*Re}},V.prototype.scaleCanvas=function(l,y){var z=this.getRescaledRect(this.canvasWidth,this.canvasHeight,l,y,this.cropRect,this.margin);this.canvasWidth=l,this.canvasHeight=y,this.onCropChange&&this.onCropChange(z),this.setCropRectangle(z)},V}(),ui=function(){function V(l){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=l,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(V.prototype,"angle",{get:function(){return this._angle},set:function(l){this._angle=l,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),V.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},V.prototype.onPointerDown=function(l){this.controlContainer.setPointerCapture(l.pointerId),this.isDragging=!0,this.previousPoint={x:l.clientX,y:l.clientY}},V.prototype.onPointerMove=function(l){this.isDragging&&(this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.previousPoint.x=l.clientX)},V.prototype.onPointerUp=function(l){this.isDragging&&this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(l.pointerId)},V.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var l=this.angleLabelText.getBBox();gt.setAttributes(this.angleLabelElement,[["x",((this.width-l.width)/2).toString()],["y",(this.height/2).toString()]])}},V.prototype.positionScaleShape=function(){if(this.scaleShape){var l=this.scaleShape.transform.baseVal.getItem(0);l.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(l,0)}},V.prototype.getVisual=function(){var l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("width",this.width+"px"),l.setAttribute("height",this.height+"px"),l.setAttribute("viewBox","0 0 "+this.width+" "+this.height),l.style.flexShrink="0",document.body.appendChild(l);for(var y="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,z=1;z<=this.width/5+10;z++){var Z=z%5==0?this.height/3:this.height/6;y+="h4v"+-Z+"h1v"+Z}y+="v1H0Z",this.scaleShape=gt.createPath(y);var G=gt.createTransform();this.scaleShape.transform.baseVal.appendItem(G),l.appendChild(this.scaleShape),this.angleLabelElement=gt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=gt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=gt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),l.appendChild(this.angleLabelElement),document.body.removeChild(l),l},V}(),gi=function(){function V(){this.naturalSize=!1,this.imageType="image/png"}return V.prototype.rasterize=function(l,y,z,Z,G,ve,ze){var Re=this;return new Promise(function(ct){var Ge=document.createElement("canvas");Ge.width=l.width.baseVal.value-2*Z,Ge.height=l.height.baseVal.value-2*Z;var Ct=1,Mt=1;Re.naturalSize===!0?(Ct=y.naturalWidth/(l.width.baseVal.value-2*Z)/ve,Mt=y.naturalHeight/(l.height.baseVal.value-2*Z)/ze,Ge.width=y.naturalWidth/ve,Ge.height=y.naturalHeight/ze):Re.width!==void 0&&Re.height!==void 0&&(Ct=Re.width/z.width,Mt=Re.height/z.height,Ge.width*=Ct,Ge.height*=Mt);var Wt=Ge.getContext("2d");Wt.translate(Ge.width/2,Ge.height/2),Wt.rotate(G*Math.PI/180),Wt.scale(ve,ze),Wt.translate(-Ge.width/2,-Ge.height/2),Wt.drawImage(y,0,0,Ge.width,Ge.height);var Fr=document.createElement("canvas");Fr.width=z.width*Ct,Fr.height=z.height*Mt,Fr.getContext("2d").putImageData(Wt.getImageData((z.x-Z)*Ct,(z.y-Z)*Mt,z.width*Ct,z.height*Mt),0,0),ct(Fr.toDataURL(Re.imageType,Re.imageQuality))})},V}(),Xe=function(){function V(l){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=V.instanceCounter++,this.styles=new Gr(this.instanceNo),this.target=l,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(l){this._zoomToCropEnabled=l,l?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"gridLines",{get:function(){return this._gridLines},set:function(l){this._gridLines=l,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(l){this._rotationAngle=l,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"aspectRatio",{get:function(){var l;return(l=this._aspectRatio)!==null&&l!==void 0?l:this.aspectRatios[0]},set:function(l){this._aspectRatio=l},enumerable:!1,configurable:!0}),V.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},V.prototype.show=function(){this.showUI(),this.open()},V.prototype.close=function(l){l===void 0&&(l=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),l||this.closeEventListeners.forEach(function(y){return y()}),this._isOpen=!1)},V.prototype.addRenderEventListener=function(l){this.renderEventListeners.push(l)},V.prototype.removeRenderEventListener=function(l){this.renderEventListeners.indexOf(l)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(l),1)},V.prototype.addCloseEventListener=function(l){this.closeEventListeners.push(l)},V.prototype.removeCloseEventListener=function(l){this.closeEventListeners.indexOf(l)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(l),1)},V.prototype.setupResizeObserver=function(){var l=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var l=1*this.target.clientWidth/this.target.clientHeight,y=this.contentDiv.clientWidth/l>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*l:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,z=y+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/l;this.resize(y,z)}},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.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",gt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},V.prototype.resize=function(l,y){this.imageWidth=Math.round(l),this.imageHeight=Math.round(y),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()},V.prototype.setEditingTarget=function(){var l=document.createElement("canvas");l.width=this.target.naturalWidth,l.height=this.target.naturalHeight,l.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var y=l.toDataURL();gt.setAttributes(this.editingTarget,[["href",y]]),this.setEditingTargetSize()},V.prototype.setTopLeft=function(){var l=this.target.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=l.left-y.left-this.CANVAS_MARGIN,this.top=l.top-y.top-this.CANVAS_MARGIN},V.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=gt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=gt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=gt.createGroup(),this.editingTargetRotationScaleContainer=gt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var l=gt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(l);var y=gt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(y),this.editingTargetContainer=gt.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)},V.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},V.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=gt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Vr(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()},V.prototype.zoomToCrop=function(){if(this.cropRect){var l=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,y=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=l+"px "+y+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-l+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-y+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},V.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)},V.prototype.cropRectChanged=function(l){this.cropRect=l,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},V.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var l=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,y=this.target.offsetTop>l+this.CANVAS_MARGIN?this.target.offsetTop-(l+this.CANVAS_MARGIN):0;this.coverDiv.style.top=y+"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},V.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},V.prototype.addTopToolbar=function(){var l=this;this.topToolbar=new Tr,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 y=new Kr;y.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(y);var z=[];this.aspectRatios.forEach(function(Mt){var Wt=new It(li.getIcon(Mt.horizontal,Mt.vertical),Mt.horizontal===0&&Mt.vertical===0?"FREE":Mt.horizontal+":"+Mt.vertical);Wt.onClick=function(){return l.ratioButtonClicked(Mt)},z.push(Wt)}),this.aspectRatioButton=new wr(li.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,y.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Z=new It('<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");Z.isActive=this.isGridVisible,Z.onClick=function(){l.isGridVisible=!l.isGridVisible,Z.isActive=l.isGridVisible},y.addButton(Z);var G=new It('<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(G.isActive=this.zoomToCropEnabled,G.onClick=function(){l.zoomToCropEnabled=!l.zoomToCropEnabled,G.isActive=l.zoomToCropEnabled},y.addButton(G),!ir.isLicensed){var ve=new ft;this.topToolbar.addElementBlock(ve);var ze=document.createElement("div");ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Re=document.createElement("a");Re.style.color="currentColor",Re.href="https://markerjs.com/products/cropro",Re.target="_blank",Re.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>',ze.appendChild(Re),ve.addElement(ze)}var ct=new Kr;ct.minWidth=3*this.toolbarHeight+"px",ct.contentAlign="end",this.topToolbar.addButtonBlock(ct);var Ge=new It('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,ct.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ct=new It('<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");Ct.onClick=this.close,ct.addButton(Ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},V.prototype.addBottomToolbar=function(){var l=this;this.bottomToolbar=new Tr,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 y=new Kr;y.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(y);var z=new It('<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,y.addButton(z);var Z=new It('<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");Z.onClick=this.rotateRightButtonClicked,y.addButton(Z);var G=new ft;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new ui("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(ct){l.rotateBy(ct),l.straightener.angle=l.rotationAngle},G.addElement(this.straightener.getUI());var ve=new Kr;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var ze=new It('<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");ze.onClick=this.flipHorizontallyButtonClicked,ve.addButton(ze);var Re=new It('<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");Re.onClick=this.flipVerticallyButtonClicked,ve.addButton(Re)},V.prototype.ratioButtonClicked=function(l){this.aspectRatio=l,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},V.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},V.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},V.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},V.prototype.restoreState=function(l){if(l){var y=this.cropLayer.getRescaledRect(l.width,l.height,this.imageWidth,this.imageHeight,l.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(y),this.cropRectChanged(y),this.flippedHorizontally=l.flippedHorizontally,this.flippedVertically=l.flippedVertically,this.applyFlip(),this.rotationAngle=l.rotationAngle,this.applyRotation()}},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.cropImage.getBoundingClientRect();return{x:l-z.left,y:y-z.top}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var l=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},V.prototype.rotateLeftButtonClicked=function(){var l=this.rotationAngle-90;this.rotationAngle%90!=0&&(l+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(l)},V.prototype.rotateRightButtonClicked=function(){var l=this.rotationAngle+90;this.rotationAngle%90!=0&&(l-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(l)},V.prototype.rotateTo=function(l){l=(l=l>180?l-360:l)<=-180?l+360:l,this.rotationAngle=l,this.applyRotation()},V.prototype.rotateBy=function(l){this.rotateTo((this.rotationAngle+l)%360)},V.prototype.applyRotation=function(){var l=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var y=this.editingTargetRotationContainer.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(y,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=l},V.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},V.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},V.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},V.prototype.startRenderAndClose=function(){return wt(this,void 0,void 0,function(){var l,y;return yr(this,function(z){switch(z.label){case 0:return[4,this.render()];case 1:return l=z.sent(),y=this.getState(),this.renderEventListeners.forEach(function(Z){return Z(l,y)}),this.close(!0),[2]}})})},V.prototype.render=function(){return wt(this,void 0,void 0,function(){var l;return yr(this,function(y){switch(y.label){case 0:return(l=new gi).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.width=this.renderWidth,l.height=this.renderHeight,this.unzoomFromCrop(),gt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,l.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return y.sent(),[4,l.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,y.sent()]}})})},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new fr("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 fr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new fr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var l=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new fr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*l)+`px;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new fr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new fr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new fr("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 fr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new fr("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 fr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new fr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},V.instanceCounter=0,V}(),St=ie("8hTe"),ei=ie.n(St),hi=/<pre[^>]*>/g;function di(V){var l=document.createElement("div");return l.innerHTML=V,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var ki=$e.a=function(V){var l=V.value,y=l===void 0?"":l,z=V.edit,Z=z===void 0?!1:z,G=V.className,ve=V.showTextOnly,ze=V.showLines,Re=V.replaces,ct=V.zoomImg,Ge=V.hasMask,Ct=V.style,Mt=Ct===void 0?{}:Ct,Wt=V.stylesPrev,Fr=Wt===void 0?{}:Wt,jr=String(y),sr=Object(w.useRef)(),Xr=Object(w.useRef)(),Ki=Object(w.useState)(""),Ar=Object(W.a)(Ki,2),_r=Ar[0],ti=Ar[1],vi=Object(w.useState)("office"),$r=Object(W.a)(vi,2),ri=$r[0],Wr=$r[1],fn=function(){var Ut=new Xe(Xr.current);Ut.displayMode="popup",Ut.addRenderEventListener(function(){var pr=Object(R.a)(P.a.mark(function Ft(mr){var Xt;return P.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:return sr.current.style.display="none",nr.next=3,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr}});case 3:Xt=nr.sent,Xt!=null&&Xt.id&&Re(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 5:case"end":return nr.stop()}},Ft)}));return function(Ft){return pr.apply(this,arguments)}}()),Ut.show()},Vi=function(){var Ut=new Lt(Xr.current);Ut.settings.displayMode="popup",Ut.addEventListener("render",function(){var pr=Object(R.a)(P.a.mark(function Ft(mr){var Xt;return P.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:if(sr.current.style.display="none",!Xr.current){nr.next=6;break}return nr.next=4,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr.dataUrl}});case 4:Xt=nr.sent,Xt!=null&&Xt.id&&Re(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 6:case"end":return nr.stop()}},Ft)}));return function(Ft){return pr.apply(this,arguments)}}()),Ut.show(),window.markerArea=Ut},Pr=Object(w.useMemo)(function(){try{var qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ut=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;jr=jr.replace(qt,"("+q.a.API_SERVER+"/api/attachments/").replace(Ut,'"'+q.a.API_SERVER+"/api/attachments/").replace(pr,'"'+q.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),jr=jr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(yi){}var Ft=K(jr),mr=C();if(jr.match(/\[TOC\]/)&&(Ft=Ft.replace("<p>[TOC]</p>",D()),L()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(yi,nr){var ar=mr[nr],ii=ar.type,bi=ar.expression;return Object(ae.renderToString)(di(bi)||"",{displayMode:ii==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),E(),ve){var Xt=document.createElement("div");return Xt.innerHTML=Ft,Xt.innerText}return setTimeout(function(){return Oi()},500),Ft},[jr]),Mr=Object(w.useRef)();f.WebkitLineClamp=ze,ze&&(Mt=Object(F.a)(Object(F.a)({},Mt),f));function Ri(qt){var Ut=qt.target;if(Ut.tagName.toUpperCase()==="IMG"){if(ct){var pr=Ut.getAttribute("src");ti(pr),Wr("image")}}else if(Ut.tagName.toUpperCase()==="A"){var Ft=Ut.getAttribute("href");if(Ft.indexOf("office")>-1)qt.preventDefault(),ti(Ft),Wr("office");else if(Ft.indexOf("application/pdf")>-1)qt.preventDefault(),ti(Ft),Wr("pdf");else if(Ft.indexOf("type=text")>-1)qt.preventDefault(),ti(Ft),Wr("html");else if(Ft.startsWith("#")){qt.preventDefault();var mr=document.getElementById(Ft.replace("#",""));mr&&mr.scrollIntoView(!0)}}}var Oi=function(){var Ut,pr=(Ut=Mr.current)===null||Ut===void 0?void 0:Ut.querySelectorAll("video");pr==null||pr.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var mr=new X.a;mr.loadSource(Ft.src),mr.attachMedia(Ft)}}})};Object(w.useEffect)(function(){if(Mr.current&&Pr&&(Pr.match(hi)&&window.PR.prettyPrint()),Mr.current)return Mr.current.addEventListener("click",Ri),function(){Mr.current.removeEventListener("click",Ri),E(),L()}},[Pr,Mr.current,Ri]);var Pi=function(Ut){if(!Z)return;Ut.target.nodeName==="IMG"?(sr.current.style.display="flex",sr.current.style.width=Ut.target.clientWidth+"px",sr.current.style.height=Ut.target.clientHeight+"px",sr.current.style.top=Ut.target.offsetTop+"px",sr.current.style.left=Ut.target.offsetLeft+"px",Xr.current.src=Ut.target.getAttribute("src")):sr.current.style.display="none"};return p.a.createElement("div",{style:{position:"relative"}},p.a.createElement("div",{ref:Mr,style:Object(F.a)({},Mt),className:"".concat(G||""," markdown-body ").concat(ei.a.mdBody),onMouseOver:Pi,dangerouslySetInnerHTML:{__html:Pr}}),p.a.createElement("div",{ref:sr,className:ei.a.button},p.a.createElement($.a,null,p.a.createElement(Y.a,{onClick:function(){return fn()}},"\u88C1\u526A"),p.a.createElement(Y.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),p.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),p.a.createElement(he.a,{close:!0,data:_r,hasMask:Ge,type:_r!=null&&_r.length?ri:"",style:Object(F.a)({},Fr),onClose:function(){return ti("")}}))}},"9VGf":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return k});var ne=ie("q1tI"),$=ie.n(ne);function k(Y,F){var R=Object(ne.useRef)();Object(ne.useEffect)(function(){R.current=Y}),Object(ne.useEffect)(function(){function W(){R.current()}if(F!==null){var B=setInterval(W,F);return function(){return clearInterval(B)}}},[F])}},BU3w:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return R});var ne=ie("MNnm"),$="rc-util-key";function k(W){if(W.attachTo)return W.attachTo;var B=document.querySelector("head");return B||document.body}function Y(W){var B,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var w=document.createElement("style");if((B=P.csp)===null||B===void 0?void 0:B.nonce){var p;w.nonce=(p=P.csp)===null||p===void 0?void 0:p.nonce}w.innerHTML=W;var b=k(P),M=b.firstChild;return P.prepend&&b.prepend?b.prepend(w):P.prepend&&M?b.insertBefore(w,M):b.appendChild(w),w}var F=new Map;function R(W,B){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=k(P);if(!F.has(w)){var p=Y("",P),b=p.parentNode;F.set(w,b),b.removeChild(p)}var M=Array.from(F.get(w).children).find(function(a){return a.tagName==="STYLE"&&a[$]===B});if(M){var A,S;if(((A=P.csp)===null||A===void 0?void 0:A.nonce)&&M.nonce!==((S=P.csp)===null||S===void 0?void 0:S.nonce)){var x;M.nonce=(x=P.csp)===null||x===void 0?void 0:x.nonce}return M.innerHTML!==W&&(M.innerHTML=W),M}var d=Y(W,P);return d[$]=B,d}},Bd2K:function(lt,$e,ie){(function(ne){ne(ie("VrN/"),ie("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(P,w,p){if(p!=ne.Init&&p&&P.removeKeyMap("autoCloseTags"),!w)return;var b={name:"autoCloseTags"};(typeof w!="object"||w.whenClosing!==!1)&&(b["'/'"]=function(M){return R(M)}),(typeof w!="object"||w.whenOpening!==!1)&&(b["'>'"]=function(M){return Y(M)}),P.addKeyMap(b)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["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 Y(P){if(P.getOption("disableInput"))return ne.Pass;for(var w=P.listSelections(),p=[],b=P.getOption("autoCloseTags"),M=0;M<w.length;M++){if(!w[M].empty())return ne.Pass;var A=w[M].head,S=P.getTokenAt(A),x=ne.innerMode(P.getMode(),S.state),d=x.state,a=x.mode.xmlCurrentTag&&x.mode.xmlCurrentTag(d),s=a&&a.name;if(!s)return ne.Pass;var u=x.mode.configuration=="html",L=typeof b=="object"&&b.dontCloseTags||u&&$,f=typeof b=="object"&&b.indentTags||u&&k;S.end>A.ch&&(s=s.slice(0,s.length-S.end+A.ch));var v=s.toLowerCase();if(!s||S.type=="string"&&(S.end!=A.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&a.close||S.string.indexOf("/")==A.ch-S.start-1||L&&W(L,v)>-1||B(P,x.mode.xmlCurrentContext&&x.mode.xmlCurrentContext(d)||[],s,A,!0))return ne.Pass;var D=typeof b=="object"&&b.emptyTags;if(D&&W(D,s)>-1){p[M]={text:"/>",newPos:ne.Pos(A.line,A.ch+2)};continue}var T=f&&W(f,v)>-1;p[M]={indent:T,text:">"+(T?`
`:"")+"</"+s+">",newPos:T?ne.Pos(A.line+1,0):ne.Pos(A.line,A.ch+1)}}for(var g=typeof b=="object"&&b.dontIndentOnAutoClose,M=w.length-1;M>=0;M--){var c=p[M];P.replaceRange(c.text,w[M].head,w[M].anchor,"+insert");var h=P.listSelections().slice(0);h[M]={head:c.newPos,anchor:c.newPos},P.setSelections(h),!g&&c.indent&&(P.indentLine(c.newPos.line,null,!0),P.indentLine(c.newPos.line+1,null,!0))}}function F(P,w){for(var p=P.listSelections(),b=[],M=w?"/":"</",A=P.getOption("autoCloseTags"),S=typeof A=="object"&&A.dontIndentOnSlash,x=0;x<p.length;x++){if(!p[x].empty())return ne.Pass;var d=p[x].head,a=P.getTokenAt(d),s=ne.innerMode(P.getMode(),a.state),u=s.state;if(w&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=d.ch-1))return ne.Pass;var L,f=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")L=M+"script";else if(f&&s.mode.name=="css")L=M+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!v||v.length&&B(P,v,v[v.length-1],d))return ne.Pass;L=M+v[v.length-1]}P.getLine(d.line).charAt(a.end)!=">"&&(L+=">"),b[x]=L}if(P.replaceSelections(b),p=P.listSelections(),!S)for(var x=0;x<p.length;x++)(x==p.length-1||p[x].head.line<p[x+1].head.line)&&P.indentLine(p[x].head.line)}function R(P){return P.getOption("disableInput")?ne.Pass:F(P,!0)}ne.commands.closeTag=function(P){return F(P)};function W(P,w){if(P.indexOf)return P.indexOf(w);for(var p=0,b=P.length;p<b;++p)if(P[p]==w)return p;return-1}function B(P,w,p,b,M){if(!ne.scanForClosingTag)return!1;var A=Math.min(P.lastLine()+1,b.line+500),S=ne.scanForClosingTag(P,b,null,A);if(!S||S.tag!=p)return!1;for(var x=M?1:0,d=w.length-1;d>=0&&w[d]==p;d--)++x;b=S.to;for(var d=1;d<x;d++){var a=ne.scanForClosingTag(P,b,null,A);if(!a||a.tag!=p)return!1;b=a.to}return!0}})},BjJ7:function(lt,$e,ie){"use strict";ie.d($e,"d",function(){return $}),ie.d($e,"c",function(){return k}),ie.d($e,"e",function(){return Y}),ie.d($e,"b",function(){return F}),ie.d($e,"a",function(){return W});var ne=ie("m3rI");function $(B){var P=!0;if(B.length>0){for(var w=0;w<B.length;w++)if(B[w].compile_success==0||!B[w].compile_success){P=!1;break}}else P=!1;return P}function k(B){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",w=[],p=0;p<B.length;p++){var b=B[p],M=P?"".concat(P,"/").concat(b.name):"".concat(b.name);w.push({title:b.name,isLeaf:!(b.type==="tree"),key:M})}return w}function Y(B,P,w){for(var p=0;p<B.length;p++){var b=B[p];if(b.key===P){b.children=w;break}b.children&&Y(b.children,P,w)}return B}function F(B,P,w){var p;return function(){var b=this,M=arguments,A=function(){p=null,w||B.apply(b,M)},S=w&&!p;clearTimeout(p),p=setTimeout(A,P),S&&B.apply(b,M)}}var R=!0,W=ne.a.API_SERVER},"C+DQ":function(lt,$e,ie){},CKgm:function(lt,$e,ie){"use strict";ie.r($e);var ne=ie("+L6B"),$=ie("2/Rp"),k=ie("5NDa"),Y=ie("5rEg"),F=ie("sPJy"),R=ie("bE4q"),W=ie("miYZ"),B=ie("tsqr"),P=ie("9og8"),w=ie("k1fw"),p=ie("y8nQ"),b=ie("Vl3Y"),M=ie("tJVT"),A=ie("PpiC"),S=ie("OaEy"),x=ie("2fM7"),d=ie("WmNS"),a=ie.n(d),s=ie("q1tI"),u=ie.n(s),L=ie("Ty5D"),f=ie("9kvl"),v=ie("55Ip"),D=ie("Ot1p"),T=ie("500L"),g=ie("h+Ho"),c=ie("7/Dv"),h=ie.n(c),o=x.a.Option,C=function(m){var O,U,j,K=m.forumsDetail,I=m.globalSetting,N=m.loading,X=m.dispatch,q=Object(A.a)(m,["forumsDetail","globalSetting","loading","dispatch"]),ae=Object(L.i)(),he=b.a.useForm(),Ae=Object(M.a)(he,1),be=Ae[0],Te=Object(s.useState)({}),Ce=Object(M.a)(Te,2),Se=Ce[0],me=Ce[1],ue=Object(s.useState)(0),te=Object(M.a)(ue,2),fe=te[0],se=te[1],_e=Object(s.useState)(!1),Oe=Object(M.a)(_e,2),xe=Oe[0],Pe=Oe[1],Ne=Object(s.useState)({}),Be=Object(M.a)(Ne,2),We=Be[0],Ue=Be[1],Fe=Object(s.useState)(1),at=Object(M.a)(Fe,2),it=at[0],et=at[1];Object(s.useEffect)(function(){if(Ze(),ae.memoId)Pe(!0),ut();else{Pe(!1);var ke={forum_id:5};me(Object(w.a)({},ke)),be.setFieldsValue(Object(w.a)({},ke))}},[ae.memoId]);var Ze=function(){var ke=Object(P.a)(a.a.mark(function nt(){var qe;return a.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Object(g.f)({});case 2:qe=He.sent,Ue(qe||{});case 4:case"end":return He.stop()}},nt)}));return function(){return ke.apply(this,arguments)}}(),ut=function(){var ke=Object(P.a)(a.a.mark(function nt(){var qe,Ie,He;return a.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:return pe.next=2,Object(g.e)({id:ae.memoId});case 2:if(pe.t0=pe.sent,pe.t0){pe.next=5;break}pe.t0={};case 5:Ie=pe.t0,He={subject:Ie.subject,content:Ie.content,attachments:Object(T.a)(Ie.attachments),forum_id:Ie.forum_id,memo_tags:(qe=Ie.memo_tags)===null||qe===void 0?void 0:qe.map(function(ye){return ye.id})},me(Object(w.a)({},He)),be.setFieldsValue(Object(w.a)({},He));case 9:case"end":return pe.stop()}},nt)}));return function(){return ke.apply(this,arguments)}}(),Je=function(){var ke=Object(P.a)(a.a.mark(function nt(qe){var Ie,He,Ee,pe;return a.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:if(Ee=Object(w.a)(Object(w.a)({id:xe?ae.memoId:null},Se),{},{attachment_ids:(Ie=Se.attachments)===null||Ie===void 0||((He=Ie.filter(function(oe){var le;return(le=oe.response)===null||le===void 0?void 0:le.id}))===null||He===void 0)?void 0:He.map(function(oe){var le;return(le=oe.response)===null||le===void 0?void 0:le.id}),tags:Se.memo_tags}),!xe){re.next=7;break}return re.next=4,Object(g.n)(Ee);case 4:re.t0=re.sent,re.next=10;break;case 7:return re.next=9,Object(g.j)(Ee);case 9:re.t0=re.sent;case 10:pe=re.t0,se(0),(pe==null?void 0:pe.status)===0&&(B.b.success(pe==null?void 0:pe.message),it===1?f.d.push("/forums/".concat(xe?ae==null?void 0:ae.memoId:pe==null?void 0:pe.memo_id)):f.d.push("/forums/".concat(xe?ae==null?void 0:ae.memoId:pe==null?void 0:pe.memo_id,"/edit")));case 13:case"end":return re.stop()}},nt)}));return function(qe){return ke.apply(this,arguments)}}(),st=function(){document.body.scrollIntoView(),window.location.href.includes("new")?f.d.goBack():f.d.push("/forums/".concat(ae.memoId))};return u.a.createElement("section",{className:h.a.bg},u.a.createElement("section",{className:"animated fadeIn mb10"},u.a.createElement("aside",{className:"mt10"},u.a.createElement(R.a,{separator:"/"},u.a.createElement(R.a.Item,null,u.a.createElement(v.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),u.a.createElement(R.a.Item,null,"\u8BE6\u60C5")))),u.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},xe?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),u.a.createElement(b.a,{form:be,className:h.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(nt,qe){console.log(qe,"values"),me(Object(w.a)(Object(w.a)({},Se),nt))},onFinish:Je,onFinishFailed:function(){se(0)}},u.a.createElement("div",{className:h.a.fieldWrap},u.a.createElement(b.a.Item,{name:"subject",label:u.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u540D\u79F0: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u540D\u79F0"}]},u.a.createElement(Y.a,{maxLength:50,suffix:"".concat(((O=Se.subject)===null||O===void 0?void 0:O.length)||0,"/50")}))),u.a.createElement("div",{className:h.a.mdWrap},u.a.createElement(b.a.Item,{name:"content",label:u.a.createElement("span",{className:"font16"},"\u5185\u5BB9: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u5185\u5BB9"}]},u.a.createElement(D.a,{height:600,id:"forums-new-content",watch:!0,defaultValue:Se.content})),u.a.createElement("div",null,u.a.createElement(b.a.Item,{name:"attachments",style:{width:350}},u.a.createElement(T.b,{showRemoveModal:!0})))),u.a.createElement("div",{className:h.a.mdWrap},u.a.createElement(b.a.Item,{name:"forum_id",label:u.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u7C7B\u578B: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u8BDD\u9898\u7C7B\u578B"}]},u.a.createElement(x.a,{style:{width:300}},We==null||((U=We.forums)===null||U===void 0)?void 0:U.map(function(ke){return u.a.createElement(o,{key:ke.id,value:ke.id},ke.name)})))),Se.forum_id===5&&u.a.createElement("div",{className:h.a.mdWrap},u.a.createElement(b.a.Item,{name:"memo_tags",label:u.a.createElement("span",{className:"font16"},"\u6280\u672F\u6807\u7B7E: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u6280\u672F\u6807\u7B7E"}]},u.a.createElement(x.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function(nt,qe){return qe.props.children.toLocaleLowerCase().indexOf(nt.toLocaleLowerCase())!=-1}},We==null||((j=We.tag_list)===null||j===void 0)?void 0:j.map(function(ke){return u.a.createElement(o,{key:ke.id,value:ke.id},ke.name)})))),u.a.createElement("div",{className:h.a.backgroundFa},u.a.createElement("div",{className:"pt40 mb30"},u.a.createElement(b.a.Item,null,u.a.createElement($.a,{size:"large",type:"primary",className:"".concat(h.a.button," mr20"),htmlType:"submit",loading:fe===1,onClick:function(){et(1),se(1)}},"\u63D0\u4EA4"),u.a.createElement($.a,{size:"large",type:"primary",className:"".concat(h.a.button," mr20"),htmlType:"submit",loading:fe===2,onClick:function(){et(2),se(2)}},"\u4FDD\u5B58"),u.a.createElement($.a,{size:"large",type:"primary",ghost:!0,className:"".concat(h.a.button," mr20"),onClick:st},"\u53D6\u6D88"))))))};$e.default=Object(f.a)(function(E){var m=E.forumsDetail,O=E.loading,U=E.globalSetting;return{forumsDetail:m,globalSetting:U,loading:O.models.forumsDetail}})(C)},D1Df:function(lt,$e,ie){"use strict";function ne(m){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(U){return typeof U}:ne=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},ne(m)}function $(){return $=Object.assign||function(m){for(var O=1;O<arguments.length;O++){var U=arguments[O];for(var j in U)Object.prototype.hasOwnProperty.call(U,j)&&(m[j]=U[j])}return m},$.apply(this,arguments)}function k(m,O){var U=Object.keys(m);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(m);O&&(j=j.filter(function(K){return Object.getOwnPropertyDescriptor(m,K).enumerable})),U.push.apply(U,j)}return U}function Y(m){for(var O=1;O<arguments.length;O++){var U=arguments[O]!=null?arguments[O]:{};O%2?k(U,!0).forEach(function(j){S(m,j,U[j])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(U)):k(U).forEach(function(j){Object.defineProperty(m,j,Object.getOwnPropertyDescriptor(U,j))})}return m}function F(m,O){if(m==null)return{};var U=R(m,O),j,K;if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(m);for(K=0;K<I.length;K++){if(j=I[K],O.indexOf(j)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(m,j))continue;U[j]=m[j]}}return U}function R(m,O){if(m==null)return{};var U={},j=Object.keys(m),K,I;for(I=0;I<j.length;I++){if(K=j[I],O.indexOf(K)>=0)continue;U[K]=m[K]}return U}function W(m,O){if(!(m instanceof O))throw new TypeError("Cannot call a class as a function")}function B(m,O){for(var U=0;U<O.length;U++){var j=O[U];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(m,j.key,j)}}function P(m,O,U){return O&&B(m.prototype,O),U&&B(m,U),m}function w(m,O){return O&&(ne(O)==="object"||typeof O=="function")?O:b(m)}function p(m){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},p(m)}function b(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function M(m,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(O&&O.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),O&&A(m,O)}function A(m,O){return A=Object.setPrototypeOf||function(j,K){return j.__proto__=K,j},A(m,O)}function S(m,O,U){return O in m?Object.defineProperty(m,O,{value:U,enumerable:!0,configurable:!0,writable:!0}):m[O]=U,m}var x=ie("q1tI"),d=ie("17x9"),a=ie("H38U"),s=ie("aRTE");function u(m){for(var O="",U=0;U<m.length;U++){var j=m.charCodeAt(U);j<128?O+=String.fromCharCode(j):j<2048?(O+=String.fromCharCode(192|j>>6),O+=String.fromCharCode(128|j&63)):j<55296||j>=57344?(O+=String.fromCharCode(224|j>>12),O+=String.fromCharCode(128|j>>6&63),O+=String.fromCharCode(128|j&63)):(U++,j=65536+((j&1023)<<10|m.charCodeAt(U)&1023),O+=String.fromCharCode(240|j>>18),O+=String.fromCharCode(128|j>>12&63),O+=String.fromCharCode(128|j>>6&63),O+=String.fromCharCode(128|j&63))}return O}var L={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},f={},v=4,D=.1;function T(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return m.forEach(function(j,K){var I=null;j.forEach(function(N,X){if(!N&&I!==null){U.push("M".concat(I+O," ").concat(K+O,"h").concat(X-I,"v1H").concat(I+O,"z")),I=null;return}if(X===j.length-1){if(!N)return;I===null?U.push("M".concat(X+O,",").concat(K+O," h1v1H").concat(X+O,"z")):U.push("M".concat(I+O,",").concat(K+O," h").concat(X+1-I,"v1H").concat(I+O,"z"));return}N&&I===null&&(I=X)})}),U.join("")}function g(m,O){return m.slice().map(function(U,j){return j<O.y||j>=O.y+O.h?U:U.map(function(K,I){return I<O.x||I>=O.x+O.w?K:!1})})}function c(m,O){var U=m.imageSettings,j=m.size,K=m.includeMargin;if(U==null)return null;var I=K?v:0,N=O.length+I*2,X=Math.floor(j*D),q=N/j,ae=(U.width||X)*q,he=(U.height||X)*q,Ae=U.x==null?O.length/2-ae/2:U.x*q,be=U.y==null?O.length/2-he/2:U.y*q,Te=null;if(U.excavate){var Ce=Math.floor(Ae),Se=Math.floor(be),me=Math.ceil(ae+Ae-Ce),ue=Math.ceil(he+be-Se);Te={x:Ce,y:Se,w:me,h:ue}}return{x:Ae,y:be,h:he,w:ae,excavation:Te}}var h=function(){try{new Path2D().addPath(new Path2D)}catch(m){return!1}return!0}(),o=function(m){M(O,m);function O(){var U,j;W(this,O);for(var K=arguments.length,I=new Array(K),N=0;N<K;N++)I[N]=arguments[N];return j=w(this,(U=p(O)).call.apply(U,[this].concat(I))),S(b(j),"_canvas",void 0),S(b(j),"_image",void 0),S(b(j),"state",{imgLoaded:!1}),S(b(j),"handleImageLoad",function(){j.setState({imgLoaded:!0})}),j}return P(O,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var j=this.props,K=j.value,I=j.size,N=j.level,X=j.bgColor,q=j.fgColor,ae=j.includeMargin,he=j.imageSettings,Ae=new a(-1,s[N]);if(Ae.addData(u(K)),Ae.make(),this._canvas!=null){var be=this._canvas,Te=be.getContext("2d");if(!Te)return;var Ce=Ae.modules;if(Ce===null)return;var Se=ae?v:0,me=Ce.length+Se*2,ue=c(this.props,Ce);he!=null&&ue!=null&&(ue.excavation!=null&&(Ce=g(Ce,ue.excavation)));var te=window.devicePixelRatio||1;be.height=be.width=I*te;var fe=I/me*te;Te.scale(fe,fe),Te.fillStyle=X,Te.fillRect(0,0,me,me),Te.fillStyle=q,h?Te.fill(new Path2D(T(Ce,Se))):Ce.forEach(function(se,_e){se.forEach(function(Oe,xe){Oe&&Te.fillRect(xe+Se,_e+Se,1,1)})}),this.state.imgLoaded&&this._image&&ue!=null&&Te.drawImage(this._image,ue.x+Se,ue.y+Se,ue.w,ue.h)}}},{key:"render",value:function(){var j=this,K=this.props,I=K.value,N=K.size,X=K.level,q=K.bgColor,ae=K.fgColor,he=K.style,Ae=K.includeMargin,be=K.imageSettings,Te=F(K,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Ce=Y({height:N,width:N},he),Se=null,me=be&&be.src;return be!=null&&me!=null&&(Se=x.createElement("img",{src:me,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(te){return j._image=te}})),x.createElement(x.Fragment,null,x.createElement("canvas",$({style:Ce,height:N,width:N,ref:function(te){return j._canvas=te}},Te)),Se)}}]),O}(x.PureComponent);S(o,"defaultProps",L);var C=function(m){M(O,m);function O(){return W(this,O),w(this,p(O).apply(this,arguments))}return P(O,[{key:"render",value:function(){var j=this.props,K=j.value,I=j.size,N=j.level,X=j.bgColor,q=j.fgColor,ae=j.includeMargin,he=j.imageSettings,Ae=F(j,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),be=new a(-1,s[N]);be.addData(u(K)),be.make();var Te=be.modules;if(Te===null)return null;var Ce=ae?v:0,Se=Te.length+Ce*2,me=c(this.props,Te),ue=null;he!=null&&me!=null&&(me.excavation!=null&&(Te=g(Te,me.excavation)),ue=x.createElement("image",{xlinkHref:he.src,height:me.h,width:me.w,x:me.x+Ce,y:me.y+Ce,preserveAspectRatio:"none"}));var te=T(Te,Ce);return x.createElement("svg",$({shapeRendering:"crispEdges",height:I,width:I,viewBox:"0 0 ".concat(Se," ").concat(Se)},Ae),x.createElement("path",{fill:X,d:"M0,0 h".concat(Se,"v").concat(Se,"H0z")}),x.createElement("path",{fill:q,d:te}),ue)}}]),O}(x.PureComponent);S(C,"defaultProps",L);var E=function(O){var U=O.renderAs,j=F(O,["renderAs"]),K=U==="svg"?C:o;return x.createElement(K,j)};E.defaultProps=Y({renderAs:"canvas"},L),lt.exports=E},DlQD:function(lt,$e,ie){(function(ne,$){lt.exports=$()})(this,function(){"use strict";function ne(Ee,pe){for(var ye=0;ye<pe.length;ye++){var re=pe[ye];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ee,re.key,re)}}function $(Ee,pe,ye){return pe&&ne(Ee.prototype,pe),ye&&ne(Ee,ye),Ee}function k(Ee,pe){if(!Ee)return;if(typeof Ee=="string")return Y(Ee,pe);var ye=Object.prototype.toString.call(Ee).slice(8,-1);if(ye==="Object"&&Ee.constructor&&(ye=Ee.constructor.name),ye==="Map"||ye==="Set")return Array.from(Ee);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return Y(Ee,pe)}function Y(Ee,pe){(pe==null||pe>Ee.length)&&(pe=Ee.length);for(var ye=0,re=new Array(pe);ye<pe;ye++)re[ye]=Ee[ye];return re}function F(Ee,pe){var ye;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(ye=k(Ee))||pe&&Ee&&typeof Ee.length=="number"){ye&&(Ee=ye);var re=0;return function(){return re>=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ye=Ee[Symbol.iterator](),ye.next.bind(ye)}function R(Ee,pe){return pe={exports:{}},Ee(pe,pe.exports),pe.exports}var W=R(function(Ee){function pe(){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 ye(re){Ee.exports.defaults=re}Ee.exports={defaults:pe(),getDefaults:pe,changeDefaults:ye}}),B=W.defaults,P=W.getDefaults,w=W.changeDefaults,p=/[&<>"']/,b=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},x=function(pe){return S[pe]};function d(Ee,pe){if(pe){if(p.test(Ee))return Ee.replace(b,x)}else if(M.test(Ee))return Ee.replace(A,x);return Ee}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ee){return Ee.replace(a,function(pe,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var u=/(^|[^\[])\^/g;function L(Ee,pe){Ee=Ee.source||Ee,pe=pe||"";var ye={replace:function(oe,le){return le=le.source||le,le=le.replace(u,"$1"),Ee=Ee.replace(oe,le),ye},getRegex:function(){return new RegExp(Ee,pe)}};return ye}var f=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(Ee,pe,ye){if(Ee){var re;try{re=decodeURIComponent(s(ye)).replace(f,"").toLowerCase()}catch(oe){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}pe&&!v.test(ye)&&(ye=o(pe,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(oe){return null}return ye}var T={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Ee,pe){T[" "+Ee]||(g.test(Ee)?T[" "+Ee]=Ee+"/":T[" "+Ee]=O(Ee,"/",!0)),Ee=T[" "+Ee];var ye=Ee.indexOf(":")===-1;return pe.substring(0,2)==="//"?ye?pe:Ee.replace(c,"$1")+pe:pe.charAt(0)==="/"?ye?pe:Ee.replace(h,"$1")+pe:Ee+pe}var C={exec:function(){}};function E(Ee){for(var pe=1,ye,re;pe<arguments.length;pe++){ye=arguments[pe];for(re in ye)Object.prototype.hasOwnProperty.call(ye,re)&&(Ee[re]=ye[re])}return Ee}function m(Ee,pe){var ye=Ee.replace(/\|/g,function(le,de,Le){for(var Me=!1,Ye=de;--Ye>=0&&Le[Ye]==="\\";)Me=!Me;return Me?"|":" |"}),re=ye.split(/ \|/),oe=0;if(re.length>pe)re.splice(pe);else for(;re.length<pe;)re.push("");for(;oe<re.length;oe++)re[oe]=re[oe].trim().replace(/\\\|/g,"|");return re}function O(Ee,pe,ye){var re=Ee.length;if(re===0)return"";for(var oe=0;oe<re;){var le=Ee.charAt(re-oe-1);if(le===pe&&!ye)oe++;else if(le!==pe&&ye)oe++;else break}return Ee.substr(0,re-oe)}function U(Ee,pe){if(Ee.indexOf(pe[1])===-1)return-1;for(var ye=Ee.length,re=0,oe=0;oe<ye;oe++)if(Ee[oe]==="\\")oe++;else if(Ee[oe]===pe[0])re++;else if(Ee[oe]===pe[1]&&(re--,re<0))return oe;return-1}function j(Ee){Ee&&Ee.sanitize&&!Ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var K={escape:d,unescape:s,edit:L,cleanUrl:D,resolveUrl:o,noopTest:C,merge:E,splitCells:m,rtrim:O,findClosingBracket:U,checkSanitizeDeprecation:j},I=W.defaults,N=K.rtrim,X=K.splitCells,q=K.escape,ae=K.findClosingBracket;function he(Ee,pe,ye){var re=pe.href,oe=pe.title?q(pe.title):null,le=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:ye,href:re,title:oe,text:le}:{type:"image",raw:ye,href:re,title:oe,text:q(le)}}function Ae(Ee,pe){var ye=Ee.match(/^(\s+)(?:```)/);if(ye===null)return pe;var re=ye[1];return pe.split(`
`).map(function(oe){var le=oe.match(/^\s+/);if(le===null)return oe;var de=le[0];return de.length>=re.length?oe.slice(re.length):oe}).join(`
`)}var be=function(){function Ee(ye){this.options=ye||I}var pe=Ee.prototype;return pe.space=function(re){var oe=this.rules.block.newline.exec(re);if(oe)return oe[0].length>1?{type:"space",raw:oe[0]}:{raw:`
`}},pe.code=function(re,oe){var le=this.rules.block.code.exec(re);if(le){var de=oe[oe.length-1];if(de&&de.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var Le=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?Le:N(Le,`
`)}}},pe.fences=function(re){var oe=this.rules.block.fences.exec(re);if(oe){var le=oe[0],de=Ae(le,oe[3]||"");return{type:"code",raw:le,lang:oe[2]?oe[2].trim():oe[2],text:de}}},pe.heading=function(re){var oe=this.rules.block.heading.exec(re);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},pe.nptable=function(re){var oe=this.rules.block.nptable.exec(re);if(oe){var le={type:"table",header:X(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[],raw:oe[0]};if(le.header.length===le.align.length){var de=le.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(le.align[Le])?le.align[Le]="right":/^ *:-+: *$/.test(le.align[Le])?le.align[Le]="center":/^ *:-+ *$/.test(le.align[Le])?le.align[Le]="left":le.align[Le]=null;for(de=le.cells.length,Le=0;Le<de;Le++)le.cells[Le]=X(le.cells[Le],le.header.length);return le}}},pe.hr=function(re){var oe=this.rules.block.hr.exec(re);if(oe)return{type:"hr",raw:oe[0]}},pe.blockquote=function(re){var oe=this.rules.block.blockquote.exec(re);if(oe){var le=oe[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:oe[0],text:le}}},pe.list=function(re){var oe=this.rules.block.list.exec(re);if(oe){for(var le=oe[0],de=oe[2],Le=de.length>1,Me=de[de.length-1]===")",Ye={type:"list",raw:le,ordered:Le,start:Le?+de.slice(0,-1):"",loose:!1,items:[]},yt=oe[0].match(this.rules.block.item),At=!1,Ke,xt,mt,ot,Rt,Lt,Kt,Bt=yt.length,wt=0;wt<Bt;wt++)Ke=yt[wt],le=Ke,xt=Ke.length,Ke=Ke.replace(/^ *([*+-]|\d+[.)]) */,""),~Ke.indexOf(`
`)&&(xt-=Ke.length,Ke=this.options.pedantic?Ke.replace(/^ {1,4}/gm,""):Ke.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),wt!==Bt-1&&(mt=this.rules.block.bullet.exec(yt[wt+1])[0],(Le?mt.length===1||!Me&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==de)&&(ot=yt.slice(wt+1).join(`
`),Ye.raw=Ye.raw.substring(0,Ye.raw.length-ot.length),wt=Bt-1)),Rt=At||/\n\n(?!\s*$)/.test(Ke),wt!==Bt-1&&(At=Ke.charAt(Ke.length-1)===`
`,Rt||(Rt=At)),Rt&&(Ye.loose=!0),Lt=/^\[[ xX]\] /.test(Ke),Kt=void 0,Lt&&(Kt=Ke[1]!==" ",Ke=Ke.replace(/^\[[ xX]\] +/,"")),Ye.items.push({type:"list_item",raw:le,task:Lt,checked:Kt,loose:Rt,text:Ke});return Ye}},pe.html=function(re){var oe=this.rules.block.html.exec(re);if(oe)return{type:this.options.sanitize?"paragraph":"html",raw:oe[0],pre:!this.options.sanitizer&&(oe[1]==="pre"||oe[1]==="script"||oe[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):q(oe[0]):oe[0]}},pe.def=function(re){var oe=this.rules.block.def.exec(re);if(oe){oe[3]&&(oe[3]=oe[3].substring(1,oe[3].length-1));var le=oe[1].toLowerCase().replace(/\s+/g," ");return{tag:le,raw:oe[0],href:oe[2],title:oe[3]}}},pe.table=function(re){var oe=this.rules.block.table.exec(re);if(oe){var le={type:"table",header:X(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[]};if(le.header.length===le.align.length){le.raw=oe[0];var de=le.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(le.align[Le])?le.align[Le]="right":/^ *:-+: *$/.test(le.align[Le])?le.align[Le]="center":/^ *:-+ *$/.test(le.align[Le])?le.align[Le]="left":le.align[Le]=null;for(de=le.cells.length,Le=0;Le<de;Le++)le.cells[Le]=X(le.cells[Le].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},pe.lheading=function(re){var oe=this.rules.block.lheading.exec(re);if(oe)return{type:"heading",raw:oe[0],depth:oe[2].charAt(0)==="="?1:2,text:oe[1]}},pe.paragraph=function(re){var oe=this.rules.block.paragraph.exec(re);if(oe)return{type:"paragraph",raw:oe[0],text:oe[1].charAt(oe[1].length-1)===`
`?oe[1].slice(0,-1):oe[1]}},pe.text=function(re,oe){var le=this.rules.block.text.exec(re);if(le){var de=oe[oe.length-1];return de&&de.type==="text"?{raw:le[0],text:le[0]}:{type:"text",raw:le[0],text:le[0]}}},pe.escape=function(re){var oe=this.rules.inline.escape.exec(re);if(oe)return{type:"escape",raw:oe[0],text:q(oe[1])}},pe.tag=function(re,oe,le){var de=this.rules.inline.tag.exec(re);if(de)return!oe&&/^<a /i.test(de[0])?oe=!0:oe&&/^<\/a>/i.test(de[0])&&(oe=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:oe,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):q(de[0]):de[0]}},pe.link=function(re){var oe=this.rules.inline.link.exec(re);if(oe){var le=ae(oe[2],"()");if(le>-1){var de=oe[0].indexOf("!")===0?5:4,Le=de+oe[1].length+le;oe[2]=oe[2].substring(0,le),oe[0]=oe[0].substring(0,Le).trim(),oe[3]=""}var Me=oe[2],Ye="";if(this.options.pedantic){var yt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);yt?(Me=yt[1],Ye=yt[3]):Ye=""}else Ye=oe[3]?oe[3].slice(1,-1):"";Me=Me.trim().replace(/^<([\s\S]*)>$/,"$1");var At=he(oe,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:Ye&&Ye.replace(this.rules.inline._escapes,"$1")},oe[0]);return At}},pe.reflink=function(re,oe){var le;if((le=this.rules.inline.reflink.exec(re))||(le=this.rules.inline.nolink.exec(re))){var de=(le[2]||le[1]).replace(/\s+/g," ");if(de=oe[de.toLowerCase()],!de||!de.href){var Le=le[0].charAt(0);return{type:"text",raw:Le,text:Le}}var Me=he(le,de,le[0]);return Me}},pe.strong=function(re,oe,le){le===void 0&&(le="");var de=this.rules.inline.strong.start.exec(re);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){oe=oe.slice(-1*re.length);var Le=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Le.lastIndex=0;for(var Me;(de=Le.exec(oe))!=null;)if(Me=this.rules.inline.strong.middle.exec(oe.slice(0,de.index+3)),Me)return{type:"strong",raw:re.slice(0,Me[0].length),text:re.slice(2,Me[0].length-2)}}},pe.em=function(re,oe,le){le===void 0&&(le="");var de=this.rules.inline.em.start.exec(re);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){oe=oe.slice(-1*re.length);var Le=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Le.lastIndex=0;for(var Me;(de=Le.exec(oe))!=null;)if(Me=this.rules.inline.em.middle.exec(oe.slice(0,de.index+2)),Me)return{type:"em",raw:re.slice(0,Me[0].length),text:re.slice(1,Me[0].length-1)}}},pe.codespan=function(re){var oe=this.rules.inline.code.exec(re);if(oe){var le=oe[2].replace(/\n/g," "),de=/[^ ]/.test(le),Le=le.startsWith(" ")&&le.endsWith(" ");return de&&Le&&(le=le.substring(1,le.length-1)),le=q(le,!0),{type:"codespan",raw:oe[0],text:le}}},pe.br=function(re){var oe=this.rules.inline.br.exec(re);if(oe)return{type:"br",raw:oe[0]}},pe.del=function(re){var oe=this.rules.inline.del.exec(re);if(oe)return{type:"del",raw:oe[0],text:oe[1]}},pe.autolink=function(re,oe){var le=this.rules.inline.autolink.exec(re);if(le){var de,Le;return le[2]==="@"?(de=q(this.options.mangle?oe(le[1]):le[1]),Le="mailto:"+de):(de=q(le[1]),Le=de),{type:"link",raw:le[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},pe.url=function(re,oe){var le;if(le=this.rules.inline.url.exec(re)){var de,Le;if(le[2]==="@")de=q(this.options.mangle?oe(le[0]):le[0]),Le="mailto:"+de;else{var Me;do Me=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Me!==le[0]);de=q(le[0]),le[1]==="www."?Le="http://"+de:Le=de}return{type:"link",raw:le[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},pe.inlineText=function(re,oe,le){var de=this.rules.inline.text.exec(re);if(de){var Le;return oe?Le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):q(de[0]):de[0]:Le=q(this.options.smartypants?le(de[0]):de[0]),{type:"text",raw:de[0],text:Le}}},Ee}(),Te=K.noopTest,Ce=K.edit,Se=K.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:Te,table:Te,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=Ce(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=Ce(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Ce(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=Ce(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Ce(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=Ce(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Se({},me),me.gfm=Se({},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=Ce(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=Ce(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=Se({},me.normal,{html:Ce(`^ *(?: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:Te,paragraph:Ce(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 ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Ce(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Ce(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Ce(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Ce(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Ce(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Ce(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Ce(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Ce(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Ce(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Ce(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Ce(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=Ce(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=Ce(ue.tag).replace("comment",me._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Ce(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Ce(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Ce(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Se({},ue),ue.pedantic=Se({},ue.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:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Se({},ue.normal,{escape:Ce(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=Ce(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Se({},ue.gfm,{br:Ce(ue.br).replace("{2,}","*").getRegex(),text:Ce(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:me,inline:ue},fe=W.defaults,se=te.block,_e=te.inline;function Oe(Ee){return Ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function xe(Ee){var pe="",ye,re,oe=Ee.length;for(ye=0;ye<oe;ye++)re=Ee.charCodeAt(ye),Math.random()>.5&&(re="x"+re.toString(16)),pe+="&#"+re+";";return pe}var Pe=function(){function Ee(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||fe,this.options.tokenizer=this.options.tokenizer||new be,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:se.normal,inline:_e.normal};this.options.pedantic?(re.block=se.pedantic,re.inline=_e.pedantic):this.options.gfm&&(re.block=se.gfm,this.options.breaks?re.inline=_e.breaks:re.inline=_e.gfm),this.tokenizer.rules=re}Ee.lex=function(re,oe){var le=new Ee(oe);return le.lex(re)};var pe=Ee.prototype;return pe.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},pe.blockTokens=function(re,oe,le){oe===void 0&&(oe=[]),le===void 0&&(le=!0),re=re.replace(/^ +$/gm,"");for(var de,Le,Me,Ye;re;){if(de=this.tokenizer.space(re)){re=re.substring(de.raw.length),de.type&&oe.push(de);continue}if(de=this.tokenizer.code(re,oe)){re=re.substring(de.raw.length),de.type?oe.push(de):(Ye=oe[oe.length-1],Ye.raw+=`
`+de.raw,Ye.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.heading(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.nptable(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.hr(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.blockquote(re)){re=re.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],le),oe.push(de);continue}if(de=this.tokenizer.list(re)){for(re=re.substring(de.raw.length),Me=de.items.length,Le=0;Le<Me;Le++)de.items[Le].tokens=this.blockTokens(de.items[Le].text,[],!1);oe.push(de);continue}if(de=this.tokenizer.html(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(le&&(de=this.tokenizer.def(re))){re=re.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.lheading(re)){re=re.substring(de.raw.length),oe.push(de);continue}if(le&&(de=this.tokenizer.paragraph(re))){re=re.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.text(re,oe)){re=re.substring(de.raw.length),de.type?oe.push(de):(Ye=oe[oe.length-1],Ye.raw+=`
`+de.raw,Ye.text+=`
`+de.text);continue}if(re){var yt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return oe},pe.inline=function(re){var oe,le,de,Le,Me,Ye,yt=re.length;for(oe=0;oe<yt;oe++){Ye=re[oe];switch(Ye.type){case"paragraph":case"text":case"heading":{Ye.tokens=[],this.inlineTokens(Ye.text,Ye.tokens);break}case"table":{for(Ye.tokens={header:[],cells:[]},Le=Ye.header.length,le=0;le<Le;le++)Ye.tokens.header[le]=[],this.inlineTokens(Ye.header[le],Ye.tokens.header[le]);for(Le=Ye.cells.length,le=0;le<Le;le++)for(Me=Ye.cells[le],Ye.tokens.cells[le]=[],de=0;de<Me.length;de++)Ye.tokens.cells[le][de]=[],this.inlineTokens(Me[de],Ye.tokens.cells[le][de]);break}case"blockquote":{this.inline(Ye.tokens);break}case"list":{for(Le=Ye.items.length,le=0;le<Le;le++)this.inline(Ye.items[le].tokens);break}}}return re},pe.inlineTokens=function(re,oe,le,de,Le){oe===void 0&&(oe=[]),le===void 0&&(le=!1),de===void 0&&(de=!1),Le===void 0&&(Le="");var Me,Ye=re,yt;if(this.tokens.links){var At=Object.keys(this.tokens.links);if(At.length>0)for(;(yt=this.tokenizer.rules.inline.reflinkSearch.exec(Ye))!=null;)At.includes(yt[0].slice(yt[0].lastIndexOf("[")+1,-1))&&(Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(yt=this.tokenizer.rules.inline.blockSkip.exec(Ye))!=null;)Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Me=this.tokenizer.escape(re)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.tag(re,le,de)){re=re.substring(Me.raw.length),le=Me.inLink,de=Me.inRawBlock,oe.push(Me);continue}if(Me=this.tokenizer.link(re)){re=re.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,de)),oe.push(Me);continue}if(Me=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,de)),oe.push(Me);continue}if(Me=this.tokenizer.strong(re,Ye,Le)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.em(re,Ye,Le)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.codespan(re)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.br(re)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.del(re)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.autolink(re,xe)){re=re.substring(Me.raw.length),oe.push(Me);continue}if(!le&&(Me=this.tokenizer.url(re,xe))){re=re.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.inlineText(re,de,Oe)){re=re.substring(Me.raw.length),Le=Me.raw.slice(-1),oe.push(Me);continue}if(re){var Ke="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return oe},$(Ee,null,[{key:"rules",get:function(){return{block:se,inline:_e}}}]),Ee}(),Ne=W.defaults,Be=K.cleanUrl,We=K.escape,Ue=function(){function Ee(ye){this.options=ye||Ne}var pe=Ee.prototype;return pe.code=function(re,oe,le){var de=(oe||"").match(/\S*/)[0];if(this.options.highlight){var Le=this.options.highlight(re,de);Le!=null&&Le!==re&&(le=!0,re=Le)}return de?'<pre><code class="'+this.options.langPrefix+We(de,!0)+'">'+(le?re:We(re,!0))+`</code></pre>
`:"<pre><code>"+(le?re:We(re,!0))+`</code></pre>
`},pe.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},pe.html=function(re){return re},pe.heading=function(re,oe,le,de){return this.options.headerIds?"<h"+oe+' id="'+this.options.headerPrefix+de.slug(le)+'">'+re+"</h"+oe+`>
`:"<h"+oe+">"+re+"</h"+oe+`>
`},pe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},pe.list=function(re,oe,le){var de=oe?"ol":"ul",Le=oe&&le!==1?' start="'+le+'"':"";return"<"+de+Le+`>
`+re+"</"+de+`>
`},pe.listitem=function(re){return"<li>"+re+`</li>
`},pe.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},pe.paragraph=function(re){return"<p>"+re+`</p>
`},pe.table=function(re,oe){return oe&&(oe="<tbody>"+oe+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+oe+`</table>
`},pe.tablerow=function(re){return`<tr>
`+re+`</tr>
`},pe.tablecell=function(re,oe){var le=oe.header?"th":"td",de=oe.align?"<"+le+' align="'+oe.align+'">':"<"+le+">";return de+re+"</"+le+`>
`},pe.strong=function(re){return"<strong>"+re+"</strong>"},pe.em=function(re){return"<em>"+re+"</em>"},pe.codespan=function(re){return"<code>"+re+"</code>"},pe.br=function(){return this.options.xhtml?"<br/>":"<br>"},pe.del=function(re){return"<del>"+re+"</del>"},pe.link=function(re,oe,le){if(re=Be(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var de='<a href="'+We(re)+'"';return oe&&(de+=' title="'+oe+'"'),de+=">"+le+"</a>",de},pe.image=function(re,oe,le){if(re=Be(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var de='<img src="'+re+'" alt="'+le+'"';return oe&&(de+=' title="'+oe+'"'),de+=this.options.xhtml?"/>":">",de},pe.text=function(re){return re},Ee}(),Fe=function(){function Ee(){}var pe=Ee.prototype;return pe.strong=function(re){return re},pe.em=function(re){return re},pe.codespan=function(re){return re},pe.del=function(re){return re},pe.html=function(re){return re},pe.text=function(re){return re},pe.link=function(re,oe,le){return""+le},pe.image=function(re,oe,le){return""+le},pe.br=function(){return""},Ee}(),at=function(){function Ee(){this.seen={}}var pe=Ee.prototype;return pe.slug=function(re){var oe=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(oe)){var le=oe;do this.seen[le]++,oe=le+"-"+this.seen[le];while(this.seen.hasOwnProperty(oe))}return this.seen[oe]=0,oe},Ee}(),it=W.defaults,et=K.unescape,Ze=function(){function Ee(ye){this.options=ye||it,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new at}Ee.parse=function(re,oe){var le=new Ee(oe);return le.parse(re)};var pe=Ee.prototype;return pe.parse=function(re,oe){oe===void 0&&(oe=!0);var le="",de,Le,Me,Ye,yt,At,Ke,xt,mt,ot,Rt,Lt,Kt,Bt,wt,yr,ir,gt,Gr=re.length;for(de=0;de<Gr;de++){ot=re[de];switch(ot.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,et(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(xt="",Ke="",Ye=ot.header.length,Le=0;Le<Ye;Le++)Ke+=this.renderer.tablecell(this.parseInline(ot.tokens.header[Le]),{header:!0,align:ot.align[Le]});for(xt+=this.renderer.tablerow(Ke),mt="",Ye=ot.cells.length,Le=0;Le<Ye;Le++){for(At=ot.tokens.cells[Le],Ke="",yt=At.length,Me=0;Me<yt;Me++)Ke+=this.renderer.tablecell(this.parseInline(At[Me]),{header:!1,align:ot.align[Me]});mt+=this.renderer.tablerow(Ke)}le+=this.renderer.table(xt,mt);continue}case"blockquote":{mt=this.parse(ot.tokens),le+=this.renderer.blockquote(mt);continue}case"list":{for(Rt=ot.ordered,Lt=ot.start,Kt=ot.loose,Ye=ot.items.length,mt="",Le=0;Le<Ye;Le++)wt=ot.items[Le],yr=wt.checked,ir=wt.task,Bt="",wt.task&&(gt=this.renderer.checkbox(yr),Kt?wt.tokens.length>0&&wt.tokens[0].type==="text"?(wt.tokens[0].text=gt+" "+wt.tokens[0].text,wt.tokens[0].tokens&&wt.tokens[0].tokens.length>0&&wt.tokens[0].tokens[0].type==="text"&&(wt.tokens[0].tokens[0].text=gt+" "+wt.tokens[0].tokens[0].text)):wt.tokens.unshift({type:"text",text:gt}):Bt+=gt),Bt+=this.parse(wt.tokens,Kt),mt+=this.renderer.listitem(Bt,ir,yr);le+=this.renderer.list(mt,Rt,Lt);continue}case"html":{le+=this.renderer.html(ot.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(mt=ot.tokens?this.parseInline(ot.tokens):ot.text;de+1<Gr&&re[de+1].type==="text";)ot=re[++de],mt+=`
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);le+=oe?this.renderer.paragraph(mt):mt;continue}default:{var br='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(br);return}else throw new Error(br)}}}return le},pe.parseInline=function(re,oe){oe=oe||this.renderer;var le="",de,Le,Me=re.length;for(de=0;de<Me;de++){Le=re[de];switch(Le.type){case"escape":{le+=oe.text(Le.text);break}case"html":{le+=oe.html(Le.text);break}case"link":{le+=oe.link(Le.href,Le.title,this.parseInline(Le.tokens,oe));break}case"image":{le+=oe.image(Le.href,Le.title,Le.text);break}case"strong":{le+=oe.strong(this.parseInline(Le.tokens,oe));break}case"em":{le+=oe.em(this.parseInline(Le.tokens,oe));break}case"codespan":{le+=oe.codespan(Le.text);break}case"br":{le+=oe.br();break}case"del":{le+=oe.del(this.parseInline(Le.tokens,oe));break}case"text":{le+=oe.text(Le.text);break}default:{var Ye='Token with "'+Le.type+'" type was not found.';if(this.options.silent){console.error(Ye);return}else throw new Error(Ye)}}}return le},Ee}(),ut=K.merge,Je=K.checkSanitizeDeprecation,st=K.escape,ke=W.getDefaults,nt=W.changeDefaults,qe=W.defaults;function Ie(Ee,pe,ye){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof pe=="function"&&(ye=pe,pe=null),pe=ut({},Ie.defaults,pe||{}),Je(pe),ye){var re=pe.highlight,oe;try{oe=Pe.lex(Ee,pe)}catch(Me){return ye(Me)}var le=function(Ye){var yt;if(!Ye)try{yt=Ze.parse(oe,pe)}catch(At){Ye=At}return pe.highlight=re,Ye?ye(Ye):ye(null,yt)};if(!re||re.length<3)return le();if(delete pe.highlight,!oe.length)return le();var de=0;Ie.walkTokens(oe,function(Me){Me.type==="code"&&(de++,setTimeout(function(){re(Me.text,Me.lang,function(Ye,yt){if(Ye)return le(Ye);yt!=null&&yt!==Me.text&&(Me.text=yt,Me.escaped=!0),de--,de===0&&le()})},0))}),de===0&&le();return}try{var Le=Pe.lex(Ee,pe);return pe.walkTokens&&Ie.walkTokens(Le,pe.walkTokens),Ze.parse(Le,pe)}catch(Me){if(Me.message+=`
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+st(Me.message+"",!0)+"</pre>";throw Me}}Ie.options=Ie.setOptions=function(Ee){return ut(Ie.defaults,Ee),nt(Ie.defaults),Ie},Ie.getDefaults=ke,Ie.defaults=qe,Ie.use=function(Ee){var pe=ut({},Ee);if(Ee.renderer&&function(){var re=Ie.defaults.renderer||new Ue,oe=function(Le){var Me=re[Le];re[Le]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var Ke=Ee.renderer[Le].apply(re,yt);return Ke===!1&&(Ke=Me.apply(re,yt)),Ke}};for(var le in Ee.renderer)oe(le);pe.renderer=re}(),Ee.tokenizer&&function(){var re=Ie.defaults.tokenizer||new be,oe=function(Le){var Me=re[Le];re[Le]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var Ke=Ee.tokenizer[Le].apply(re,yt);return Ke===!1&&(Ke=Me.apply(re,yt)),Ke}};for(var le in Ee.tokenizer)oe(le);pe.tokenizer=re}(),Ee.walkTokens){var ye=Ie.defaults.walkTokens;pe.walkTokens=function(re){Ee.walkTokens(re),ye&&ye(re)}}Ie.setOptions(pe)},Ie.walkTokens=function(Ee,pe){for(var ye=F(Ee),re;!(re=ye()).done;){var oe=re.value;pe(oe);switch(oe.type){case"table":{for(var le=F(oe.tokens.header),de;!(de=le()).done;){var Le=de.value;Ie.walkTokens(Le,pe)}for(var Me=F(oe.tokens.cells),Ye;!(Ye=Me()).done;)for(var yt=Ye.value,At=F(yt),Ke;!(Ke=At()).done;){var xt=Ke.value;Ie.walkTokens(xt,pe)}break}case"list":{Ie.walkTokens(oe.items,pe);break}default:oe.tokens&&Ie.walkTokens(oe.tokens,pe)}}},Ie.Parser=Ze,Ie.parser=Ze.parse,Ie.Renderer=Ue,Ie.TextRenderer=Fe,Ie.Lexer=Pe,Ie.lexer=Pe.lex,Ie.Tokenizer=be,Ie.Slugger=at,Ie.parse=Ie;var He=Ie;return He})},ELLl:function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(S,x,d){d&&d!=ne.Init&&(S.removeKeyMap(F),S.state.closeBrackets=null),x&&(R(Y(x,"pairs")),S.state.closeBrackets=x,S.addKeyMap(F))});function Y(S,x){return x=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[x]!=null?S[x]:$[x]}var F={Backspace:P,Enter:w};function R(S){for(var x=0;x<S.length;x++){var d=S.charAt(x),a="'"+d+"'";F[a]||(F[a]=W(d))}}R($.pairs+"`");function W(S){return function(x){return b(x,S)}}function B(S){var x=S.state.closeBrackets;if(!x||x.override)return x;var d=S.getModeAt(S.getCursor());return d.closeBrackets||x}function P(S){var x=B(S);if(!x||S.getOption("disableInput"))return ne.Pass;for(var d=Y(x,"pairs"),a=S.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var u=M(S,a[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}for(var s=a.length-1;s>=0;s--){var L=a[s].head;S.replaceRange("",k(L.line,L.ch-1),k(L.line,L.ch+1),"+delete")}}function w(S){var x=B(S),d=x&&Y(x,"explode");if(!d||S.getOption("disableInput"))return ne.Pass;for(var a=S.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var u=M(S,a[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}S.operation(function(){var L=S.lineSeparator()||`
`;S.replaceSelection(L+L,null),S.execCommand("goCharLeft"),a=S.listSelections();for(var f=0;f<a.length;f++){var v=a[f].head.line;S.indentLine(v,null,!0),S.indentLine(v+1,null,!0)}})}function p(S){var x=ne.cmpPos(S.anchor,S.head)>0;return{anchor:new k(S.anchor.line,S.anchor.ch+(x?-1:1)),head:new k(S.head.line,S.head.ch+(x?1:-1))}}function b(S,x){var d=B(S);if(!d||S.getOption("disableInput"))return ne.Pass;var a=Y(d,"pairs"),s=a.indexOf(x);if(s==-1)return ne.Pass;for(var u=Y(d,"closeBefore"),L=Y(d,"triples"),f=a.charAt(s+1)==x,v=S.listSelections(),D=s%2==0,T,g=0;g<v.length;g++){var c=v[g],h=c.head,o,C=S.getRange(h,k(h.line,h.ch+1));if(D&&!c.empty())o="surround";else if((f||!D)&&C==x)f&&A(S,h)?o="both":L.indexOf(x)>=0&&S.getRange(h,k(h.line,h.ch+3))==x+x+x?o="skipThree":o="skip";else if(f&&h.ch>1&&L.indexOf(x)>=0&&S.getRange(k(h.line,h.ch-2),h)==x+x){if(h.ch>2&&/\bstring/.test(S.getTokenTypeAt(k(h.line,h.ch-2))))return ne.Pass;o="addFour"}else if(f){var E=h.ch==0?" ":S.getRange(k(h.line,h.ch-1),h);if(!ne.isWordChar(C)&&E!=x&&!ne.isWordChar(E))o="both";else return ne.Pass}else if(D&&(C.length===0||/\s/.test(C)||u.indexOf(C)>-1))o="both";else return ne.Pass;if(!T)T=o;else if(T!=o)return ne.Pass}var m=s%2?a.charAt(s-1):x,O=s%2?x:a.charAt(s+1);S.operation(function(){if(T=="skip")S.execCommand("goCharRight");else if(T=="skipThree")for(var U=0;U<3;U++)S.execCommand("goCharRight");else if(T=="surround"){for(var j=S.getSelections(),U=0;U<j.length;U++)j[U]=m+j[U]+O;S.replaceSelections(j,"around"),j=S.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=p(j[U]);S.setSelections(j)}else T=="both"?(S.replaceSelection(m+O,null),S.triggerElectric(m+O),S.execCommand("goCharLeft")):T=="addFour"&&(S.replaceSelection(m+m+m+m,"before"),S.execCommand("goCharRight"))})}function M(S,x){var d=S.getRange(k(x.line,x.ch-1),k(x.line,x.ch+1));return d.length==2?d:null}function A(S,x){var d=S.getTokenAt(k(x.line,x.ch+1));return/\bstring/.test(d.type)&&d.start==x.ch&&(x.ch==0||!/\bstring/.test(S.getTokenTypeAt(x)))}})},GfqC:function(lt,$e,ie){"use strict";var ne=ie("q1tI"),$=ie.n(ne),k=ie("TSYQ"),Y=ie.n(k);function F(K,I){var N="cannot "+K.method+" "+K.action+" "+I.status+"'",X=new Error(N);return X.status=I.status,X.method=K.method,X.url=K.action,X}function R(K){var I=K.responseText||K.response;if(!I)return I;try{return JSON.parse(I)}catch(N){return I}}function W(K){var I=new XMLHttpRequest;K.onProgress&&I.upload&&(I.upload.onprogress=function(ae){ae.total>0&&(ae.percent=ae.loaded/ae.total*100),K.onProgress(ae)});var N=new FormData;K.data&&Object.keys(K.data).forEach(function(q){var ae=K.data[q];if(Array.isArray(ae)){ae.forEach(function(he){N.append(q+"[]",he)});return}N.append(q,K.data[q])}),K.file instanceof Blob?N.append(K.filename,K.file,K.file.name):N.append(K.filename,K.file),I.onerror=function(ae){K.onError(ae)},I.onload=function(){return I.status<200||I.status>=300?K.onError(F(K,I),R(I)):K.onSuccess(R(I),I)},I.open(K.method,K.action,!0),K.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var X=K.headers||{};return X["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(q){X[q]!==null&&I.setRequestHeader(q,X[q])}),I.send(N),{abort:function(){I.abort()}}}var B=+new Date,P=0;function w(){return"rc-upload-"+B+"-"+ ++P}function p(K,I){return K.indexOf(I,K.length-I.length)!==-1}var b=function(K,I){if(K&&I){var N=Array.isArray(I)?I:I.split(","),X=K.name||"",q=K.type||"",ae=q.replace(/\/.*$/,"");return N.some(function(he){var Ae=he.trim();return Ae.charAt(0)==="."?p(X.toLowerCase(),Ae.toLowerCase()):/\/\*$/.test(Ae)?ae===Ae.replace(/\/.*$/,""):q===Ae})}return!0};function M(K,I){var N=K.createReader(),X=[];function q(){N.readEntries(function(ae){var he=Array.prototype.slice.apply(ae);X=X.concat(he);var Ae=!he.length;Ae?I(X):q()})}q()}var A=function(I,N,X){var q=function ae(he,Ae){Ae=Ae||"",he.isFile?he.file(function(be){X(be)&&(he.fullPath&&!be.webkitRelativePath&&(Object.defineProperties(be,{webkitRelativePath:{writable:!0}}),be.webkitRelativePath=he.fullPath.replace(/^\//,""),Object.defineProperties(be,{webkitRelativePath:{writable:!1}})),N([be]))}):he.isDirectory&&M(he,function(be){be.forEach(function(Te){ae(Te,""+Ae+he.name+"/")})})};I.forEach(function(ae){q(ae.webkitGetAsEntry())})},S=A,x=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(K[X]=N[X])}return K},d=function(){function K(I,N){var X=[],q=!0,ae=!1,he=void 0;try{for(var Ae=I[Symbol.iterator](),be;!(q=(be=Ae.next()).done)&&!(X.push(be.value),N&&X.length===N);q=!0);}catch(Te){ae=!0,he=Te}finally{try{!q&&Ae.return&&Ae.return()}finally{if(ae)throw he}}return X}return function(I,N){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return K(I,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function K(I,N){for(var X=0;X<N.length;X++){var q=N[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,X){return N&&K(I.prototype,N),X&&K(I,X),I}}();function s(K,I,N){return I in K?Object.defineProperty(K,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):K[I]=N,K}function u(K,I){var N={};for(var X in K){if(I.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(K,X))continue;N[X]=K[X]}return N}function L(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function f(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function v(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}var D=function(I){return Object.keys(I).reduce(function(N,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(N[X]=I[X]),N},{})},T=function(K){v(I,K);function I(){var N,X,q,ae;L(this,I);for(var he=arguments.length,Ae=Array(he),be=0;be<he;be++)Ae[be]=arguments[be];return ae=(X=(q=f(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ae))),q),q.state={uid:w()},q.reqs={},q.onChange=function(Te){var Ce=Te.target.files;q.uploadFiles(Ce),q.reset()},q.onClick=function(Te){var Ce=q.fileInput;if(!Ce)return;var Se=q.props,me=Se.children,ue=Se.onClick;me&&me.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),ue&&ue(Te)},q.onKeyDown=function(Te){Te.key==="Enter"&&q.onClick()},q.onFileDrop=function(Te){var Ce=q.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(q.props.directory)S(Array.prototype.slice.call(Te.dataTransfer.items),q.uploadFiles,function(me){return b(me,q.props.accept)});else{var Se=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(me){return b(me,q.props.accept)});Ce===!1&&(Se=Se.slice(0,1)),q.uploadFiles(Se)}},q.uploadFiles=function(Te){var Ce=Array.prototype.slice.call(Te);Ce.map(function(Se){return Se.uid=w(),Se}).forEach(function(Se){q.upload(Se,Ce)})},q.saveFileInput=function(Te){q.fileInput=Te},X),f(q,ae)}return a(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(X,q){var ae=this,he=this.props;if(!he.beforeUpload)return setTimeout(function(){return ae.post(X)},0);var Ae=he.beforeUpload(X,q);Ae&&Ae.then?Ae.then(function(be){var Te=Object.prototype.toString.call(be);return Te==="[object File]"||Te==="[object Blob]"?ae.post(be):ae.post(X)}).catch(function(be){console.log(be)}):Ae!==!1&&setTimeout(function(){return ae.post(X)},0);return}},{key:"post",value:function(X){var q=this;if(!this._isMounted)return;var ae=this.props,he=ae.onStart,Ae=ae.onProgress,be=ae.transformFile,Te=be===void 0?function(Ce){return Ce}:be;new Promise(function(Ce){var Se=ae.action;return typeof Se=="function"&&(Se=Se(X)),Ce(Se)}).then(function(Ce){var Se=X.uid,me=ae.customRequest||W,ue=Promise.resolve(Te(X)).then(function(te){var fe=ae.data;return typeof fe=="function"&&(fe=fe(te)),Promise.all([te,fe])}).catch(function(te){console.error(te)});ue.then(function(te){var fe=d(te,2),se=fe[0],_e=fe[1],Oe={action:Ce,filename:ae.name,data:_e,file:se,headers:ae.headers,withCredentials:ae.withCredentials,method:ae.method||"post",onProgress:Ae?function(xe){Ae(xe,X)}:null,onSuccess:function(Pe,Ne){delete q.reqs[Se],ae.onSuccess(Pe,X,Ne)},onError:function(Pe,Ne){delete q.reqs[Se],ae.onError(Pe,Ne,X)}};he(X),q.reqs[Se]=me(Oe)})})}},{key:"reset",value:function(){this.setState({uid:w()})}},{key:"abort",value:function(X){var q=this.reqs;if(X){var ae=X;X&&X.uid&&(ae=X.uid),q[ae]&&q[ae].abort&&q[ae].abort(),delete q[ae]}else Object.keys(q).forEach(function(he){q[he]&&q[he].abort&&q[he].abort(),delete q[he]})}},{key:"render",value:function(){var X,q=this.props,ae=q.component,he=q.prefixCls,Ae=q.className,be=q.disabled,Te=q.id,Ce=q.style,Se=q.multiple,me=q.accept,ue=q.children,te=q.directory,fe=q.openFileDialogOnClick,se=q.onMouseEnter,_e=q.onMouseLeave,Oe=u(q,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=Y()((X={},s(X,he,!0),s(X,he+"-disabled",be),s(X,Ae,Ae),X)),Pe=be?{}:{onClick:fe?this.onClick:function(){},onKeyDown:fe?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:_e,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(ae,x({},Pe,{className:xe,role:"button",style:Ce}),$.a.createElement("input",x({},D(Oe),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(Be){return Be.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Se,onChange:this.onChange})),ue)}}]),I}(ne.Component),g=T,c=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(K[X]=N[X])}return K},h=function(){function K(I,N){for(var X=0;X<N.length;X++){var q=N[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,X){return N&&K(I.prototype,N),X&&K(I,X),I}}();function o(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function C(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function E(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}function m(){}var O=function(K){E(I,K);function I(){var N,X,q,ae;o(this,I);for(var he=arguments.length,Ae=Array(he),be=0;be<he;be++)Ae[be]=arguments[be];return ae=(X=(q=C(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ae))),q),q.saveUploader=function(Te){q.uploader=Te},X),C(q,ae)}return h(I,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return $.a.createElement(g,c({},this.props,{ref:this.saveUploader}))}}]),I}(ne.Component);O.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:m,onError:m,onSuccess:m,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=O,j=$e.a=U},H38U:function(lt,$e,ie){var ne=ie("f4xo"),$=ie("rcnY"),k=ie("wU8J"),Y=ie("Iq15"),F=ie("dWSS");function R(B,P){this.typeNumber=B,this.errorCorrectLevel=P,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var W=R.prototype;W.addData=function(B){var P=new ne(B);this.dataList.push(P),this.dataCache=null},W.isDark=function(B,P){if(B<0||this.moduleCount<=B||P<0||this.moduleCount<=P)throw new Error(B+","+P);return this.modules[B][P]},W.getModuleCount=function(){return this.moduleCount},W.make=function(){if(this.typeNumber<1){var B=1;for(B=1;B<40;B++){for(var P=$.getRSBlocks(B,this.errorCorrectLevel),w=new k,p=0,b=0;b<P.length;b++)p+=P[b].dataCount;for(var b=0;b<this.dataList.length;b++){var M=this.dataList[b];w.put(M.mode,4),w.put(M.getLength(),Y.getLengthInBits(M.mode,B)),M.write(w)}if(w.getLengthInBits()<=p*8)break}this.typeNumber=B}this.makeImpl(!1,this.getBestMaskPattern())},W.makeImpl=function(B,P){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var w=0;w<this.moduleCount;w++){this.modules[w]=new Array(this.moduleCount);for(var p=0;p<this.moduleCount;p++)this.modules[w][p]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(B,P),this.typeNumber>=7&&this.setupTypeNumber(B),this.dataCache==null&&(this.dataCache=R.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,P)},W.setupPositionProbePattern=function(B,P){for(var w=-1;w<=7;w++){if(B+w<=-1||this.moduleCount<=B+w)continue;for(var p=-1;p<=7;p++){if(P+p<=-1||this.moduleCount<=P+p)continue;0<=w&&w<=6&&(p==0||p==6)||0<=p&&p<=6&&(w==0||w==6)||2<=w&&w<=4&&2<=p&&p<=4?this.modules[B+w][P+p]=!0:this.modules[B+w][P+p]=!1}}},W.getBestMaskPattern=function(){for(var B=0,P=0,w=0;w<8;w++){this.makeImpl(!0,w);var p=Y.getLostPoint(this);(w==0||B>p)&&(B=p,P=w)}return P},W.createMovieClip=function(B,P,w){var p=B.createEmptyMovieClip(P,w),b=1;this.make();for(var M=0;M<this.modules.length;M++)for(var A=M*b,S=0;S<this.modules[M].length;S++){var x=S*b,d=this.modules[M][S];d&&(p.beginFill(0,100),p.moveTo(x,A),p.lineTo(x+b,A),p.lineTo(x+b,A+b),p.lineTo(x,A+b),p.endFill())}return p},W.setupTimingPattern=function(){for(var B=8;B<this.moduleCount-8;B++){if(this.modules[B][6]!=null)continue;this.modules[B][6]=B%2==0}for(var P=8;P<this.moduleCount-8;P++){if(this.modules[6][P]!=null)continue;this.modules[6][P]=P%2==0}},W.setupPositionAdjustPattern=function(){for(var B=Y.getPatternPosition(this.typeNumber),P=0;P<B.length;P++)for(var w=0;w<B.length;w++){var p=B[P],b=B[w];if(this.modules[p][b]!=null)continue;for(var M=-2;M<=2;M++)for(var A=-2;A<=2;A++)M==-2||M==2||A==-2||A==2||M==0&&A==0?this.modules[p+M][b+A]=!0:this.modules[p+M][b+A]=!1}},W.setupTypeNumber=function(B){for(var P=Y.getBCHTypeNumber(this.typeNumber),w=0;w<18;w++){var p=!B&&(P>>w&1)==1;this.modules[Math.floor(w/3)][w%3+this.moduleCount-8-3]=p}for(var w=0;w<18;w++){var p=!B&&(P>>w&1)==1;this.modules[w%3+this.moduleCount-8-3][Math.floor(w/3)]=p}},W.setupTypeInfo=function(B,P){for(var w=this.errorCorrectLevel<<3|P,p=Y.getBCHTypeInfo(w),b=0;b<15;b++){var M=!B&&(p>>b&1)==1;b<6?this.modules[b][8]=M:b<8?this.modules[b+1][8]=M:this.modules[this.moduleCount-15+b][8]=M}for(var b=0;b<15;b++){var M=!B&&(p>>b&1)==1;b<8?this.modules[8][this.moduleCount-b-1]=M:b<9?this.modules[8][15-b-1+1]=M:this.modules[8][15-b-1]=M}this.modules[this.moduleCount-8][8]=!B},W.mapData=function(B,P){for(var w=-1,p=this.moduleCount-1,b=7,M=0,A=this.moduleCount-1;A>0;A-=2)for(A==6&&A--;;){for(var S=0;S<2;S++)if(this.modules[p][A-S]==null){var x=!1;M<B.length&&(x=(B[M]>>>b&1)==1);var d=Y.getMask(P,p,A-S);d&&(x=!x),this.modules[p][A-S]=x,b--,b==-1&&(M++,b=7)}if(p+=w,p<0||this.moduleCount<=p){p-=w,w=-w;break}}},R.PAD0=236,R.PAD1=17,R.createData=function(B,P,w){for(var p=$.getRSBlocks(B,P),b=new k,M=0;M<w.length;M++){var A=w[M];b.put(A.mode,4),b.put(A.getLength(),Y.getLengthInBits(A.mode,B)),A.write(b)}for(var S=0,M=0;M<p.length;M++)S+=p[M].dataCount;if(b.getLengthInBits()>S*8)throw new Error("code length overflow. ("+b.getLengthInBits()+">"+S*8+")");for(b.getLengthInBits()+4<=S*8&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=S*8);){if(b.put(R.PAD0,8),b.getLengthInBits()>=S*8)break;b.put(R.PAD1,8)}return R.createBytes(b,p)},R.createBytes=function(B,P){for(var w=0,p=0,b=0,M=new Array(P.length),A=new Array(P.length),S=0;S<P.length;S++){var x=P[S].dataCount,d=P[S].totalCount-x;p=Math.max(p,x),b=Math.max(b,d),M[S]=new Array(x);for(var a=0;a<M[S].length;a++)M[S][a]=255&B.buffer[a+w];w+=x;var s=Y.getErrorCorrectPolynomial(d),u=new F(M[S],s.getLength()-1),L=u.mod(s);A[S]=new Array(s.getLength()-1);for(var a=0;a<A[S].length;a++){var f=a+L.getLength()-A[S].length;A[S][a]=f>=0?L.get(f):0}}for(var v=0,a=0;a<P.length;a++)v+=P[a].totalCount;for(var D=new Array(v),T=0,a=0;a<p;a++)for(var S=0;S<P.length;S++)a<M[S].length&&(D[T++]=M[S][a]);for(var a=0;a<b;a++)for(var S=0;S<P.length;S++)a<A[S].length&&(D[T++]=A[S][a]);return D},lt.exports=R},HmJG:function(lt,$e,ie){},Iq15:function(lt,$e,ie){var ne=ie("nVVt"),$=ie("dWSS"),k=ie("dQei"),Y={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},F={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(R){for(var W=R<<10;F.getBCHDigit(W)-F.getBCHDigit(F.G15)>=0;)W^=F.G15<<F.getBCHDigit(W)-F.getBCHDigit(F.G15);return(R<<10|W)^F.G15_MASK},getBCHTypeNumber:function(R){for(var W=R<<12;F.getBCHDigit(W)-F.getBCHDigit(F.G18)>=0;)W^=F.G18<<F.getBCHDigit(W)-F.getBCHDigit(F.G18);return R<<12|W},getBCHDigit:function(R){for(var W=0;R!=0;)W++,R>>>=1;return W},getPatternPosition:function(R){return F.PATTERN_POSITION_TABLE[R-1]},getMask:function(R,W,B){switch(R){case Y.PATTERN000:return(W+B)%2==0;case Y.PATTERN001:return W%2==0;case Y.PATTERN010:return B%3==0;case Y.PATTERN011:return(W+B)%3==0;case Y.PATTERN100:return(Math.floor(W/2)+Math.floor(B/3))%2==0;case Y.PATTERN101:return W*B%2+W*B%3==0;case Y.PATTERN110:return(W*B%2+W*B%3)%2==0;case Y.PATTERN111:return(W*B%3+(W+B)%2)%2==0;default:throw new Error("bad maskPattern:"+R)}},getErrorCorrectPolynomial:function(R){for(var W=new $([1],0),B=0;B<R;B++)W=W.multiply(new $([1,k.gexp(B)],0));return W},getLengthInBits:function(R,W){if(1<=W&&W<10)switch(R){case ne.MODE_NUMBER:return 10;case ne.MODE_ALPHA_NUM:return 9;case ne.MODE_8BIT_BYTE:return 8;case ne.MODE_KANJI:return 8;default:throw new Error("mode:"+R)}else if(W<27)switch(R){case ne.MODE_NUMBER:return 12;case ne.MODE_ALPHA_NUM:return 11;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 10;default:throw new Error("mode:"+R)}else if(W<41)switch(R){case ne.MODE_NUMBER:return 14;case ne.MODE_ALPHA_NUM:return 13;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 12;default:throw new Error("mode:"+R)}else throw new Error("type:"+W)},getLostPoint:function(R){for(var W=R.getModuleCount(),B=0,P=0;P<W;P++)for(var w=0;w<W;w++){for(var p=0,b=R.isDark(P,w),M=-1;M<=1;M++){if(P+M<0||W<=P+M)continue;for(var A=-1;A<=1;A++){if(w+A<0||W<=w+A)continue;if(M==0&&A==0)continue;b==R.isDark(P+M,w+A)&&p++}}p>5&&(B+=3+p-5)}for(var P=0;P<W-1;P++)for(var w=0;w<W-1;w++){var S=0;R.isDark(P,w)&&S++,R.isDark(P+1,w)&&S++,R.isDark(P,w+1)&&S++,R.isDark(P+1,w+1)&&S++,(S==0||S==4)&&(B+=3)}for(var P=0;P<W;P++)for(var w=0;w<W-6;w++)R.isDark(P,w)&&!R.isDark(P,w+1)&&R.isDark(P,w+2)&&R.isDark(P,w+3)&&R.isDark(P,w+4)&&!R.isDark(P,w+5)&&R.isDark(P,w+6)&&(B+=40);for(var w=0;w<W;w++)for(var P=0;P<W-6;P++)R.isDark(P,w)&&!R.isDark(P+1,w)&&R.isDark(P+2,w)&&R.isDark(P+3,w)&&R.isDark(P+4,w)&&!R.isDark(P+5,w)&&R.isDark(P+6,w)&&(B+=40);for(var x=0,w=0;w<W;w++)for(var P=0;P<W;P++)R.isDark(P,w)&&x++;var d=Math.abs(100*x/W/W-50)/5;return B+=d*10,B}};lt.exports=F},LdHM:function(lt,$e,ie){"use strict";ie.d($e,"b",function(){return u}),ie.d($e,"a",function(){return f});var ne=ie("1OyB"),$=ie("vuIU"),k=ie("Ji7U"),Y=ie("LK+K"),F=ie("q1tI"),R=ie("rePB"),W=ie("Ff2n"),B=ie("ODXe"),P=ie("4IlW"),w=ie("bX4T"),p=ie("YrtM"),b=ie("TSYQ"),M=ie.n(b),A=ie("+nKL"),S=ie("8OUc"),x=function(X,q){var ae=X.prefixCls,he=X.id,Ae=X.flattenOptions,be=X.childrenAsData,Te=X.values,Ce=X.searchValue,Se=X.multiple,me=X.defaultActiveFirstOption,ue=X.height,te=X.itemHeight,fe=X.notFoundContent,se=X.open,_e=X.menuItemSelectedIcon,Oe=X.virtual,xe=X.onSelect,Pe=X.onToggleOpen,Ne=X.onActiveValue,Be=X.onScroll,We=X.onMouseEnter,Ue="".concat(ae,"-item"),Fe=Object(p.a)(function(){return Ae},[se,Ae],function(He,Ee){return Ee[0]&&He[1]!==Ee[1]}),at=F.useRef(null),it=function(Ee){Ee.preventDefault()},et=function(Ee){at.current&&at.current.scrollTo({index:Ee})},Ze=function(Ee){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ye=Fe.length,re=0;re<ye;re+=1){var oe=(Ee+re*pe+ye)%ye,le=Fe[oe],de=le.group,Le=le.data;if(!de&&!Le.disabled)return oe}return-1},ut=F.useState(function(){return Ze(0)}),Je=Object(B.a)(ut,2),st=Je[0],ke=Je[1],nt=function(Ee){ke(Ee);var pe=Fe[Ee];if(!pe){Ne(null,-1);return}Ne(pe.data.value,Ee)};F.useEffect(function(){nt(me!==!1?Ze(0):-1)},[Fe.length,Ce]),F.useEffect(function(){var He=setTimeout(function(){if(!Se&&se&&Te.size===1){var Ee=Array.from(Te)[0],pe=Fe.findIndex(function(ye){var re=ye.data;return re.value===Ee});nt(pe),et(pe)}});return function(){return clearTimeout(He)}},[se]);var qe=function(Ee){Ee!==void 0&&xe(Ee,{selected:!Te.has(Ee)}),Se||Pe(!1)};if(F.useImperativeHandle(q,function(){return{onKeyDown:function(Ee){var pe=Ee.which;switch(pe){case P.a.UP:case P.a.DOWN:{var ye=0;if(pe===P.a.UP?ye=-1:pe===P.a.DOWN&&(ye=1),ye!==0){var re=Ze(st+ye,ye);et(re),nt(re)}break}case P.a.ENTER:{var oe=Fe[st];oe&&!oe.data.disabled?qe(oe.data.value):qe(void 0),se&&Ee.preventDefault();break}case P.a.ESC:Pe(!1)}},onKeyUp:function(){},scrollTo:function(Ee){et(Ee)}}}),Fe.length===0)return F.createElement("div",{role:"listbox",id:"".concat(he,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:it},fe);function Ie(He){var Ee=Fe[He];if(!Ee)return null;var pe=Ee.data||{},ye=pe.value,re=pe.label,oe=pe.children,le=Object(w.a)(pe,!0),de=be?oe:re;return Ee?F.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},le,{key:He,role:"option",id:"".concat(he,"_list_").concat(He),"aria-selected":Te.has(ye)}),ye):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(he,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ie(st-1),Ie(st),Ie(st+1)),F.createElement(A.a,{itemKey:"key",ref:at,data:Fe,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:it,onScroll:Be,virtual:Oe,onMouseEnter:We},function(He,Ee){var pe,ye=He.group,re=He.groupOption,oe=He.data,le=oe.label,de=oe.key;if(ye)return F.createElement("div",{className:M()(Ue,"".concat(Ue,"-group"))},le!==void 0?le:de);var Le=oe.disabled,Me=oe.value,Ye=oe.title,yt=oe.children,At=oe.style,Ke=oe.className,xt=Object(W.a)(oe,["disabled","value","title","children","style","className"]),mt=Te.has(Me),ot="".concat(Ue,"-option"),Rt=M()(Ue,ot,Ke,(pe={},Object(R.a)(pe,"".concat(ot,"-grouped"),re),Object(R.a)(pe,"".concat(ot,"-active"),st===Ee&&!Le),Object(R.a)(pe,"".concat(ot,"-disabled"),Le),Object(R.a)(pe,"".concat(ot,"-selected"),mt),pe)),Lt=be?yt:le,Kt=!_e||typeof _e=="function"||mt;return F.createElement("div",Object.assign({},xt,{"aria-selected":mt,className:Rt,title:Ye,onMouseMove:function(){if(st===Ee||Le)return;nt(Ee)},onClick:function(){Le||qe(Me)},style:At}),F.createElement("div",{className:"".concat(ot,"-content")},Lt||Me),F.isValidElement(_e)||mt,Kt&&F.createElement(S.a,{className:"".concat(Ue,"-option-state"),customizeIcon:_e,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=F.forwardRef(x);d.displayName="OptionList";var a=d,s=function(){return null};s.isSelectOption=!0;var u=s,L=function(){return null};L.isSelectOptGroup=!0;var f=L,v=ie("VTBJ"),D=ie("Zm9Q");function T(N){var X=N.key,q=N.props,ae=q.children,he=q.value,Ae=Object(W.a)(q,["children","value"]);return Object(v.a)({key:X,value:he!==void 0?he:X,children:ae},Ae)}function g(N){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(N).map(function(q,ae){if(!F.isValidElement(q)||!q.type)return null;var he=q.type.isSelectOptGroup,Ae=q.key,be=q.props,Te=be.children,Ce=Object(W.a)(be,["children"]);return X||!he?T(q):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Ae===null?ae:Ae,"__"),label:Ae},Ce),{},{options:g(Te)})}).filter(function(q){return q})}var c=ie("2Qr1"),h=ie("qNPg"),o=ie("U8pU"),C=ie("Kwbf"),E=ie("WKfj");function m(N){var X=N.mode,q=N.options,ae=N.children,he=N.backfill,Ae=N.allowClear,be=N.placeholder,Te=N.getInputElement,Ce=N.showSearch,Se=N.onSearch,me=N.defaultOpen,ue=N.autoFocus,te=N.labelInValue,fe=N.value,se=N.inputValue,_e=N.optionLabelProp,Oe=X==="multiple"||X==="tags",xe=Ce!==void 0?Ce:Oe||X==="combobox",Pe=q||g(ae);if(Object(C.a)(X!=="tags"||Pe.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Ne=Pe.some(function(Ue){return Ue.options?Ue.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(C.a)(!Ne,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)(X!=="combobox"||!_e,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)(X==="combobox"||!he,"`backfill` only works with `combobox` mode."),Object(C.a)(X==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(C.b)(X!=="combobox"||!Te||!Ae||!be,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!xe&&X!=="combobox"&&X!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!me||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),fe!=null){var Be=Object(E.d)(fe);Object(C.a)(!te||Be.every(function(Ue){return Object(o.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(C.a)(!Oe||Array.isArray(fe),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var We=null;Object(D.a)(ae).some(function(Ue){if(!F.isValidElement(Ue)||!Ue.type)return!1;var Fe=Ue.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var at=Object(D.a)(Ue.props.children).every(function(it){return!F.isValidElement(it)||!Ue.type||it.type.isSelectOption?!0:(We=it.type,!1)});return!at}return We=Fe,!0}),We&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(C.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var O=m,U=Object(h.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:g,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:O,fillOptionsWithMissingValue:c.a}),j=function(N){Object(k.a)(q,N);var X=Object(Y.a)(q);function q(){var ae;return Object(ne.a)(this,q),ae=X.apply(this,arguments),ae.selectRef=F.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object($.a)(q,[{key:"render",value:function(){return F.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),q}(F.Component);j.Option=u,j.OptGroup=f;var K=j,I=$e.c=K},M8RZ:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return P});var ne=ie("fWQN"),$=ie("mtLc"),k=ie("yKVA"),Y=ie("879j"),F=ie("q1tI"),R=ie.n(F),W=ie("i8i4"),B=ie.n(W),P=function(w){Object(k.a)(b,w);var p=Object(Y.a)(b);function b(M){var A;Object(ne.a)(this,b),A=p.call(this,M);var S=window.document;return A.node=S.createElement("div"),S.body.appendChild(A.node),A}return Object($.a)(b,[{key:"render",value:function(){var A=this.props.children;return Object(W.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),b}(R.a.Component)},Ot1p:function(lt,$e,ie){"use strict";var ne=ie("2qtc"),$=ie("kLXV"),k=ie("rAM+"),Y=ie("miYZ"),F=ie("tsqr"),R=ie("9og8"),W=ie("tJVT"),B=ie("jrin"),P=ie("WmNS"),w=ie.n(P),p=ie("q1tI"),b=ie.n(p),M=ie("VrN/"),A=ie.n(M),S=ie("bdgK"),x=ie("p77/"),d=ie("Bd2K"),a=ie("ELLl"),s=ie("19Vz"),u=ie("lZu9"),L=ie("+NIl"),f=ie("kSUc"),v=ie("9Bee"),D=function(Ke){var xt=Ke.value,mt=xt===void 0?"":xt,ot=Ke.className,Rt=Ke.showTextOnly,Lt=Ke.showLines,Kt=Ke.style,Bt=Kt===void 0?{}:Kt,wt=Object(p.useMemo)(function(){return""},[mt]);return b.a.createElement(b.a.Fragment,null,b.a.createElement("div",{dangerouslySetInnerHTML:{__html:wt}}))},T=ie("Q9mQ"),g=ie("diRs"),c=ie("0Owb"),h=ie("dejd"),o=ie("C+DQ"),C=ie("D1Df"),E=ie.n(C),m=ie("1vsH"),O=ie("m3rI"),U=[{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 j(Ke){var xt=Ke.onActionCallback,mt=Ke.title,ot=Ke.icon,Rt=Ke.actionName,Lt=Ke.className,Kt=Lt===void 0?"":Lt,Bt=Ke.children;function wt(){xt(Rt)}return b.a.createElement("a",{title:mt,className:Kt,onClick:wt},b.a.createElement("i",{className:"md-iconfont ".concat(ot)}),Bt)}var K=function(Ke){var xt=Ke.watch,mt=Ke.showNullButton,ot=Ke.onActionCallback,Rt=Ke.fullScreen,Lt=Ke.insertTemp,Kt=Ke.hidetoolBar,Bt=Ke.uuid,wt=Ke.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(m.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.E)("_educoder_session"),"&key=").concat(Bt,"&api=").concat(encodeURIComponent(O.a.PROXY_SERVER)));var yr=[].concat(U,[{title:"".concat(xt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(xt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return b.a.createElement("ul",{className:"markdown-toolbar-container"},!Kt&&yr.map(function(ir,gt){return b.a.createElement("li",{key:gt},ir.actionName?b.a.createElement(j,Object(c.a)({},ir,{onActionCallback:ot})):b.a.createElement("span",{className:"v-line"}))}),mt?b.a.createElement("li",null,b.a.createElement(j,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ot},b.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Lt&&b.a.createElement("li",null,b.a.createElement(j,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Lt),onActionCallback:ot},b.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),b.a.createElement("li",null,b.a.createElement(g.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:b.a.createElement("div",null,b.a.createElement(E.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(m.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.E)("_educoder_session"),"&key=").concat(Bt,"&api=").concat(encodeURIComponent(O.a.PROXY_SERVER))}))},b.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return wt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),b.a.createElement("li",{className:"btn-full-screen"},b.a.createElement(j,{icon:"".concat(Rt?"icon-shrink":"icon-enlarge"),title:Rt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ot})))},I=ie("M8RZ"),N=ie("+L6B"),X=ie("2/Rp"),q=ie("y8nQ"),ae=ie("Vl3Y"),he=ie("5NDa"),Ae=ie("5rEg"),be={labelCol:{span:4},wrapperCol:{span:20}},Te=function(Ke){var xt=Ke.callback,mt=Ke.onCancel;function ot(Rt){xt(Rt)}return b.a.createElement(ae.a,Object(c.a)({},be,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ot}),b.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},b.a.createElement(Ae.a,null)),b.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},b.a.createElement(Ae.a,null)),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},Ce=ie("7ahc"),Se=ie("k1fw"),me=ie("HmJG"),ue=ie("BjJ7"),te=ae.a.useForm,fe={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},_e=function(Ke){var xt=Ke.callback,mt=Ke.onCancel,ot=te(),Rt=Object(W.a)(ot,1),Lt=Rt[0],Kt=Object(p.useRef)();function Bt(ir){xt(Object(Se.a)(Object(Se.a)({},ir),{},{name:Kt.current}))}function wt(ir,gt){Lt.setFieldsValue({src:"/api/attachments/".concat(ir.id,"?type=").concat(ir.content_type),type:gt.type})}function yr(ir){var gt=ir.target.files[0];Kt.current=gt.name,xe(gt,wt)}return b.a.createElement(ae.a,Object(c.a)({form:Lt},se,{className:"upload-image-panel",onFinish:Bt}),b.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},b.a.createElement("div",{className:"flex-container"},b.a.createElement(ae.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},b.a.createElement(Ae.a,{style:fe})),b.a.createElement(Oe,{onFileChange:yr}))),b.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},b.a.createElement(Ae.a,{style:{width:264}})),b.a.createElement(ae.a.Item,{style:{textAlign:"right"}},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))};function Oe(Ke){var xt=Ke.onFileChange;return b.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",b.a.createElement("input",{type:"file",onChange:xt}))}function xe(Ke,xt){if(!Ke)throw new String("\u6CA1\u6709\u6587\u4EF6");var mt=new FormData;mt.append("editormd-image-file",Ke),mt.append("file_param_name","editormd-image-file"),mt.append("byxhr","true");var ot=new window.XMLHttpRequest;ot.withCredentials=!0,ot.addEventListener("load",function(Rt){xt(JSON.parse(Rt.target.responseText),Ke)},!1),ot.addEventListener("error",function(Rt){console.error(Rt)},!1),ot.open("POST","".concat(ue.a,"/api/attachments.json")),ot.send(mt)}var Pe=ie("giR+"),Ne=ie("fyUT"),Be=ie("7Kak"),We=ie("9yH6"),Ue=We.a.Group,Fe={margin:"0 8px"},at=function(Ke){var xt=Ke.callback,mt=Ke.onCancel;function ot(Rt){xt(Rt)}return b.a.createElement(ae.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ot},b.a.createElement("div",{className:"flex-container"},b.a.createElement("span",{style:Fe},"\u5355\u5143\u683C\u6570\uFF1A"),b.a.createElement("span",{style:Fe},"\u884C\u6570"),b.a.createElement(ae.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},b.a.createElement(Ne.a,null)),b.a.createElement("span",{style:Fe},"\u5217\u6570"),b.a.createElement(ae.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},b.a.createElement(Ne.a,null))),b.a.createElement("div",{className:"flex-container",style:{marginTop:12}},b.a.createElement("span",{style:Fe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),b.a.createElement(ae.a.Item,{name:"align"},b.a.createElement(Ue,null,b.a.createElement(We.a,{value:"default"},b.a.createElement("i",{className:"fa fa-align-justify"})),b.a.createElement(We.a,{value:"left"},b.a.createElement("i",{className:"fa fa-align-left"})),b.a.createElement(We.a,{value:"center"},b.a.createElement("i",{className:"fa fa-align-center"})),b.a.createElement(We.a,{value:"right"},b.a.createElement("i",{className:"fa fa-align-right"}))))),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},it=ie("ErOA"),et=ie("7Cbv"),Ze="link",ut="upload-image",Je="code-block",st="add-table",ke="------------",nt={default:ke,left:":".concat(ke),center:":".concat(ke,":"),right:"".concat(ke,":")},qe=ie("9VGf"),Ie,He;function Ee(){}var pe=0,ye=1e4,re="\u2581",oe=`
**\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 le(Ke){return/^\d+$/.test(Ke)?"".concat(Ke,"px"):Ke}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,Le=de?"Cmd":"Ctrl",Me=["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"],Ye=(Ie={},Object(B.a)(Ie,Le+"-B","bold"),Object(B.a)(Ie,Le+"-I","italic"),Ie),yt=(He={},Object(B.a)(He,Ze,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(He,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(He,ut,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(He,st,"\u6DFB\u52A0\u8868\u683C"),He),At=$e.a=function(Ke){var xt=Ke.defaultValue,mt=xt===void 0?"":xt,ot=Ke.onChange,Rt=Ke.width,Lt=Rt===void 0?"100%":Rt,Kt=Ke.height,Bt=Kt===void 0?400:Kt,wt=Ke.miniToolbar,yr=wt===void 0?!1:wt,ir=Ke.isFocus,gt=ir===void 0?!1:ir,Gr=Ke.watch,br=Ke.insertTemp,fr=Ke.mode,Tr=fr===void 0?"markdown":fr,si=Ke.id,Kr=si===void 0?"markdown-editor-id":si,It=Ke.showResizeBar,ft=It===void 0?!1:It,Ur=Ke.noStorage,li=Ur===void 0?!1:Ur,wr=Ke.showNullButton,Ot=wr===void 0?!1:wr,Vr=Ke.hidetoolBar,ui=Vr===void 0?!1:Vr,gi=Ke.fullScreen,Xe=gi===void 0?!1:gi,St=Ke.onBlur,ei=Ke.onCMBeforeChange,hi=Ke.onFullScreen,di=Ke.className,ki=di===void 0?"":di,V=Ke.disablePaste,l=V===void 0?!1:V,y=Ke.placeholder,z=y===void 0?"":y,Z=Ke.values,G=Z===void 0?"":Z,ve=Object(p.useState)(null),ze=Object(W.a)(ve,2),Re=ze[0],ct=ze[1],Ge=Object(p.useState)(mt),Ct=Object(W.a)(Ge,2),Mt=Ct[0],Wt=Ct[1],Fr=Object(p.useState)(Gr),jr=Object(W.a)(Fr,2),sr=jr[0],Xr=jr[1],Ki=Object(p.useState)(Xe),Ar=Object(W.a)(Ki,2),_r=Ar[0],ti=Ar[1],vi=Object(p.useState)(""),$r=Object(W.a)(vi,2),ri=$r[0],Wr=$r[1],fn=Object(p.useState)(0),Vi=Object(W.a)(fn,2),Pr=Vi[0],Mr=Vi[1],Ri=Object(p.useState)(Bt),Oi=Object(W.a)(Ri,2),Pi=Oi[0],qt=Oi[1],Ut=Object(p.useState)(!1),pr=Object(W.a)(Ut,2),Ft=pr[0],mr=pr[1],Xt=Object(p.useRef)(Object(et.a)()),yi=Object(p.useRef)(!1),nr=Object(p.useRef)(),ar=Object(p.useRef)(),ii=Object(p.useRef)(),bi=Object(p.useRef)(),xi=Object(p.useRef)(),Fn=function(){var pt=Object(R.a)(w.a.mark(function Tt(){var bt,Dt;return w.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(it.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Xt.current}});case 2:Dt=Ht.sent,Dt!=null&&(bt=Dt.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",Re,ar),Dt.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?Re.replaceSelection("![,](/api/attachments/".concat(Pt.id,"?type=").concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?Re.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Pt.content_type.indexOf("pdf")>-1?Re.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):Re.replaceSelection("[".concat(Pt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return Ht.stop()}},Tt)}));return function(){return pt.apply(this,arguments)}}();Object(p.useEffect)(function(){Wt(G),Re==null||Re.setValue(G)},[G]),Object(p.useEffect)(function(){hi==null||hi(_r)},[_r]),Object(p.useEffect)(function(){if(ar.current){var pt=A.a.fromTextArea(ar.current,{mode:Tr,lineNumbers:!yr,lineWrapping:!0,value:mt,autoCloseTags:!0,autoCloseBrackets:!0});gt&&pt.focus();function Tt(bt,Dt){if(l){Dt.preventDefault();return}var Nt=Dt.clipboardData;if(Nt){var Ht=Nt.types.toString(),Pt=Nt.items;if(Ht==="Files"||Nt.types.indexOf("Files")>-1){if(Dt.preventDefault(),Tr=="stex")return;try{var Qt,lr=Pt[1];((Qt=Pt[0])===null||Qt===void 0?void 0:Qt.kind)==="file"&&(lr=Pt[0]);var kt=lr.getAsFile(),Mi=kt.name.split(".").pop();xe(kt,function(zt){if(zt.id){var gr,Vt,Yr;(kt==null||((gr=kt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?pt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(kt==null||((Vt=kt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(kt==null||((Yr=kt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):pt.replaceSelection("[".concat(kt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return pt.on("paste",Tt),pt.on("dragleave",function(bt,Dt){ii.current.classList.remove("mouse-hover-md")}),pt.on("dragover",function(bt,Dt){ii.current.classList.add("mouse-hover-md")}),pt.on("drop",function(bt,Dt){ii.current.classList.add("mouse-hover-md");var Nt;if(Nt=Dt.dataTransfer.files,Nt.length>0){Dt.preventDefault(),Dt.stopPropagation();for(var Ht=function(lr){var kt=Nt[lr],Mi=kt.name.split(".").pop();xe(kt,function(zt){if(zt.id){var gr,Vt,Yr;(kt==null||((gr=kt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?pt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(kt==null||((Vt=kt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(kt==null||((Yr=kt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):pt.replaceSelection("[".concat(kt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt<Nt.length;Pt++)Ht(Pt)}}),ct(pt),function(){pt.off("paste",Tt)}}},[]);var Qr=Object(p.useCallback)(function(){if(ii.current)try{}catch(pt){console.log(pt,"---- to set md editor body height")}},[Pi,ii,_r]);Object(p.useEffect)(function(){function pt(){var bt=new S.default(function(Dt){var Nt=Object(k.a)(Dt),Ht;try{for(Nt.s();!(Ht=Nt.n()).done;){var Pt=Ht.value;(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&(Qr(),Re.setSize("100%","100%"),Re.refresh())}}catch(Qt){Nt.e(Qt)}finally{Nt.f()}});return bt.observe(ar.current.parentElement),bt}if(Re){var Tt=pt();return function(){Tt.unobserve(ar.current.parentElement)}}},[Re,Qr]),Object(p.useEffect)(function(){if(Re){for(var pt=[],Tt=function(){var Pt=Dt[bt];Nt=Object(W.a)(Pt,2);var Qt=Nt[0],lr=Nt[1],kt=Object(B.a)({},Qt,function(){Xi(lr)});pt.push(kt),Re.addKeyMap(kt)},bt=0,Dt=Object.entries(Ye);bt<Dt.length;bt++){var Nt;Tt()}return nr.current=setInterval(function(){yi.current&&Fn()},4e3),function(){clearInterval(nr.current);var Ht=Object(k.a)(pt),Pt;try{for(Ht.s();!(Pt=Ht.n()).done;){var Qt=Pt.value;Re.removeKeyMap(Qt)}}catch(lr){Ht.e(lr)}finally{Ht.f()}}}},[Re]),Object(p.useEffect)(function(){Xe!==_r&&ti(Xe)},[Xe]),Object(qe.a)(function(){if(!li&&Pr>0){var pt=new Date().getTime(),Tt=window.sessionStorage.getItem(Kr);pt>=Pr+ye&&(!Tt||Tt!==Mt)&&(window.sessionStorage.setItem(Kr,Mt),mr(!0))}},ye),Object(p.useEffect)(function(){Xr(Gr)},[Re,Gr]),Object(p.useEffect)(function(){Re&&(gt&&Re.focus())},[Re,gt]),Object(p.useEffect)(function(){if(sr&&Re){var pt=Re.getScrollerElement();function Tt(bt){var Dt=bt.target;if(xi.current){var Nt=Dt.scrollTop/Dt.scrollHeight;xi.current.scrollTop=xi.current.scrollHeight*Nt}}return pt.addEventListener("scroll",Tt),function(){pt.removeEventListener("scroll",Tt)}}},[Re,sr]),Object(p.useEffect)(function(){if(Re&&ei){function pt(Tt,bt){ei(Tt,bt)}return Re.on("beforeChange",pt),function(){Re.off("beforeChange",pt)}}},[Re,ei]),Object(p.useEffect)(function(){if(Re&&St){function pt(){St(Re.getValue())}return Re.on("blur",pt),function(){Re.off("blur",pt)}}},[Re,St]),Object(p.useEffect)(function(){if(Re){function pt(Tt){var bt=Tt.getValue();Wt(bt),Mr(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ot&&ot(bt)}return Re.on("change",pt),function(){Re.off("change",pt)}}},[Re,ot]),Object(p.useEffect)(function(){Re&&(mt==null?(Re.setValue(""),Wt("")):mt!==Re.getValue()&&(Re.setValue(mt),Wt(mt),Re.setCursor(Re.lineCount(),0)))},[Re,mt]);var Xi=Object(p.useCallback)(function(pt){var Tt=Re.getCursor(),bt=Re.getSelection(),Dt=bt.split(`
`);switch(pt){case"bold":return Re.replaceSelection("**"+bt+"**"),bt===""&&Re.setCursor(Tt.line,Tt.ch+2),Re.focus();case"italic":return Re.replaceSelection("*"+bt+"*"),bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.focus();case"code":return Re.replaceSelection("`"+bt+"`"),bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.focus();case"inline-latex":return Re.replaceSelection("`$$"+bt+"$$`"),bt===""&&Re.setCursor(Tt.line,Tt.ch+3),Re.focus();case"latex":return Re.replaceSelection("```latex\n"+bt+"\n```"),Re.setCursor(Tt.line+1,bt.length+1),Re.focus();case"line-break":return Re.replaceSelection(`<br/>
`),Re.focus();case"list-ul":return bt===""?Re.replaceSelection("- "+bt):Re.replaceSelection(Dt.map(function(Nt){return Nt===""?"":"- ".concat(Nt)}).join(`
`)),Re.focus();case"list-ol":return bt===""?Re.replaceSelection("1. "+bt):Re.replaceSelection(Dt.map(function(Nt,Ht){return Nt===""?"":"".concat(Ht+1,". ").concat(Nt)}).join(`
`)),Re.focus();case"add-null-ch":return bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.replaceSelection(re),Re.focus();case"inster-template-1":return bt===""&&Re.setCursor(Tt.line,Tt.ch),Re.replaceSelection(oe),Re.focus();case"eraser":return Re.setValue(""),Re.focus();case"trigger-watch":return Xr(!sr),Re.focus();case"trigger-full-screen":return ti(!_r),Re.focus();case Ze:Wr(Ze);return;case Je:Wr(Je);return;case ut:Wr(ut);return;case st:Wr(st);return;default:throw new Error}},[Re,sr,_r]),Ir=Object(p.useCallback)(function(pt){Wr("");switch(ri){case Ze:var Tt=pt.title,bt=pt.link;return Re.replaceSelection("[".concat(Tt,"](").concat(bt,")")),Re.focus();case Je:var Dt=pt.language,Nt=pt.content;return Re.replaceSelection(["```"+Dt,Nt,"```"].join(`
`)),Re.focus();case ut:var Ht=pt.src,Pt=pt.alt,Qt=pt.name;return Ht.indexOf("type=image")>-1?Re.replaceSelection("![ ".concat(Pt||""," ]( ").concat(Ht,' "').concat(Pt||"",'" )')):Ht.indexOf("type=application/pdf")>-1?Re.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(Qt,"</a>")):Re.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(Qt,"</a>")),Re.focus();case st:for(var lr=pt.row,kt=pt.col,Mi=pt.align,zt=`
`,gr=0;gr<lr;gr++){for(var Vt=[],Yr=[],pn=0;pn<kt;pn++)gr===1&&Yr.push(nt[Mi]),Vt.push(" ");gr===1&&(zt+="| ".concat(Yr.join(" | "),` |
`)),zt+="| ".concat(Vt.join(kt===1?"":" | "),` |
`)}return Re.replaceSelection(zt+`
`),Re.focus();default:throw new Error}},[Re,ri]),Yi=Object(p.useMemo)(function(){switch(ri){case Ze:return b.a.createElement(Te,{callback:Ir,onCancel:ci});case Je:return b.a.createElement(Ce.b,{callback:Ir,onCancel:ci});case ut:return b.a.createElement(_e,{callback:Ir,onCancel:ci});case st:return b.a.createElement(at,{callback:Ir,onCancel:ci});default:return null}},[ri]);function ci(){Wr("")}Object(p.useEffect)(function(){if(bi.current){var pt=bi.current,Tt=!1,bt=0;function Dt(Pt){Tt=!0,bt=Pt.pageY}function Nt(){Tt=!1}function Ht(Pt){if(Tt){var Qt=Pt.pageY-bt;Qt<0&&(Qt=0),Qt>300&&(Qt=300);var lr=Bt+Qt+"px";qt(lr)}}return pt.addEventListener("mousedown",Dt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Nt),function(){pt.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Nt)}}},[Re,bi]),Object(p.useEffect)(function(){qt(Bt)},[Bt]);var Ei=le(Lt),ua=le(Pi),ha={width:Ei,height:ua},Qa=Object(p.useMemo)(function(){if(Pr){var pt=new Date(Pr),Tt=pt.getHours(),bt=pt.getMinutes(),Dt=pt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,bt=bt<10?"0"+bt:bt,Dt=Dt<10?"0"+Dt:Dt,"".concat(Tt,":").concat(bt,":").concat(Dt)}return 0},[Pr]);function Ja(){window.sessionStorage.removeItem(Kr),mr(!1),Mr(0)}function da(){mr(!1),Mr(0),Re.setValue(window.sessionStorage.getItem(Kr))}function jn(pt,Tt){var bt=Re.getValue();bt=bt.replace(pt,Tt),Wt(bt),Re==null||Re.setValue(bt)}return b.a.createElement(p.Fragment,null,b.a.createElement("div",{className:"markdown-editor-wrapper",ref:ii},b.a.createElement("div",{className:"markdown-editor-container ".concat(ki," ").concat(sr?"on-preview":""," ").concat(yr?"mini":""," ").concat(_r?"full-screen":""),style:ha},b.a.createElement(K,{insertTemp:br,watch:sr,fullScreen:_r,showNullButton:Ot,onActionCallback:Xi,hidetoolBar:ui,uuid:Xt.current,setOpenPhones:function(){yi.current=!0}}),b.a.createElement("div",{className:"markdown-editor-body"},b.a.createElement("div",{className:"codemirror-container"},b.a.createElement("textarea",{ref:ar,placeholder:z})),sr?b.a.createElement("div",{ref:xi,className:"preview-container"},Tr==="stex"&&b.a.createElement(D,{value:Mt}),Tr!=="stex"&&b.a.createElement(v.a,{edit:!0,value:Mt,replaces:jn})):null))),ft?b.a.createElement("a",{ref:bi,className:"editor-resize"}):null,b.a.createElement(I.a,null,yt[ri]?b.a.createElement($.a,{centered:!0,title:yt[ri],visible:!0,onCancel:ci,footer:null},Yi):null))}},SJMd:function(lt,$e){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var ie,ne,$,k=!1,Y,F;window.PR_SHOULD_USE_CONTINUATION=!0;var R,W;(function(){var B=window,P=["break,continue,do,else,for,if,return,while"],w=[P,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],p=[w,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[p,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],M=[p,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[p,"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"],S="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",x=[p,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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",a=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[b,A,M,x,d,a,s,u],f=/^(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",D="kwd",T="com",g="typ",c="lit",h="pun",o="pln",C="tag",E="dec",m="src",O="atn",U="atv",j="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(xe){for(var Pe=0,Ne=!1,Be=!1,We=0,Ue=xe.length;We<Ue;++We){var Fe=xe[We];if(Fe.ignoreCase)Be=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ne=!0,Be=!1;break}}var at={b:8,t:9,n:10,v:11,f:12,r:13};function it(st){var ke=st.charCodeAt(0);if(ke!==92)return ke;var nt=st.charAt(1);return ke=at[nt],ke||("0"<=nt&&nt<="7"?parseInt(st.substring(1),8):nt==="u"||nt==="x"?parseInt(st.substring(2),16):st.charCodeAt(1))}function et(st){if(st<32)return(st<16?"\\x0":"\\x")+st.toString(16);var ke=String.fromCharCode(st);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function Ze(st){var ke=st.substring(1,st.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")),nt=[],qe=ke[0]==="^",Ie=["["];qe&&Ie.push("^");for(var He=qe?1:0,Ee=ke.length;He<Ee;++He){var pe=ke[He];if(/\\[bdsw]/i.test(pe))Ie.push(pe);else{var ye=it(pe),re;He+2<Ee&&ke[He+1]==="-"?(re=it(ke[He+2]),He+=2):re=ye,nt.push([ye,re]),re<65||ye>122||(re<65||ye>90||nt.push([Math.max(65,ye)|32,Math.min(re,90)|32]),re<97||ye>122||nt.push([Math.max(97,ye)&~32,Math.min(re,122)&~32]))}}nt.sort(function(Le,Me){return Le[0]-Me[0]||Me[1]-Le[1]});for(var oe=[],le=[],He=0;He<nt.length;++He){var de=nt[He];de[0]<=le[1]+1?le[1]=Math.max(le[1],de[1]):oe.push(le=de)}for(var He=0;He<oe.length;++He){var de=oe[He];Ie.push(et(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Ie.push("-"),Ie.push(et(de[1])))}return Ie.push("]"),Ie.join("")}function ut(st){for(var ke=st.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")),nt=ke.length,qe=[],Ie=0,He=0;Ie<nt;++Ie){var Ee=ke[Ie];if(Ee==="(")++He;else if(Ee.charAt(0)==="\\"){var pe=+Ee.substring(1);pe&&(pe<=He?qe[pe]=-1:ke[Ie]=et(pe))}}for(var Ie=1;Ie<qe.length;++Ie)qe[Ie]===-1&&(qe[Ie]=++Pe);for(var Ie=0,He=0;Ie<nt;++Ie){var Ee=ke[Ie];if(Ee==="(")++He,qe[He]||(ke[Ie]="(?:");else if(Ee.charAt(0)==="\\"){var pe=+Ee.substring(1);pe&&pe<=He&&(ke[Ie]="\\"+qe[pe])}}for(var Ie=0;Ie<nt;++Ie)ke[Ie]==="^"&&ke[Ie+1]!=="^"&&(ke[Ie]="");if(st.ignoreCase&&Ne)for(var Ie=0;Ie<nt;++Ie){var Ee=ke[Ie],ye=Ee.charAt(0);Ee.length>=2&&ye==="["?ke[Ie]=Ze(Ee):ye!=="\\"&&(ke[Ie]=Ee.replace(/[a-zA-Z]/g,function(le){var de=le.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return ke.join("")}for(var Je=[],We=0,Ue=xe.length;We<Ue;++We){var Fe=xe[We];if(Fe.global||Fe.multiline)throw new Error(""+Fe);Je.push("(?:"+ut(Fe)+")")}return new RegExp(Je.join("|"),Be?"gi":"g")}function N(xe,Pe){var Ne=/(?:^|\s)nocode(?:\s|$)/,Be=[],We=0,Ue=[],Fe=0;function at(it){var et=it.nodeType;if(et==1){if(Ne.test(it.className))return;for(var Ze=it.firstChild;Ze;Ze=Ze.nextSibling)at(Ze);var ut=it.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(Be[Fe]=`
`,Ue[Fe<<1]=We++,Ue[Fe++<<1|1]=it)}else if(et==3||et==4){var Je=it.nodeValue;Je.length&&(Pe?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),Be[Fe]=Je,Ue[Fe<<1]=We,We+=Je.length,Ue[Fe++<<1|1]=it)}}return at(xe),{sourceCode:Be.join("").replace(/\n$/,""),spans:Ue}}function X(xe,Pe,Ne,Be,We){if(!Ne)return;var Ue={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Ne,spans:null,basePos:Pe,decorations:null};Be(Ue),We.push.apply(We,Ue.decorations)}var q=/\S/;function ae(xe){for(var Pe=void 0,Ne=xe.firstChild;Ne;Ne=Ne.nextSibling){var Be=Ne.nodeType;Pe=Be===1?Pe?xe:Ne:Be===3&&q.test(Ne.nodeValue)?xe:Pe}return Pe===xe?void 0:Pe}function he(xe,Pe){var Ne={},Be;(function(){for(var Fe=xe.concat(Pe),at=[],it={},et=0,Ze=Fe.length;et<Ze;++et){var ut=Fe[et],Je=ut[3];if(Je)for(var st=Je.length;--st>=0;)Ne[Je.charAt(st)]=ut;var ke=ut[1],nt=""+ke;it.hasOwnProperty(nt)||(at.push(ke),it[nt]=null)}at.push(/[\0-\uffff]/),Be=I(at)})();var We=Pe.length,Ue=function(Fe){for(var at=Fe.sourceCode,it=Fe.basePos,et=Fe.sourceNode,Ze=[it,o],ut=0,Je=at.match(Be)||[],st={},ke=0,nt=Je.length;ke<nt;++ke){var qe=Je[ke],Ie=st[qe],He=void 0,Ee;if(typeof Ie=="string")Ee=!1;else{var pe=Ne[qe.charAt(0)];if(pe)He=qe.match(pe[1]),Ie=pe[0];else{for(var ye=0;ye<We;++ye)if(pe=Pe[ye],He=qe.match(pe[1]),He){Ie=pe[0];break}He||(Ie=o)}Ee=Ie.length>=5&&Ie.substring(0,5)==="lang-",Ee&&!(He&&typeof He[1]=="string")&&(Ee=!1,Ie=m),Ee||(st[qe]=Ie)}var re=ut;if(ut+=qe.length,!Ee)Ze.push(it+re,Ie);else{var oe=He[1],le=qe.indexOf(oe),de=le+oe.length;He[2]&&(de=qe.length-He[2].length,le=de-oe.length);var Le=Ie.substring(5);X(et,it+re,qe.substring(0,le),Ue,Ze),X(et,it+re+le,oe,ue(Le,oe),Ze),X(et,it+re+de,qe.substring(de),Ue,Ze)}}Fe.decorations=Ze};return Ue}function Ae(xe){var Pe=[],Ne=[];xe.tripleQuotedStrings?Pe.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?Pe.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Pe.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Ne.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=xe.hashComments;Be&&(xe.cStyleComments?(Be>1?Pe.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Pe.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ne.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([T,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Ne.push([T,/^\/\/[^\r\n]*/,null]),Ne.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=xe.regexLiterals;if(We){var Ue=We>1?"":`
\r`,Fe=Ue?".":"[\\S\\s]",at="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Ne.push(["lang-regex",RegExp("^"+K+"("+at+")")])}var it=xe.types;it&&Ne.push([g,it]);var et=(""+xe.keywords).replace(/^ | $/g,"");et.length&&Ne.push([D,new RegExp("^(?:"+et.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([o,/^\s+/,null,` \r
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Ze+="(?!s*/)"),Ne.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[h,new RegExp(Ze),null]),he(Pe,Ne)}var be=Ae({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(xe,Pe,Ne){for(var Be=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Ue=xe.ownerDocument,Fe=Ue.createElement("li");xe.firstChild;)Fe.appendChild(xe.firstChild);var at=[Fe];function it(ke){var nt=ke.nodeType;if(nt==1&&!Be.test(ke.className))if(ke.nodeName==="br")et(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var qe=ke.firstChild;qe;qe=qe.nextSibling)it(qe);else if((nt==3||nt==4)&&Ne){var Ie=ke.nodeValue,He=Ie.match(We);if(He){var Ee=Ie.substring(0,He.index);ke.nodeValue=Ee;var pe=Ie.substring(He.index+He[0].length);if(pe){var ye=ke.parentNode;ye.insertBefore(Ue.createTextNode(pe),ke.nextSibling)}et(ke),Ee||ke.parentNode.removeChild(ke)}}}function et(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function nt(He,Ee){var pe=Ee?He.cloneNode(!1):He,ye=He.parentNode;if(ye){var re=nt(ye,1),oe=He.nextSibling;re.appendChild(pe);for(var le=oe;le;le=oe)oe=le.nextSibling,re.appendChild(le)}return pe}for(var qe=nt(ke.nextSibling,0),Ie;(Ie=qe.parentNode)&&Ie.nodeType===1;)qe=Ie;at.push(qe)}for(var Ze=0;Ze<at.length;++Ze)it(at[Ze]);Pe===(Pe|0)&&at[0].setAttribute("value",Pe);var ut=Ue.createElement("ol");ut.className="linenums";for(var Je=Math.max(0,Pe-1|0)||0,Ze=0,st=at.length;Ze<st;++Ze)Fe=at[Ze],Fe.className="L"+(Ze+Je)%10,Fe.firstChild||Fe.appendChild(Ue.createTextNode("\xA0")),ut.appendChild(Fe);xe.appendChild(ut)}function Ce(xe){var Pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Pe=Pe&&+Pe[1]<=8;var Ne=/\n/g,Be=xe.sourceCode,We=Be.length,Ue=0,Fe=xe.spans,at=Fe.length,it=0,et=xe.decorations,Ze=et.length,ut=0;et[Ze]=We;var Je,st;for(st=Je=0;st<Ze;)et[st]!==et[st+2]?(et[Je++]=et[st++],et[Je++]=et[st++]):st+=2;for(Ze=Je,st=Je=0;st<Ze;){for(var ke=et[st],nt=et[st+1],qe=st+2;qe+2<=Ze&&et[qe+1]===nt;)qe+=2;et[Je++]=ke,et[Je++]=nt,st=qe}Ze=et.length=Je;var Ie=xe.sourceNode,He="";Ie&&(He=Ie.style.display,Ie.style.display="none");try{for(var Ee=null;it<at;){var pe=Fe[it],ye=Fe[it+2]||We,re=et[ut+2]||We,qe=Math.min(ye,re),oe=Fe[it+1],le;if(oe.nodeType!==1&&(le=Be.substring(Ue,qe))){Pe&&(le=le.replace(Ne,"\r")),oe.nodeValue=le;var de=oe.ownerDocument,Le=de.createElement("span");Le.className=et[ut+1];var Me=oe.parentNode;Me.replaceChild(Le,oe),Le.appendChild(oe),Ue<ye&&(Fe[it+1]=oe=de.createTextNode(Be.substring(qe,ye)),Me.insertBefore(oe,Le.nextSibling))}Ue=qe,Ue>=ye&&(it+=2),Ue>=re&&(ut+=2)}}finally{Ie&&(Ie.style.display=He)}}var Se={};function me(xe,Pe){for(var Ne=Pe.length;--Ne>=0;){var Be=Pe[Ne];Se.hasOwnProperty(Be)?B.console&&console.warn("cannot override language handler %s",Be):Se[Be]=xe}}function ue(xe,Pe){return xe&&Se.hasOwnProperty(xe)||(xe=/^\s*</.test(Pe)?"default-markup":"default-code"),Se[xe]}me(be,["default-code"]),me(he([],[[o,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\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(he([[o,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[O,/^(?!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(he([],[[U,/^[\s\S]+/]]),["uq.val"]),me(Ae({keywords:b,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),me(Ae({keywords:"null,true,false"}),["json"]),me(Ae({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),me(Ae({keywords:M,cStyleComments:!0}),["java"]),me(Ae({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Ae({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Ae({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Ae({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Ae({keywords:x,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Ae({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(he([],[[v,/^[\s\S]+/]]),["regex"]);function te(xe){var Pe=xe.langExtension;try{var Ne=N(xe.sourceNode,xe.pre),Be=Ne.sourceCode;xe.sourceCode=Be,xe.spans=Ne.spans,xe.basePos=0,ue(Pe,Be)(xe),Ce(xe)}catch(We){B.console&&console.log(We&&We.stack||We)}}function fe(xe,Pe,Ne){var Be=Ne||!1,We=Pe||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+xe+"</pre>",Ue=Ue.firstChild,Be&&Te(Ue,Be,!0);var Fe={langExtension:We,numberLines:Be,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Fe),Ue.innerHTML}function se(xe,Pe){var Ne=Pe||document.body,Be=Ne.ownerDocument||document;function We(pe){return Ne.getElementsByTagName(pe)}for(var Ue=[We("pre"),We("code"),We("xmp")],Fe=[],at=0;at<Ue.length;++at)for(var it=0,et=Ue[at].length;it<et;++it)Fe.push(Ue[at][it]);Ue=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var ut=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,st=/\bprettyprint\b/,ke=/\bprettyprinted\b/,nt=/pre|xmp/i,qe=/^code$/i,Ie=/^(?:pre|code|xmp)$/i,He={};function Ee(){for(var pe=B.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;ut<Fe.length&&Ze.now()<pe;ut++){for(var ye=Fe[ut],re=He,oe=ye;oe=oe.previousSibling;){var le=oe.nodeType,de=(le===7||le===8)&&oe.nodeValue;if(de?!/^\??prettify\b/.test(de):le!==3||/\S/.test(oe.nodeValue))break;if(de){re={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Bt,wt,yr){re[wt]=yr});break}}var Le=ye.className;if((re!==He||st.test(Le))&&!ke.test(Le)){for(var Me=!1,Ye=ye.parentNode;Ye;Ye=Ye.parentNode){var yt=Ye.tagName;if(Ie.test(yt)&&Ye.className&&st.test(Ye.className)){Me=!0;break}}if(!Me){ye.className+=" prettyprinted";var At=re.lang;if(!At){At=Le.match(Je);var Ke;!At&&(Ke=ae(ye))&&qe.test(Ke.tagName)&&(At=Ke.className.match(Je)),At&&(At=At[1])}var xt;if(nt.test(ye.tagName))xt=1;else{var mt=ye.currentStyle,ot=Be.defaultView,Rt=mt?mt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(ye,null).getPropertyValue("white-space"):0;xt=Rt&&Rt.substring(0,3)==="pre"}var Lt=re.linenums;(Lt=Lt==="true"||+Lt)||(Lt=Le.match(/\blinenums\b(?::(\d+))?/),Lt=Lt?Lt[1]&&Lt[1].length?+Lt[1]:!0:!1),Lt&&Te(ye,Lt,xt);var Kt={langExtension:At,sourceNode:ye,numberLines:Lt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}ut<Fe.length?B.setTimeout(Ee,250):typeof xe=="function"&&xe()}Ee()}var _e=B.PR={createSimpleLexer:he,registerLangHandler:me,sourceDecorator:Ae,PR_ATTRIB_NAME:O,PR_ATTRIB_VALUE:U,PR_COMMENT:T,PR_DECLARATION:E,PR_KEYWORD:D,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:o,PR_PUNCTUATION:h,PR_SOURCE:m,PR_STRING:v,PR_TAG:C,PR_TYPE:g,prettyPrintOne:k?B.prettyPrintOne=fe:R=fe,prettyPrint:W=k?B.prettyPrint=se:W=se},Oe=B.define;typeof Oe=="function"&&Oe.amd&&Oe("google-code-prettify",[],function(){return _e})})()},"VrN/":function(lt,$e,ie){(function(ne,$){lt.exports=$()})(this,function(){"use strict";var ne=navigator.userAgent,$=navigator.platform,k=/gecko\/\d/i.test(ne),Y=/MSIE \d/.test(ne),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),R=/Edge\/(\d+)/.exec(ne),W=Y||F||R,B=W&&(Y?document.documentMode||6:+(R||F)[1]),P=!R&&/WebKit\//.test(ne),w=P&&/Qt\/\d+\.\d+/.test(ne),p=!R&&/Chrome\//.test(ne),b=/Opera\//.test(ne),M=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),S=/PhantomJS/.test(ne),x=!R&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),d=/Android/.test(ne),a=x||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=x||/Mac/.test($),u=/\bCrOS\b/.test(ne),L=/win/i.test($),f=b&&ne.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(b=!1,P=!0);var v=s&&(w||b&&(f==null||f<12.11)),D=k||W&&B>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var i=e.className,r=T(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return c(e).appendChild(t)}function o(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var _=0;_<t.length;++_)n.appendChild(t[_]);return n}function C(e,t,i,r){var n=o(e,t,i,r);return n.setAttribute("role","presentation"),n}var E;document.createRange?E=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:E=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function m(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 O(){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 U(e,t){var i=e.className;T(t).test(i)||(e.className+=(i?" ":"")+t)}function j(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!T(i[r]).test(t)&&(t+=" "+i[r]);return t}var K=function(e){e.select()};x?K=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(K=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function X(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var _=r||0,H=n||0;;){var Q=e.indexOf(" ",_);if(Q<0||Q>=t)return H+(t-_);H+=Q-_,H+=i-H%i,_=Q+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ae(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var he=50,Ae={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},Te={origin:"*mouse"},Ce={origin:"+move"};function Se(e,t,i){for(var r=0,n=0;;){var _=e.indexOf(" ",r);_==-1&&(_=e.length);var H=_-r;if(_==e.length||n+H>=t)return r+Math.min(H,t-n);if(n+=_-r,n+=i-n%i,r=_+1,n>=t)return r}}var me=[""];function ue(e){for(;me.length<=e;)me.push(te(me)+" ");return me[e]}function te(e){return e[e.length-1]}function fe(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function se(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function _e(){}function Oe(e,t){var i;return Object.create?i=Object.create(e):(_e.prototype=e,i=new _e),t&&N(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Pe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Ne(e,t){return t?t.source.indexOf("\\w")>-1&&Pe(e)?!0:t.test(e):Pe(e)}function Be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ue(e){return e.charCodeAt(0)>=768&&We.test(e)}function Fe(e,t,i){for(;(i<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=i;return t}function at(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,_=r<0?Math.ceil(n):Math.floor(n);if(_==t)return e(_)?t:i;e(_)?i=_:t=_+r}}function it(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,_=0;_<e.length;++_){var H=e[_];(H.from<i&&H.to>t||t==i&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,i),H.level==1?"rtl":"ltr",_),n=!0)}n||r(t,i,"ltr")}var et=null;function Ze(e,t,i){var r;et=null;for(var n=0;n<e.length;++n){var _=e[n];if(_.from<t&&_.to>t)return n;_.to==t&&(_.from!=_.to&&i=="before"?r=n:et=n),_.from==t&&(_.from!=_.to&&i!="before"?r=n:et=n)}return r!=null?r:et}var ut=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,_=/[LRr]/,H=/[Lb1n]/,Q=/[1n]/;function J(ee,ce,ge){this.level=ee,this.from=ce,this.to=ge}return function(ee,ce){var ge=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!r.test(ee))return!1;for(var De=ee.length,we=[],je=0;je<De;++je)we.push(i(ee.charCodeAt(je)));for(var Ve=0,Qe=ge;Ve<De;++Ve){var tt=we[Ve];tt=="m"?we[Ve]=Qe:Qe=tt}for(var ht=0,rt=ge;ht<De;++ht){var dt=we[ht];dt=="1"&&rt=="r"?we[ht]="n":_.test(dt)&&(rt=dt,dt=="r"&&(we[ht]="R"))}for(var Et=1,vt=we[0];Et<De-1;++Et){var _t=we[Et];_t=="+"&&vt=="1"&&we[Et+1]=="1"?we[Et]="1":_t==","&&vt==we[Et+1]&&(vt=="1"||vt=="n")&&(we[Et]=vt),vt=_t}for(var Yt=0;Yt<De;++Yt){var dr=we[Yt];if(dr==",")we[Yt]="N";else if(dr=="%"){var Jt=void 0;for(Jt=Yt+1;Jt<De&&we[Jt]=="%";++Jt);for(var Br=Yt&&we[Yt-1]=="!"||Jt<De&&we[Jt]=="1"?"1":"N",kr=Yt;kr<Jt;++kr)we[kr]=Br;Yt=Jt-1}}for(var tr=0,Rr=ge;tr<De;++tr){var vr=we[tr];Rr=="L"&&vr=="1"?we[tr]="L":_.test(vr)&&(Rr=vr)}for(var or=0;or<De;++or)if(n.test(we[or])){var rr=void 0;for(rr=or+1;rr<De&&n.test(we[rr]);++rr);for(var Zt=(or?we[or-1]:ge)=="L",Or=(rr<De?we[rr]:ge)=="L",dn=Zt==Or?Zt?"L":"R":ge,Di=or;Di<rr;++Di)we[Di]=dn;or=rr-1}for(var Er=[],oi,cr=0;cr<De;)if(H.test(we[cr])){var Ya=cr;for(++cr;cr<De&&H.test(we[cr]);++cr);Er.push(new J(0,Ya,cr))}else{var mi=cr,zi=Er.length,Gi=ce=="rtl"?1:0;for(++cr;cr<De&&we[cr]!="L";++cr);for(var Cr=mi;Cr<cr;)if(Q.test(we[Cr])){mi<Cr&&(Er.splice(zi,0,new J(1,mi,Cr)),zi+=Gi);var cn=Cr;for(++Cr;Cr<cr&&Q.test(we[Cr]);++Cr);Er.splice(zi,0,new J(2,cn,Cr)),zi+=Gi,mi=Cr}else++Cr;mi<cr&&Er.splice(zi,0,new J(1,mi,cr))}return ce=="ltr"&&(Er[0].level==1&&(oi=ee.match(/^\s+/))&&(Er[0].from=oi[0].length,Er.unshift(new J(0,0,oi[0].length))),te(Er).level==1&&(oi=ee.match(/\s+$/))&&(te(Er).to-=oi[0].length,Er.push(new J(0,De-oi[0].length,De)))),ce=="rtl"?Er.reverse():Er}}();function Je(e,t){var i=e.order;return i==null&&(i=e.order=ut(e.text,t)),i}var st=[],ke=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||st).concat(i)}};function nt(e,t){return e._handlers&&e._handlers[t]||st}function qe(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var _=ae(n,i);_>-1&&(r[t]=n.slice(0,_).concat(n.slice(_+1)))}}}function Ie(e,t){var i=nt(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function He(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ie(e,i||t.type,e,t),le(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ae(i,t[r])==-1&&i.push(t[r])}function pe(e,t){return nt(e,t).length>0}function ye(e){e.prototype.on=function(t,i){ke(this,t,i)},e.prototype.off=function(t,i){qe(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function le(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){re(e),oe(e)}function Le(e){return e.target||e.srcElement}function Me(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 Ye=function(){if(W&&B<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),yt;function At(e){if(yt==null){var t=o("span","\u200B");h(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(yt=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&B<8))}var i=yt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ke;function xt(e){if(Ke!=null)return Ke;var t=h(e,document.createTextNode("A\u062EA")),i=E(t,0,1).getBoundingClientRect(),r=E(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:Ke=r.right-i.right<3}var mt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var _=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),H=_.indexOf("\r");H!=-1?(i.push(_.slice(0,H)),t+=H+1):(i.push(_),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},ot=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Rt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Lt=null;function Kt(e){if(Lt!=null)return Lt;var t=h(e,o("span","x")),i=t.getBoundingClientRect(),r=E(t,0,1).getBoundingClientRect();return Lt=Math.abs(i.left-r.left)>1}var Bt={},wt={};function yr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Bt[e]=t}function ir(e,t){wt[e]=t}function gt(e){if(typeof e=="string"&&wt.hasOwnProperty(e))e=wt[e];else if(e&&typeof e.name=="string"&&wt.hasOwnProperty(e.name)){var t=wt[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 gt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return gt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gr(e,t){t=gt(t);var i=Bt[t.name];if(!i)return Gr(e,"text/plain");var r=i(e,t);if(br.hasOwnProperty(t.name)){var n=br[t.name];for(var _ in n){if(!n.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=n[_]}}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 br={};function fr(e,t){var i=br.hasOwnProperty(e)?br[e]:br[e]={};N(t,i)}function Tr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function si(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Kr(e,t,i){return e.startState?e.startState(t,i):!0}var It=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(H){return i?H.toLowerCase():H},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var _=this.string.slice(this.pos).match(e);return _&&_.index>0?null:(_&&t!==!1&&(this.pos+=_[0].length),_)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ft(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],_=n.chunkSize();if(t<_){i=n;break}t-=_}return i.lines[t]}function Ur(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(_){var H=_.text;n==i.line&&(H=H.slice(0,i.ch)),n==t.line&&(H=H.slice(t.ch)),r.push(H),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function wr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,i=ae(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Vr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],_=n.height;if(t<_){e=n;continue e}t-=_,i+=n.chunkSize()}return i}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Q=e.lines[H],J=Q.height;if(t<J)break;t-=J}return i+H}function ui(e,t){return t>=e.first&&t<e.first+e.size}function gi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Xe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Xe))return new Xe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function St(e,t){return e.line-t.line||e.ch-t.ch}function ei(e,t){return e.sticky==t.sticky&&St(e,t)==0}function hi(e){return Xe(e.line,e.ch)}function di(e,t){return St(e,t)<0?t:e}function ki(e,t){return St(e,t)<0?e:t}function V(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function l(e,t){if(t.line<e.first)return Xe(e.first,0);var i=e.first+e.size-1;return t.line>i?Xe(i,ft(e,i).text.length):y(t,ft(e,t.line).text.length)}function y(e,t){var i=e.ch;return i==null||i>t?Xe(e.line,t):i<0?Xe(e.line,0):e}function z(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=l(e,t[r]);return i}var Z=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.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}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,i){return t instanceof Z?new G(e,Tr(e.mode,t.state),i,t.lookAhead):new G(e,Tr(e.mode,t),i)},G.prototype.save=function(e){var t=e!==!1?Tr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],_={};jr(e,t.text,e.doc.mode,i,function(ee,ce){return n.push(ee,ce)},_,r);for(var H=i.state,Q=function(ee){i.baseTokens=n;var ce=e.state.overlays[ee],ge=1,De=0;i.state=!0,jr(e,t.text,ce.mode,i,function(we,je){for(var Ve=ge;De<we;){var Qe=n[ge];Qe>we&&n.splice(ge,1,we,n[ge+1],Qe),ge+=2,De=Math.min(we,Qe)}if(!je)return;if(ce.opaque)n.splice(Ve,ge-Ve,we,"overlay "+je),ge=Ve+2;else for(;Ve<ge;Ve+=2){var tt=n[Ve+1];n[Ve+1]=(tt?tt+" ":"")+"overlay "+je}},_),i.state=H,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Q(J);return{styles:n,classes:_.bgClass||_.textClass?_:null}}function ze(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Re(e,Ot(t)),n=t.text.length>e.options.maxHighlightLength&&Tr(e.doc.mode,r.state),_=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=_.styles,_.classes?t.styleClasses=_.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Re(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new G(r,!0,t);var _=sr(e,t,i),H=_>r.first&&ft(r,_-1).stateAfter,Q=H?G.fromSaved(r,H,_):new G(r,Kr(r.mode),_);return r.iter(_,t,function(J){ct(e,J.text,Q);var ee=Q.line;J.stateAfter=ee==t-1||ee%5==0||ee>=n.viewFrom&&ee<n.viewTo?Q.save():null,Q.nextLine()}),i&&(r.modeFrontier=Q.line),Q}function ct(e,t,i,r){var n=e.doc.mode,_=new It(t,e.options.tabSize,i);for(_.start=_.pos=r||0,t==""&&Ge(n,i.state);!_.eol();)Ct(n,_,i.state),_.start=_.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=si(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Ct(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=si(e,i).mode);var _=e.token(t,i);if(t.pos>t.start)return _}throw new Error("Mode "+e.name+" failed to advance stream.")}var Mt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Wt(e,t,i,r){var n=e.doc,_=n.mode,H;t=l(n,t);var Q=ft(n,t.line),J=Re(e,t.line,i),ee=new It(Q.text,e.options.tabSize,J),ce;for(r&&(ce=[]);(r||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,H=Ct(_,ee,J.state),r&&ce.push(new Mt(ee,H,Tr(n.mode,J.state)));return r?ce:new Mt(ee,H,J.state)}function Fr(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function jr(e,t,i,r,n,_,H){var Q=i.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var J=0,ee=null,ce=new It(t,e.options.tabSize,r),ge,De=e.options.addModeClass&&[null];for(t==""&&Fr(Ge(i,r.state),_);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Q=!1,H&&ct(e,t,r,ce.pos),ce.pos=t.length,ge=null):ge=Fr(Ct(i,ce,r.state,De),_),De){var we=De[0].name;we&&(ge="m-"+(ge?we+" "+ge:we))}if(!Q||ee!=ge){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),n(J,ee);ee=ge}ce.start=ce.pos}for(;J<ce.pos;){var je=Math.min(ce.pos,J+5e3);n(je,ee),J=je}}function sr(e,t,i){for(var r,n,_=e.doc,H=i?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>H;--Q){if(Q<=_.first)return _.first;var J=ft(_,Q-1),ee=J.stateAfter;if(ee&&(!i||Q+(ee instanceof Z?ee.lookAhead:0)<=_.modeFrontier))return Q;var ce=X(J.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Q-1,r=ce)}return n}function Xr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=ft(e,r).stateAfter;if(n&&(!(n instanceof Z)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ki=!1,Ar=!1;function _r(){Ki=!0}function ti(){Ar=!0}function vi(e,t,i){this.marker=e,this.from=t,this.to=i}function $r(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ri(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function Wr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function fn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var _=e[n],H=_.marker,Q=_.from==null||(H.inclusiveLeft?_.from<=t:_.from<t);if(Q||_.from==t&&H.type=="bookmark"&&(!i||!_.marker.insertLeft)){var J=_.to==null||(H.inclusiveRight?_.to>=t:_.to>t);(r||(r=[])).push(new vi(H,_.from,J?null:_.to))}}return r}function Vi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var _=e[n],H=_.marker,Q=_.to==null||(H.inclusiveRight?_.to>=t:_.to>t);if(Q||_.from==t&&H.type=="bookmark"&&(!i||_.marker.insertLeft)){var J=_.from==null||(H.inclusiveLeft?_.from<=t:_.from<t);(r||(r=[])).push(new vi(H,J?null:_.from-t,_.to==null?null:_.to-t))}}return r}function Pr(e,t){if(t.full)return null;var i=ui(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=ui(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,_=t.to.ch,H=St(t.from,t.to)==0,Q=fn(i,n,H),J=Vi(r,_,H),ee=t.text.length==1,ce=te(t.text).length+(ee?n:0);if(Q)for(var ge=0;ge<Q.length;++ge){var De=Q[ge];if(De.to==null){var we=$r(J,De.marker);we?ee&&(De.to=we.to==null?null:we.to+ce):De.to=n}}if(J)for(var je=0;je<J.length;++je){var Ve=J[je];if(Ve.to!=null&&(Ve.to+=ce),Ve.from==null){var Qe=$r(Q,Ve.marker);Qe||(Ve.from=ce,ee&&(Q||(Q=[])).push(Ve))}else Ve.from+=ce,ee&&(Q||(Q=[])).push(Ve)}Q&&(Q=Mr(Q)),J&&J!=Q&&(J=Mr(J));var tt=[Q];if(!ee){var ht=t.text.length-2,rt;if(ht>0&&Q)for(var dt=0;dt<Q.length;++dt)Q[dt].to==null&&(rt||(rt=[])).push(new vi(Q[dt].marker,null,null));for(var Et=0;Et<ht;++Et)tt.push(rt);tt.push(J)}return tt}function Mr(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ri(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(we){if(we.markedSpans)for(var je=0;je<we.markedSpans.length;++je){var Ve=we.markedSpans[je].marker;Ve.readOnly&&(!r||ae(r,Ve)==-1)&&(r||(r=[])).push(Ve)}}),!r)return null;for(var n=[{from:t,to:i}],_=0;_<r.length;++_)for(var H=r[_],Q=H.find(0),J=0;J<n.length;++J){var ee=n[J];if(St(ee.to,Q.from)<0||St(ee.from,Q.to)>0)continue;var ce=[J,1],ge=St(ee.from,Q.from),De=St(ee.to,Q.to);(ge<0||!H.inclusiveLeft&&!ge)&&ce.push({from:ee.from,to:Q.from}),(De>0||!H.inclusiveRight&&!De)&&ce.push({from:Q.to,to:ee.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function Oi(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function Pi(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function qt(e){return e.inclusiveLeft?-1:0}function Ut(e){return e.inclusiveRight?1:0}function pr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),_=St(r.from,n.from)||qt(e)-qt(t);if(_)return-_;var H=St(r.to,n.to)||Ut(e)-Ut(t);return H||t.id-e.id}function Ft(e,t){var i=Ar&&e.markedSpans,r;if(i)for(var n=void 0,_=0;_<i.length;++_)n=i[_],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||pr(r,n.marker)<0)&&(r=n.marker);return r}function mr(e){return Ft(e,!0)}function Xt(e){return Ft(e,!1)}function yi(e,t){var i=Ar&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var _=i[n];_.marker.collapsed&&(_.from==null||_.from<t)&&(_.to==null||_.to>t)&&(!r||pr(r,_.marker)<0)&&(r=_.marker)}return r}function nr(e,t,i,r,n){var _=ft(e,t),H=Ar&&_.markedSpans;if(H)for(var Q=0;Q<H.length;++Q){var J=H[Q];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),ce=St(ee.from,i)||qt(J.marker)-qt(n),ge=St(ee.to,r)||Ut(J.marker)-Ut(n);if(ce>=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.to,i)>=0:St(ee.to,i)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.from,r)<=0:St(ee.from,r)<0))return!0}}function ar(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function ii(e){for(var t;t=Xt(e);)e=t.find(1,!0).line;return e}function bi(e){for(var t,i;t=Xt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function xi(e,t){var i=ft(e,t),r=ar(i);return i==r?t:Ot(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=ft(e,t),r;if(!Qr(e,i))return t;for(;r=Xt(i);)i=r.find(1,!0).line;return Ot(i)+1}function Qr(e,t){var i=Ar&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Xi(e,t,r))return!0}}function Xi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Xi(e,r.line,$r(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,_=0;_<t.markedSpans.length;++_)if(n=t.markedSpans[_],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Xi(e,t,n))return!0}function Ir(e){e=ar(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var _=i.parent;_;i=_,_=i.parent)for(var H=0;H<_.children.length;++H){var Q=_.children[H];if(Q==i)break;t+=Q.height}return t}function Yi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=mr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Xt(r);){var _=i.find(0,!0);t-=r.text.length-_.from.ch,r=_.to.line,t+=r.text.length-_.to.ch}return t}function ci(e){var t=e.display,i=e.doc;t.maxLine=ft(i,i.first),t.maxLineLength=Yi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Yi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ei=function(e,t,i){this.text=e,Pi(this,t),this.height=i?i(this):1};Ei.prototype.lineNo=function(){return Ot(this)},ye(Ei);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Oi(e),Pi(e,i);var n=r?r(e):1;n!=e.height&&wr(e,n)}function ha(e){e.parent=null,Oi(e)}var Qa={},Ja={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ja:Qa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var i=C("span",null,null,P?"padding-right: .1px":null),r={pre:C("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var _=n?t.rest[n-1]:t.line,H=void 0;r.pos=0,r.addToken=Tt,xt(e.display.measure)&&(H=Je(_,e.doc.direction))&&(r.addToken=Dt(r.addToken,H)),r.map=[];var Q=t!=e.display.externalMeasured&&Ot(_);Ht(_,r,ze(e,_,Q)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=j(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=j(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(At(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ie(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function pt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Tt(e,t,i,r,n,_,H){if(!t)return;var Q=e.splitSpaces?bt(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,ce),W&&B<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var De=J.exec(t),we=De?De.index-ge:t.length-ge;if(we){var je=document.createTextNode(Q.slice(ge,ge+we));W&&B<9?ce.appendChild(o("span",[je])):ce.appendChild(je),e.map.push(e.pos,e.pos+we,je),e.col+=we,e.pos+=we}if(!De)break;ge+=we+1;var Ve=void 0;if(De[0]==" "){var Qe=e.cm.options.tabSize,tt=Qe-e.col%Qe;Ve=ce.appendChild(o("span",ue(tt),"cm-tab")),Ve.setAttribute("role","presentation"),Ve.setAttribute("cm-text"," "),e.col+=tt}else De[0]=="\r"||De[0]==`
`?(Ve=ce.appendChild(o("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ve.setAttribute("cm-text",De[0]),e.col+=1):(Ve=e.cm.options.specialCharPlaceholder(De[0]),Ve.setAttribute("cm-text",De[0]),W&&B<9?ce.appendChild(o("span",[Ve])):ce.appendChild(Ve),e.col+=1);e.map.push(e.pos,e.pos+1,Ve),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,i||r||n||ee||_||H){var ht=i||"";r&&(ht+=r),n&&(ht+=n);var rt=o("span",[ce],ht,_);if(H)for(var dt in H)H.hasOwnProperty(dt)&&dt!="style"&&dt!="class"&&rt.setAttribute(dt,H[dt]);return e.content.appendChild(rt)}e.content.appendChild(ce)}function bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var _=e.charAt(n);_==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(_="\xA0"),r+=_,i=_==" "}return r}function Dt(e,t){return function(i,r,n,_,H,Q,J){n=n?n+" cm-force-border":"cm-force-border";for(var ee=i.pos,ce=ee+r.length;;){for(var ge=void 0,De=0;De<t.length&&!(ge=t[De],ge.to>ee&&ge.from<=ee);De++);if(ge.to>=ce)return e(i,r,n,_,H,Q,J);e(i,r.slice(0,ge.to-ee),n,_,null,Q,J),_=null,r=r.slice(ge.to-ee),ee=ge.to}}}function Nt(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Ht(e,t,i){var r=e.markedSpans,n=e.text,_=0;if(!r){for(var H=1;H<i.length;H+=2)t.addToken(t,n.slice(_,_=i[H]),da(i[H+1],t.cm.options));return}for(var Q=n.length,J=0,ee=1,ce="",ge,De,we=0,je,Ve,Qe,tt,ht;;){if(we==J){je=Ve=Qe=De="",ht=null,tt=null,we=Infinity;for(var rt=[],dt=void 0,Et=0;Et<r.length;++Et){var vt=r[Et],_t=vt.marker;if(_t.type=="bookmark"&&vt.from==J&&_t.widgetNode)rt.push(_t);else if(vt.from<=J&&(vt.to==null||vt.to>J||_t.collapsed&&vt.to==J&&vt.from==J)){if(vt.to!=null&&vt.to!=J&&we>vt.to&&(we=vt.to,Ve=""),_t.className&&(je+=" "+_t.className),_t.css&&(De=(De?De+";":"")+_t.css),_t.startStyle&&vt.from==J&&(Qe+=" "+_t.startStyle),_t.endStyle&&vt.to==we&&(dt||(dt=[])).push(_t.endStyle,vt.to),_t.title&&((ht||(ht={})).title=_t.title),_t.attributes)for(var Yt in _t.attributes)(ht||(ht={}))[Yt]=_t.attributes[Yt];_t.collapsed&&(!tt||pr(tt.marker,_t)<0)&&(tt=vt)}else vt.from>J&&we>vt.from&&(we=vt.from)}if(dt)for(var dr=0;dr<dt.length;dr+=2)dt[dr+1]==we&&(Ve+=" "+dt[dr]);if(!tt||tt.from==J)for(var Jt=0;Jt<rt.length;++Jt)Nt(t,0,rt[Jt]);if(tt&&(tt.from||0)==J){if(Nt(t,(tt.to==null?Q+1:tt.to)-J,tt.marker,tt.from==null),tt.to==null)return;tt.to==J&&(tt=!1)}}if(J>=Q)break;for(var Br=Math.min(Q,we);;){if(ce){var kr=J+ce.length;if(!tt){var tr=kr>Br?ce.slice(0,Br-J):ce;t.addToken(t,tr,ge?ge+je:je,Qe,J+tr.length==we?Ve:"",De,ht)}if(kr>=Br){ce=ce.slice(Br-J),J=Br;break}J=kr,Qe=""}ce=n.slice(_,_=i[ee++]),ge=da(i[ee++],t.cm.options)}}}function Pt(e,t,i){this.line=t,this.rest=bi(t),this.size=this.rest?Ot(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Qr(e,t)}function Qt(e,t,i){for(var r=[],n,_=t;_<i;_=n){var H=new Pt(e.doc,ft(e.doc,_),_);n=_+H.size,r.push(H)}return r}var lr=null;function kt(e){lr?lr.ops.push(e):e.ownsGroup=lr={ops:[e],delayedCallbacks:[]}}function Mi(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function zt(e,t){var i=e.ownsGroup;if(!i)return;try{Mi(i)}finally{lr=null,t(i)}}var gr=null;function Vt(e,t){var i=nt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;lr?n=lr.delayedCallbacks:gr?n=gr:(n=gr=[],setTimeout(Yr,0));for(var _=function(Q){n.push(function(){return i[Q].apply(null,r)})},H=0;H<i.length;++H)_(H)}function Yr(){var e=gr;gr=null;for(var t=0;t<e.length;++t)e[t]()}function pn(e,t,i,r){for(var n=0;n<t.changes.length;n++){var _=t.changes[n];_=="text"?Ms(e,t):_=="gutter"?qa(e,t,i,r):_=="class"?ca(e,t):_=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&B<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=mn(t);t.background=r.insertBefore(o("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):jn(e,t)}function Ms(e,t){var i=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,ca(e,t)):i&&(t.text.className=i)}function ca(e,t){Ps(e,t),t.line.wrapClass?mn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function qa(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=mn(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var _=t.line.gutterMarkers;if(e.options.lineNumbers||_){var H=mn(t),Q=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),H.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(o("div",gi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),_)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,ce=_.hasOwnProperty(ee)&&_[ee];ce&&Q.appendChild(o("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[ee]+"px; width: "+r.gutterWidth[ee]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=T("CodeMirror-linewidget"),n=t.node.firstChild,_=void 0;n;n=_)_=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);eo(e,t,i)}function Ns(e,t,i,r){var n=Za(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ca(e,t),qa(e,t,i,r),eo(e,t,r),t.node}function eo(e,t,i){if(to(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,i,!1)}function to(e,t,i,r,n){if(!t.widgets)return;for(var _=mn(i),H=0,Q=t.widgets;H<Q.length;++H){var J=Q[H],ee=o("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Bs(J,ee,i,r),e.display.input.setUneditable(ee),n&&J.above?_.insertBefore(ee,i.gutter||i.text):_.appendChild(ee),Vt(J,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!m(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),h(t.display.measure,o("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=Le(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Wn(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,o("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ni(e){return he-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function pa(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Ii(e);if(!t.measure.heights||r&&t.measure.width!=n){var _=t.measure.heights=[];if(r){t.measure.width=n;for(var H=t.text.firstChild.getClientRects(),Q=0;Q<H.length-1;Q++){var J=H[Q],ee=H[Q+1];Math.abs(J.bottom-ee.bottom)>2&&_.push((J.bottom+ee.top)/2-i.top)}}_.push(i.bottom-i.top)}}function io(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(Ot(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=ar(t);var i=Ot(t),r=e.display.externalMeasured=new Pt(e.doc,t,i);r.lineN=i;var n=r.built=jn(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function no(e,t,i,r){return ai(e,$i(e,t),i,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ui(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function $i(e,t){var i=Ot(t),r=ma(e,i);r&&!r.text?r=null:r&&r.changes&&(pn(e,r,i,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=io(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ai(e,t,i,r,n){t.before&&(i=-1);var _=i+(r||""),H;return t.cache.hasOwnProperty(_)?H=t.cache[_]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,i,r),H.bogus||(t.cache[_]=H)),{left:H.left,right:H.right,top:n?H.rtop:H.top,bottom:n?H.rbottom:H.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,i){for(var r,n,_,H,Q,J,ee=0;ee<e.length;ee+=3)if(Q=e[ee],J=e[ee+1],t<Q?(n=0,_=1,H="left"):t<J?(n=t-Q,_=n+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(_=J-Q,n=_-1,t>=J&&(H="right")),n!=null){if(r=e[ee+2],Q==J&&i==(r.insertLeft?"left":"right")&&(H=i),i=="left"&&n==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)r=e[(ee-=3)+2],H="left";if(i=="right"&&n==J-Q)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)r=e[(ee+=3)+2],H="right";break}return{node:r,start:n,end:_,collapse:H,coverStart:Q,coverEnd:J}}function js(e,t){var i=ao;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=oo(t.map,i,r),_=n.node,H=n.start,Q=n.end,J=n.collapse,ee;if(_.nodeType==3){for(var ce=0;ce<4;ce++){for(;H&&Ue(t.line.text.charAt(n.coverStart+H));)--H;for(;n.coverStart+Q<n.coverEnd&&Ue(t.line.text.charAt(n.coverStart+Q));)++Q;if(W&&B<9&&H==0&&Q==n.coverEnd-n.coverStart?ee=_.parentNode.getBoundingClientRect():ee=js(E(_,H,Q).getClientRects(),r),ee.left||ee.right||H==0)break;Q=H,H=H-1,J="right"}W&&B<11&&(ee=Hs(e.display.measure,ee))}else{H>0&&(J=r="right");var ge;e.options.lineWrapping&&(ge=_.getClientRects()).length>1?ee=ge[r=="right"?ge.length-1:0]:ee=_.getBoundingClientRect()}if(W&&B<9&&!H&&(!ee||!ee.left&&!ee.right)){var De=_.parentNode.getClientRects()[0];De?ee={left:De.left,right:De.left+Ji(e.display),top:De.top,bottom:De.bottom}:ee=ao}for(var we=ee.top-t.rect.top,je=ee.bottom-t.rect.top,Ve=(we+je)/2,Qe=t.view.measure.heights,tt=0;tt<Qe.length-1&&!(Ve<Qe[tt]);tt++);var ht=tt?Qe[tt-1]:0,rt=Qe[tt],dt={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:ht,bottom:rt};return!ee.left&&!ee.right&&(dt.bogus=!0),e.options.singleCursorHeightPerLine||(dt.rtop=we,dt.rbottom=je),dt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Kt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function so(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 lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function vn(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return p&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ho(){return p&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ga(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function Hn(e,t,i,r,n){if(!n){var _=ga(t);i.top+=_,i.bottom+=_}if(r=="line")return i;r||(r="local");var H=Ir(t);if(r=="local"?H+=Wn(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Q=e.display.lineSpace.getBoundingClientRect();H+=Q.top+(r=="window"?0:ho());var J=Q.left+(r=="window"?0:uo());i.left+=J,i.right+=J}return i.top+=H,i.bottom+=H,i}function co(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=uo(),n-=ho();else if(i=="local"||!i){var _=e.display.sizer.getBoundingClientRect();r+=_.left,n+=_.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:n-H.top}}function va(e,t,i,r,n){return r||(r=ft(e.doc,t.line)),Hn(e,r,no(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,_){r=r||ft(e.doc,t.line),n||(n=$i(e,r));function H(je,Ve){var Qe=ai(e,n,je,Ve?"right":"left",_);return Ve?Qe.left=Qe.right:Qe.right=Qe.left,Hn(e,r,Qe,i)}var Q=Je(r,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=r.text.length?(J=r.text.length,ee="before"):J<=0&&(J=0,ee="after"),!Q)return H(ee=="before"?J-1:J,ee=="before");function ce(je,Ve,Qe){var tt=Q[Ve],ht=tt.level==1;return H(Qe?je-1:je,ht!=Qe)}var ge=Ze(Q,J,ee),De=et,we=ce(J,ge,ee=="before");return De!=null&&(we.other=ce(J,De,ee!="before")),we}function fo(e,t){var i=0;t=l(e.doc,t),e.options.lineWrapping||(i=Ji(e.display)*t.ch);var r=ft(e.doc,t.line),n=Ir(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ya(e,t,i,r,n){var _=Xe(e,t,i);return _.xRel=n,r&&(_.outside=r),_}function ba(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ya(r.first,0,null,-1,-1);var n=Vr(r,i),_=r.first+r.size-1;if(n>_)return ya(r.first+r.size-1,ft(r,_).text.length,null,1,1);t<0&&(t=0);for(var H=ft(r,n);;){var Q=zs(e,H,n,t,i),J=yi(H,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!J)return Q;var ee=J.find(1);if(ee.line==n)return ee;H=ft(r,n=ee.line)}}function po(e,t,i,r){r-=ga(t);var n=t.text.length,_=at(function(H){return ai(e,i,H-1).bottom<=r},n,0);return n=at(function(H){return ai(e,i,H).top>r},_,n),{begin:_,end:n}}function mo(e,t,i,r){i||(i=$i(e,t));var n=Hn(e,t,ai(e,i,r),"line").top;return po(e,t,i,n)}function xa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zs(e,t,i,r,n){n-=Ir(t);var _=$i(e,t),H=ga(t),Q=0,J=t.text.length,ee=!0,ce=Je(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ks:Gs)(e,t,i,_,ce,r,n);ee=ge.level!=1,Q=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var De=null,we=null,je=at(function(Et){var vt=ai(e,_,Et);return vt.top+=H,vt.bottom+=H,xa(vt,r,n,!1)?(vt.top<=n&&vt.left<=r&&(De=Et,we=vt),!0):!1},Q,J),Ve,Qe,tt=!1;if(we){var ht=r-we.left<we.right-r,rt=ht==ee;je=De+(rt?0:1),Qe=rt?"after":"before",Ve=ht?we.left:we.right}else{!ee&&(je==J||je==Q)&&je++,Qe=je==0?"after":je==t.text.length?"before":ai(e,_,je-(ee?1:0)).bottom+H<=n==ee?"after":"before";var dt=Jr(e,Xe(i,je,Qe),"line",t,_);Ve=dt.left,tt=n<dt.top?-1:n>=dt.bottom?1:0}return je=Fe(t.text,je,1),ya(i,je,Qe,tt,r-Ve)}function Gs(e,t,i,r,n,_,H){var Q=at(function(ge){var De=n[ge],we=De.level!=1;return xa(Jr(e,Xe(i,we?De.to:De.from,we?"before":"after"),"line",t,r),_,H,!0)},0,n.length-1),J=n[Q];if(Q>0){var ee=J.level!=1,ce=Jr(e,Xe(i,ee?J.from:J.to,ee?"after":"before"),"line",t,r);xa(ce,_,H,!0)&&ce.top>H&&(J=n[Q-1])}return J}function Ks(e,t,i,r,n,_,H){var Q=po(e,t,r,H),J=Q.begin,ee=Q.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ge=null,De=0;De<n.length;De++){var we=n[De];if(we.from>=ee||we.to<=J)continue;var je=we.level!=1,Ve=ai(e,r,je?Math.min(ee,we.to)-1:Math.max(J,we.from)).right,Qe=Ve<_?_-Ve+1e9:Ve-_;(!ce||ge>Qe)&&(ce=we,ge=Qe)}return ce||(ce=n[n.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>ee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Ni;function Qi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ni==null){Ni=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ni.appendChild(document.createTextNode("x")),Ni.appendChild(o("br"));Ni.appendChild(document.createTextNode("x"))}h(e.measure,Ni);var i=Ni.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function Ji(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),i=o("pre",[t],"CodeMirror-line-like");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,_=t.gutters.firstChild,H=0;_;_=_.nextSibling,++H){var Q=e.display.gutterSpecs[H].className;i[Q]=_.offsetLeft+_.clientLeft+n,r[Q]=_.clientWidth}return{fixedPos:Sa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Qi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Ji(e.display)-3);return function(n){if(Qr(e.doc,n))return 0;var _=0;if(n.widgets)for(var H=0;H<n.widgets.length;H++)n.widgets[H].height&&(_+=n.widgets[H].height);return i?_+(Math.ceil(n.text.length/r)||1)*t:_+t}}function Ca(e){var t=e.doc,i=go(e);t.iter(function(r){var n=i(r);n!=r.height&&wr(r,n)})}function Bi(e,t,i,r){var n=e.display;if(!i&&Le(t).getAttribute("cm-not-content")=="true")return null;var _,H,Q=n.lineSpace.getBoundingClientRect();try{_=t.clientX-Q.left,H=t.clientY-Q.top}catch(ge){return null}var J=ba(e,_,H),ee;if(r&&J.xRel>0&&(ee=ft(e.doc,J.line).text).length==J.ch){var ce=X(ee,ee.length,e.options.tabSize)-ee.length;J=Xe(J.line,Math.max(0,Math.round((_-ro(e.display).left)/Ji(e.display))-ce))}return J}function Ui(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Lr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Ar&&xi(e.doc,t)<n.viewTo&&Ci(e);else if(i<=n.viewFrom)Ar&&Fn(e.doc,i+r)>n.viewFrom?Ci(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ci(e);else if(t<=n.viewFrom){var _=zn(e,i,i+r,1);_?(n.view=n.view.slice(_.index),n.viewFrom=_.lineN,n.viewTo+=r):Ci(e)}else if(i>=n.viewTo){var H=zn(e,t,t,-1);H?(n.view=n.view.slice(0,H.index),n.viewTo=H.lineN):Ci(e)}else{var Q=zn(e,t,t,-1),J=zn(e,i,i+r,1);Q&&J?(n.view=n.view.slice(0,Q.index).concat(Qt(e,Q.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):Ci(e)}var ee=n.externalMeasured;ee&&(i<ee.lineN?ee.lineN+=r:t<ee.lineN+ee.size&&(n.externalMeasured=null))}function Si(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var _=r.view[Ui(e,t)];if(_.node==null)return;var H=_.changes||(_.changes=[]);ae(H,i)==-1&&H.push(i)}function Ci(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Ui(e,t),_,H=e.display.view;if(!Ar||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Q=e.display.viewFrom,J=0;J<n;J++)Q+=H[J].size;if(Q!=t){if(r>0){if(n==H.length-1)return null;_=Q+H[n].size-t,n++}else _=Q-t;t+=_,i+=_}for(;xi(e.doc,i)!=i;){if(n==(r<0?0:H.length-1))return null;i+=r*H[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Qt(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Qt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ui(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Qt(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ui(e,i)))),r.viewTo=i}function vo(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),_=r.selection=document.createDocumentFragment(),H=0;H<i.sel.ranges.length;H++){if(!t&&H==i.sel.primIndex)continue;var Q=i.sel.ranges[H];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var J=Q.empty();(J||e.options.showCursorWhenSelecting)&&bo(e,Q.head,n),J||Xs(e,Q,_)}return r}function bo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(o("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var _=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));_.style.display="",_.style.left=r.other.left+"px",_.style.top=r.other.top+"px",_.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Gn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,_=document.createDocumentFragment(),H=ro(e.display),Q=H.left,J=Math.max(r.sizerWidth,Ii(e)-r.sizer.offsetLeft)-H.right,ee=n.direction=="ltr";function ce(rt,dt,Et,vt){dt<0&&(dt=0),dt=Math.round(dt),vt=Math.round(vt),_.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
top: `+dt+"px; width: "+(Et==null?J-rt:Et)+`px;
height: `+(vt-dt)+"px"))}function ge(rt,dt,Et){var vt=ft(n,rt),_t=vt.text.length,Yt,dr;function Jt(tr,Rr){return va(e,Xe(rt,tr),"div",vt,Rr)}function Br(tr,Rr,vr){var or=mo(e,vt,null,tr),rr=Rr=="ltr"==(vr=="after")?"left":"right",Zt=vr=="after"?or.begin:or.end-(/\s/.test(vt.text.charAt(or.end-1))?2:1);return Jt(Zt,rr)[rr]}var kr=Je(vt,n.direction);return it(kr,dt||0,Et==null?_t:Et,function(tr,Rr,vr,or){var rr=vr=="ltr",Zt=Jt(tr,rr?"left":"right"),Or=Jt(Rr-1,rr?"right":"left"),dn=dt==null&&tr==0,Di=Et==null&&Rr==_t,Er=or==0,oi=!kr||or==kr.length-1;if(Or.top-Zt.top<=3){var cr=(ee?dn:Di)&&Er,Ya=(ee?Di:dn)&&oi,mi=cr?Q:(rr?Zt:Or).left,zi=Ya?J:(rr?Or:Zt).right;ce(mi,Zt.top,zi-mi,Zt.bottom)}else{var Gi,Cr,cn,$a;rr?(Gi=ee&&dn&&Er?Q:Zt.left,Cr=ee?J:Br(tr,vr,"before"),cn=ee?Q:Br(Rr,vr,"after"),$a=ee&&Di&&oi?J:Or.right):(Gi=ee?Br(tr,vr,"before"):Q,Cr=!ee&&dn&&Er?J:Zt.right,cn=!ee&&Di&&oi?Q:Or.left,$a=ee?Br(Rr,vr,"after"):J),ce(Gi,Zt.top,Cr-Gi,Zt.bottom),Zt.bottom<Or.top&&ce(Q,Zt.bottom,null,Or.top),ce(cn,Or.top,$a-cn,Or.bottom)}(!Yt||Gn(Zt,Yt)<0)&&(Yt=Zt),Gn(Or,Yt)<0&&(Yt=Or),(!dr||Gn(Zt,dr)<0)&&(dr=Zt),Gn(Or,dr)<0&&(dr=Or)}),{start:Yt,end:dr}}var De=t.from(),we=t.to();if(De.line==we.line)ge(De.line,De.ch,we.ch);else{var je=ft(n,De.line),Ve=ft(n,we.line),Qe=ar(je)==ar(Ve),tt=ge(De.line,De.ch,Qe?je.text.length+1:null).end,ht=ge(we.line,Qe?0:null,we.ch).start;Qe&&(tt.top<ht.top-2?(ce(tt.right,tt.top,null,tt.bottom),ce(Q,ht.top,ht.left,ht.bottom)):ce(tt.right,tt.top,ht.left-tt.right,tt.bottom)),tt.bottom<ht.top&&ce(Q,tt.bottom,null,ht.top)}i.appendChild(_)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function xo(e){e.state.focused||(e.display.input.focus(),wa(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ie(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ie(e,"blur",e,t),e.state.focused=!1,g(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],_=e.options.lineWrapping,H=void 0,Q=0;if(n.hidden)continue;if(W&&B<8){var J=n.node.offsetTop+n.node.offsetHeight;H=J-i,i=J}else{var ee=n.node.getBoundingClientRect();H=ee.bottom-ee.top,!_&&n.text.firstChild&&(Q=n.text.firstChild.getBoundingClientRect().right-ee.left-1)}var ce=n.line.height-H;if((ce>.005||ce<-.005)&&(wr(n.line,H),So(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)So(n.rest[ge]);if(Q>e.display.sizerWidth){var De=Math.ceil(Q/Ji(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function So(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,_=Vr(t,r),H=Vr(t,n);if(i&&i.ensure){var Q=i.ensure.from.line,J=i.ensure.to.line;Q<_?(_=Q,H=Vr(t,Ir(ft(t,Q))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=H&&(_=Vr(t,Ir(ft(t,J))-e.wrapper.clientHeight),H=J)}return{from:_,to:Math.max(H,_+1)}}function Ys(e,t){if(He(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!S){var _=o("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(n),e.display.lineSpace.removeChild(_)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Xe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Xe(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var H=!1,Q=Jr(e,t),J=!i||i==t?Q:Jr(e,i);n={left:Math.min(Q.left,J.left),top:Math.min(Q.top,J.top)-r,right:Math.max(Q.left,J.left),bottom:Math.max(Q.bottom,J.bottom)+r};var ee=Aa(e,n),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(xn(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(H=!0)),ee.scrollLeft!=null&&(Fi(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(H=!0)),!H)break}return n}function Qs(e,t){var i=Aa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Fi(e,i.scrollLeft)}function Aa(e,t){var i=e.display,r=Qi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,_=pa(e),H={};t.bottom-t.top>_&&(t.bottom=t.top+_);var Q=e.doc.height+fa(i),J=t.top<r,ee=t.bottom>Q-r;if(t.top<n)H.scrollTop=J?0:t.top;else if(t.bottom>n+_){var ce=Math.min(t.top,(ee?Q:t.bottom)-_);ce!=n&&(H.scrollTop=ce)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,we=Ii(e)-i.gutters.offsetWidth,je=t.right-t.left>we;return je&&(t.right=t.left+we),t.left<10?H.scrollLeft=0:t.left<De?H.scrollLeft=Math.max(0,t.left+ge-(je?0:10)):t.right>we+De-3&&(H.scrollLeft=t.right+(je?0:10)-we),H}function _a(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qi(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=fo(e,t.from),r=fo(e,t.to);Co(e,i,r,t.margin)}}function Co(e,t,i,r){var n=Aa(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bn(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;k||Da(e,{top:t}),To(e,t,!0),k&&Da(e),Cn(e,100)}function To(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Fi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function En(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ji=function(e,t,i){this.cm=i;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ke(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ke(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ji.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var _=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+_)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},ji.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ji.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ji.prototype.zeroWidthHack=function(){var e=s&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new q,this.disableVert=new q},ji.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),_=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);_!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ji.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sn=function(){};Sn.prototype.update=function(){return{bottom:0,right:0}},Sn.prototype.setScrollLeft=function(){},Sn.prototype.setScrollTop=function(){},Sn.prototype.clear=function(){};function en(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),wo(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function wo(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Ao={native:ji,null:Sn};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Fi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Wi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},kt(e.curOp)}function Hi(e){var t=e.curOp;t&&zt(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var _=0;_<t.length;_++)il(t[_]);for(var H=0;H<t.length;H++)nl(t[H])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&ci(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ii(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&en(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&xo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&To(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,l(r,e.scrollToPos.from),l(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var _=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(_)for(var Q=0;Q<_.length;++Q)_[Q].lines.length||Ie(_[Q],"hide");if(H)for(var J=0;J<H.length;++J)H[J].lines.length&&Ie(H[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ie(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Nr(e,t){if(e.curOp)return t();Wi(e);try{return t()}finally{Hi(e)}}function ur(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);Wi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function hr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Wi(t);try{return e.apply(this,arguments)}finally{Hi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Re(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(_){if(r.line>=e.display.viewFrom){var H=_.styles,Q=_.text.length>e.options.maxHighlightLength?Tr(t.mode,r.state):null,J=ve(e,_,r,!0);Q&&(r.state=Q),_.styles=J.styles;var ee=_.styleClasses,ce=J.classes;ce?_.styleClasses=ce:ee&&(_.styleClasses=null);for(var ge=!H||H.length!=_.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),De=0;!ge&&De<H.length;++De)ge=H[De]!=_.styles[De];ge&&n.push(r.line),_.stateAfter=r.save(),r.nextLine()}else _.text.length<=e.options.maxHighlightLength&&ct(e,_.text,r),_.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Nr(e,function(){for(var _=0;_<n.length;_++)Si(e,n[_],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ii(e),this.force=i,this.dims=Ea(e),this.events=[]};Yn.prototype.signal=function(e,t){pe(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ie.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=O();if(!t||!m(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&m(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==O())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&m(document.body,e.anchorNode)&&m(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ci(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&vo(e)==0)return!1;ko(e)&&(Ci(e),t.dims=Ea(e));var n=r.first+r.size,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<_&&_-i.viewFrom<20&&(_=Math.max(r.first,i.viewFrom)),i.viewTo>H&&i.viewTo-H<20&&(H=Math.min(n,i.viewTo)),Ar&&(_=xi(e.doc,_),H=Fn(e.doc,H));var Q=_!=i.viewFrom||H!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,_,H),i.viewOffset=Ir(ft(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=vo(e);if(!Q&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var ee=sl(e);return J>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),J>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(ee),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Q&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function Lo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Ii(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+fa(e.display)-pa(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!La(e,t))break;Kn(e);var n=En(e);yn(e),en(e,n),Ra(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var i=new Yn(e,t);if(La(e,i)){Kn(e),Lo(e,i);var r=En(e);yn(e),en(e,r),Ra(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,_=r.lineDiv,H=_.firstChild;function Q(je){var Ve=je.nextSibling;return P&&s&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ve}for(var J=r.view,ee=r.viewFrom,ce=0;ce<J.length;ce++){var ge=J[ce];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=_){var De=Ns(e,ge,ee,i);_.insertBefore(De,H)}else{for(;H!=ge.node;)H=Q(H);var we=n&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(ae(ge.changes,"gutter")>-1&&(we=!1),pn(e,ge,ee,i)),we&&(c(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(gi(e.options,ee)))),H=ge.node.nextSibling}ee+=ge.size}for(;H;)H=Q(H)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+ni(e)+"px"}function Do(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Sa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,_=r+"px",H=0;H<i.length;H++)if(!i[H].hidden){e.options.fixedGutter&&(i[H].gutter&&(i[H].gutter.style.left=_),i[H].gutterBackground&&(i[H].gutterBackground.style.left=_));var Q=i[H].alignable;if(Q)for(var J=0;J<Q.length;J++)Q[J].style.left=_}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=gi(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(o("div",[o("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=n.firstChild.offsetWidth,H=n.offsetWidth-_;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(_,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Oa(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var _=e[n],H=null;if(typeof _!="string"&&(H=_.style,_=_.className),_=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:_,style:H})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Ro(e){var t=e.gutters,i=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],_=n.className,H=n.style,Q=t.appendChild(o("div",null,"CodeMirror-gutter "+_));H&&(Q.style.cssText=H),_=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function Tn(e){Ro(e.display),Lr(e),Do(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=C("div",null,"CodeMirror-code"),n.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=o("div",null,"CodeMirror-cursors"),n.measure=o("div",null,"CodeMirror-measure"),n.lineMeasure=o("div",null,"CodeMirror-measure"),n.lineSpace=C("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var _=C("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[_],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+he+"px; width: 1px;"),n.gutters=o("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=o("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=o("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),W&&B<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!P&&!(k&&a)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Oa(r.gutters,r.lineNumbers),Ro(n),i.init(n)}var $n=0,Hr=null;W?Hr=-.53:k?Hr=15:p?Hr=-.7:M&&(Hr=-1/3);function Oo(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function dl(e){var t=Oo(e);return t.x*=Hr,t.y*=Hr,t}function Po(e,t){var i=Oo(t),r=i.x,n=i.y,_=e.display,H=_.scroller,Q=H.scrollWidth>H.clientWidth,J=H.scrollHeight>H.clientHeight;if(!(r&&Q||n&&J))return;if(n&&s&&P){e:for(var ee=t.target,ce=_.view;ee!=H;ee=ee.parentNode)for(var ge=0;ge<ce.length;ge++)if(ce[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(r&&!k&&!b&&Hr!=null){n&&J&&xn(e,Math.max(0,H.scrollTop+n*Hr)),Fi(e,Math.max(0,H.scrollLeft+r*Hr)),(!n||n&&J)&&re(t),_.wheelStartX=null;return}if(n&&Hr!=null){var De=n*Hr,we=e.doc.scrollTop,je=we+_.wrapper.clientHeight;De<0?we=Math.max(0,we+De-50):je=Math.min(e.doc.height,je+De+50),Da(e,{top:we,bottom:je})}$n<20&&(_.wheelStartX==null?(_.wheelStartX=H.scrollLeft,_.wheelStartY=H.scrollTop,_.wheelDX=r,_.wheelDY=n,setTimeout(function(){if(_.wheelStartX==null)return;var Ve=H.scrollLeft-_.wheelStartX,Qe=H.scrollTop-_.wheelStartY,tt=Qe&&_.wheelDY&&Qe/_.wheelDY||Ve&&_.wheelDX&&Ve/_.wheelDX;if(_.wheelStartX=_.wheelStartY=null,!tt)return;Hr=(Hr*$n+tt)/($n+1),++$n},200)):(_.wheelDX+=r,_.wheelDY+=n))}var zr=function(e,t){this.ranges=e,this.primIndex=t};zr.prototype.primary=function(){return this.ranges[this.primIndex]},zr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!ei(i.anchor,r.anchor)||!ei(i.head,r.head))return!1}return!0},zr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(hi(this.ranges[t].anchor),hi(this.ranges[t].head));return new zr(e,this.primIndex)},zr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},zr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(St(t,r.from())>=0&&St(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return ki(this.anchor,this.head)},jt.prototype.to=function(){return di(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Zr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,we){return St(De.from(),we.from())}),i=ae(t,n);for(var _=1;_<t.length;_++){var H=t[_],Q=t[_-1],J=St(Q.to(),H.from());if(r&&!H.empty()?J>0:J>=0){var ee=ki(Q.from(),H.from()),ce=di(Q.to(),H.to()),ge=Q.empty()?H.from()==H.head:Q.from()==Q.head;_<=i&&--i,t.splice(--_,2,new jt(ge?ce:ee,ge?ee:ce))}}return new zr(t,i)}function Ti(e,t){return new zr([new jt(e,t||e)],0)}function wi(e){return e.text?Xe(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return wi(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=wi(t).ch-t.to.ch),Xe(i,r)}function Pa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Mo(n.anchor,t),Mo(n.head,t)))}return Zr(e.cm,i,e.sel.primIndex)}function Io(e,t,i){return e.line==t.line?Xe(i.line,e.ch-t.ch+i.ch):Xe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Xe(e.first,0),_=n,H=0;H<t.length;H++){var Q=t[H],J=Io(Q.from,n,_),ee=Io(wi(Q),n,_);if(n=Q.to,_=ee,i=="around"){var ce=e.sel.ranges[H],ge=St(ce.head,ce.anchor)<0;r[H]=new jt(ge?ee:J,ge?J:ee)}else r[H]=new jt(J,J)}return new zr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Gr(e.options,e.doc.modeOption),wn(e)}function wn(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,Cn(e,100),e.state.modeGen++,e.curOp&&Lr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ia(e,t,i,r){function n(ht){return i?i[ht]:null}function _(ht,rt,dt){ua(ht,rt,dt,r),Vt(ht,"change",ht,t)}function H(ht,rt){for(var dt=[],Et=ht;Et<rt;++Et)dt.push(new Ei(ee[Et],n(Et),r));return dt}var Q=t.from,J=t.to,ee=t.text,ce=ft(e,Q.line),ge=ft(e,J.line),De=te(ee),we=n(ee.length-1),je=J.line-Q.line;if(t.full)e.insert(0,H(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(No(e,t)){var Ve=H(0,ee.length-1);_(ge,ge.text,we),je&&e.remove(Q.line,je),Ve.length&&e.insert(Q.line,Ve)}else if(ce==ge)if(ee.length==1)_(ce,ce.text.slice(0,Q.ch)+De+ce.text.slice(J.ch),we);else{var Qe=H(1,ee.length-1);Qe.push(new Ei(De+ce.text.slice(J.ch),we,r)),_(ce,ce.text.slice(0,Q.ch)+ee[0],n(0)),e.insert(Q.line+1,Qe)}else if(ee.length==1)_(ce,ce.text.slice(0,Q.ch)+ee[0]+ge.text.slice(J.ch),n(0)),e.remove(Q.line+1,je);else{_(ce,ce.text.slice(0,Q.ch)+ee[0],n(0)),_(ge,De+ge.text.slice(J.ch),we);var tt=H(1,ee.length-1);je>1&&e.remove(Q.line+1,je-1),e.insert(Q.line+1,tt)}Vt(e,"change",e,t)}function Ai(e,t,i){function r(n,_,H){if(n.linked)for(var Q=0;Q<n.linked.length;++Q){var J=n.linked[Q];if(J.doc==_)continue;var ee=H&&J.sharedHist;if(i&&!ee)continue;t(J.doc,ee),r(J.doc,n,ee)}}r(e,null,!0)}function Bo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Ma(e),Uo(e),e.options.lineWrapping||ci(e),e.options.mode=t.modeOption,Lr(e)}function Uo(e){(e.doc.direction=="rtl"?U:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Nr(e,function(){Uo(e),Lr(e)})}function Qn(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 Na(e,t){var i={from:hi(t.from),to:wi(t),text:Ur(e,t.from,t.to)};return Wo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Wo(r,i,t.from.line,t.to.line+1)},!0),i}function Fo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function jo(e,t,i,r){var n=e.history;n.undone.length=0;var _=+new Date,H,Q;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(n,n.lastOp==r)))Q=te(H.changes),St(t.from,t.to)==0&&St(t.from,Q.to)==0?Q.to=wi(t):H.changes.push(Na(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Jn(e.sel,n.done),H={changes:[Na(e,t)],generation:n.generation},n.done.push(H);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=_,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Q||Ie(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,_=r&&r.origin;i==n.lastSelOp||_&&n.lastSelOrigin==_&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==_||ml(e,_,te(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=_,n.lastSelOp=i,r&&r.clearRedo!==!1&&Fo(n.undone)}function Jn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Wo(e,t,i,r){var n=t["spans_"+e.id],_=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((n||(n=t["spans_"+e.id]={}))[_]=H.markedSpans),++_})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Ho(e,t){var i=yl(e,t),r=Pr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var _=i[n],H=r[n];if(_&&H){e:for(var Q=0;Q<H.length;++Q){for(var J=H[Q],ee=0;ee<_.length;++ee)if(_[ee].marker==J.marker)continue e;_.push(J)}}else H&&(i[n]=H)}return i}function tn(e,t,i){for(var r=[],n=0;n<e.length;++n){var _=e[n];if(_.ranges){r.push(i?zr.prototype.deepCopy.call(_):_);continue}var H=_.changes,Q=[];r.push({changes:Q});for(var J=0;J<H.length;++J){var ee=H[J],ce=void 0;if(Q.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(ce=ge.match(/^spans_(\d+)$/))&&(ae(t,Number(ce[1]))>-1&&(te(Q)[ge]=ee[ge],delete ee[ge]))}}return r}function Ba(e,t,i,r){if(r){var n=e.anchor;if(i){var _=St(t,n)<0;_!=St(i,n)<0?(n=t,t=i):_!=St(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function Zn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),xr(e,new zr([Ba(e.sel.primary(),t,i,n)],0),r)}function zo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),_=0;_<e.sel.ranges.length;_++)r[_]=Ba(e.sel.ranges[_],t[_],null,n);var H=Zr(e.cm,r,e.sel.primIndex);xr(e,H,i)}function Ua(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,xr(e,Zr(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){xr(e,Ti(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var _=0;_<n.length;_++)this.ranges[_]=new jt(l(e,n[_].anchor),l(e,n[_].head))},origin:i&&i.origin};return Ie(e,"beforeSelectionChange",e,r),e.cm&&Ie(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Zr(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):xr(e,t,i)}function xr(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(pe(e,"beforeSelectionChange")||e.cm&&pe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&qi(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ee(e.cm)),Vt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,i,r){for(var n,_=0;_<t.ranges.length;_++){var H=t.ranges[_],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[_],J=ea(e,H.anchor,Q&&Q.anchor,i,r),ee=ea(e,H.head,Q&&Q.head,i,r);(n||J!=H.anchor||ee!=H.head)&&(n||(n=t.ranges.slice(0,_)),n[_]=new jt(J,ee))}return n?Zr(e.cm,n,t.primIndex):t}function rn(e,t,i,r,n){var _=ft(e,t.line);if(_.markedSpans)for(var H=0;H<_.markedSpans.length;++H){var Q=_.markedSpans[H],J=Q.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Q.from==null||(ee?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(ce?Q.to>=t.ch:Q.to>t.ch))){if(n&&(Ie(J,"beforeCursorEnter"),J.explicitlyCleared))if(_.markedSpans){--H;continue}else break;if(!J.atomic)continue;if(i){var ge=J.find(r<0?1:-1),De=void 0;if((r<0?ce:ee)&&(ge=$o(e,ge,-r,ge&&ge.line==t.line?_:null)),ge&&ge.line==t.line&&(De=St(ge,i))&&(r<0?De<0:De>0))return rn(e,ge,t,r,n)}var we=J.find(r<0?-1:1);return(r<0?ee:ce)&&(we=$o(e,we,r,we.line==t.line?_:null)),we?rn(e,we,t,r,n):null}}return t}function ea(e,t,i,r,n){var _=r||1,H=rn(e,t,i,_,n)||!n&&rn(e,t,i,_,!0)||rn(e,t,i,-_,n)||!n&&rn(e,t,i,-_,!0);return H||(e.cantEdit=!0,Xe(e.first,0))}function $o(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?l(e,Xe(t.line-1)):null:i>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?Xe(t.line+1,0):null:new Xe(t.line,t.ch+i)}function Qo(e){e.setSelection(Xe(e.firstLine(),0),Xe(e.lastLine()),be)}function Jo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,_,H,Q){n&&(r.from=l(e,n)),_&&(r.to=l(e,_)),H&&(r.text=H),Q!==void 0&&(r.origin=Q)}),Ie(e,"beforeChange",e,r),e.cm&&Ie(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 nn(e,t,i){if(e.cm){if(!e.cm.curOp)return ur(e.cm,nn)(e,t,i);if(e.cm.state.suppressEdits)return}if((pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ki&&!i&&Ri(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Zo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&St(t.from,t.to)==0)return;var i=Pa(e,t);jo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Pr(e,t));var r=[];Ai(e,function(n,_){!_&&ae(r,n.history)==-1&&(rs(n.history,t),r.push(n.history)),An(n,t,null,Pr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,_,H=e.sel,Q=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,ee=0;ee<Q.length&&!(_=Q[ee],i?_.ranges&&!_.equals(e.sel):!_.ranges);ee++);if(ee==Q.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(_=Q.pop(),_.ranges){if(Jn(_,J),i&&!_.equals(e.sel)){xr(e,_,{clearRedo:!1});return}H=_}else if(r){Q.push(_);return}else break;var ce=[];Jn(H,J),J.push({changes:ce,generation:n.generation}),n.generation=_.generation||++n.maxGeneration;for(var ge=pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"),De=function(Ve){var Qe=_.changes[Ve];if(Qe.origin=t,ge&&!Jo(e,Qe,!1))return Q.length=0,{};ce.push(Na(e,Qe));var tt=Ve?Pa(e,Qe):te(Q);An(e,Qe,tt,Ho(e,Qe)),!Ve&&e.cm&&e.cm.scrollIntoView({from:Qe.from,to:wi(Qe)});var ht=[];Ai(e,function(rt,dt){!dt&&ae(ht,rt.history)==-1&&(rs(rt.history,Qe),ht.push(rt.history)),An(rt,Qe,null,Ho(rt,Qe))})},we=_.changes.length-1;we>=0;--we){var je=De(we);if(je)return je.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new zr(fe(e.sel.ranges,function(n){return new jt(Xe(n.anchor.line+t,n.anchor.ch),Xe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Lr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Si(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return ur(e.cm,An)(e,t,i,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 n=t.text.length-1-(e.first-t.from.line);qo(e,n),t={from:Xe(e.first,0),to:Xe(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var _=e.lastLine();t.to.line>_&&(t={from:t.from,to:Xe(_,ft(e,_).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ur(e,t.from,t.to),i||(i=Pa(e,t)),e.cm?xl(e.cm,t,r):Ia(e,t,r),qn(e,i,be),e.cantEdit&&ea(e,Xe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,_=t.from,H=t.to,Q=!1,J=_.line;e.options.lineWrapping||(J=Ot(ar(ft(r,_.line))),r.iter(J,H.line+1,function(we){if(we==n.maxLine)return Q=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ee(e),Ia(r,t,i,go(e)),e.options.lineWrapping||(r.iter(J,_.line+t.text.length,function(we){var je=Yi(we);je>n.maxLineLength&&(n.maxLine=we,n.maxLineLength=je,n.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Xr(r,_.line),Cn(e,400);var ee=t.text.length-(H.line-_.line)-1;t.full?Lr(e):_.line==H.line&&t.text.length==1&&!No(e.doc,t)?Si(e,_.line,"text"):Lr(e,_.line,H.line+1,ee);var ce=pe(e,"changes"),ge=pe(e,"change");if(ge||ce){var De={from:_,to:H,text:t.text,removed:t.removed,origin:t.origin};ge&&Vt(e,"change",e,De),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function an(e,t,i,r,n){var _;r||(r=i),St(r,i)<0&&(_=[r,i],i=_[0],r=_[1]),typeof t=="string"&&(t=e.splitLines(t)),nn(e,{from:i,to:r,text:t,origin:n})}function es(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,i,r){for(var n=0;n<e.length;++n){var _=e[n],H=!0;if(_.ranges){_.copied||(_=e[n]=_.deepCopy(),_.copied=!0);for(var Q=0;Q<_.ranges.length;Q++)es(_.ranges[Q].anchor,t,i,r),es(_.ranges[Q].head,t,i,r);continue}for(var J=0;J<_.changes.length;++J){var ee=_.changes[J];if(i<ee.from.line)ee.from=Xe(ee.from.line+r,ee.from.ch),ee.to=Xe(ee.to.line+r,ee.to.ch);else if(t<=ee.to.line){H=!1;break}}H||(e.splice(0,n+1),n=0)}}function rs(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;ts(e.done,i,r,n),ts(e.undone,i,r,n)}function _n(e,t,i,r){var n=t,_=t;return typeof t=="number"?_=ft(e,V(e,t)):n=Ot(t),n==null?null:(r(_,n)&&e.cm&&Si(e.cm,n,i),_)}function Ln(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ln.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,ha(n),Vt(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Dn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}Dn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var _=Math.min(t,n-e),H=r.height;if(r.removeInner(e,_),this.height-=H-r.height,n==_&&(this.children.splice(i--,1),r.parent=null),(t-=_)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var Q=[];this.collapse(Q),this.children=[new Ln(Q)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],_=n.chunkSize();if(e<=_){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var H=n.lines.length%25+25,Q=H;Q<n.lines.length;){var J=new Ln(n.lines.slice(Q,Q+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,H),this.maybeSpill()}break}e-=_}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Dn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=ae(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Dn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],_=n.chunkSize();if(e<_){var H=Math.min(t,_-e);if(n.iterN(e,H,i))return!0;if((t-=H)==0)break;e=0}else e-=_}}};var kn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};kn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Ot(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var _=gn(this);wr(i,Math.max(0,i.height-_)),e&&(Nr(e,function(){is(e,i,-_),Si(e,r,"widget")}),Vt(e,"lineWidgetCleared",e,this,r))},kn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=gn(this)-t;if(!n)return;Qr(this.doc,r)||wr(r,r.height+n),i&&Nr(i,function(){i.curOp.forceUpdate=!0,is(i,r,n),Vt(i,"lineWidgetChanged",i,e,Ot(r))})},ye(kn);function is(e,t,i){Ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,i)}function El(e,t,i,r){var n=new kn(e,i,r),_=e.cm;return _&&n.noHScroll&&(_.display.alignWidgets=!0),_n(e,t,"widget",function(H){var Q=H.widgets||(H.widgets=[]);if(n.insertAt==null?Q.push(n):Q.splice(Math.min(Q.length-1,Math.max(0,n.insertAt)),0,n),n.line=H,_&&!Qr(e,H)){var J=Ir(H)<e.scrollTop;wr(H,H.height+gn(n)),J&&_a(_,n.height),_.curOp.forceUpdate=!0}return!0}),_&&Vt(_,"lineWidgetAdded",_,n,typeof t=="number"?t:Ot(t)),n}var ns=0,_i=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};_i.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wi(e),pe(this,"clear")){var i=this.find();i&&Vt(this,"clear",i.from,i.to)}for(var r=null,n=null,_=0;_<this.lines.length;++_){var H=this.lines[_],Q=$r(H.markedSpans,this);e&&!this.collapsed?Si(e,Ot(H),"text"):e&&(Q.to!=null&&(n=Ot(H)),Q.from!=null&&(r=Ot(H))),H.markedSpans=ri(H.markedSpans,Q),Q.from==null&&this.collapsed&&!Qr(this.doc,H)&&e&&wr(H,Qi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=ar(this.lines[J]),ce=Yi(ee);ce>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Lr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Vt(e,"markerCleared",e,this,r,n),t&&Hi(e),this.parent&&this.parent.clear()},_i.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var _=this.lines[n],H=$r(_.markedSpans,this);if(H.from!=null&&(i=Xe(t?_:Ot(_),H.from),e==-1))return i;if(H.to!=null&&(r=Xe(t?_:Ot(_),H.to),e==1))return r}return i&&{from:i,to:r}},_i.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Nr(r,function(){var n=t.line,_=Ot(t.line),H=ma(r,_);if(H&&(so(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Qr(i.doc,n)&&i.height!=null){var Q=i.height;i.height=null;var J=gn(i)-Q;J&&wr(n,n.height+J)}Vt(r,"markerChanged",r,e)})},_i.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ae(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},_i.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(_i);function on(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return ur(e.cm,on)(e,t,i,r,n);var _=new _i(e,n),H=St(t,i);if(r&&N(r,_,!1),H>0||H==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=C("span",[_.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(nr(e,t.line,t,i,_)||t.line!=i.line&&nr(e,i.line,t,i,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");ti()}_.addToHistory&&jo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Q=t.line,J=e.cm,ee;if(e.iter(Q,i.line+1,function(ge){J&&_.collapsed&&!J.options.lineWrapping&&ar(ge)==J.display.maxLine&&(ee=!0),_.collapsed&&Q!=t.line&&wr(ge,0),Wr(ge,new vi(_,Q==t.line?t.ch:null,Q==i.line?i.ch:null)),++Q}),_.collapsed&&e.iter(t.line,i.line+1,function(ge){Qr(e,ge)&&wr(ge,0)}),_.clearOnEnter&&ke(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(_r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++ns,_.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),_.collapsed)Lr(J,t.line,i.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var ce=t.line;ce<=i.line;ce++)Si(J,ce,"text");_.atomic&&Xo(J.doc),Vt(J,"markerAdded",J,_)}return _}var Rn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Rn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Vt(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Rn);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var _=[on(e,t,i,r,n)],H=_[0],Q=r.widgetNode;return Ai(e,function(J){Q&&(r.widgetNode=Q.cloneNode(!0)),_.push(on(J,l(J,t),l(J,i),r,n));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;H=te(_)}),new Rn(_,H)}function as(e){return e.findMarks(Xe(e.first,0),e.clipPos(Xe(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),_=e.clipPos(n.from),H=e.clipPos(n.to);if(St(_,H)){var Q=on(e,_,H,r.primary,r.primary.type);r.markers.push(Q),Q.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],_=[n.primary.doc];Ai(n.primary.doc,function(J){return _.push(J)});for(var H=0;H<n.markers.length;H++){var Q=n.markers[H];ae(_,Q.doc)==-1&&(Q.parent=null,n.markers.splice(H--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Dr=function(e,t,i,r,n){if(!(this instanceof Dr))return new Dr(e,t,i,r,n);i==null&&(i=0),Dn.call(this,[new Ln([new Ei("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var _=Xe(i,0);this.sel=Ti(_),this.history=new Qn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ia(this,{from:_,to:_,text:e}),xr(this,Ti(_),be)};Dr.prototype=Oe(Dn.prototype,{constructor:Dr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=li(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:hr(function(e){var t=Xe(this.first,0),i=this.first+this.size-1;nn(this,{from:t,to:Xe(i,ft(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),xr(this,Ti(t),be)}),replaceRange:function(e,t,i,r){t=l(this,t),i=i?l(this,i):t,an(this,e,t,i,r)},getRange:function(e,t,i){var r=Ur(this,l(this,e),l(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ui(this,e))return ft(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),ar(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return l(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:hr(function(e,t,i){Go(this,l(this,typeof e=="number"?Xe(e,t||0):e),null,i)}),setSelection:hr(function(e,t,i){Go(this,l(this,e),l(this,t||e),i)}),extendSelection:hr(function(e,t,i){Zn(this,l(this,e),t&&l(this,t),i)}),extendSelections:hr(function(e,t){zo(this,z(this,e),t)}),extendSelectionsBy:hr(function(e,t){var i=fe(this.sel.ranges,e);zo(this,z(this,i),t)}),setSelections:hr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(l(this,e[n].anchor),l(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),xr(this,Zr(this.cm,r,t),i)}),addSelection:hr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(l(this,e),l(this,t||e))),xr(this,Zr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Ur(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Ur(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:hr(function(e,t,i){for(var r=[],n=this.sel,_=0;_<n.ranges.length;_++){var H=n.ranges[_];r[_]={from:H.from(),to:H.to(),text:this.splitLines(e[_]),origin:i}}for(var Q=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)nn(this,r[J]);Q?Ko(this,Q):this.cm&&qi(this.cm)}),undo:hr(function(){ta(this,"undo")}),redo:hr(function(){ta(this,"redo")}),undoSelection:hr(function(){ta(this,"undo",!0)}),redoSelection:hr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ai(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:tn(this.history.done),undone:tn(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=tn(e.done.slice(0),null,!0),t.undone=tn(e.undone.slice(0),null,!0)},setGutterMarker:hr(function(e,t,i){return _n(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Be(n)&&(r.gutterMarkers=null),!0})}),clearGutter:hr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&_n(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Be(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ui(this,e))return null;if(t=e,e=ft(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:hr(function(e,t,i){return _n(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(T(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:hr(function(e,t,i){return _n(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",_=r[n];if(_)if(i==null)r[n]=null;else{var H=_.match(T(i));if(!H)return!1;var Q=H.index+H[0].length;r[n]=_.slice(0,H.index)+(!H.index||Q==_.length?"":" ")+_.slice(Q)||null}else return!1;return!0})}),addLineWidget:hr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return on(this,l(this,e),l(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=l(this,e),on(this,e,e,i,"bookmark")},findMarksAt:function(e){e=l(this,e);var t=[],i=ft(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=l(this,e),t=l(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(_){var H=_.markedSpans;if(H)for(var Q=0;Q<H.length;Q++){var J=H[Q];!(J.to!=null&&n==e.line&&e.ch>=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!i||i(J.marker))&&r.push(J.marker.parent||J.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var _=n.text.length+r;if(_>e)return t=e,!0;e-=_,++i}),l(this,Xe(i,t))},indexFromPos:function(e){e=l(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Dr(li(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Dr(li(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof $t&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(as(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Qn(null),e.history.done=tn(this.history.done,r),e.history.undone=tn(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:hr(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)})}),Dr.prototype.eachLine=Dr.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),He(t,e)||fi(t.display,e))return;re(e),W&&(os=+new Date);var i=Bi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,_=Array(n),H=0,Q=function(){++H==n&&ur(t,function(){i=l(t.doc,i);var we={from:i,to:i,text:t.doc.splitLines(_.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};nn(t.doc,we),Ko(t.doc,Ti(l(t.doc,i),l(t.doc,wi(we))))})()},J=function(we,je){if(t.options.allowDropFileTypes&&ae(t.options.allowDropFileTypes,we.type)==-1){Q();return}var Ve=new FileReader;Ve.onerror=function(){return Q()},Ve.onload=function(){var Qe=Ve.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Qe)){Q();return}_[je]=Qe,Q()},Ve.readAsText(we)},ee=0;ee<r.length;ee++)J(r[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Ti(i,i)),ge)for(var De=0;De<ge.length;++De)an(t.doc,"",ge[De].anchor,ge[De].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(we){}}}function _l(e,t){if(W&&(!e.state.draggingText||+new Date-os<100)){de(t);return}if(He(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var i=o("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),b&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Bi(e,t);if(!i)return;var r=document.createDocumentFragment();bo(e,i,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),h(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var _=0;_<i.length;_++)e(i[_])})}var us=!1;function Dl(){if(us)return;kl(),us=!0}function kl(){var e;ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),ke(window,"blur",function(){return ls(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Li={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"},On=0;On<10;On++)Li[On+48]=Li[On+96]=String(On);for(var ra=65;ra<=90;ra++)Li[ra]=String.fromCharCode(ra);for(var Pn=1;Pn<=12;Pn++)Li[Pn+111]=Li[Pn+63235]="F"+Pn;var pi={};pi.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"},pi.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"},pi.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"},pi.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"]},pi.default=s?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,_,H=0;H<t.length-1;H++){var Q=t[H];if(/^(cmd|meta|m)$/i.test(Q))_=!0;else if(/^a(lt)?$/i.test(Q))i=!0;else if(/^(c|ctrl|control)$/i.test(Q))r=!0;else if(/^s(hift)?$/i.test(Q))n=!0;else throw new Error("Unrecognized modifier name: "+Q)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),_&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=fe(i.split(" "),Ol),_=0;_<n.length;_++){var H=void 0,Q=void 0;_==n.length-1?(Q=n.join(" "),H=r):(Q=n.slice(0,_+1).join(" "),H="...");var J=t[Q];if(!J)t[Q]=H;else if(J!=H)throw new Error("Inconsistent bindings for "+Q)}delete e[i]}for(var ee in t)e[ee]=t[ee];return e}function sn(e,t,i,r){t=ia(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return sn(e,t.fallthrough,i,r);for(var _=0;_<t.fallthrough.length;_++){var H=sn(e,t.fallthrough[_],i,r);if(H)return H}}}function hs(e){var t=typeof e=="string"?e:Li[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,i){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),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(b&&e.keyCode==34&&e.char)return!1;var i=Li[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function ia(e){return typeof e=="string"?pi[e]:e}function ln(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var _=t(i[n]);r.length&&St(_.from,te(r).to)<=0;){var H=r.pop();if(St(H.from,_.from)<0){_.from=H.from;break}}r.push(_)}Nr(e,function(){for(var Q=r.length-1;Q>=0;Q--)an(e.doc,"",r[Q].from,r[Q].to,"+delete");qi(e)})}function Fa(e,t,i){var r=Fe(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ja(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new Xe(t.line,r,i<0?"after":"before")}function Wa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var _=Je(i,t.doc.direction);if(_){var H=n<0?te(_):_[0],Q=n<0==(H.level==1),J=Q?"after":"before",ee;if(H.level>0||t.doc.direction=="rtl"){var ce=$i(t,i);ee=n<0?i.text.length-1:0;var ge=ai(t,ce,ee).top;ee=at(function(De){return ai(t,ce,De).top==ge},n<0==(H.level==1)?H.from:H.to-1,ee),J=="before"&&(ee=Fa(i,ee,1))}else ee=n<0?H.to:H.from;return new Xe(r,ee,J)}}return new Xe(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Je(t,e.doc.direction);if(!n)return ja(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var _=Ze(n,i.ch,i.sticky),H=n[_];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>i.ch:H.from<i.ch))return ja(t,i,r);var Q=function(tt,ht){return Fa(t,tt instanceof Xe?tt.ch:tt,ht)},J,ee=function(tt){return e.options.lineWrapping?(J=J||$i(e,t),mo(e,t,J,tt)):{begin:0,end:t.text.length}},ce=ee(i.sticky=="before"?Q(i,-1):i.ch);if(e.doc.direction=="rtl"||H.level==1){var ge=H.level==1==r<0,De=Q(i,ge?1:-1);if(De!=null&&(ge?De<=H.to&&De<=ce.end:De>=H.from&&De>=ce.begin)){var we=ge?"before":"after";return new Xe(i.line,De,we)}}var je=function(tt,ht,rt){for(var dt=function(Yt,dr){return dr?new Xe(i.line,Q(Yt,1),"before"):new Xe(i.line,Yt,"after")};tt>=0&&tt<n.length;tt+=ht){var Et=n[tt],vt=ht>0==(Et.level!=1),_t=vt?rt.begin:Q(rt.end,-1);if(Et.from<=_t&&_t<Et.to)return dt(_t,vt);if(_t=vt?Et.from:Q(Et.to,-1),rt.begin<=_t&&_t<rt.end)return dt(_t,vt)}},Ve=je(_+r,r,ce);if(Ve)return Ve;var Qe=r>0?ce.end:Q(ce.begin,-1);return Qe!=null&&!(r>0&&Qe==t.text.length)&&(Ve=je(r>0?0:n.length-1,r,ee(Qe)),Ve)?Ve:null}var Mn={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),be)},killLine:function(e){return ln(e,function(t){if(t.empty()){var i=ft(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Xe(t.head.line+1,0)}:{from:t.head,to:Xe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:l(e.doc,Xe(t.to().line+1,0))}})},delLineLeft:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ln(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ln(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Xe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Xe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Ce)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?ps(e,t.head):r},Ce)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var _=i[n].from(),H=X(e.getLine(_.line),_.ch,r);t.push(ue(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Nr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,_=ft(e.doc,n.line).text;if(_){if(n.ch==_.length&&(n=new Xe(n.line,n.ch-1)),n.ch>0)n=new Xe(n.line,n.ch+1),e.replaceRange(_.charAt(n.ch-1)+_.charAt(n.ch-2),Xe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var H=ft(e.doc,n.line-1).text;H&&(n=new Xe(n.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Xe(n.line-1,H.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Nr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);qi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fs(e,t){var i=ft(e.doc,t),r=ar(i);return r!=i&&(t=Ot(r)),Wa(!0,e,r,t,1)}function Il(e,t){var i=ft(e.doc,t),r=ii(i);return r!=i&&(t=Ot(r)),Wa(!0,e,i,t,-1)}function ps(e,t){var i=fs(e,t.line),r=ft(e.doc,i.line),n=Je(r,e.doc.direction);if(!n||n[0].level==0){var _=Math.max(i.ch,r.text.search(/\S/)),H=t.line==i.line&&t.ch<=_&&t.ch;return Xe(i.line,H?0:_,i.sticky)}return i}function na(e,t,i){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Ae}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=sn(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&sn(t,e.options.extraKeys,i,e)||sn(t,e.options.keyMap,i,e)}var Bl=new q;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(hs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),ms(e,n+" "+t,i,r))return!0}return ms(e,t,i,r)}function ms(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Vt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ta(e)),!!n}function gs(e,t){var i=cs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):In(e,i,t,function(r){return na(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return na(e,r,!0)})}var Ha=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=O(),He(t,e))return;W&&B<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=gs(t,e);b&&(Ha=r?i:null,!r&&i==88&&!Rt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!s&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),qe(document,"keyup",i),qe(document,"mouseover",i))}ke(document,"keyup",i),ke(document,"mouseover",i)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),He(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||He(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(b&&i==Ha){Ha=null,re(e);return}if(b&&(!e.which||e.which<10)&&gs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Ul(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,za=function(e,t,i){this.time=e,this.pos=t,this.button=i};za.prototype.compare=function(e,t,i){return this.time+jl>e&&St(t,this.pos)==0&&i==this.button};var Nn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Nn=Bn=null,"triple"):Nn&&Nn.compare(i,e,t)?(Bn=new za(i,e,t),Nn=null,"double"):(Nn=new za(i,e,t),Bn=null,"single")}function xs(e){var t=this,i=t.display;if(He(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){P||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Bi(t,e),n=Me(e),_=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,_,e))return;n==1?r?Gl(t,r,_,e):Le(e)==i.scroller&&re(e):n==2?(r&&Zn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(D?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,i,r,n){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,In(e,ds(_,n),n,function(H){if(typeof H=="string"&&(H=Mn[H]),!H)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=H(e,i)!=Ae}finally{e.state.suppressEdits=!1}return Q})}function zl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var _=u?i.shiftKey&&i.metaKey:i.altKey;n.unit=_?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function Gl(e,t,i,r){W?setTimeout(I(xo,e),0):e.curOp.focus=O();var n=zl(e,i,r),_=e.doc.sel,H;e.options.dragDrop&&Ye&&!e.isReadOnly()&&i=="single"&&(H=_.contains(t))>-1&&(St((H=_.ranges[H]).from(),t)<0||t.xRel>0)&&(St(H.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,_=!1,H=ur(e,function(ee){P&&(n.scroller.draggable=!1),e.state.draggingText=!1,qe(n.wrapper.ownerDocument,"mouseup",H),qe(n.wrapper.ownerDocument,"mousemove",Q),qe(n.scroller,"dragstart",J),qe(n.scroller,"drop",H),_||(re(ee),r.addNew||Zn(e.doc,i,null,null,r.extend),P&&!M||W&&B==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Q=function(ee){_=_||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return _=!0};P&&(n.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),ke(n.wrapper.ownerDocument,"mouseup",H),ke(n.wrapper.ownerDocument,"mousemove",Q),ke(n.scroller,"dragstart",J),ke(n.scroller,"drop",H),Eo(e),setTimeout(function(){return n.input.focus()},20)}function Es(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Xe(t.line,0),l(e.doc,Xe(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,_=e.doc;re(t);var H,Q,J=_.sel,ee=J.ranges;if(r.addNew&&!r.extend?(Q=_.sel.contains(i),Q>-1?H=ee[Q]:H=new jt(i,i)):(H=_.sel.primary(),Q=_.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new jt(i,i)),i=Bi(e,t,!0,!0),Q=-1;else{var ce=Es(e,i,r.unit);r.extend?H=Ba(H,ce.anchor,ce.head,r.extend):H=ce}r.addNew?Q==-1?(Q=ee.length,xr(_,Zr(e,ee.concat([H]),Q),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Q].empty()&&r.unit=="char"&&!r.extend?(xr(_,Zr(e,ee.slice(0,Q).concat(ee.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),J=_.sel):Ua(_,Q,H,Te):(Q=0,xr(_,new zr([H],0),Te),J=_.sel);var ge=i;function De(rt){if(St(ge,rt)==0)return;if(ge=rt,r.unit=="rectangle"){for(var dt=[],Et=e.options.tabSize,vt=X(ft(_,i.line).text,i.ch,Et),_t=X(ft(_,rt.line).text,rt.ch,Et),Yt=Math.min(vt,_t),dr=Math.max(vt,_t),Jt=Math.min(i.line,rt.line),Br=Math.min(e.lastLine(),Math.max(i.line,rt.line));Jt<=Br;Jt++){var kr=ft(_,Jt).text,tr=Se(kr,Yt,Et);Yt==dr?dt.push(new jt(Xe(Jt,tr),Xe(Jt,tr))):kr.length>tr&&dt.push(new jt(Xe(Jt,tr),Xe(Jt,Se(kr,dr,Et))))}dt.length||dt.push(new jt(i,i)),xr(_,Zr(e,J.ranges.slice(0,Q).concat(dt),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var Rr=H,vr=Es(e,rt,r.unit),or=Rr.anchor,rr;St(vr.anchor,or)>0?(rr=vr.head,or=ki(Rr.from(),vr.anchor)):(rr=vr.anchor,or=di(Rr.to(),vr.head));var Zt=J.ranges.slice(0);Zt[Q]=Xl(e,new jt(l(_,or),rr)),xr(_,Zr(e,Zt,Q),Te)}}var we=n.wrapper.getBoundingClientRect(),je=0;function Ve(rt){var dt=++je,Et=Bi(e,rt,!0,r.unit=="rectangle");if(!Et)return;if(St(Et,ge)!=0){e.curOp.focus=O(),De(Et);var vt=Vn(n,_);(Et.line>=vt.to||Et.line<vt.from)&&setTimeout(ur(e,function(){je==dt&&Ve(rt)}),150)}else{var _t=rt.clientY<we.top?-20:rt.clientY>we.bottom?20:0;_t&&setTimeout(ur(e,function(){if(je!=dt)return;n.scroller.scrollTop+=_t,Ve(rt)}),50)}}function Qe(rt){e.state.selectingText=!1,je=Infinity,rt&&(re(rt),n.input.focus()),qe(n.wrapper.ownerDocument,"mousemove",tt),qe(n.wrapper.ownerDocument,"mouseup",ht),_.history.lastSelOrigin=null}var tt=ur(e,function(rt){rt.buttons===0||!Me(rt)?Qe(rt):Ve(rt)}),ht=ur(e,Qe);e.state.selectingText=ht,ke(n.wrapper.ownerDocument,"mousemove",tt),ke(n.wrapper.ownerDocument,"mouseup",ht)}function Xl(e,t){var i=t.anchor,r=t.head,n=ft(e.doc,i.line);if(St(i,r)==0&&i.sticky==r.sticky)return t;var _=Je(n);if(!_)return t;var H=Ze(_,i.ch,i.sticky),Q=_[H];if(Q.from!=i.ch&&Q.to!=i.ch)return t;var J=H+(Q.from==i.ch==(Q.level!=1)?0:1);if(J==0||J==_.length)return t;var ee;if(r.line!=i.line)ee=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Ze(_,r.ch,r.sticky),ge=ce-H||(r.ch-i.ch)*(Q.level==1?-1:1);ce==J-1||ce==J?ee=ge<0:ee=ge>0}var De=_[J+(ee?-1:0)],we=ee==(De.level==1),je=we?De.from:De.to,Ve=we?"after":"before";return i.ch==je&&i.sticky==Ve?t:new jt(new Xe(i.line,je,Ve),r)}function Ss(e,t,i,r){var n,_;if(t.touches)n=t.touches[0].clientX,_=t.touches[0].clientY;else try{n=t.clientX,_=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var H=e.display,Q=H.lineDiv.getBoundingClientRect();if(_>Q.bottom||!pe(e,i))return le(t);_-=Q.top-H.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=H.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=n){var ce=Vr(e.doc,_),ge=e.display.gutterSpecs[J];return Ie(e,i,e,ce,ge.className,t),le(t)}}}function Ga(e,t){return Ss(e,t,"gutterClick",!0)}function Cs(e,t){if(fi(e.display,t)||Yl(e,t))return;if(He(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return pe(e,"gutterContextMenu")?Ss(e,t,"gutterContextMenu",!1):!1}function Ts(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}var un={toString:function(){return"CodeMirror.Init"}},ws={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,_,H){e.defaults[r]=n,_&&(t[r]=H?function(Q,J,ee){ee!=un&&_(Q,J,ee)}:_)}e.defineOption=i,e.Init=un,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ma(r)},!0),i("indentUnit",2,Ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Lr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var _=[],H=r.doc.first;r.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(n,ee);if(ce==-1)break;ee=ce+n.length,_.push(Xe(H,ce))}H++});for(var Q=_.length-1;Q>=0;Q--)an(r.doc,n,_[Q],Xe(_[Q].line,_[Q].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,_){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),_!=un&&r.refresh()}),i("specialCharPlaceholder",pt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!L),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Tn(r)},!0),i("keyMap","default",function(r,n,_){var H=ia(n),Q=_!=un&&ia(_);Q&&Q.detach&&Q.detach(r,H),H.attach&&H.attach(r,Q||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Oa(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Sa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return en(r)},!0),i("scrollbarStyle","native",function(r){_o(r),en(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Oa(r.options.gutters,n),Tn(r)},!0),i("firstLineNumber",1,Tn,!0),i("lineNumberFormatter",function(r){return r},Tn,!0),i("showCursorWhenSelecting",!1,yn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Ql),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yn,!0),i("singleCursorHeightPerLine",!0,yn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,wn,!0),i("addModeClass",!1,wn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,wn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Ql(e,t,i){var r=i&&i!=un;if(!t!=!r){var n=e.display.dragFunctions,_=t?ke:qe;_(e.display.scroller,"dragstart",n.start),_(e.display.scroller,"dragenter",n.enter),_(e.display.scroller,"dragover",n.over),_(e.display.scroller,"dragleave",n.leave),_(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),ci(e)),Ca(e),Lr(e),vn(e),setTimeout(function(){return en(e)},100)}function $t(e,t){var i=this;if(!(this instanceof $t))return new $t(e,t);this.options=t=t?N(t):{},N(ws,t,!1);var r=t.value;typeof r=="string"?r=new Dr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new $t.inputStyles[t.inputStyle](this),_=this.display=new hl(e,r,n,t);_.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new q,keySeq:null,specialChars:null},t.autofocus&&!a&&_.input.focus(),W&&B<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Zl(this),Dl(),Wi(this),this.curOp.forceUpdate=!0,Bo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&wa(i)},20):Zi(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],un);ko(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Ka.length;++Q)Ka[Q](this);Hi(this),P&&t.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}$t.defaults=ws,$t.optionHandlers=aa;function Zl(e){var t=e.display;ke(t.scroller,"mousedown",ur(e,xs)),W&&B<11?ke(t.scroller,"dblclick",ur(e,function(J){if(He(e,J))return;var ee=Bi(e,J);if(!ee||Ga(e,J)||fi(e.display,J))return;re(J);var ce=e.findWordAt(ee);Zn(e.doc,ce.anchor,ce.head)})):ke(t.scroller,"dblclick",function(J){return He(e,J)||re(J)}),ke(t.scroller,"contextmenu",function(J){return Cs(e,J)}),ke(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Cs(e,J)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function _(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function H(J,ee){if(ee.left==null)return!0;var ce=ee.left-J.left,ge=ee.top-J.top;return ce*ce+ge*ge>20*20}ke(t.scroller,"touchstart",function(J){if(!He(e,J)&&!_(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(i);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!fi(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||H(ee,ee.prev)?ge=new jt(ce,ce):!ee.prev.prev||H(ee,ee.prev.prev)?ge=e.findWordAt(ce):ge=new jt(Xe(ce.line,0),l(e.doc,Xe(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(J)}n()}),ke(t.scroller,"touchcancel",n),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),Ie(e,"scroll",e))}),ke(t.scroller,"mousewheel",function(J){return Po(e,J)}),ke(t.scroller,"DOMMouseScroll",function(J){return Po(e,J)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){He(e,J)||de(J)},over:function(J){He(e,J)||(Ll(e,J),de(J))},start:function(J){return _l(e,J)},drop:ur(e,Al),leave:function(J){He(e,J)||ss(e)}};var Q=t.input.getField();ke(Q,"keyup",function(J){return ys.call(e,J)}),ke(Q,"keydown",ur(e,vs)),ke(Q,"keypress",ur(e,bs)),ke(Q,"focus",function(J){return wa(e,J)}),ke(Q,"blur",function(J){return Zi(e,J)})}var Ka=[];$t.defineInitHook=function(e){return Ka.push(e)};function Un(e,t,i,r){var n=e.doc,_;i==null&&(i="add"),i=="smart"&&(n.mode.indent?_=Re(e,t).state:i="prev");var H=e.options.tabSize,Q=ft(n,t),J=X(Q.text,null,H);Q.stateAfter&&(Q.stateAfter=null);var ee=Q.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(Q.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(_,Q.text.slice(ee.length),Q.text),ce==Ae||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=X(ft(n,t-1).text,null,H):ce=0:i=="add"?ce=J+e.options.indentUnit:i=="subtract"?ce=J-e.options.indentUnit:typeof i=="number"&&(ce=J+i),ce=Math.max(0,ce);var ge="",De=0;if(e.options.indentWithTabs)for(var we=Math.floor(ce/H);we;--we)De+=H,ge+=" ";if(De<ce&&(ge+=ue(ce-De)),ge!=ee)return an(n,ge,Xe(t,0),Xe(t,ee.length),"+input"),Q.stateAfter=null,!0;for(var je=0;je<n.sel.ranges.length;je++){var Ve=n.sel.ranges[je];if(Ve.head.line==t&&Ve.head.ch<ee.length){var Qe=Xe(t,ee.length);Ua(n,je,new jt(Qe,Qe));break}}}var qr=null;function oa(e){qr=e}function Va(e,t,i,r,n){var _=e.doc;e.display.shift=!1,r||(r=_.sel);var H=+new Date-200,Q=n=="paste"||e.state.pasteIncoming>H,J=mt(t),ee=null;if(Q&&r.ranges.length>1)if(qr&&qr.text.join(`
`)==t){if(r.ranges.length%qr.text.length==0){ee=[];for(var ce=0;ce<qr.text.length;ce++)ee.push(_.splitLines(qr.text[ce]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(ee=fe(J,function(tt){return[tt]}));for(var ge=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var we=r.ranges[De],je=we.from(),Ve=we.to();we.empty()&&(i&&i>0?je=Xe(je.line,je.ch-i):e.state.overwrite&&!Q?Ve=Xe(Ve.line,Math.min(ft(_,Ve.line).text.length,Ve.ch+te(J).length)):Q&&qr&&qr.lineWise&&qr.text.join(`
`)==J.join(`
`)&&(je=Ve=Xe(je.line,0)));var Qe={from:je,to:Ve,text:ee?ee[De%ee.length]:J,origin:n||(Q?"paste":e.state.cutIncoming>H?"cut":"+input")};nn(e.doc,Qe),Vt(e,"inputRead",e,Qe)}t&&!Q&&_s(e,t),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Nr(t,function(){return Va(t,i,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var _=e.getModeAt(n.head),H=!1;if(_.electricChars){for(var Q=0;Q<_.electricChars.length;Q++)if(t.indexOf(_.electricChars.charAt(Q))>-1){H=Un(e,n.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(ft(e.doc,n.head.line).text.slice(0,n.head.ch))&&(H=Un(e,n.head.line,"smart")));H&&Vt(e,"electricInput",e,n.head.line)}}function Ls(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,_={anchor:Xe(n,0),head:Xe(n+1,0)};i.push(_),t.push(e.getRange(_.anchor,_.head))}return{text:t,ranges:i}}function Ds(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),x&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var _=this.options,H=_[r];if(_[r]==n&&r!="mode")return;_[r]=n,t.hasOwnProperty(r)&&ur(this,t[r])(this,n,H),Ie(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,_=0;_<n.length;++_)if(n[_]==r||n[_].name==r)return n.splice(_,1),!0},addOverlay:Sr(function(r,n){var _=r.token?r:e.getMode(this.options,r);if(_.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:_,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(H){return H.priority}),this.state.modeGen++,Lr(this)}),removeOverlay:Sr(function(r){for(var n=this.state.overlays,_=0;_<n.length;++_){var H=n[_].modeSpec;if(H==r||typeof r=="string"&&H.name==r){n.splice(_,1),this.state.modeGen++,Lr(this);return}}}),indentLine:Sr(function(r,n,_){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),ui(this.doc,r)&&Un(this,r,n,_)}),indentSelection:Sr(function(r){for(var n=this.doc.sel.ranges,_=-1,H=0;H<n.length;H++){var Q=n[H];if(Q.empty())Q.head.line>_&&(Un(this,Q.head.line,r,!0),_=Q.head.line,H==this.doc.sel.primIndex&&qi(this));else{var J=Q.from(),ee=Q.to(),ce=Math.max(_,J.line);_=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=ce;ge<_;++ge)Un(this,ge,r);var De=this.doc.sel.ranges;J.ch==0&&n.length==De.length&&De[H].from().ch>0&&Ua(this.doc,H,new jt(J,De[H].to()),be)}}}),getTokenAt:function(r,n){return Wt(this,r,n)},getLineTokens:function(r,n){return Wt(this,Xe(r),n,!0)},getTokenTypeAt:function(r){r=l(this.doc,r);var n=ze(this,ft(this.doc,r.line)),_=0,H=(n.length-1)/2,Q=r.ch,J;if(Q==0)J=n[2];else for(;;){var ee=_+H>>1;if((ee?n[ee*2-1]:0)>=Q)H=ee;else if(n[ee*2+1]<Q)_=ee+1;else{J=n[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var _=[];if(!i.hasOwnProperty(n))return _;var H=i[n],Q=this.getModeAt(r);if(typeof Q[n]=="string")H[Q[n]]&&_.push(H[Q[n]]);else if(Q[n])for(var J=0;J<Q[n].length;J++){var ee=H[Q[n][J]];ee&&_.push(ee)}else Q.helperType&&H[Q.helperType]?_.push(H[Q.helperType]):H[Q.name]&&_.push(H[Q.name]);for(var ce=0;ce<H._global.length;ce++){var ge=H._global[ce];ge.pred(Q,this)&&ae(_,ge.val)==-1&&_.push(ge.val)}return _},getStateAfter:function(r,n){var _=this.doc;return r=V(_,r==null?_.first+_.size-1:r),Re(this,r+1,n).state},cursorCoords:function(r,n){var _,H=this.doc.sel.primary();return r==null?_=H.head:typeof r=="object"?_=l(this.doc,r):_=r?H.from():H.to(),Jr(this,_,n||"page")},charCoords:function(r,n){return va(this,l(this.doc,r),n||"page")},coordsChar:function(r,n){return r=co(this,r,n||"page"),ba(this,r.left,r.top)},lineAtHeight:function(r,n){return r=co(this,{top:r,left:0},n||"page").top,Vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,_){var H=!1,Q;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,H=!0),Q=ft(this.doc,r)}else Q=r;return Hn(this,Q,{top:0,left:0},n||"page",_||H).top+(H?this.doc.height-Ir(Q):0)},defaultTextHeight:function(){return Qi(this.display)},defaultCharWidth:function(){return Ji(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,_,H,Q){var J=this.display;r=Jr(this,l(this.doc,r));var ee=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),H=="over")ee=r.top;else if(H=="above"||H=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),De=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(H=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?ee=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(ee=r.bottom),ce+n.offsetWidth>De&&(ce=De-n.offsetWidth)}n.style.top=ee+"px",n.style.left=n.style.right="",Q=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Q=="left"?ce=0:Q=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),_&&Qs(this,{left:ce,top:ee,right:ce+n.offsetWidth,bottom:ee+n.offsetHeight})},triggerOnKeyDown:Sr(vs),triggerOnKeyPress:Sr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:Sr(xs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Sr(function(r){_s(this,r)}),findPosH:function(r,n,_,H){var Q=1;n<0&&(Q=-1,n=-n);for(var J=l(this.doc,r),ee=0;ee<n&&!(J=Xa(this.doc,J,Q,_,H),J.hitSide);++ee);return J},moveH:Sr(function(r,n){var _=this;this.extendSelectionsBy(function(H){return _.display.shift||_.doc.extend||H.empty()?Xa(_.doc,H.head,r,n,_.options.rtlMoveVisually):r<0?H.from():H.to()},Ce)}),deleteH:Sr(function(r,n){var _=this.doc.sel,H=this.doc;_.somethingSelected()?H.replaceSelection("",null,"+delete"):ln(this,function(Q){var J=Xa(H,Q.head,r,n,!1);return r<0?{from:J,to:Q.head}:{from:Q.head,to:J}})}),findPosV:function(r,n,_,H){var Q=1,J=H;n<0&&(Q=-1,n=-n);for(var ee=l(this.doc,r),ce=0;ce<n;++ce){var ge=Jr(this,ee,"div");if(J==null?J=ge.left:ge.left=J,ee=Rs(this,ge,Q,_),ee.hitSide)break}return ee},moveV:Sr(function(r,n){var _=this,H=this.doc,Q=[],J=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(ce){if(J)return r<0?ce.from():ce.to();var ge=Jr(_,ce.head,"div");ce.goalColumn!=null&&(ge.left=ce.goalColumn),Q.push(ge.left);var De=Rs(_,ge,r,n);return n=="page"&&ce==H.sel.primary()&&_a(_,va(_,De,"div").top-ge.top),De},Ce),Q.length)for(var ee=0;ee<H.sel.ranges.length;ee++)H.sel.ranges[ee].goalColumn=Q[ee]}),findWordAt:function(r){var n=this.doc,_=ft(n,r.line).text,H=r.ch,Q=r.ch;if(_){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Q==_.length)&&H?--H:++Q;for(var ee=_.charAt(H),ce=Ne(ee,J)?function(ge){return Ne(ge,J)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Ne(ge)};H>0&&ce(_.charAt(H-1));)--H;for(;Q<_.length&&ce(_.charAt(Q));)++Q}return new jt(Xe(r.line,H),Xe(r.line,Q))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Ie(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:pa(this),clientWidth:Ii(this)}},scrollIntoView:Sr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Xe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Sr(function(r,n){var _=this,H=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=H(r)),n!=null&&(this.display.wrapper.style.height=H(n)),this.options.lineWrapping&&lo(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Si(_,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,Ie(this,"refresh",this)}),operation:function(r){return Nr(this,r)},startOperation:function(){return Wi(this)},endOperation:function(){return Hi(this)},refresh:Sr(function(){var r=this.display.cachedTextHeight;Lr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Qi(this.display))>.5||this.options.lineWrapping)&&Ca(this),Ie(this,"refresh",this)}),swapDoc:Sr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Vt(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(r,n,_){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=_},e.registerGlobalHelper=function(r,n,_,H){e.registerHelper(r,n,H),i[r]._global.push({pred:_,val:H})}}function Xa(e,t,i,r,n){var _=t,H=i,Q=ft(e,t.line),J=n&&e.direction=="rtl"?-i:i;function ee(){var ht=t.line+J;return ht<e.first||ht>=e.first+e.size?!1:(t=new Xe(ht,t.ch,t.sticky),Q=ft(e,ht))}function ce(ht){var rt;if(r=="codepoint"){var dt=Q.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(dt)?rt=null:rt=new Xe(t.line,Math.max(0,Math.min(Q.text.length,t.ch+i*(dt>=55296&&dt<56320?2:1))),-i)}else n?rt=Ml(e.cm,Q,t,i):rt=ja(Q,t,i);if(rt==null)if(!ht&&ee())t=Wa(n,e.cm,Q,t.line,J);else return!1;else t=rt;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var ge=null,De=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(i<0&&!ce(!je));je=!1){var Ve=Q.text.charAt(t.ch)||`
`,Qe=Ne(Ve,we)?"w":De&&Ve==`
`?"n":!De||/\s/.test(Ve)?null:"p";if(De&&!je&&!Qe&&(Qe="s"),ge&&ge!=Qe){i<0&&(i=1,ce(),t.sticky="after");break}if(Qe&&(ge=Qe),i>0&&!ce(!je))break}var tt=ea(e,t,_,H,!0);return ei(_,tt)&&(tt.hitSide=!0),tt}function Rs(e,t,i,r){var n=e.doc,_=t.left,H;if(r=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Q-.5*Qi(e.display),3);H=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(H=i>0?t.bottom+3:t.top-3);for(var ee;!(ee=ba(e,_,H),!ee.outside);){if(i<0?H<=0:H>=n.height){ee.hitSide=!0;break}H+=i*5}return ee}var Gt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Gt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ds(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function _(Q){for(var J=Q.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}ke(n,"paste",function(Q){if(!_(Q)||He(r,Q)||As(Q,r))return;B<=11&&setTimeout(ur(r,function(){return t.updateFromDOM()}),20)}),ke(n,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),ke(n,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),ke(n,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(n,"touchstart",function(){return i.forceCompositionEnd()}),ke(n,"input",function(){t.composing||t.readFromDOMSoon()});function H(Q){if(!_(Q)||He(r,Q))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),Q.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=Ls(r);oa({lineWise:!0,text:J.text}),Q.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,be),r.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var ee=qr.text.join(`
`);if(Q.clipboardData.setData("Text",ee),Q.clipboardData.getData("Text")==ee){Q.preventDefault();return}}var ce=ks(),ge=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),ge.value=qr.text.join(`
`);var De=document.activeElement;K(ge),setTimeout(function(){r.display.lineSpace.removeChild(ce),De.focus(),De==n&&i.showPrimarySelection()},50)}ke(n,"copy",H),ke(n,"cut",H)},Gt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Gt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Gt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Gt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var _=sa(t,e.anchorNode,e.anchorOffset),H=sa(t,e.focusNode,e.focusOffset);if(_&&!_.bad&&H&&!H.bad&&St(ki(_,H),r)==0&&St(di(_,H),n)==0)return;var Q=t.display.view,J=r.line>=t.display.viewFrom&&Os(t,r)||{node:Q[0].measure.map[2],offset:0},ee=n.line<t.display.viewTo&&Os(t,n);if(!ee){var ce=Q[Q.length-1].measure,ge=ce.maps?ce.maps[ce.maps.length-1]:ce.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!J||!ee){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),we;try{we=E(J.node,J.offset,ee.offset,ee.node)}catch(je){}we&&(!k&&t.state.focused?(e.collapse(J.node,J.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),De&&e.anchorNode==null?e.addRange(De):k&&this.startGracePeriod()),this.rememberSelection()},Gt.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)},Gt.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},Gt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Gt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return m(this.div,t)},Gt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Gt.prototype.blur=function(){this.div.blur()},Gt.prototype.getField=function(){return this.div},Gt.prototype.supportsTouch=function(){return!0},Gt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Nr(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)},Gt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Gt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&p&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Nr(t,function(){xr(t.doc,Ti(i,r),be),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Gt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Xe(r.line-1,ft(e.doc,r.line-1).length)),n.ch==ft(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Xe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var _,H,Q;r.line==t.viewFrom||(_=Ui(e,r.line))==0?(H=Ot(t.view[0].line),Q=t.view[0].node):(H=Ot(t.view[_].line),Q=t.view[_-1].node.nextSibling);var J=Ui(e,n.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=Ot(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!Q)return!1;for(var ge=e.doc.splitLines(tu(e,Q,ce,H,ee)),De=Ur(e.doc,Xe(H,0),Xe(ee,ft(e.doc,ee).text.length));ge.length>1&&De.length>1;)if(te(ge)==te(De))ge.pop(),De.pop(),ee--;else if(ge[0]==De[0])ge.shift(),De.shift(),H++;else break;for(var we=0,je=0,Ve=ge[0],Qe=De[0],tt=Math.min(Ve.length,Qe.length);we<tt&&Ve.charCodeAt(we)==Qe.charCodeAt(we);)++we;for(var ht=te(ge),rt=te(De),dt=Math.min(ht.length-(ge.length==1?we:0),rt.length-(De.length==1?we:0));je<dt&&ht.charCodeAt(ht.length-je-1)==rt.charCodeAt(rt.length-je-1);)++je;if(ge.length==1&&De.length==1&&H==r.line)for(;we&&we>r.ch&&ht.charCodeAt(ht.length-je-1)==rt.charCodeAt(rt.length-je-1);)we--,je++;ge[ge.length-1]=ht.slice(0,ht.length-je).replace(/^\u200b+/,""),ge[0]=ge[0].slice(we).replace(/\u200b+$/,"");var Et=Xe(H,we),vt=Xe(ee,De.length?te(De).length-je:0);if(ge.length>1||ge[0]||St(Et,vt))return an(e.doc,ge,Et,vt,"+input"),!0},Gt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Gt.prototype.reset=function(){this.forceCompositionEnd()},Gt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Gt.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)},Gt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Nr(this.cm,function(){return Lr(e.cm)})},Gt.prototype.setUneditable=function(e){e.contentEditable="false"},Gt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||ur(this.cm,Va)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Gt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Gt.prototype.onContextMenu=function(){},Gt.prototype.resetPosition=function(){},Gt.prototype.needsContentAttribute=!0;function Os(e,t){var i=ma(e,t.line);if(!i||i.hidden)return null;var r=ft(e.doc,t.line),n=io(i,r,t.line),_=Je(r,e.doc.direction),H="left";if(_){var Q=Ze(_,t.ch);H=Q%2?"right":"left"}var J=oo(n.map,t.ch,H);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function hn(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var _="",H=!1,Q=e.doc.lineSeparator(),J=!1;function ee(we){return function(je){return je.id==we}}function ce(){H&&(_+=Q,J&&(_+=Q),H=J=!1)}function ge(we){we&&(ce(),_+=we)}function De(we){if(we.nodeType==1){var je=we.getAttribute("cm-text");if(je){ge(je);return}var Ve=we.getAttribute("cm-marker"),Qe;if(Ve){var tt=e.findMarks(Xe(r,0),Xe(n+1,0),ee(+Ve));tt.length&&(Qe=tt[0].find(0))&&ge(Ur(e.doc,Qe.from,Qe.to).join(Q));return}if(we.getAttribute("contenteditable")=="false")return;var ht=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;ht&&ce();for(var rt=0;rt<we.childNodes.length;rt++)De(we.childNodes[rt]);/^(pre|p)$/i.test(we.nodeName)&&(J=!0),ht&&(H=!0)}else we.nodeType==3&&ge(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,J=!1;return _}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return hn(e.clipPos(Xe(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var _=e.display.view[n];if(_.node==r)return ru(_,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!m(r,t))return hn(Xe(Ot(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var _=e.rest?te(e.rest):e.line;return hn(Xe(Ot(_),_.text.length),n)}var H=t.nodeType==3?t:null,Q=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,i&&(i=H.nodeValue.length));Q.parentNode!=r;)Q=Q.parentNode;var J=e.measure,ee=J.maps;function ce(Qe,tt,ht){for(var rt=-1;rt<(ee?ee.length:0);rt++)for(var dt=rt<0?J.map:ee[rt],Et=0;Et<dt.length;Et+=3){var vt=dt[Et+2];if(vt==Qe||vt==tt){var _t=Ot(rt<0?e.line:e.rest[rt]),Yt=dt[Et]+ht;return(ht<0||vt!=Qe)&&(Yt=dt[Et+(ht?1:0)]),Xe(_t,Yt)}}}var ge=ce(H,Q,i);if(ge)return hn(ge,n);for(var De=Q.nextSibling,we=H?H.nodeValue.length-i:0;De;De=De.nextSibling){if(ge=ce(De,De.firstChild,0),ge)return hn(Xe(ge.line,ge.ch-we),n);we+=De.textContent.length}for(var je=Q.previousSibling,Ve=i;je;je=je.previousSibling){if(ge=ce(je,je.firstChild,-1),ge)return hn(Xe(ge.line,ge.ch+Ve),n);Ve+=je.textContent.length}}var er=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};er.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),x&&(n.style.width="0px"),ke(n,"input",function(){W&&B>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ke(n,"paste",function(H){if(He(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function _(H){if(He(r,H))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Q=Ls(r);oa({lineWise:!0,text:Q.text}),H.type=="cut"?r.setSelections(Q.ranges,null,be):(i.prevInput="",n.value=Q.text.join(`
`),K(n))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}ke(n,"cut",_),ke(n,"copy",_),ke(e.scroller,"paste",function(H){if(fi(e,H)||He(r,H))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Q=new Event("paste");Q.clipboardData=H.clipboardData,n.dispatchEvent(Q)}),ke(e.lineSpace,"selectstart",function(H){fi(e,H)||re(H)}),ke(n,"compositionstart",function(){var H=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ke(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},er.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},er.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},er.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),_=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+H.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+H.left-_.left))}return r},er.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},er.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&K(this.textarea),W&&B>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",W&&B>=9&&(this.hasSelection=null))},er.prototype.getField=function(){return this.textarea},er.prototype.supportsTouch=function(){return!1},er.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},er.prototype.blur=function(){this.textarea.blur()},er.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},er.prototype.receivedFocus=function(){this.slowPoll()},er.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()})},er.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},er.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(W&&B>=9&&this.hasSelection===n||s&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=n.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Q=Math.min(r.length,n.length);H<Q&&r.charCodeAt(H)==n.charCodeAt(H);)++H;return Nr(t,function(){Va(t,n.slice(H),r.length-H,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},er.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},er.prototype.onKeyPress=function(){W&&B>=9&&(this.hasSelection=null),this.fastPoll()},er.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var _=Bi(i,e),H=r.scroller.scrollTop;if(!_||b)return;var Q=i.options.resetSelectionOnContextMenu;Q&&i.doc.sel.contains(_)==-1&&ur(i,xr)(i.doc,Ti(_),be);var J=n.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.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 ge;P&&(ge=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var Ve=i.somethingSelected(),Qe="\u200B"+(Ve?n.value:"");n.value="\u21DA",n.value=Qe,t.prevInput=Ve?"":"\u200B",n.selectionStart=1,n.selectionEnd=Qe.length,r.selForContextMenu=i.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,n.style.cssText=J,W&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),n.selectionStart!=null){(!W||W&&B<9)&&De();var Ve=0,Qe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?ur(i,Qo)(i):Ve++<10?r.detectingSelectAll=setTimeout(Qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Qe,200)}}if(W&&B>=9&&De(),D){de(e);var je=function(){qe(window,"mouseup",je),setTimeout(we,20)};ke(window,"mouseup",je)}else setTimeout(we,50)},er.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},er.prototype.setUneditable=function(){},er.prototype.needsContentAttribute=!1;function iu(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 i=O();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Q.getValue()}var n;if(e.form&&(ke(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;n=_.submit;try{var H=_.submit=function(){r(),_.submit=n,_.submit(),_.submit=H}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Q=$t(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Q}function nu(e){e.off=qe,e.on=ke,e.wheelEventPixels=dl,e.Doc=Dr,e.splitLines=mt,e.countColumn=X,e.findColumn=Se,e.isWordChar=Pe,e.Pass=Ae,e.signal=Ie,e.Line=Ei,e.changeEnd=wi,e.scrollbarModel=Ao,e.Pos=Xe,e.cmpPos=St,e.modes=Bt,e.mimeModes=wt,e.resolveMode=gt,e.getMode=Gr,e.modeExtensions=br,e.extendMode=fr,e.copyState=Tr,e.startState=Kr,e.innerMode=si,e.commands=Mn,e.keyMap=pi,e.keyName=cs,e.isModifierKey=hs,e.lookupKey=sn,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=Rn,e.TextMarker=_i,e.LineWidget=kn,e.e_preventDefault=re,e.e_stopPropagation=oe,e.e_stop=de,e.addClass=U,e.contains=m,e.rmClass=g,e.keyNames=Li}$l($t),ql($t);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Dr.prototype)Dr.prototype.hasOwnProperty(la)&&ae(au,la)<0&&($t.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Dr.prototype[la]));return ye(Dr),$t.inputStyles={textarea:er,contenteditable:Gt},$t.defineMode=function(e){!$t.defaults.mode&&e!="null"&&($t.defaults.mode=e),yr.apply(this,arguments)},$t.defineMIME=ir,$t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$t.defineMIME("text/plain","null"),$t.defineExtension=function(e,t){$t.prototype[e]=t},$t.defineDocExtension=function(e,t){Dr.prototype[e]=t},$t.fromTextArea=iu,nu($t),$t.version="5.58.2",$t})},Y1PL:function(lt,$e,ie){"use strict";ie.r($e),ie.d($e,"ResizableTextArea",function(){return ae});var ne=ie("wx14"),$=ie("1OyB"),k=ie("vuIU"),Y=ie("Ji7U"),F=ie("LK+K"),R=ie("q1tI"),W=ie("VTBJ"),B=ie("rePB"),P=ie("Zm9Q"),w=ie("Kwbf"),p=ie("c+Xe"),b=ie("m+aA"),M=ie("bdgK"),A=new Map;function S(be){be.forEach(function(Te){var Ce,Se=Te.target;(Ce=A.get(Se))===null||Ce===void 0||Ce.forEach(function(me){return me(Se)})})}var x=new M.default(S),d=null,a=null;function s(be,Te){A.has(be)||(A.set(be,new Set),x.observe(be)),A.get(be).add(Te)}function u(be,Te){A.has(be)&&(A.get(be).delete(Te),A.get(be).size||(x.unobserve(be),A.delete(be)))}var L=function(be){Object(Y.a)(Ce,be);var Te=Object(F.a)(Ce);function Ce(){return Object($.a)(this,Ce),Te.apply(this,arguments)}return Object(k.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(R.Component),f=R.createContext(null);function v(be){var Te=be.children,Ce=be.onBatchResize,Se=R.useRef(0),me=R.useRef([]),ue=R.useContext(f),te=R.useCallback(function(fe,se,_e){Se.current+=1;var Oe=Se.current;me.current.push({size:fe,element:se,data:_e}),Promise.resolve().then(function(){Oe===Se.current&&(Ce==null||Ce(me.current),me.current=[])}),ue==null||ue(fe,se,_e)},[Ce,ue]);return R.createElement(f.Provider,{value:te},Te)}function D(be){var Te=be.children,Ce=be.disabled,Se=R.useRef(null),me=R.useRef(null),ue=R.useContext(f),te=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),fe=R.isValidElement(Te)&&Object(p.c)(Te),se=fe?Te.ref:null,_e=R.useMemo(function(){return Object(p.a)(se,Se)},[se,Se]),Oe=R.useRef(be);Oe.current=be;var xe=R.useCallback(function(Pe){var Ne=Oe.current,Be=Ne.onResize,We=Ne.data,Ue=Pe.getBoundingClientRect(),Fe=Ue.width,at=Ue.height,it=Pe.offsetWidth,et=Pe.offsetHeight,Ze=Math.floor(Fe),ut=Math.floor(at);if(te.current.width!==Ze||te.current.height!==ut||te.current.offsetWidth!==it||te.current.offsetHeight!==et){var Je={width:Ze,height:ut,offsetWidth:it,offsetHeight:et};te.current=Je;var st=it===Math.round(Fe)?Fe:it,ke=et===Math.round(at)?at:et,nt=Object(W.a)(Object(W.a)({},Je),{},{offsetWidth:st,offsetHeight:ke});ue==null||ue(nt,Pe,We),Be&&Promise.resolve().then(function(){Be(nt,Pe)})}},[]);return R.useEffect(function(){var Pe=Object(b.a)(Se.current)||Object(b.a)(me.current);return Pe&&!Ce&&s(Pe,xe),function(){return u(Pe,xe)}},[Se.current,Ce]),R.createElement(L,{ref:me},fe?R.cloneElement(Te,{ref:_e}):Te)}var T="rc-observer-key";function g(be){var Te=be.children,Ce=Object(P.a)(Te);return Ce.map(function(Se,me){var ue=(Se==null?void 0:Se.key)||"".concat(T,"-").concat(me);return R.createElement(D,Object(ne.a)({},be,{key:ue}),Se)})}g.Collection=v;var c=g,h=ie("bT9E"),o=ie("TSYQ"),C=ie.n(o),E=`
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
`,m=["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"],O={},U;function j(be){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=be.getAttribute("id")||be.getAttribute("data-reactid")||be.getAttribute("name");if(Te&&O[Ce])return O[Ce];var Se=window.getComputedStyle(be),me=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),te=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),fe=m.map(function(_e){return"".concat(_e,":").concat(Se.getPropertyValue(_e))}).join(";"),se={sizingStyle:fe,paddingSize:ue,borderSize:te,boxSizing:me};return Te&&Ce&&(O[Ce]=se),se}function K(be){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),be.getAttribute("wrap")?U.setAttribute("wrap",be.getAttribute("wrap")):U.removeAttribute("wrap");var me=j(be,Te),ue=me.paddingSize,te=me.borderSize,fe=me.boxSizing,se=me.sizingStyle;U.setAttribute("style","".concat(se,";").concat(E)),U.value=be.value||be.placeholder||"";var _e=Number.MIN_SAFE_INTEGER,Oe=Number.MAX_SAFE_INTEGER,xe=U.scrollHeight,Pe;if(fe==="border-box"?xe+=te:fe==="content-box"&&(xe-=ue),Ce!==null||Se!==null){U.value=" ";var Ne=U.scrollHeight-ue;Ce!==null&&(_e=Ne*Ce,fe==="border-box"&&(_e=_e+ue+te),xe=Math.max(_e,xe)),Se!==null&&(Oe=Ne*Se,fe==="border-box"&&(Oe=Oe+ue+te),Pe=xe>Oe?"":"hidden",xe=Math.min(Oe,xe))}return{height:xe,minHeight:_e,maxHeight:Oe,overflowY:Pe,resize:"none"}}var I=ie("Gytx"),N=ie.n(I),X;(function(be){be[be.NONE=0]="NONE",be[be.RESIZING=1]="RESIZING",be[be.RESIZED=2]="RESIZED"})(X||(X={}));var q=function(be){Object(Y.a)(Ce,be);var Te=Object(F.a)(Ce);function Ce(Se){var me;return Object($.a)(this,Ce),me=Te.call(this,Se),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(ue){me.textArea=ue},me.handleResize=function(ue){var te=me.state.resizeStatus,fe=me.props,se=fe.autoSize,_e=fe.onResize;if(te!==X.NONE)return;typeof _e=="function"&&_e(ue),se&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var ue=me.props.autoSize;if(!ue||!me.textArea)return;var te=ue.minRows,fe=ue.maxRows,se=K(me.textArea,!1,te,fe);me.setState({textareaStyles:se,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:X.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:X.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var ue=me.props,te=ue.prefixCls,fe=te===void 0?"rc-textarea":te,se=ue.autoSize,_e=ue.onResize,Oe=ue.className,xe=ue.disabled,Pe=me.state,Ne=Pe.textareaStyles,Be=Pe.resizeStatus,We=Object(h.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=C()(fe,Oe,Object(B.a)({},"".concat(fe,"-disabled"),xe));"value"in We&&(We.value=We.value||"");var Fe=Object(W.a)(Object(W.a)(Object(W.a)({},me.props.style),Ne),Be===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:me.handleResize,disabled:!(se||_e)},R.createElement("textarea",Object(ne.a)({},We,{className:Ue,style:Fe,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:X.NONE},me}return Object(k.a)(Ce,[{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,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,ue)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(R.Component),ae=q,he=function(be){Object(Y.a)(Ce,be);var Te=Object(F.a)(Ce);function Ce(Se){var me;Object($.a)(this,Ce),me=Te.call(this,Se),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(te){me.resizableTextArea=te},me.handleChange=function(te){var fe=me.props.onChange;me.setValue(te.target.value,function(){me.resizableTextArea.resizeTextarea()}),fe&&fe(te)},me.handleKeyDown=function(te){var fe=me.props,se=fe.onPressEnter,_e=fe.onKeyDown;te.keyCode===13&&se&&se(te),_e&&_e(te)};var ue=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return me.state={value:ue},me}return Object(k.a)(Ce,[{key:"setValue",value:function(me,ue){"value"in this.props||this.setState({value:me},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ae,Object(ne.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}}]),Ce}(R.Component),Ae=$e.default=he},ZW9T:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return L});var ne=ie("k1fw"),$=ie("miYZ"),k=ie("tsqr"),Y=ie("rAM+"),F=ie("tJVT"),R=ie("PpiC"),W=ie("q1tI"),B=ie.n(W),P=ie("bdgK");function w(f,v,D,T,g){var c=v.getWordUntilPosition(D),h={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},o=T.map(function(C){return{label:C,kind:f.languages.CompletionItemKind.Keyword,insertText:C,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:h}});return g.map(function(C){o.push(Object(ne.a)(Object(ne.a)({},C),{},{range:h}))}),o}var p=function(f){var v={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["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"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(h,o){var C=w(f,h,o,D,[v]);return{suggestions:C}}});var T=["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"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(h,o){var C=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=w(f,h,o,T,C);return{suggestions:E}}});var g=["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"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(h,o){var C=[v,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=w(f,h,o,g,C);return{suggestions:E}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=ie("LvDl");function A(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function S(){}var x=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function a(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=f;if(Array.isArray(f)){for(var D=0;D<f.length;D++){var T=d[f[D]];if(T)return T}return v[0]}return d[v]||v}var s=null,u=$e.b=function(f){var v=f.width,D=v===void 0?"100%":v,T=f.height,g=T===void 0?"100%":T,c=f.value,h=f.language,o=h===void 0?"javascript":h,C=f.style,E=C===void 0?{}:C,m=f.options,O=m===void 0?{}:m,U=f.overrideServices,j=U===void 0?{}:U,K=f.theme,I=K===void 0?"vs-dark":K,N=f.onEditBlur,X=f.onSave,q=f.autoHeight,ae=q===void 0?!1:q,he=f.forbidCopy,Ae=he===void 0?!1:he,be=f.onChange,Te=be===void 0?S:be,Ce=f.editorDidMount,Se=Ce===void 0?S:Ce,me=f.onFocus,ue=me===void 0?S:me,te=f.filename,fe=te===void 0?"educoder.txt":te,se=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),_e=Object(W.useRef)(),Oe=Object(W.useRef)({}),xe=Object(W.useRef)(),Pe=Object(W.useRef)(!1),Ne=Object(W.useRef)(),Be=Object(W.useState)(!1),We=Object(F.a)(Be,2),Ue=We[0],Fe=We[1];function at(){var le;return _e.current&&(le=new P.default(function(de){var Le=Object(Y.a)(de),Me;try{for(Le.s();!(Me=Le.n()).done;){var Ye=Me.value;(Ye.target.offsetHeight>0||Ye.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(yt){Le.e(yt)}finally{Le.f()}}),le.observe(_e.current)),le}function it(){k.b.warn(decodeURIComponent(b))}var et=function(){var de=Oe.current.instance;if(c!=null&&de&&Ue){var Le=de.getModel();Le&&c!==Le.getValue()&&(x=!0,Le.setValue(c),de.layout(),x=!1)}};Object(W.useEffect)(function(){xe.current&&clearTimeout(xe.current),xe.current=setTimeout(function(){et()},500)},[c,Ue,Oe.current]);function Ze(){var le=Oe.current.instance;if(le){var de=le.getSelection(),Le=Oe.current.pastePos||{},Me=new s.Range(Le.startLineNumber||de.endLineNumber,Le.startColumn||de.endColumn,Le.endLineNumber||de.endLineNumber,Le.endColumn||de.endColumn);setTimeout(function(){le.executeEdits("",[{range:Me,text:""}])},300)}}function ut(le){(window.navigator.platform.match("Mac")?le.metaKey:le.ctrlKey)&&le.keyCode==83&&(le.preventDefault(),X())}var Je=function(){if(ae&&Oe.current.instance){var de=Oe.current.instance.getContentHeight();re(de<g?g:de)}else re(g)};function st(le){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),le.dispatchEvent(de)}function ke(le,de){var Le=window.URL||window.webkitURL||window,Me=new Blob([de]),Ye=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ye.href=Le.createObjectURL(Me),Ye.download=le,st(Ye)}Object(W.useEffect)(function(){Je()},[Je]),Object(W.useEffect)(function(){_e.current&&!Ue&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(le){try{s=le,Oe.current.instance=s.editor.create(_e.current,{value:c,language:a(o),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var de=Oe.current.instance;if(Se(de,s),setTimeout(function(){Je(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ke(fe||"educoder.txt",de.getValue())}})},500),Oe.current.subscription=de.onDidChangeModelContent(function(Me){Pe.current?clearTimeout(Ne.current):(Je(),Te(de.getValue(),Me)),Ne.current=setTimeout(function(){Pe.current=!1},500)}),window.Monaco||p(s),Ae&&(de.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return it(),null}),de.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return it(),null})),window.Monaco=s,N&&de.onDidBlurEditorWidget(function(){N(de.getValue())}),ue&&de.onDidFocusEditorText(function(){ue(de.getValue())}),Ae){de.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return it(),null}),de.onDidPaste(function(Me){Oe.current.pastePos=Me});try{window.addEventListener("paste",Ze)}catch(Me){}}var Le=at();return Fe(!0),function(){var Me=Oe.current.instance;Me.dispose();var Ye=Me.getModel();Ye&&Ye.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),Ae&&window.removeEventListener("paste",Ze),Le.unobserve(_e.current)}}catch(Me){}})},[]),Object(W.useEffect)(function(){var le=Oe.current.instance;if(le&&Ue)return document.addEventListener("keydown",ut,!1),function(){document.removeEventListener("keydown",ut)}},[X,Ue]),Object(W.useEffect)(function(){var le=Oe.current.instance;if(le&&Ue){var de=a(o);s.editor.setModelLanguage(le.getModel(),de),console.log("language:",o,le.getModel(),de)}},[o,Ue]),Object(W.useEffect)(function(){var le=Oe.current.instance;le&&Ue&&s.editor.setTheme(I)},[I,Ue]),Object(W.useEffect)(function(){var le=Oe.current.instance;le&&Ue&&(le.updateOptions(Object(ne.a)({},O)),setTimeout(function(){le.getModel().updateOptions(Object(ne.a)({},O))},200))},[JSON.stringify(O),Ue]),Object(W.useEffect)(function(){var le=Oe.current.instance;le&&Ue&&le.layout()},[D,g,Ue]);var nt=Object(W.useState)(A(D)),qe=Object(F.a)(nt,2),Ie=qe[0],He=qe[1],Ee=Object(W.useState)(A(g)),pe=Object(F.a)(Ee,2),ye=pe[0],re=pe[1],oe=Object(ne.a)(Object(ne.a)({},E),{},{width:Ie,height:ye});return B.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:oe})};function L(f){var v=f.width,D=v===void 0?"100%":v,T=f.height,g=T===void 0?"100%":T,c=f.original,h=f.modified,o=f.language,C=f.options,E=C===void 0?{}:C,m=Object(W.useRef)(),O=Object(W.useState)(null),U=Object(F.a)(O,2),j=U[0],K=U[1];function I(ae){var he;return m.current&&(he=new P.default(function(Ae){var be=Object(Y.a)(Ae),Te;try{for(be.s();!(Te=be.n()).done;){var Ce=Te.value;(Ce.target.offsetHeight>0||Ce.target.offsetWidth>0)&&ae.layout()}}catch(Se){be.e(Se)}finally{be.f()}}),he.observe(m.current)),he}Object(W.useEffect)(function(){m.current&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(ae){s=ae;var he=s.editor.createDiffEditor(m.current,Object(ne.a)(Object(ne.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},E),{},{wordWrap:!0}));K(he);var Ae=I(he);return function(){he.dispose();var be=he.getModel();be&&be.dispose(),Ae.unobserve(m.current)}})},[]),Object(W.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,o),modified:s.editor.createModel(h,o)})},[c,h,o,j]);var N=A(D),X=A(g),q={width:N,height:X};return B.a.createElement("div",{className:"my-diff-editor",ref:m,style:q})}},ZpRC:function(lt,$e,ie){"use strict";function ne(p){return typeof p=="object"&&p!=null&&p.nodeType===1}function $(p,b){return(!b||p!=="hidden")&&p!=="visible"&&p!=="clip"}function k(p,b){if(p.clientHeight<p.scrollHeight||p.clientWidth<p.scrollWidth){var M=getComputedStyle(p,null);return $(M.overflowY,b)||$(M.overflowX,b)||function(A){var S=function(x){if(!x.ownerDocument||!x.ownerDocument.defaultView)return null;try{return x.ownerDocument.defaultView.frameElement}catch(d){return null}}(A);return!!S&&(S.clientHeight<A.scrollHeight||S.clientWidth<A.scrollWidth)}(p)}return!1}function Y(p,b,M,A,S,x,d,a){return x<p&&d>b||x>p&&d<b?0:x<=p&&a<=M||d>=b&&a>=M?x-p-A:d>b&&a<M||x<p&&a>M?d-b+S:0}var F=function(p,b){var M=window,A=b.scrollMode,S=b.block,x=b.inline,d=b.boundary,a=b.skipOverflowHiddenElements,s=typeof d=="function"?d:function(Ne){return Ne!==d};if(!ne(p))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,L=[],f=p;ne(f)&&s(f);){if((f=f.parentElement)===u){L.push(f);break}f!=null&&f===document.body&&k(f)&&!k(document.documentElement)||f!=null&&k(f,a)&&L.push(f)}for(var v=M.visualViewport?M.visualViewport.width:innerWidth,D=M.visualViewport?M.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,c=p.getBoundingClientRect(),h=c.height,o=c.width,C=c.top,E=c.right,m=c.bottom,O=c.left,U=S==="start"||S==="nearest"?C:S==="end"?m:C+h/2,j=x==="center"?O+o/2:x==="end"?E:O,K=[],I=0;I<L.length;I++){var N=L[I],X=N.getBoundingClientRect(),q=X.height,ae=X.width,he=X.top,Ae=X.right,be=X.bottom,Te=X.left;if(A==="if-needed"&&C>=0&&O>=0&&m<=D&&E<=v&&C>=he&&m<=be&&O>=Te&&E<=Ae)return K;var Ce=getComputedStyle(N),Se=parseInt(Ce.borderLeftWidth,10),me=parseInt(Ce.borderTopWidth,10),ue=parseInt(Ce.borderRightWidth,10),te=parseInt(Ce.borderBottomWidth,10),fe=0,se=0,_e="offsetWidth"in N?N.offsetWidth-N.clientWidth-Se-ue:0,Oe="offsetHeight"in N?N.offsetHeight-N.clientHeight-me-te:0;if(u===N)fe=S==="start"?U:S==="end"?U-D:S==="nearest"?Y(g,g+D,D,me,te,g+U,g+U+h,h):U-D/2,se=x==="start"?j:x==="center"?j-v/2:x==="end"?j-v:Y(T,T+v,v,Se,ue,T+j,T+j+o,o),fe=Math.max(0,fe+g),se=Math.max(0,se+T);else{fe=S==="start"?U-he-me:S==="end"?U-be+te+Oe:S==="nearest"?Y(he,be,q,me,te+Oe,U,U+h,h):U-(he+q/2)+Oe/2,se=x==="start"?j-Te-Se:x==="center"?j-(Te+ae/2)+_e/2:x==="end"?j-Ae+ue+_e:Y(Te,Ae,ae,Se,ue+_e,j,j+o,o);var xe=N.scrollLeft,Pe=N.scrollTop;U+=Pe-(fe=Math.max(0,Math.min(Pe+fe,N.scrollHeight-q+Oe))),j+=xe-(se=Math.max(0,Math.min(xe+se,N.scrollWidth-ae+_e)))}K.push({el:N,top:fe,left:se})}return K};function R(p){return p===Object(p)&&Object.keys(p).length!==0}function W(p,b){b===void 0&&(b="auto");var M="scrollBehavior"in document.body.style;p.forEach(function(A){var S=A.el,x=A.top,d=A.left;S.scroll&&M?S.scroll({top:x,left:d,behavior:b}):(S.scrollTop=x,S.scrollLeft=d)})}function B(p){return p===!1?{block:"end",inline:"nearest"}:R(p)?p:{block:"start",inline:"nearest"}}function P(p,b){var M=!p.ownerDocument.documentElement.contains(p);if(R(b)&&typeof b.behavior=="function")return b.behavior(M?[]:F(p,b));if(M)return;var A=B(b);return W(F(p,A),A.behavior)}var w=$e.a=P},Zss7:function(lt,$e,ie){var ne;(function($){var k=/^\s+/,Y=/\s+$/,F=0,R=$.round,W=$.min,B=$.max,P=$.random;function w(te,fe){if(te=te||"",fe=fe||{},te instanceof w)return te;if(!(this instanceof w))return new w(te,fe);var se=p(te);this._originalInput=te,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=R(100*this._a)/100,this._format=fe.format||se.format,this._gradientType=fe.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=se.ok,this._tc_id=F++}w.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),fe,se,_e,Oe,xe,Pe;return fe=te.r/255,se=te.g/255,_e=te.b/255,fe<=.03928?Oe=fe/12.92:Oe=$.pow((fe+.055)/1.055,2.4),se<=.03928?xe=se/12.92:xe=$.pow((se+.055)/1.055,2.4),_e<=.03928?Pe=_e/12.92:Pe=$.pow((_e+.055)/1.055,2.4),.2126*Oe+.7152*xe+.0722*Pe},setAlpha:function(te){return this._a=K(te),this._roundA=R(100*this._a)/100,this},toHsv:function(){var te=S(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=S(this._r,this._g,this._b),fe=R(te.h*360),se=R(te.s*100),_e=R(te.v*100);return this._a==1?"hsv("+fe+", "+se+"%, "+_e+"%)":"hsva("+fe+", "+se+"%, "+_e+"%, "+this._roundA+")"},toHsl:function(){var te=M(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=M(this._r,this._g,this._b),fe=R(te.h*360),se=R(te.s*100),_e=R(te.l*100);return this._a==1?"hsl("+fe+", "+se+"%, "+_e+"%)":"hsla("+fe+", "+se+"%, "+_e+"%, "+this._roundA+")"},toHex:function(te){return d(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(I(this._r,255)*100)+"%",g:R(I(this._g,255)*100)+"%",b:R(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(I(this._r,255)*100)+"%, "+R(I(this._g,255)*100)+"%, "+R(I(this._b,255)*100)+"%)":"rgba("+R(I(this._r,255)*100)+"%, "+R(I(this._g,255)*100)+"%, "+R(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var fe="#"+s(this._r,this._g,this._b,this._a),se=fe,_e=this._gradientType?"GradientType = 1, ":"";if(te){var Oe=w(te);se="#"+s(Oe._r,Oe._g,Oe._b,Oe._a)}return"progid:DXImageTransform.Microsoft.gradient("+_e+"startColorstr="+fe+",endColorstr="+se+")"},toString:function(te){var fe=!!te;te=te||this._format;var se=!1,_e=this._a<1&&this._a>=0,Oe=!fe&&_e&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Oe?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(se=this.toRgbString()),te==="prgb"&&(se=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(se=this.toHexString()),te==="hex3"&&(se=this.toHexString(!0)),te==="hex4"&&(se=this.toHex8String(!0)),te==="hex8"&&(se=this.toHex8String()),te==="name"&&(se=this.toName()),te==="hsl"&&(se=this.toHslString()),te==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return w(this.toString())},_applyModification:function(te,fe){var se=te.apply(null,[this].concat([].slice.call(fe)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(te,fe){return te.apply(null,[this].concat([].slice.call(fe)))},analogous:function(){return this._applyCombination(E,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(m,arguments)},splitcomplement:function(){return this._applyCombination(C,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},w.fromRatio=function(te,fe){if(typeof te=="object"){var se={};for(var _e in te)te.hasOwnProperty(_e)&&(_e==="a"?se[_e]=te[_e]:se[_e]=Ae(te[_e]));te=se}return w(te,fe)};function p(te){var fe={r:0,g:0,b:0},se=1,_e=null,Oe=null,xe=null,Pe=!1,Ne=!1;return typeof te=="string"&&(te=me(te)),typeof te=="object"&&(Se(te.r)&&Se(te.g)&&Se(te.b)?(fe=b(te.r,te.g,te.b),Pe=!0,Ne=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Se(te.h)&&Se(te.s)&&Se(te.v)?(_e=Ae(te.s),Oe=Ae(te.v),fe=x(te.h,_e,Oe),Pe=!0,Ne="hsv"):Se(te.h)&&Se(te.s)&&Se(te.l)&&(_e=Ae(te.s),xe=Ae(te.l),fe=A(te.h,_e,xe),Pe=!0,Ne="hsl"),te.hasOwnProperty("a")&&(se=te.a)),se=K(se),{ok:Pe,format:te.format||Ne,r:W(255,B(fe.r,0)),g:W(255,B(fe.g,0)),b:W(255,B(fe.b,0)),a:se}}function b(te,fe,se){return{r:I(te,255)*255,g:I(fe,255)*255,b:I(se,255)*255}}function M(te,fe,se){te=I(te,255),fe=I(fe,255),se=I(se,255);var _e=B(te,fe,se),Oe=W(te,fe,se),xe,Pe,Ne=(_e+Oe)/2;if(_e==Oe)xe=Pe=0;else{var Be=_e-Oe;Pe=Ne>.5?Be/(2-_e-Oe):Be/(_e+Oe);switch(_e){case te:xe=(fe-se)/Be+(fe<se?6:0);break;case fe:xe=(se-te)/Be+2;break;case se:xe=(te-fe)/Be+4;break}xe/=6}return{h:xe,s:Pe,l:Ne}}function A(te,fe,se){var _e,Oe,xe;te=I(te,360),fe=I(fe,100),se=I(se,100);function Pe(We,Ue,Fe){return Fe<0&&(Fe+=1),Fe>1&&(Fe-=1),Fe<1/6?We+(Ue-We)*6*Fe:Fe<1/2?Ue:Fe<2/3?We+(Ue-We)*(2/3-Fe)*6:We}if(fe===0)_e=Oe=xe=se;else{var Ne=se<.5?se*(1+fe):se+fe-se*fe,Be=2*se-Ne;_e=Pe(Be,Ne,te+1/3),Oe=Pe(Be,Ne,te),xe=Pe(Be,Ne,te-1/3)}return{r:_e*255,g:Oe*255,b:xe*255}}function S(te,fe,se){te=I(te,255),fe=I(fe,255),se=I(se,255);var _e=B(te,fe,se),Oe=W(te,fe,se),xe,Pe,Ne=_e,Be=_e-Oe;if(Pe=_e===0?0:Be/_e,_e==Oe)xe=0;else{switch(_e){case te:xe=(fe-se)/Be+(fe<se?6:0);break;case fe:xe=(se-te)/Be+2;break;case se:xe=(te-fe)/Be+4;break}xe/=6}return{h:xe,s:Pe,v:Ne}}function x(te,fe,se){te=I(te,360)*6,fe=I(fe,100),se=I(se,100);var _e=$.floor(te),Oe=te-_e,xe=se*(1-fe),Pe=se*(1-Oe*fe),Ne=se*(1-(1-Oe)*fe),Be=_e%6,We=[se,Pe,xe,xe,Ne,se][Be],Ue=[Ne,se,se,Pe,xe,xe][Be],Fe=[xe,xe,Ne,se,se,Pe][Be];return{r:We*255,g:Ue*255,b:Fe*255}}function d(te,fe,se,_e){var Oe=[he(R(te).toString(16)),he(R(fe).toString(16)),he(R(se).toString(16))];return _e&&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 a(te,fe,se,_e,Oe){var xe=[he(R(te).toString(16)),he(R(fe).toString(16)),he(R(se).toString(16)),he(be(_e))];return Oe&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function s(te,fe,se,_e){var Oe=[he(be(_e)),he(R(te).toString(16)),he(R(fe).toString(16)),he(R(se).toString(16))];return Oe.join("")}w.equals=function(te,fe){return!te||!fe?!1:w(te).toRgbString()==w(fe).toRgbString()},w.random=function(){return w.fromRatio({r:P(),g:P(),b:P()})};function u(te,fe){fe=fe===0?0:fe||10;var se=w(te).toHsl();return se.s-=fe/100,se.s=N(se.s),w(se)}function L(te,fe){fe=fe===0?0:fe||10;var se=w(te).toHsl();return se.s+=fe/100,se.s=N(se.s),w(se)}function f(te){return w(te).desaturate(100)}function v(te,fe){fe=fe===0?0:fe||10;var se=w(te).toHsl();return se.l+=fe/100,se.l=N(se.l),w(se)}function D(te,fe){fe=fe===0?0:fe||10;var se=w(te).toRgb();return se.r=B(0,W(255,se.r-R(255*-(fe/100)))),se.g=B(0,W(255,se.g-R(255*-(fe/100)))),se.b=B(0,W(255,se.b-R(255*-(fe/100)))),w(se)}function T(te,fe){fe=fe===0?0:fe||10;var se=w(te).toHsl();return se.l-=fe/100,se.l=N(se.l),w(se)}function g(te,fe){var se=w(te).toHsl(),_e=(se.h+fe)%360;return se.h=_e<0?360+_e:_e,w(se)}function c(te){var fe=w(te).toHsl();return fe.h=(fe.h+180)%360,w(fe)}function h(te){var fe=w(te).toHsl(),se=fe.h;return[w(te),w({h:(se+120)%360,s:fe.s,l:fe.l}),w({h:(se+240)%360,s:fe.s,l:fe.l})]}function o(te){var fe=w(te).toHsl(),se=fe.h;return[w(te),w({h:(se+90)%360,s:fe.s,l:fe.l}),w({h:(se+180)%360,s:fe.s,l:fe.l}),w({h:(se+270)%360,s:fe.s,l:fe.l})]}function C(te){var fe=w(te).toHsl(),se=fe.h;return[w(te),w({h:(se+72)%360,s:fe.s,l:fe.l}),w({h:(se+216)%360,s:fe.s,l:fe.l})]}function E(te,fe,se){fe=fe||6,se=se||30;var _e=w(te).toHsl(),Oe=360/se,xe=[w(te)];for(_e.h=(_e.h-(Oe*fe>>1)+720)%360;--fe;)_e.h=(_e.h+Oe)%360,xe.push(w(_e));return xe}function m(te,fe){fe=fe||6;for(var se=w(te).toHsv(),_e=se.h,Oe=se.s,xe=se.v,Pe=[],Ne=1/fe;fe--;)Pe.push(w({h:_e,s:Oe,v:xe})),xe=(xe+Ne)%1;return Pe}w.mix=function(te,fe,se){se=se===0?0:se||50;var _e=w(te).toRgb(),Oe=w(fe).toRgb(),xe=se/100,Pe={r:(Oe.r-_e.r)*xe+_e.r,g:(Oe.g-_e.g)*xe+_e.g,b:(Oe.b-_e.b)*xe+_e.b,a:(Oe.a-_e.a)*xe+_e.a};return w(Pe)},w.readability=function(te,fe){var se=w(te),_e=w(fe);return($.max(se.getLuminance(),_e.getLuminance())+.05)/($.min(se.getLuminance(),_e.getLuminance())+.05)},w.isReadable=function(te,fe,se){var _e=w.readability(te,fe),Oe,xe;xe=!1,Oe=ue(se);switch(Oe.level+Oe.size){case"AAsmall":case"AAAlarge":xe=_e>=4.5;break;case"AAlarge":xe=_e>=3;break;case"AAAsmall":xe=_e>=7;break}return xe},w.mostReadable=function(te,fe,se){var _e=null,Oe=0,xe,Pe,Ne,Be;se=se||{},Pe=se.includeFallbackColors,Ne=se.level,Be=se.size;for(var We=0;We<fe.length;We++)xe=w.readability(te,fe[We]),xe>Oe&&(Oe=xe,_e=w(fe[We]));return w.isReadable(te,_e,{level:Ne,size:Be})||!Pe?_e:(se.includeFallbackColors=!1,w.mostReadable(te,["#fff","#000"],se))};var O=w.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"},U=w.hexNames=j(O);function j(te){var fe={};for(var se in te)te.hasOwnProperty(se)&&(fe[te[se]]=se);return fe}function K(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,fe){q(te)&&(te="100%");var se=ae(te);return te=W(fe,B(0,parseFloat(te))),se&&(te=parseInt(te*fe,10)/100),$.abs(te-fe)<1e-6?1:te%fe/parseFloat(fe)}function N(te){return W(1,B(0,te))}function X(te){return parseInt(te,16)}function q(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ae(te){return typeof te=="string"&&te.indexOf("%")!=-1}function he(te){return te.length==1?"0"+te:""+te}function Ae(te){return te<=1&&(te=te*100+"%"),te}function be(te){return $.round(parseFloat(te)*255).toString(16)}function Te(te){return X(te)/255}var Ce=function(){var te="[-\\+]?\\d+%?",fe="[-\\+]?\\d*\\.\\d+%?",se="(?:"+fe+")|(?:"+te+")",_e="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",Oe="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+_e),rgba:new RegExp("rgba"+Oe),hsl:new RegExp("hsl"+_e),hsla:new RegExp("hsla"+Oe),hsv:new RegExp("hsv"+_e),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 Se(te){return!!Ce.CSS_UNIT.exec(te)}function me(te){te=te.replace(k,"").replace(Y,"").toLowerCase();var fe=!1;if(O[te])te=O[te],fe=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Ce.rgb.exec(te))?{r:se[1],g:se[2],b:se[3]}:(se=Ce.rgba.exec(te))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Ce.hsl.exec(te))?{h:se[1],s:se[2],l:se[3]}:(se=Ce.hsla.exec(te))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Ce.hsv.exec(te))?{h:se[1],s:se[2],v:se[3]}:(se=Ce.hsva.exec(te))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Ce.hex8.exec(te))?{r:X(se[1]),g:X(se[2]),b:X(se[3]),a:Te(se[4]),format:fe?"name":"hex8"}:(se=Ce.hex6.exec(te))?{r:X(se[1]),g:X(se[2]),b:X(se[3]),format:fe?"name":"hex"}:(se=Ce.hex4.exec(te))?{r:X(se[1]+""+se[1]),g:X(se[2]+""+se[2]),b:X(se[3]+""+se[3]),a:Te(se[4]+""+se[4]),format:fe?"name":"hex8"}:(se=Ce.hex3.exec(te))?{r:X(se[1]+""+se[1]),g:X(se[2]+""+se[2]),b:X(se[3]+""+se[3]),format:fe?"name":"hex"}:!1}function ue(te){var fe,se;return te=te||{level:"AA",size:"small"},fe=(te.level||"AA").toUpperCase(),se=(te.size||"small").toLowerCase(),fe!=="AA"&&fe!=="AAA"&&(fe="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:fe,size:se}}lt.exports?lt.exports=w:!(ne=function(){return w}.call($e,ie,$e,lt),ne!==void 0&&(lt.exports=ne))})(Math)},aRTE:function(lt,$e){lt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return $});var ne=ie("VTBJ");function $(k,Y){var F=Object(ne.a)({},k);return Array.isArray(Y)&&Y.forEach(function(R){delete F[R]}),F}},c5Ni:function(lt,$e,ie){},dQei:function(lt,$e){for(var ie={glog:function($){if($<1)throw new Error("glog("+$+")");return ie.LOG_TABLE[$]},gexp:function($){for(;$<0;)$+=255;for(;$>=256;)$-=255;return ie.EXP_TABLE[$]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},ne=0;ne<8;ne++)ie.EXP_TABLE[ne]=1<<ne;for(var ne=8;ne<256;ne++)ie.EXP_TABLE[ne]=ie.EXP_TABLE[ne-4]^ie.EXP_TABLE[ne-5]^ie.EXP_TABLE[ne-6]^ie.EXP_TABLE[ne-8];for(var ne=0;ne<255;ne++)ie.LOG_TABLE[ie.EXP_TABLE[ne]]=ne;lt.exports=ie},dWSS:function(lt,$e,ie){var ne=ie("dQei");function $(k,Y){if(k.length==null)throw new Error(k.length+"/"+Y);for(var F=0;F<k.length&&k[F]==0;)F++;this.num=new Array(k.length-F+Y);for(var R=0;R<k.length-F;R++)this.num[R]=k[R+F]}$.prototype={get:function(k){return this.num[k]},getLength:function(){return this.num.length},multiply:function(k){for(var Y=new Array(this.getLength()+k.getLength()-1),F=0;F<this.getLength();F++)for(var R=0;R<k.getLength();R++)Y[F+R]^=ne.gexp(ne.glog(this.get(F))+ne.glog(k.get(R)));return new $(Y,0)},mod:function(k){if(this.getLength()-k.getLength()<0)return this;for(var Y=ne.glog(this.get(0))-ne.glog(k.get(0)),F=new Array(this.getLength()),R=0;R<this.getLength();R++)F[R]=this.get(R);for(var R=0;R<k.getLength();R++)F[R]^=ne.gexp(ne.glog(k.get(R))+Y);return new $(F,0).mod(k)}},lt.exports=$},dejd:function(lt,$e,ie){},dmUQ:function(lt,$e,ie){"use strict";var ne=ie("Ff2n"),$=ie("rePB"),k=ie("1OyB"),Y=ie("vuIU"),F=ie("Ji7U"),R=ie("md7G"),W=ie("foSv"),B=ie("q1tI"),P=ie.n(B),w=ie("TSYQ"),p=ie.n(w),b=ie("4IlW");function M(h,o){var C=Object.keys(h);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(h);o&&(E=E.filter(function(m){return Object.getOwnPropertyDescriptor(h,m).enumerable})),C.push.apply(C,E)}return C}function A(h){for(var o=1;o<arguments.length;o++){var C=arguments[o]!=null?arguments[o]:{};o%2?M(Object(C),!0).forEach(function(E){Object($.a)(h,E,C[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(C)):M(Object(C)).forEach(function(E){Object.defineProperty(h,E,Object.getOwnPropertyDescriptor(C,E))})}return h}function S(h){var o=x();return function(){var E=Object(W.a)(h),m;if(o){var O=Object(W.a)(this).constructor;m=Reflect.construct(E,arguments,O)}else m=E.apply(this,arguments);return Object(R.a)(this,m)}}function x(){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 d(){}function a(h){h.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},u=200,L=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(o){return o!=null},D=function(o,C){return C===o||typeof C=="number"&&typeof o=="number"&&isNaN(C)&&isNaN(o)},T=function(h){Object(F.a)(C,h);var o=S(C);function C(E){var m;Object(k.a)(this,C),m=o.call(this,E),m.onKeyDown=function(j){var K=m.props,I=K.onKeyDown,N=K.onPressEnter;if(j.keyCode===b.a.UP){var X=m.getRatio(j);m.up(j,X,null),m.stop()}else if(j.keyCode===b.a.DOWN){var q=m.getRatio(j);m.down(j,q,null),m.stop()}else j.keyCode===b.a.ENTER&&N&&N(j);if(m.recordCursorPosition(),m.lastKeyCode=j.keyCode,I){for(var ae=arguments.length,he=new Array(ae>1?ae-1:0),Ae=1;Ae<ae;Ae++)he[Ae-1]=arguments[Ae];I.apply(void 0,[j].concat(he))}},m.onKeyUp=function(j){var K=m.props.onKeyUp;if(m.stop(),m.recordCursorPosition(),K){for(var I=arguments.length,N=new Array(I>1?I-1:0),X=1;X<I;X++)N[X-1]=arguments[X];K.apply(void 0,[j].concat(N))}},m.onChange=function(j){var K=m.props.onChange;m.state.focused&&(m.inputting=!0),m.rawInput=m.props.parser(m.getValueFromEvent(j)),m.setState({inputValue:m.rawInput}),K(m.toNumber(m.rawInput))},m.onMouseUp=function(){var j=m.props.onMouseUp;m.recordCursorPosition(),j&&j.apply(void 0,arguments)},m.onFocus=function(){var j;m.setState({focused:!0}),(j=m.props).onFocus.apply(j,arguments)},m.onBlur=function(){var j=m.props.onBlur;m.inputting=!1,m.setState({focused:!1});var K=m.getCurrentValidValue(m.state.inputValue),I=m.setValue(K,d);if(j){var N=m.input.value,X=m.getInputDisplayValue({focus:!1,value:I});m.input.value=X&&Number(X),j.apply(void 0,arguments),m.input.value=N}},m.getRatio=function(j){var K=1;return j.metaKey||j.ctrlKey?K=.1:j.shiftKey&&(K=10),K},m.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},m.getPrecision=function(j){if(v(m.props.precision))return m.props.precision;var K=String(j);if(K.indexOf("e-")>=0)return parseInt(K.slice(K.indexOf("e-")+2),10);var I=0;return K.indexOf(".")>=0&&(I=K.length-K.indexOf(".")-1),I},m.getInputDisplayValue=function(j){var K=j||m.state,I=K.focused,N=K.inputValue,X=K.value,q;I?q=N:q=m.toPrecisionAsStep(X),q==null&&(q="");var ae=m.formatWrapper(q);return v(m.props.decimalSeparator)&&(ae=ae.toString().replace(".",m.props.decimalSeparator)),ae},m.recordCursorPosition=function(){try{m.cursorStart=m.input.selectionStart,m.cursorEnd=m.input.selectionEnd,m.currentValue=m.input.value,m.cursorBefore=m.input.value.substring(0,m.cursorStart),m.cursorAfter=m.input.value.substring(m.cursorEnd)}catch(j){}},m.restoreByAfter=function(j){if(j===void 0)return!1;var K=m.input.value,I=K.lastIndexOf(j);if(I===-1)return!1;var N=m.cursorBefore.length;return m.lastKeyCode===b.a.DELETE&&m.cursorBefore.charAt(N-1)===j[0]?(m.fixCaret(N,N),!0):I+j.length===K.length?(m.fixCaret(I,I),!0):!1},m.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(K,I){var N=j.substring(I);return m.restoreByAfter(N)})},m.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},m.stop=function(){m.autoStepTimer&&clearTimeout(m.autoStepTimer)},m.down=function(j,K,I){m.pressingUpOrDown=!0,m.step("down",j,K,I)},m.up=function(j,K,I){m.pressingUpOrDown=!0,m.step("up",j,K,I)},m.saveInput=function(j){m.input=j};var O=E.value;O===void 0&&(O=E.defaultValue),m.state={focused:E.autoFocus};var U=m.getValidValue(m.toNumber(O));return m.state=A(A({},m.state),{},{inputValue:m.toPrecisionAsStep(U),value:U}),m}return Object(Y.a)(C,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(m){var O=this.props,U=O.value,j=O.onChange,K=O.max,I=O.min,N=this.state.focused;if(m){if(!D(m.value,U)||!D(m.max,K)||!D(m.min,I)){var X=N?U:this.getValidValue(U),q;this.pressingUpOrDown?q=X:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:q})}var ae="value"in this.props?U:this.state.value;"max"in this.props&&m.max!==K&&typeof ae=="number"&&ae>K&&j&&j(K),"min"in this.props&&m.min!==I&&typeof ae=="number"&&ae<I&&j&&j(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var he=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?he=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(he=this.cursorStart):he=this.input.value.length,this.fixCaret(he,he)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ae){}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(m){var O=m;return O===""?O="":this.isNotCompleteNumber(parseFloat(O))?O=this.state.value:O=this.getValidValue(O),this.toNumber(O)}},{key:"getValueFromEvent",value:function(m){var O=m.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(O=O.replace(this.props.decimalSeparator,".")),O}},{key:"getValidValue",value:function(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(m);return isNaN(j)?m:(j<O&&(j=O),j>U&&(j=U),j)}},{key:"setValue",value:function(m,O){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(m))?null:parseFloat(m),K=this.state.value,I=K===void 0?null:K,N=this.state.inputValue,X=N===void 0?null:N,q=typeof j=="number"?j.toFixed(U):"".concat(j),ae=j!==I||q!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},O)):this.setState({value:j,inputValue:this.toPrecisionAsStep(m)},O),ae&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,K=U.step;if(v(j))return j;var I=this.getPrecision(O),N=this.getPrecision(K),X=this.getPrecision(m);return m?Math.max(X,I+N):I+N}},{key:"getPrecisionFactor",value:function(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(m,O);return Math.pow(10,U)}},{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(m){return this.props.formatter?this.props.formatter(m):m}},{key:"toPrecisionAsStep",value:function(m){if(this.isNotCompleteNumber(m)||m==="")return m;var O=Math.abs(this.getMaxPrecision(m));return isNaN(O)?m.toString():Number(m).toFixed(O)}},{key:"toNumber",value:function(m){var O=this.props.precision,U=this.state.focused,j=m&&m.length>16&&U;return this.isNotCompleteNumber(m)||j?m:v(O)?Math.round(m*Math.pow(10,O))/Math.pow(10,O):Number(m)}},{key:"upStep",value:function(m,O){var U=this.props.step,j=this.getPrecisionFactor(m,O),K=Math.abs(this.getMaxPrecision(m,O)),I=((j*m+j*U*O)/j).toFixed(K);return this.toNumber(I)}},{key:"downStep",value:function(m,O){var U=this.props.step,j=this.getPrecisionFactor(m,O),K=Math.abs(this.getMaxPrecision(m,O)),I=((j*m-j*U*O)/j).toFixed(K);return this.toNumber(I)}},{key:"step",value:function(m,O){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,K=arguments.length>3?arguments[3]:void 0;this.stop(),O&&(O.persist(),O.preventDefault());var I=this.props;if(I.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var X=this["".concat(m,"Step")](N,j),q=X>I.max||X<I.min;if(X>I.max?X=I.max:X<I.min&&(X=I.min),this.setValue(X,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){U[m](O,j,!0)},K?u:L)}},{key:"fixCaret",value:function(m,O){if(m===void 0||O===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(m!==U||O!==j)&&this.input.setSelectionRange(m,O)}catch(K){}}},{key:"render",value:function(){var m,O=this.props,U=O.prefixCls,j=O.disabled,K=O.readOnly,I=O.useTouch,N=O.autoComplete,X=O.upHandler,q=O.downHandler,ae=O.className,he=O.max,Ae=O.min,be=O.style,Te=O.title,Ce=O.onMouseEnter,Se=O.onMouseLeave,me=O.onMouseOver,ue=O.onMouseOut,te=O.required,fe=O.onClick,se=O.tabIndex,_e=O.type,Oe=O.placeholder,xe=O.id,Pe=O.inputMode,Ne=O.pattern,Be=O.step,We=O.maxLength,Ue=O.autoFocus,Fe=O.name,at=O.onPaste,it=O.onInput,et=Object(ne.a)(O,["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"]),Ze=this.state,ut=Ze.value,Je=Ze.focused,st=p()(U,(m={},Object($.a)(m,ae,!!ae),Object($.a)(m,"".concat(U,"-disabled"),j),Object($.a)(m,"".concat(U,"-focused"),Je),m)),ke={};Object.keys(et).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(ke[de]=et[de])});var nt=!K&&!j,qe=this.getInputDisplayValue(null),Ie=(ut||ut===0)&&(isNaN(ut)||Number(ut)>=he),He=(ut||ut===0)&&(isNaN(ut)||Number(ut)<=Ae),Ee=Ie||j||K,pe=He||j||K,ye=p()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object($.a)({},"".concat(U,"-handler-up-disabled"),Ee)),re=p()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object($.a)({},"".concat(U,"-handler-down-disabled"),pe)),oe=I?{onTouchStart:Ee?d:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},le=I?{onTouchStart:pe?d:this.down,onTouchEnd:this.stop}:{onMouseDown:pe?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:st,style:be,title:Te,onMouseEnter:Ce,onMouseLeave:Se,onMouseOver:me,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(U,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:ye}),X||P.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:a})),P.a.createElement("span",Object.assign({unselectable:"on"},le,{role:"button","aria-label":"Decrease Value","aria-disabled":pe,className:re}),q||P.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:a}))),P.a.createElement("div",{className:"".concat(U,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ae,"aria-valuemax":he,"aria-valuenow":ut,required:te,type:_e,placeholder:Oe,onPaste:at,onClick:fe,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:se,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:nt?this.onKeyDown:d,onKeyUp:nt?this.onKeyUp:d,autoFocus:Ue,maxLength:We,readOnly:K,disabled:j,max:he,min:Ae,step:Be,name:Fe,title:Te,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(qe),pattern:Ne,inputMode:Pe,onInput:it},ke))))}}]),C}(P.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var g=T,c=$e.a=g},f4xo:function(lt,$e,ie){var ne=ie("nVVt");function $(k){this.mode=ne.MODE_8BIT_BYTE,this.data=k}$.prototype={getLength:function(k){return this.data.length},write:function(k){for(var Y=0;Y<this.data.length;Y++)k.put(this.data.charCodeAt(Y),8)}},lt.exports=$},h78n:function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return m});var ne=ie("q1tI"),$=ie.n(ne),k=ie("TSYQ"),Y=ie.n(k),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var K=j.map(function(){return Object(ne.useRef)()}),I=Object(ne.useRef)();return Object(ne.useEffect)(function(){var N=Date.now(),X=!1;Object.keys(K).forEach(function(q){var ae=K[q].current;if(!ae)return;X=!0;var he=ae.style;he.transitionDuration=".3s, .3s, .3s, .06s",I.current&&N-I.current<100&&(he.transitionDuration="0s, 0s")}),X&&(I.current=Date.now())}),[K]};function W(){return W=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var K=arguments[j];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(U[I]=K[I])}return U},W.apply(this,arguments)}function B(U,j){return M(U)||b(U,j)||w(U,j)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(U,j){if(!U)return;if(typeof U=="string")return p(U,j);var K=Object.prototype.toString.call(U).slice(8,-1);if(K==="Object"&&U.constructor&&(K=U.constructor.name),K==="Map"||K==="Set")return Array.from(U);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return p(U,j)}function p(U,j){(j==null||j>U.length)&&(j=U.length);for(var K=0,I=new Array(j);K<j;K++)I[K]=U[K];return I}function b(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var K=[],I=!0,N=!1,X=void 0;try{for(var q=U[Symbol.iterator](),ae;!(I=(ae=q.next()).done)&&!(K.push(ae.value),j&&K.length===j);I=!0);}catch(he){N=!0,X=he}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw X}}return K}function M(U){if(Array.isArray(U))return U}function A(U,j){if(U==null)return{};var K=S(U,j),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(U);for(N=0;N<X.length;N++){if(I=X[N],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,I))continue;K[I]=U[I]}}return K}function S(U,j){if(U==null)return{};var K={},I=Object.keys(U),N,X;for(X=0;X<I.length;X++){if(N=I[X],j.indexOf(N)>=0)continue;K[N]=U[N]}return K}var x=function(j){var K=j.className,I=j.percent,N=j.prefixCls,X=j.strokeColor,q=j.strokeLinecap,ae=j.strokeWidth,he=j.style,Ae=j.trailColor,be=j.trailWidth,Te=j.transition,Ce=A(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var Se=Array.isArray(I)?I:[I],me=Array.isArray(X)?X:[X],ue=R(Se),te=B(ue,1),fe=te[0],se=ae/2,_e=100-ae/2,Oe="M ".concat(q==="round"?se:0,",").concat(se,`
L `).concat(q==="round"?_e:100,",").concat(se),xe="0 0 100 ".concat(ae),Pe=0;return $.a.createElement("svg",W({className:Y()("".concat(N,"-line"),K),viewBox:xe,preserveAspectRatio:"none",style:he},Ce),$.a.createElement("path",{className:"".concat(N,"-line-trail"),d:Oe,strokeLinecap:q,stroke:Ae,strokeWidth:be||ae,fillOpacity:"0"}),Se.map(function(Ne,Be){var We={strokeDasharray:"".concat(Ne,"px, 100px"),strokeDashoffset:"-".concat(Pe,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=me[Be]||me[me.length-1];return Pe+=Ne,$.a.createElement("path",{key:Be,className:"".concat(N,"-line-path"),d:Oe,strokeLinecap:q,stroke:Ue,strokeWidth:ae,fillOpacity:"0",ref:fe[Be],style:We})}))};x.defaultProps=F;var d=x;function a(){return a=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var K=arguments[j];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(U[I]=K[I])}return U},a.apply(this,arguments)}function s(U,j){return D(U)||v(U,j)||L(U,j)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(U,j){if(!U)return;if(typeof U=="string")return f(U,j);var K=Object.prototype.toString.call(U).slice(8,-1);if(K==="Object"&&U.constructor&&(K=U.constructor.name),K==="Map"||K==="Set")return Array.from(U);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return f(U,j)}function f(U,j){(j==null||j>U.length)&&(j=U.length);for(var K=0,I=new Array(j);K<j;K++)I[K]=U[K];return I}function v(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var K=[],I=!0,N=!1,X=void 0;try{for(var q=U[Symbol.iterator](),ae;!(I=(ae=q.next()).done)&&!(K.push(ae.value),j&&K.length===j);I=!0);}catch(he){N=!0,X=he}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw X}}return K}function D(U){if(Array.isArray(U))return U}function T(U,j){if(U==null)return{};var K=g(U,j),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(U);for(N=0;N<X.length;N++){if(I=X[N],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,I))continue;K[I]=U[I]}}return K}function g(U,j){if(U==null)return{};var K={},I=Object.keys(U),N,X;for(X=0;X<I.length;X++){if(N=I[X],j.indexOf(N)>=0)continue;K[N]=U[N]}return K}var c=0;function h(U){return+U.replace("%","")}function o(U){return Array.isArray(U)?U:[U]}function C(U,j,K,I){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,q=50-I/2,ae=0,he=-q,Ae=0,be=-2*q;switch(X){case"left":ae=-q,he=0,Ae=2*q,be=0;break;case"right":ae=q,he=0,Ae=-2*q,be=0;break;case"bottom":he=q,be=2*q;break;default:}var Te="M 50,50 m ".concat(ae,",").concat(he,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(Ae,",").concat(-be,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(-Ae,",").concat(be),Ce=Math.PI*2*q,Se={stroke:K,strokeDasharray:"".concat(j/100*(Ce-N),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(N/2+U/100*(Ce-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:Se}}var E=function(j){var K=j.prefixCls,I=j.strokeWidth,N=j.trailWidth,X=j.gapDegree,q=j.gapPosition,ae=j.trailColor,he=j.strokeLinecap,Ae=j.style,be=j.className,Te=j.strokeColor,Ce=j.percent,Se=T(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(ne.useMemo)(function(){return c+=1,c},[]),ue=C(0,100,ae,I,X,q),te=ue.pathString,fe=ue.pathStyle,se=o(Ce),_e=o(Te),Oe=_e.find(function(We){return Object.prototype.toString.call(We)==="[object Object]"}),xe=R(se),Pe=s(xe,1),Ne=Pe[0],Be=function(){var Ue=0;return se.map(function(Fe,at){var it=_e[at]||_e[_e.length-1],et=Object.prototype.toString.call(it)==="[object Object]"?"url(#".concat(K,"-gradient-").concat(me,")"):"",Ze=C(Ue,Fe,it,I,X,q);return Ue+=Fe,$.a.createElement("path",{key:at,className:"".concat(K,"-circle-path"),d:Ze.pathString,stroke:et,strokeLinecap:he,strokeWidth:I,opacity:Fe===0?0:1,fillOpacity:"0",style:Ze.pathStyle,ref:Ne[at]})})};return $.a.createElement("svg",a({className:Y()("".concat(K,"-circle"),be),viewBox:"0 0 100 100",style:Ae},Se),Oe&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(K,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Oe).sort(function(We,Ue){return h(We)-h(Ue)}).map(function(We,Ue){return $.a.createElement("stop",{key:Ue,offset:We,stopColor:Oe[We]})}))),$.a.createElement("path",{className:"".concat(K,"-circle-trail"),d:te,stroke:ae,strokeLinecap:he,strokeWidth:N||I,fillOpacity:"0",style:fe}),Be().reverse())};E.defaultProps=F;var m=E,O={Line:d,Circle:m}},kSUc:function(lt,$e,ie){},lZu9:function(lt,$e,ie){(function(ne){ne(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function($,k){var Y=ne.getMode($,"text/html"),F=Y.name=="null";function R(I){if(ne.findModeByName){var N=ne.findModeByName(I);N&&(I=N.mime||N.mimes[0])}var X=ne.getMode($,I);return X.name=="null"?null:X}k.highlightFormatting===void 0&&(k.highlightFormatting=!1),k.maxBlockquoteDepth===void 0&&(k.maxBlockquoteDepth=0),k.taskLists===void 0&&(k.taskLists=!1),k.strikethrough===void 0&&(k.strikethrough=!1),k.emoji===void 0&&(k.emoji=!1),k.fencedCodeBlockHighlighting===void 0&&(k.fencedCodeBlockHighlighting=!0),k.fencedCodeBlockDefaultMode===void 0&&(k.fencedCodeBlockDefaultMode="text/plain"),k.xml===void 0&&(k.xml=!0),k.tokenTypeOverrides===void 0&&(k.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 B in W)W.hasOwnProperty(B)&&k.tokenTypeOverrides[B]&&(W[B]=k.tokenTypeOverrides[B]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,w=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,p=/^\[(x| )\](?=\s)/i,b=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,x=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,a=" ";function s(I,N,X){return N.f=N.inline=X,X(I,N)}function u(I,N,X){return N.f=N.block=X,X(I,N)}function L(I){return!I||!/\S/.test(I.string)}function f(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==D){var N=F;if(!N){var X=ne.innerMode(Y,I.htmlState);N=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}N&&(I.f=h,I.block=v,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function v(I,N){var X=I.column()===N.indentation,q=L(N.prevLine.stream),ae=N.indentedCode,he=N.prevLine.hr,Ae=N.list!==!1,be=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Te=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Ae)){for(N.list=null;Te<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=Te-N.listStack[N.listStack.length-1])}var Ce=!q&&!he&&!N.prevLine.header&&(!Ae||!ae)&&!N.prevLine.fencedCodeEnd,Se=(N.list===!1||he||q)&&N.indentation<=be&&I.match(P),me=null;if(N.indentationDiff>=4&&(ae||N.prevLine.fencedCodeEnd||N.prevLine.header||q))return I.skipToEnd(),N.indentedCode=!0,W.code;if(I.eatSpace())return null;if(X&&N.indentation<=be&&(me=I.match(b))&&me[1].length<=6)return N.quote=0,N.header=me[1].length,N.thisLine.header=!0,k.highlightFormatting&&(N.formatting="header"),N.f=N.inline,g(N);if(N.indentation<=be&&I.eat(">"))return N.quote=X?1:N.quote+1,k.highlightFormatting&&(N.formatting="quote"),I.eatSpace(),g(N);if(!Se&&!N.setext&&X&&N.indentation<=be&&(me=I.match(w))){var ue=me[1]?"ol":"ul";return N.indentation=Te+I.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,k.taskLists&&I.match(p,!1)&&(N.taskList=!0),N.f=N.inline,k.highlightFormatting&&(N.formatting=["list","list-"+ue]),g(N)}else{if(X&&N.indentation<=be&&(me=I.match(S,!0)))return N.quote=0,N.fencedEndRE=new RegExp(me[1]+"+ *$"),N.localMode=k.fencedCodeBlockHighlighting&&R(me[2]||k.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ne.startState(N.localMode)),N.f=N.block=T,k.highlightFormatting&&(N.formatting="code-block"),N.code=-1,g(N);if(N.setext||(!Ce||!Ae)&&!N.quote&&N.list===!1&&!N.code&&!Se&&!x.test(I.string)&&(me=I.lookAhead(1))&&(me=me.match(M)))return N.setext?(N.header=N.setext,N.setext=0,I.skipToEnd(),k.highlightFormatting&&(N.formatting="header")):(N.header=me[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,g(N);if(Se)return I.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,W.hr;if(I.peek()==="[")return s(I,N,O)}return s(I,N,N.inline)}function D(I,N){var X=Y.token(I,N.htmlState);if(!F){var q=ne.innerMode(Y,N.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||N.md_inside&&I.current().indexOf(">")>-1)&&(N.f=h,N.block=v,N.htmlState=null)}return X}function T(I,N){var X=N.listStack[N.listStack.length-1]||0,q=N.indentation<X,ae=X+3;if(N.fencedEndRE&&N.indentation<=ae&&(q||I.match(N.fencedEndRE))){k.highlightFormatting&&(N.formatting="code-block");var he;return q||(he=g(N)),N.localMode=N.localState=null,N.block=v,N.f=h,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,q?u(I,N,N.block):he}else return N.localMode?N.localMode.token(I,N.localState):(I.skipToEnd(),W.code)}function g(I){var N=[];if(I.formatting){N.push(W.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var X=0;X<I.formatting.length;X++)N.push(W.formatting+"-"+I.formatting[X]),I.formatting[X]==="header"&&N.push(W.formatting+"-"+I.formatting[X]+"-"+I.header),I.formatting[X]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=I.quote?N.push(W.formatting+"-"+I.formatting[X]+"-"+I.quote):N.push("error"))}if(I.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(I.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(I.linkHref?N.push(W.linkHref,"url"):(I.strong&&N.push(W.strong),I.em&&N.push(W.em),I.strikethrough&&N.push(W.strikethrough),I.emoji&&N.push(W.emoji),I.linkText&&N.push(W.linkText),I.code&&N.push(W.code),I.image&&N.push(W.image),I.imageAltText&&N.push(W.imageAltText,"link"),I.imageMarker&&N.push(W.imageMarker)),I.header&&N.push(W.header,W.header+"-"+I.header),I.quote&&(N.push(W.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=I.quote?N.push(W.quote+"-"+I.quote):N.push(W.quote+"-"+k.maxBlockquoteDepth)),I.list!==!1){var q=(I.listStack.length-1)%3;q?q===1?N.push(W.list2):N.push(W.list3):N.push(W.list1)}return I.trailingSpaceNewLine?N.push("trailing-space-new-line"):I.trailingSpace&&N.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function c(I,N){return I.match(A,!0)?g(N):void 0}function h(I,N){var X=N.text(I,N);if(typeof X!="undefined")return X;if(N.list)return N.list=null,g(N);if(N.taskList){var q=I.match(p,!0)[1]===" ";return q?N.taskOpen=!0:N.taskClosed=!0,k.highlightFormatting&&(N.formatting="task"),N.taskList=!1,g(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&I.match(/^#+$/,!0))return k.highlightFormatting&&(N.formatting="header"),g(N);var ae=I.next();if(N.linkTitle){N.linkTitle=!1;var he=ae;ae==="("&&(he=")"),he=(he+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ae="^\\s*(?:[^"+he+"\\\\]+|\\\\\\\\|\\\\.)"+he;if(I.match(new RegExp(Ae),!0))return W.linkHref}if(ae==="`"){var be=N.formatting;k.highlightFormatting&&(N.formatting="code"),I.eatWhile("`");var Te=I.current().length;if(N.code==0&&(!N.quote||Te==1))return N.code=Te,g(N);if(Te==N.code){var Ce=g(N);return N.code=0,Ce}else return N.formatting=be,g(N)}else if(N.code)return g(N);if(ae==="\\"&&(I.next(),k.highlightFormatting)){var Se=g(N),me=W.formatting+"-escape";return Se?Se+" "+me:me}if(ae==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,k.highlightFormatting&&(N.formatting="image"),g(N);if(ae==="["&&N.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,k.highlightFormatting&&(N.formatting="image"),g(N);if(ae==="]"&&N.imageAltText){k.highlightFormatting&&(N.formatting="image");var Se=g(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=C,Se}if(ae==="["&&!N.image)return N.linkText&&I.match(/^.*?\]/)||(N.linkText=!0,k.highlightFormatting&&(N.formatting="link")),g(N);if(ae==="]"&&N.linkText){k.highlightFormatting&&(N.formatting="link");var Se=g(N);return N.linkText=!1,N.inline=N.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?C:h,Se}if(ae==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,k.highlightFormatting&&(N.formatting="link");var Se=g(N);return Se?Se+=" ":Se="",Se+W.linkInline}if(ae==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,k.highlightFormatting&&(N.formatting="link");var Se=g(N);return Se?Se+=" ":Se="",Se+W.linkEmail}if(k.xml&&ae==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var te=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(N.md_inside=!0)}return I.backUp(1),N.htmlState=ne.startState(Y),u(I,N,D)}if(k.xml&&ae==="<"&&I.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var fe=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);fe<3&&I.eat(ae);)fe++;var _e=I.peek()||" ",Oe=!/\s/.test(_e)&&(!d.test(_e)||/\s/.test(se)||d.test(se)),xe=!/\s/.test(se)&&(!d.test(se)||/\s/.test(_e)||d.test(_e)),Pe=null,Ne=null;if(fe%2&&(!N.em&&Oe&&(ae==="*"||!xe||d.test(se))?Pe=!0:N.em==ae&&xe&&(ae==="*"||!Oe||d.test(_e))&&(Pe=!1)),fe>1&&(!N.strong&&Oe&&(ae==="*"||!xe||d.test(se))?Ne=!0:N.strong==ae&&xe&&(ae==="*"||!Oe||d.test(_e))&&(Ne=!1)),Ne!=null||Pe!=null){k.highlightFormatting&&(N.formatting=Pe==null?"strong":Ne==null?"em":"strong em"),Pe===!0&&(N.em=ae),Ne===!0&&(N.strong=ae);var Ce=g(N);return Pe===!1&&(N.em=!1),Ne===!1&&(N.strong=!1),Ce}}else if(ae===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return g(N);I.backUp(1)}if(k.strikethrough){if(ae==="~"&&I.eatWhile(ae)){if(N.strikethrough){k.highlightFormatting&&(N.formatting="strikethrough");var Ce=g(N);return N.strikethrough=!1,Ce}else if(I.match(/^[^\s]/,!1))return N.strikethrough=!0,k.highlightFormatting&&(N.formatting="strikethrough"),g(N)}else if(ae===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return g(N);I.backUp(2)}}if(k.emoji&&ae===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,k.highlightFormatting&&(N.formatting="emoji");var Be=g(N);return N.emoji=!1,Be}return ae===" "&&(I.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),g(N)}function o(I,N){var X=I.next();if(X===">"){N.f=N.inline=h,k.highlightFormatting&&(N.formatting="link");var q=g(N);return q?q+=" ":q="",q+W.linkInline}return I.match(/^[^>]+/,!0),W.linkInline}function C(I,N){if(I.eatSpace())return null;var X=I.next();return X==="("||X==="["?(N.f=N.inline=m(X==="("?")":"]"),k.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,g(N)):"error"}var E={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function m(I){return function(N,X){var q=N.next();if(q===I){X.f=X.inline=h,k.highlightFormatting&&(X.formatting="link-string");var ae=g(X);return X.linkHref=!1,ae}return N.match(E[I]),X.linkHref=!0,g(X)}}function O(I,N){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=U,I.next(),k.highlightFormatting&&(N.formatting="link"),N.linkText=!0,g(N)):s(I,N,h)}function U(I,N){if(I.match(/^\]:/,!0)){N.f=N.inline=j,k.highlightFormatting&&(N.formatting="link");var X=g(N);return N.linkText=!1,X}return I.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function j(I,N){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?N.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=h,W.linkHref+" url")}var K={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:h,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ne.copyState(Y,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ne.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,N){if(N.formatting=!1,I!=N.thisLine.stream){if(N.header=0,N.hr=!1,I.match(/^\s*$/,!0))return f(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:I},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=D)){var X=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(N.indentation=X,N.indentationDiff=null,X>0)return null}}return N.f(I,N)},innerMode:function(I){return I.block==D?{state:I.htmlState,mode:Y}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:K}},indent:function(I,N,X){return I.block==D&&Y.indent?Y.indent(I.htmlState,N,X):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,N,X):ne.Pass},blankLine:f,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return K},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},nVVt:function(lt,$e){lt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(lt,$e,ie){(function(ne){ne(ie("VrN/"))})(function(ne){"use strict";var $=ne.Pos;function k(d,a){return d.line-a.line||d.ch-a.ch}var Y="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=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+Y+"]["+F+"]*)","g");function W(d,a,s,u){this.line=a,this.ch=s,this.cm=d,this.text=d.getLine(a),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function B(d,a){var s=d.cm.getTokenTypeAt($(d.line,a));return s&&/\btag\b/.test(s)}function P(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function w(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function p(d){for(;;){var a=d.text.indexOf(">",d.ch);if(a==-1){if(P(d))continue;return}if(!B(d,a+1)){d.ch=a+1;continue}var s=d.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(d.text.slice(s+1,a));return d.ch=a+1,u?"selfClose":"regular"}}function b(d){for(;;){var a=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(a==-1){if(w(d))continue;return}if(!B(d,a+1)){d.ch=a;continue}R.lastIndex=a,d.ch=a;var s=R.exec(d.text);if(s&&s.index==a)return s}}function M(d){for(;;){R.lastIndex=d.ch;var a=R.exec(d.text);if(!a){if(P(d))continue;return}if(!B(d,a.index+1)){d.ch=a.index+1;continue}return d.ch=a.index+a[0].length,a}}function A(d){for(;;){var a=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(a==-1){if(w(d))continue;return}if(!B(d,a+1)){d.ch=a;continue}var s=d.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(d.text.slice(s+1,a));return d.ch=a+1,u?"selfClose":"regular"}}function S(d,a){for(var s=[];;){var u=M(d),L,f=d.line,v=d.ch-(u?u[0].length:0);if(!u||!(L=p(d)))return;if(L=="selfClose")continue;if(u[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==u[2]){s.length=D;break}if(D<0&&(!a||a==u[2]))return{tag:u[2],from:$(f,v),to:$(d.line,d.ch)}}else s.push(u[2])}}function x(d,a){for(var s=[];;){var u=A(d);if(!u)return;if(u=="selfClose"){b(d);continue}var L=d.line,f=d.ch,v=b(d);if(!v)return;if(v[1])s.push(v[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==v[2]){s.length=D;break}if(D<0&&(!a||a==v[2]))return{tag:v[2],from:$(d.line,d.ch),to:$(L,f)}}}}ne.registerHelper("fold","xml",function(d,a){for(var s=new W(d,a.line,0);;){var u=M(s);if(!u||s.line!=a.line)return;var L=p(s);if(!L)return;if(!u[1]&&L!="selfClose"){var f=$(s.line,s.ch),v=S(s,u[2]);return v&&k(v.from,f)>0?{from:f,to:v.from}:null}}}),ne.findMatchingTag=function(d,a,s){var u=new W(d,a.line,a.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var L=p(u),f=L&&$(u.line,u.ch),v=L&&b(u);if(!L||!v||k(u,a)>0)return;var D={from:$(u.line,u.ch),to:f,tag:v[2]};return L=="selfClose"?{open:D,close:null,at:"open"}:v[1]?{open:x(u,v[2]),close:D,at:"close"}:(u=new W(d,f.line,f.ch,s),{open:D,close:S(u,v[2]),at:"open"})},ne.findEnclosingTag=function(d,a,s,u){for(var L=new W(d,a.line,a.ch,s);;){var f=x(L,u);if(!f)break;var v=new W(d,a.line,a.ch,s),D=S(v,f.tag);if(D)return{open:f,close:D}}},ne.scanForClosingTag=function(d,a,s,u){var L=new W(d,a.line,a.ch,u?{from:0,to:u}:null);return S(L,s)}})},p5ED:function(lt,$e,ie){"use strict";var ne=ie("+L6B"),$=ie("2/Rp"),k=ie("5Dmo"),Y=ie("3S7+"),F=ie("k1fw"),R=ie("tJVT"),W=ie("q1tI"),B=ie.n(W),P=ie("vHTk"),w=ie.n(P),p=ie("yEEn"),b=ie("ZW9T"),M=ie("1vsH");$e.a=function(A){var S=A.name,x=A.data,d=A.theme,a=A.type,s=A.filename,u=A.monacoEditor,L=A.className,f=A.style,v=A.close,D=A.onClose,T=A.hasMask,g=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(g,2),h=c[0],o=c[1],C=Object(W.useState)(""),E=Object(R.a)(C,2),m=E[0],O=E[1],U=Object(W.useRef)();s&&(u.filename=s),Object(W.useEffect)(function(){var I,N,X=(I=document.cookie)===null||I===void 0||((N=I.replace(/\s/g,""))===null||N===void 0)?void 0:N.split(";");X==null||X.map(function(q){var ae=q.split("=");ae[0]==="_educoder_session"&&O(ae[1])})},[]);var j=function(){if(x.startsWith("http")||x.startsWith("/")){K();return}Object(M.x)(s||"educoder",x,s)},K=function(){Object(M.v)(s||S,x)};return console.log("data:",x,"fileanme:",s," name:",S),B.a.createElement("div",{style:Object(F.a)({},f||{}),className:"".concat(T&&w.a.bgBlack," ").concat(a?w.a.wrp:"hide")},v&&B.a.createElement("div",{className:w.a.close,ref:U},B.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},B.a.createElement("span",{onClick:K},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},B.a.createElement("span",{className:"",onClick:D},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(w.a[L]," ").concat(L," ").concat(w.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&B.a.createElement(b.b,u)),a==="audio"&&B.a.createElement("audio",{src:"".concat(x!=null&&x.startsWith("/")||(x==null?void 0:x.indexOf("https://"))>-1?x:"data:audio/mp3;base64,").concat(x),autoPlay:!0}),a==="video"&&B.a.createElement(B.a.Fragment,null,x!=null&&x.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(x),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(x),autoPlay:!0})),a==="html"&&B.a.createElement("iframe",{src:x+"&disposition=inline"}),a==="pdf"&&B.a.createElement("embed",{className:w.a.embed,src:x}),a==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(x!=null&&x.startsWith("/")||(x==null?void 0:x.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(x)})),a==="other"&&B.a.createElement("div",null,B.a.createElement($.a,{type:"primary",size:"large",onClick:j},B.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&B.a.createElement($.a,{type:"primary",size:"large",onClick:j},B.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(lt,$e,ie){},"rAM+":function(lt,$e,ie){"use strict";ie.d($e,"a",function(){return $});var ne=ie("Qw5x");function $(k,Y){var F;if(typeof Symbol=="undefined"||k[Symbol.iterator]==null){if(Array.isArray(k)||(F=Object(ne.a)(k))||Y&&k&&typeof k.length=="number"){F&&(k=F);var R=0,W=function(){};return{s:W,n:function(){return R>=k.length?{done:!0}:{done:!1,value:k[R++]}},e:function(b){throw b},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 B=!0,P=!1,w;return{s:function(){F=k[Symbol.iterator]()},n:function(){var b=F.next();return B=b.done,b},e:function(b){P=!0,w=b},f:function(){try{!B&&F.return!=null&&F.return()}finally{if(P)throw w}}}}},rUJ1:function(lt,$e){const ie=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=T=>Y[T];function R(T,g){if(g){if(ie.test(T))return T.replace(ne,F)}else if($.test(T))return T.replace(k,F);return T}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(T){return T.replace(W,(g,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const P=/(^|[^\[])\^/g;function w(T,g){T=T.source||T,g=g||"";const c={replace:(h,o)=>(o=o.source||o,o=o.replace(P,"$1"),T=T.replace(h,o),c),getRegex:()=>new RegExp(T,g)};return c}const p=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(T,g,c){if(T){let h;try{h=decodeURIComponent(B(c)).replace(p,"").toLowerCase()}catch(o){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}g&&!b.test(c)&&(c=a(g,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(h){return null}return c}const A={},S=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(T,g){A[" "+T]||(S.test(T)?A[" "+T]=T+"/":A[" "+T]=f(T,"/",!0)),T=A[" "+T];const c=T.indexOf(":")===-1;return g.substring(0,2)==="//"?c?g:T.replace(x,"$1")+g:g.charAt(0)==="/"?c?g:T.replace(d,"$1")+g:T+g}const s={exec:function(){}};function u(T){let g=1,c,h;for(;g<arguments.length;g++){c=arguments[g];for(h in c)Object.prototype.hasOwnProperty.call(c,h)&&(T[h]=c[h])}return T}function L(T,g){const c=T.replace(/\|/g,(C,E,m)=>{let O=!1,U=E;for(;--U>=0&&m[U]==="\\";)O=!O;return O?"|":" |"}),h=c.split(/ \|/);let o=0;if(h.length>g)h.splice(g);else for(;h.length<g;)h.push("");for(;o<h.length;o++)h[o]=h[o].trim().replace(/\\\|/g,"|");return h}function f(T,g,c){const h=T.length;if(h===0)return"";let o=0;for(;o<h;){const C=T.charAt(h-o-1);if(C===g&&!c)o++;else if(C!==g&&c)o++;else break}return T.substr(0,h-o)}function v(T,g){if(T.indexOf(g[1])===-1)return-1;const c=T.length;let h=0,o=0;for(;o<c;o++)if(T[o]==="\\")o++;else if(T[o]===g[0])h++;else if(T[o]===g[1]&&(h--,h<0))return o;return-1}function D(T){T&&T.sanitize&&!T.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")}lt.exports={escape:R,unescape:B,edit:w,cleanUrl:M,resolveUrl:a,noopTest:s,merge:u,splitCells:L,rtrim:f,findClosingBracket:v,checkSanitizeDeprecation:D}},rcnY:function(lt,$e,ie){var ne=ie("aRTE");function $(k,Y){this.totalCount=k,this.dataCount=Y}$.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],$.getRSBlocks=function(k,Y){var F=$.getRsBlockTable(k,Y);if(F==null)throw new Error("bad rs block @ typeNumber:"+k+"/errorCorrectLevel:"+Y);for(var R=F.length/3,W=new Array,B=0;B<R;B++)for(var P=F[B*3+0],w=F[B*3+1],p=F[B*3+2],b=0;b<P;b++)W.push(new $(w,p));return W},$.getRsBlockTable=function(k,Y){switch(Y){case ne.L:return $.RS_BLOCK_TABLE[(k-1)*4+0];case ne.M:return $.RS_BLOCK_TABLE[(k-1)*4+1];case ne.Q:return $.RS_BLOCK_TABLE[(k-1)*4+2];case ne.H:return $.RS_BLOCK_TABLE[(k-1)*4+3];default:return}},lt.exports=$},ulZh:function(lt,$e,ie){typeof window!="undefined"&&function($,k){lt.exports=k()}(this,function(){return function(ne){var $={};function k(Y){if($[Y])return $[Y].exports;var F=$[Y]={i:Y,l:!1,exports:{}};return ne[Y].call(F.exports,F,F.exports,k),F.l=!0,F.exports}return k.m=ne,k.c=$,k.d=function(Y,F,R){k.o(Y,F)||Object.defineProperty(Y,F,{enumerable:!0,get:R})},k.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},k.t=function(Y,F){if(F&1&&(Y=k(Y)),F&8)return Y;if(F&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var R=Object.create(null);if(k.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:Y}),F&2&&typeof Y!="string")for(var W in Y)k.d(R,W,function(B){return Y[B]}.bind(null,W));return R},k.n=function(Y){var F=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return k.d(F,"a",F),F},k.o=function(Y,F){return Object.prototype.hasOwnProperty.call(Y,F)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,$,k){"use strict";var Y=Object.prototype.hasOwnProperty,F="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(F=!1));function W(p,b,M){this.fn=p,this.context=b,this.once=M||!1}function B(p,b,M,A,S){if(typeof M!="function")throw new TypeError("The listener must be a function");var x=new W(M,A||p,S),d=F?F+b:b;return p._events[d]?p._events[d].fn?p._events[d]=[p._events[d],x]:p._events[d].push(x):(p._events[d]=x,p._eventsCount++),p}function P(p,b){--p._eventsCount===0?p._events=new R:delete p._events[b]}function w(){this._events=new R,this._eventsCount=0}w.prototype.eventNames=function(){var b=[],M,A;if(this._eventsCount===0)return b;for(A in M=this._events)Y.call(M,A)&&b.push(F?A.slice(1):A);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(M)):b},w.prototype.listeners=function(b){var M=F?F+b:b,A=this._events[M];if(!A)return[];if(A.fn)return[A.fn];for(var S=0,x=A.length,d=new Array(x);S<x;S++)d[S]=A[S].fn;return d},w.prototype.listenerCount=function(b){var M=F?F+b:b,A=this._events[M];return A?A.fn?1:A.length:0},w.prototype.emit=function(b,M,A,S,x,d){var a=F?F+b:b;if(!this._events[a])return!1;var s=this._events[a],u=arguments.length,L,f;if(s.fn){s.once&&this.removeListener(b,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,M),!0;case 3:return s.fn.call(s.context,M,A),!0;case 4:return s.fn.call(s.context,M,A,S),!0;case 5:return s.fn.call(s.context,M,A,S,x),!0;case 6:return s.fn.call(s.context,M,A,S,x,d),!0}for(f=1,L=new Array(u-1);f<u;f++)L[f-1]=arguments[f];s.fn.apply(s.context,L)}else{var v=s.length,D;for(f=0;f<v;f++){s[f].once&&this.removeListener(b,s[f].fn,void 0,!0);switch(u){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,M);break;case 3:s[f].fn.call(s[f].context,M,A);break;case 4:s[f].fn.call(s[f].context,M,A,S);break;default:if(!L)for(D=1,L=new Array(u-1);D<u;D++)L[D-1]=arguments[D];s[f].fn.apply(s[f].context,L)}}}return!0},w.prototype.on=function(b,M,A){return B(this,b,M,A,!1)},w.prototype.once=function(b,M,A){return B(this,b,M,A,!0)},w.prototype.removeListener=function(b,M,A,S){var x=F?F+b:b;if(!this._events[x])return this;if(!M)return P(this,x),this;var d=this._events[x];if(d.fn)d.fn===M&&(!S||d.once)&&(!A||d.context===A)&&P(this,x);else{for(var a=0,s=[],u=d.length;a<u;a++)(d[a].fn!==M||S&&!d[a].once||A&&d[a].context!==A)&&s.push(d[a]);s.length?this._events[x]=s.length===1?s[0]:s:P(this,x)}return this},w.prototype.removeAllListeners=function(b){var M;return b?(M=F?F+b:b,this._events[M]&&P(this,M)):(this._events=new R,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=F,w.EventEmitter=w,ne.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,$,k){(function(Y){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(w,p,b){if(b=b||{},w=w.trim(),p=p.trim(),!p){if(!b.alwaysNormalize)return w;var M=P.parseURL(w);if(!M)throw new Error("Error trying to parse base URL.");return M.path=P.normalizePath(M.path),P.buildURLFromParts(M)}var A=P.parseURL(p);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return b.alwaysNormalize?(A.path=P.normalizePath(A.path),P.buildURLFromParts(A)):p;var S=P.parseURL(w);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var x=R.exec(S.path);S.netLoc=x[1],S.path=x[2]}S.netLoc&&!S.path&&(S.path="/");var d={scheme:S.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(d.netLoc=S.netLoc,A.path[0]!=="/"))if(!A.path)d.path=S.path,A.params||(d.params=S.params,A.query||(d.query=S.query));else{var a=S.path,s=a.substring(0,a.lastIndexOf("/")+1)+A.path;d.path=P.normalizePath(s)}return d.path===null&&(d.path=b.alwaysNormalize?P.normalizePath(A.path):A.path),P.buildURLFromParts(d)},parseURL:function(w){var p=F.exec(w);return p?{scheme:p[1]||"",netLoc:p[2]||"",path:p[3]||"",params:p[4]||"",query:p[5]||"",fragment:p[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(W,"");w.length!==(w=w.replace(B,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};ne.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,$,k){function Y(b){var M={};function A(x){if(M[x])return M[x].exports;var d=M[x]={i:x,l:!1,exports:{}};return b[x].call(d.exports,d,d.exports,A),d.l=!0,d.exports}A.m=b,A.c=M,A.i=function(x){return x},A.d=function(x,d,a){A.o(x,d)||Object.defineProperty(x,d,{configurable:!1,enumerable:!0,get:a})},A.r=function(x){Object.defineProperty(x,"__esModule",{value:!0})},A.n=function(x){var d=x&&x.__esModule?function(){return x.default}:function(){return x};return A.d(d,"a",d),d},A.o=function(x,d){return Object.prototype.hasOwnProperty.call(x,d)},A.p="/",A.oe=function(x){throw console.error(x),x};var S=A(A.s=ENTRY_MODULE);return S.default||S}var F="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function W(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(b){return!isNaN(1*b)}function P(b,M,A){var S={};S[A]=[];var x=M.toString(),d=x.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return S;for(var a=d[1],s=new RegExp("(\\\\n|\\W)"+W(a)+R,"g"),u;u=s.exec(x);){if(u[3]==="dll-reference")continue;S[A].push(u[3])}for(s=new RegExp("\\("+W(a)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+R,"g");u=s.exec(x);)b[u[2]]||(S[A].push(u[1]),b[u[2]]=k(u[1]).m),S[u[2]]=S[u[2]]||[],S[u[2]].push(u[4]);for(var L=Object.keys(S),f=0;f<L.length;f++)for(var v=0;v<S[L[f]].length;v++)B(S[L[f]][v])&&(S[L[f]][v]=1*S[L[f]][v]);return S}function w(b){var M=Object.keys(b);return M.reduce(function(A,S){return A||b[S].length>0},!1)}function p(b,M){for(var A={main:[M]},S={main:[]},x={main:{}};w(A);)for(var d=Object.keys(A),a=0;a<d.length;a++){var s=d[a],u=A[s],L=u.pop();if(x[s]=x[s]||{},x[s][L]||!b[s][L])continue;x[s][L]=!0,S[s]=S[s]||[],S[s].push(L);for(var f=P(b,b[s][L],s),v=Object.keys(f),D=0;D<v.length;D++)A[v[D]]=A[v[D]]||[],A[v[D]]=A[v[D]].concat(f[v[D]])}return S}ne.exports=function(b,M){M=M||{};var A={main:k.m},S=M.all?{main:Object.keys(A.main)}:p(A,b),x="";Object.keys(S).filter(function(L){return L!=="main"}).forEach(function(L){for(var f=0;S[L][f];)f++;S[L].push(f),A[L][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",x=x+"var "+L+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+S[L].map(function(v){return""+JSON.stringify(v)+": "+A[L][v].toString()}).join(",")+`});
`}),x=x+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+S.main.map(function(L){return""+JSON.stringify(L)+": "+A.main[L].toString()}).join(",")+"}))(self);";var d=new window.Blob([x],{type:"text/javascript"});if(M.bare)return d;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(ne,$,k){"use strict";k.r($),k.d($,"hlsDefaultConfig",function(){return D}),k.d($,"mergeConfig",function(){return g}),k.d($,"enableStreamingMode",function(){return c});var Y=k("./src/controller/abr-controller.ts"),F=k("./src/controller/audio-stream-controller.ts"),R=k("./src/controller/audio-track-controller.ts"),W=k("./src/controller/subtitle-stream-controller.ts"),B=k("./src/controller/subtitle-track-controller.ts"),P=k("./src/controller/buffer-controller.ts"),w=k("./src/controller/timeline-controller.ts"),p=k("./src/controller/cap-level-controller.ts"),b=k("./src/controller/fps-controller.ts"),M=k("./src/controller/eme-controller.ts"),A=k("./src/controller/cmcd-controller.ts"),S=k("./src/utils/xhr-loader.ts"),x=k("./src/utils/fetch-loader.ts"),d=k("./src/utils/cues.ts"),a=k("./src/utils/mediakeys-helper.ts"),s=k("./src/utils/logger.ts");function u(){return u=Object.assign||function(h){for(var o=1;o<arguments.length;o++){var C=arguments[o];for(var E in C)Object.prototype.hasOwnProperty.call(C,E)&&(h[E]=C[E])}return h},u.apply(this,arguments)}function L(h,o){var C=Object.keys(h);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(h);o&&(E=E.filter(function(m){return Object.getOwnPropertyDescriptor(h,m).enumerable})),C.push.apply(C,E)}return C}function f(h){for(var o=1;o<arguments.length;o++){var C=arguments[o]!=null?arguments[o]:{};o%2?L(Object(C),!0).forEach(function(E){v(h,E,C[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(C)):L(Object(C)).forEach(function(E){Object.defineProperty(h,E,Object.getOwnPropertyDescriptor(C,E))})}return h}function v(h,o,C){return o in h?Object.defineProperty(h,o,{value:C,enumerable:!0,configurable:!0,writable:!0}):h[o]=C,h}var D=f(f({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:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:P.default,capLevelController:p.default,fpsController:b.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:B.default,timelineController:w.TimelineController,audioStreamController:F.default,audioTrackController:R.default,emeController:M.default,cmcdController:A.default});function T(){return{cueHandler:d.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 g(h,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},h,o)}function c(h){var o=h.loader;if(o!==x.default&&o!==S.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var C=Object(x.fetchSupported)();C&&(h.loader=x.default,h.progressive=!0,h.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/polyfills/number.ts"),F=k("./src/utils/ewma-bandwidth-estimator.ts"),R=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/errors.ts"),P=k("./src/types/loader.ts"),w=k("./src/utils/logger.ts");function p(A,S){for(var x=0;x<S.length;x++){var d=S[x];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function b(A,S,x){return S&&p(A.prototype,S),x&&p(A,x),A}var M=function(){function A(x){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=x;var d=x.config;this.bwEstimator=new F.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var S=A.prototype;return S.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(d,a){var s=a.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=a.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(d,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var d=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,L=s.config,f=s.media;if(!d||!f)return;var v=a?a.stats:d.stats,D=a?a.duration:d.duration;if(v.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||f.paused||!f.playbackRate||!f.readyState)return;var T=performance.now()-v.loading.start,g=Math.abs(f.playbackRate);if(T<=500*D/g)return;var c=s.levels,h=s.minAutoLevel,o=c[d.level],C=v.total||Math.max(v.loaded,Math.round(D*o.maxBitrate/8)),E=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/T),m=(C-v.loaded)/E,O=f.currentTime,U=(W.BufferHelper.bufferInfo(f,O,L.maxBufferHole).end-O)/g;if(U>=2*D/g||m<=U)return;var j=Number.POSITIVE_INFINITY,K;for(K=d.level-1;K>h;K--){var I=c[K].maxBitrate;if(j=D*I/(8*.8*E),j<U)break}if(j>=m)return;var N=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+d.sn+(a?" part "+a.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+K+`
Current BW estimate: `+(Object(Y.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+m.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=K,this.bwEstimator.sample(T,v.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:a,stats:v})},S.onFragLoaded=function(d,a){var s=a.frag,u=a.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(s.sn)){var L=u?u.stats:s.stats,f=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[s.level],D=(v.loaded?v.loaded.bytes:0)+L.loaded,T=(v.loaded?v.loaded.duration:0)+f;v.loaded={bytes:D,duration:T},v.realBitrate=Math.round(8*D/T)}if(s.bitrateTest){var g={stats:L,frag:s,part:u,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,g),s.bitrateTest=!1}}},S.onFragBuffered=function(d,a){var s=a.frag,u=a.part,L=u?u.stats:s.stats;if(L.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=L.parsing.end-L.loading.start;this.bwEstimator.sample(f,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},S.onError=function(d,a){switch(a.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var d=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.maxAutoLevel,L=s.config,f=s.minAutoLevel,v=s.media,D=a?a.duration:d?d.duration:0,T=v?v.currentTime:0,g=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,h=(W.BufferHelper.bufferInfo(v,T,L.maxBufferHole).end-T)/g,o=this.findBestLevel(c,f,u,h,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(o>=0)return o;w.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var C=D?Math.min(D,L.maxStarvationDelay):L.maxStarvationDelay,E=L.abrBandWidthFactor,m=L.abrBandWidthUpFactor;if(!h){var O=this.bitrateTestDelay;if(O){var U=D?Math.min(D,L.maxLoadingDelay):L.maxLoadingDelay;C=U-O,w.logger.trace("bitrate test took "+Math.round(1e3*O)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*C)+" ms"),E=m=1}}return o=this.findBestLevel(c,f,u,h+C,E,m),Math.max(o,0)},S.findBestLevel=function(d,a,s,u,L,f){for(var v,D=this.fragCurrent,T=this.partCurrent,g=this.lastLoadedFragLevel,c=this.hls.levels,h=c[g],o=!!(h!=null&&(v=h.details)!==null&&v!==void 0&&v.live),C=h==null?void 0:h.codecSet,E=T?T.duration:D?D.duration:0,m=s;m>=a;m--){var O=c[m];if(!O||C&&O.codecSet!==C)continue;var U=O.details,j=(T?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||E,K=void 0;m<=g?K=L*d:K=f*d;var I=c[m].maxBitrate,N=I*j/K;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(K)+"/"+I+"/"+j+"/"+u+"/"+N),K>I&&(!N||o&&!this.bitrateTestDelay||N<u))return m}return-1},b(A,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,a=this.bwEstimator;if(d!==-1&&(!a||!a.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),A}();$.default=M},"./src/controller/audio-stream-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/polyfills/number.ts"),F=k("./src/controller/base-stream-controller.ts"),R=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/controller/fragment-tracker.ts"),P=k("./src/types/level.ts"),w=k("./src/types/loader.ts"),p=k("./src/loader/fragment.ts"),b=k("./src/demux/chunk-cache.ts"),M=k("./src/demux/transmuxer-interface.ts"),A=k("./src/types/transmuxer.ts"),S=k("./src/controller/fragment-finders.ts"),x=k("./src/utils/discontinuities.ts"),d=k("./src/errors.ts"),a=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},s.apply(this,arguments)}function u(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,L(D,T)}function L(D,T){return L=Object.setPrototypeOf||function(c,h){return c.__proto__=h,c},L(D,T)}var f=100,v=function(D){u(T,D);function T(c,h){var o;return o=D.call(this,c,h,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var g=T.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var h=this.hls;h.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(R.Events.ERROR,this.onError,this),h.on(R.Events.BUFFER_RESET,this.onBufferReset,this),h.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var h=this.hls;h.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(R.Events.ERROR,this.onError,this),h.off(R.Events.BUFFER_RESET,this.onBufferReset,this),h.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(h,o){var C=o.frag,E=o.id,m=o.initPTS;if(E==="main"){var O=C.cc;this.initPTS[C.cc]=m,this.log("InitPTS for cc: "+O+" found from main: "+m),this.videoTrackCC=O,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=F.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,o>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+o.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()},g.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var h,o=this.levels,C=this.trackId,E=o==null||((h=o[C])===null||h===void 0)?void 0:h.details;if(E){if(this.waitForCdnTuneIn(E))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var m,O=performance.now(),U=this.retryDate;(!U||O>=U||(m=this.media)!==null&&m!==void 0&&m.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 K=j.frag,I=j.part,N=j.cache,X=j.complete;if(this.initPTS[K.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var q=N.flush(),ae={frag:K,part:I,payload:q,networkDetails:null};this._handleFragmentLoadProgress(ae),X&&D.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+K.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var he=this.getLoadPosition(),Ae=W.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),be=Object(S.fragmentWithinToleranceTest)(Ae.end,this.config.maxFragLookUpTolerance,K);be<0&&(a.logger.log("Waiting fragment cc ("+K.cc+") @ "+K.start+" cancelled because another fragment at "+Ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},g.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:h,C=o.buffered;!this.loadedmetadata&&C.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},g.doTickIdle=function(){var h,o,C=this.hls,E=this.levels,m=this.media,O=this.trackId,U=C.config;if(!E||!E[O])return;if(!m&&(this.startFragRequested||!U.startFragPrefetch))return;var j=E[O],K=j.details;if(!K||K.live&&this.levelLastLoaded!==O||this.waitForCdnTuneIn(K)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,p.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(),q=this.audioSwitch;if(N>=X&&!q)return;if(!q&&this._streamEnded(I,K)){C.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var ae=K.fragments,he=ae[0].start,Ae=I.end;if(q){var be=this.getLoadPosition();Ae=be,K.PTSKnown&&be<he&&((I.end>he||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),m.currentTime=he+.05))}var Te=this.getNextFragment(Ae,K);if(!Te){this.bufferFlushed=!0;return}((h=Te.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((o=Te.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Te,K):this.loadFragment(Te,K,Ae)},g.getMaxBufferLength=function(){var h=D.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return o===null?h:Math.max(h,o.len)},g.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(h,o){var C=o.audioTracks;this.resetTransmuxer(),this.levels=C.map(function(E){return new P.Level(E)})},g.onAudioTrackSwitching=function(h,o){var C=!!o.url;this.trackId=o.id;var E=this.fragCurrent;E!=null&&E.loader&&E.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),C?this.setInterval(f):this.resetTransmuxer(),C?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(h,o){this.mainDetails=o.details},g.onAudioTrackLoaded=function(h,o){var C,E=this.levels,m=o.details,O=o.id;if(!E){this.warn("Audio tracks were reset while loading level "+O);return}this.log("Track "+O+" loaded ["+m.startSN+","+m.endSN+"],duration:"+m.totalduration);var U=E[O],j=0;if(m.live||(C=U.details)!==null&&C!==void 0&&C.live){var K=this.mainDetails;if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed||!K)return;!U.details&&m.hasProgramDateTime&&K.hasProgramDateTime?(Object(x.alignMediaPlaylistByPDT)(m,K),j=m.fragments[0].start):j=this.alignPlaylists(m,U.details)}U.details=m,this.levelLastLoaded=O,!this.startFragRequested&&(this.mainDetails||!m.live)&&this.setStartPosition(U.details,j),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(m)&&(this.state=F.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(h){var o,C=h.frag,E=h.part,m=h.payload,O=this.config,U=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+C.sn+" of level "+C.level+" will not be buffered");return}var K=j[U];console.assert(K,"Audio track is defined on fragment load progress");var I=K.details;console.assert(I,"Audio track details are defined on fragment load progress");var N=O.defaultAudioCodec||K.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new M.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[C.cc],ae=(o=C.initSegment)===null||o===void 0?void 0:o.data;if(q!==void 0){var he=!1,Ae=E?E.index:-1,be=Ae!==-1,Te=new A.ChunkMetadata(C.level,C.sn,C.stats.chunkCount,m.byteLength,Ae,be);X.push(m,ae,N,"",C,E,I.totalduration,he,Te,q)}else{a.logger.log("Unknown video PTS for cc "+C.cc+", waiting for video PTS before demuxing audio frag "+C.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+U);var Ce=this.waitingData=this.waitingData||{frag:C,part:E,cache:new b.default,complete:!1},Se=Ce.cache;Se.push(new Uint8Array(m)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,h)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(h,o){var C=o.tracks.audio;C&&(this.mediaBuffer=C.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},g.onFragBuffered=function(h,o){var C=o.frag,E=o.part;if(C.type!==w.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(C)){this.warn("Fragment "+C.sn+(E?" p: "+E.index:"")+" of level "+C.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}C.sn!=="initSegment"&&(this.fragPrevious=C,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(C,E)},g.onError=function(h,o){switch(o.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.AUDIO,o);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=o.fatal?F.State.ERROR:F.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var C=!0,E=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);E&&E.len>.5&&(C=!this.reduceMaxBufferLength(E.len)),C&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(h,o){var C=o.type;C===p.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(h){var o,C="audio",E=this.hls,m=h.remuxResult,O=h.chunkMeta,U=this.getCurrentContext(O);if(!U){this.warn("The loading context changed while buffering fragment "+O.sn+" of level "+O.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(O.level);return}var j=U.frag,K=U.part,I=m.audio,N=m.text,X=m.id3,q=m.initSegment;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,j,O),E.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:C,tracks:q.tracks})),I){var ae=I.startPTS,he=I.endPTS,Ae=I.startDTS,be=I.endDTS;K&&(K.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:he,startDTS:Ae,endDTS:be}),j.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,ae,he,Ae,be),this.bufferFragmentData(I,j,K,O)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var Te=s({frag:j,id:C},X);E.trigger(R.Events.FRAG_PARSING_METADATA,Te)}if(N){var Ce=s({frag:j,id:C},N);E.trigger(R.Events.FRAG_PARSING_USERDATA,Ce)}},g._bufferInitSegment=function(h,o,C){if(this.state!==F.State.PARSING)return;h.video&&delete h.video;var E=h.audio;if(!E)return;E.levelCodec=E.codec,E.id="audio",this.log("Init audio buffer, container:"+E.container+", codecs[parsed]=["+E.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,h);var m=E.initSegment;if(m!=null&&m.byteLength){var O={type:"audio",frag:o,part:null,chunkMeta:C,parent:o.type,data:m};this.hls.trigger(R.Events.BUFFER_APPENDING,O)}this.tick()},g.loadFragment=function(h,o,C){var E=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||E===B.FragmentState.NOT_LOADED||E===B.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):o.live&&!Object(Y.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,D.prototype.loadFragment.call(this,h,o,C)))},g.completeAudioSwitch=function(){var h=this.hls,o=this.media,C=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:C})},T}(F.default);$.default=v},"./src/controller/audio-track-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/events.ts"),F=k("./src/errors.ts"),R=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function B(M,A){for(var S=0;S<A.length;S++){var x=A[S];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(M,x.key,x)}}function P(M,A,S){return A&&B(M.prototype,A),S&&B(M,S),M}function w(M,A){M.prototype=Object.create(A.prototype),M.prototype.constructor=M,p(M,A)}function p(M,A){return p=Object.setPrototypeOf||function(x,d){return x.__proto__=d,x},p(M,A)}var b=function(M){w(A,M);function A(x){var d;return d=M.call(this,x,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var S=A.prototype;return S.registerListeners=function(){var d=this.hls;d.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(Y.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(Y.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(d,a){this.tracks=a.audioTracks||[]},S.onAudioTrackLoaded=function(d,a){var s=a.id,u=a.details,L=this.tracksInGroup[s];if(!L){this.warn("Invalid audio track id "+s);return}var f=L.details;L.details=a.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,f))},S.onLevelLoading=function(d,a){this.switchLevel(a.level)},S.onLevelSwitching=function(d,a){this.switchLevel(a.level)},S.switchLevel=function(d){var a=this.hls.levels[d];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!u.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var L={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},S.onError=function(d,a){if(M.prototype.onError.call(this,d,a),a.fatal||!a.context)return;a.context.type===W.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},S.setAudioTrack=function(d){var a=this.tracksInGroup;if(d<0||d>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+d);var u=a[d],L=u.id,f=u.groupId,v=f===void 0?"":f,D=u.name,T=u.type,g=u.url;if(this.trackId=d,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:v,name:D,type:T,url:g}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},S.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(d){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var u=a[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},S.loadPlaylist=function(d){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,u=a.groupId,L=a.url;if(d)try{L=d.addDirectives(L)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:L,id:s,groupId:u,deliveryDirectives:d||null})}},P(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),A}(R.default);$.default=b},"./src/controller/base-playlist-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return P});var Y=k("./src/polyfills/number.ts"),F=k("./src/types/level.ts"),R=k("./src/controller/level-helper.ts"),W=k("./src/utils/logger.ts"),B=k("./src/errors.ts"),P=function(){function w(b,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,M+":"),this.warn=W.logger.warn.bind(W.logger,M+":"),this.hls=b}var p=w.prototype;return p.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},p.onError=function(M,A){A.fatal&&A.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},p.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},p.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},p.stopLoad=function(){this.canLoad=!1,this.clearTimer()},p.switchParams=function(M,A){var S=A==null?void 0:A.renditionReports;if(S)for(var x=0;x<S.length;x++){var d=S[x],a=""+d.URI;if(a===M.substr(-a.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var L=Math.min(A.age-A.partTarget,A.targetduration);u!==void 0&&L>A.partTarget&&(u+=1)}if(Object(Y.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object(Y.isFiniteNumber)(u)?u:void 0,F.HlsSkip.No)}}},p.loadPlaylist=function(M){},p.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},p.playlistLoaded=function(M,A,S){var x=this,d=A.details,a=A.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||S!=null&&S.live){if(d.reloaded(S),S&&this.log("live playlist "+M+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),S&&d.fragments.length>0&&Object(R.mergeDetails)(S,d),!this.canLoad||!d.live)return;var u,L=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var v=this.hls.config.lowLatencyMode,D=d.lastPartSn,T=d.endSN,g=d.lastPartIndex,c=g!==-1,h=D===T,o=v?0:g;c?(L=h?T+1:D,f=h?o:g+1):L=T+1;var C=d.age,E=C+d.ageHeader,m=Math.min(E-d.partTarget,d.targetduration*1.5);if(m>0){if(S&&m>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+m+" with playlist age: "+d.age),m=0;else{var O=Math.floor(m/d.targetduration);if(L+=O,f!==void 0){var U=Math.round(m%d.targetduration/d.partTarget);f+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+C.toFixed(2)+"s goal: "+m+" skip sn "+O+" to part "+f)}d.tuneInGoal=m}if(u=this.getDeliveryDirectives(d,A.deliveryDirectives,L,f),v||!h){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,A.deliveryDirectives,L,f);var j=Object(R.computeReloadInterval)(d,a);L!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return x.loadPlaylist(u)},j)}else this.clearTimer()},p.getDeliveryDirectives=function(M,A,S,x){var d=Object(F.getSkipValue)(M,S);return A!=null&&A.skip&&M.deltaUpdateFailed&&(S=A.msn,x=A.part,d=F.HlsSkip.No),new F.HlsUrlParameters(S,x,d)},p.retryLoadingOrFail=function(M){var A=this,S=this.hls.config,x=this.retryCount<S.levelLoadingMaxRetry;if(x){var d;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(d=M.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return x},w}()},"./src/controller/base-stream-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"State",function(){return T}),k.d($,"default",function(){return g});var Y=k("./src/polyfills/number.ts"),F=k("./src/task-loop.ts"),R=k("./src/controller/fragment-tracker.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/utils/logger.ts"),P=k("./src/events.ts"),w=k("./src/errors.ts"),p=k("./src/types/transmuxer.ts"),b=k("./src/utils/mp4-tools.ts"),M=k("./src/utils/discontinuities.ts"),A=k("./src/controller/fragment-finders.ts"),S=k("./src/controller/level-helper.ts"),x=k("./src/loader/fragment-loader.ts"),d=k("./src/crypt/decrypter.ts"),a=k("./src/utils/time-ranges.ts"),s=k("./src/types/loader.ts");function u(c,h){for(var o=0;o<h.length;o++){var C=h[o];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(c,C.key,C)}}function L(c,h,o){return h&&u(c.prototype,h),o&&u(c,o),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function v(c,h){c.prototype=Object.create(h.prototype),c.prototype.constructor=c,D(c,h)}function D(c,h){return D=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},D(c,h)}var T={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"},g=function(c){v(h,c);function h(C,E,m){var O;return O=c.call(this)||this,O.hls=void 0,O.fragPrevious=null,O.fragCurrent=null,O.fragmentTracker=void 0,O.transmuxer=null,O._state=T.STOPPED,O.media=void 0,O.mediaBuffer=void 0,O.config=void 0,O.bitrateTest=!1,O.lastCurrentTime=0,O.nextLoadPosition=0,O.startPosition=0,O.loadedmetadata=!1,O.fragLoadError=0,O.retryDate=0,O.levels=null,O.fragmentLoader=void 0,O.levelLastLoaded=null,O.startFragRequested=!1,O.decrypter=void 0,O.initPTS=[],O.onvseeking=null,O.onvended=null,O.logPrefix="",O.log=void 0,O.warn=void 0,O.logPrefix=m,O.log=B.logger.log.bind(B.logger,m+":"),O.warn=B.logger.warn.bind(B.logger,m+":"),O.hls=C,O.fragmentLoader=new x.default(C.config),O.fragmentTracker=E,O.config=C.config,O.decrypter=new d.default(C,C.config),C.on(P.Events.KEY_LOADED,O.onKeyLoaded,f(O)),O}var o=h.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(E){},o.stopLoad=function(){this.fragmentLoader.abort();var E=this.fragCurrent;E&&this.fragmentTracker.removeFragment(E),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},o._streamEnded=function(E,m){var O=this.fragCurrent,U=this.fragmentTracker;if(!m.live&&O&&O.sn===m.endSN&&!E.nextStart){var j=U.getState(O);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},o.onMediaAttached=function(E,m){var O=this.media=this.mediaBuffer=m.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),O.addEventListener("seeking",this.onvseeking),O.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(U.startPosition)},o.onMediaDetaching=function(){var E=this.media;E!=null&&E.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),E&&(E.removeEventListener("seeking",this.onvseeking),E.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var E=this.config,m=this.fragCurrent,O=this.media,U=this.mediaBuffer,j=this.state,K=O?O.currentTime:0,I=W.BufferHelper.bufferInfo(U||O,K,E.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(K)?K.toFixed(3):K)+", state: "+j),j===T.ENDED)this.resetLoadingState();else if(m&&!I.len){var N=E.maxFragLookUpTolerance,X=m.start-N,q=m.start+m.duration+N,ae=K>q;(K<X||ae)&&(ae&&m.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),m.loader.abort()),this.resetLoadingState())}O&&(this.lastCurrentTime=K),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=K),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(E,m){if(this.state!==T.KEY_LOADING||m.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var O=this.levels[m.frag.level].details;O&&this.loadFragment(m.frag,O,m.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(P.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(E,m){this.log("Loading key for "+E.sn+" of ["+m.startSN+"-"+m.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level),this.state=T.KEY_LOADING,this.fragCurrent=E,this.hls.trigger(P.Events.KEY_LOADING,{frag:E})},o.loadFragment=function(E,m,O){this._loadFragForPlayback(E,m,O)},o._loadFragForPlayback=function(E,m,O){var U=this,j=function(I){if(U.fragContextChanged(E)){U.warn("Fragment "+E.sn+(I.part?" p: "+I.part.index:"")+" of level "+E.level+" was dropped during download."),U.fragmentTracker.removeFragment(E);return}E.stats.chunkCount++,U._handleFragmentLoadProgress(I)};this._doFragLoad(E,m,O,j).then(function(K){if(!K)return;U.fragLoadError=0;var I=U.state;if(U.fragContextChanged(E)){(I===T.FRAG_LOADING||I===T.BACKTRACKING||!U.fragCurrent&&I===T.PARSING)&&(U.fragmentTracker.removeFragment(E),U.state=T.IDLE);return}if("payload"in K&&(U.log("Loaded fragment "+E.sn+" of level "+E.level),U.hls.trigger(P.Events.FRAG_LOADED,K),U.state===T.BACKTRACKING)){U.fragmentTracker.backtrack(E,K),U.resetFragmentLoading(E);return}U._handleFragmentLoadComplete(K)}).catch(function(K){U.warn(K),U.resetFragmentLoading(E)})},o.flushMainBuffer=function(E,m,O){if(O===void 0&&(O=null),!(E-m))return;var U={startOffset:E,endOffset:m,type:O};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,U)},o._loadInitSegment=function(E){var m=this;this._doFragLoad(E).then(function(O){if(!O||m.fragContextChanged(E)||!m.levels)throw new Error("init load aborted");return O}).then(function(O){var U=m.hls,j=O.payload,K=E.decryptdata;if(j&&j.byteLength>0&&K&&K.key&&K.iv&&K.method==="AES-128"){var I=self.performance.now();return m.decrypter.webCryptoDecrypt(new Uint8Array(j),K.key.buffer,K.iv.buffer).then(function(N){var X=self.performance.now();return U.trigger(P.Events.FRAG_DECRYPTED,{frag:E,payload:N,stats:{tstart:I,tdecrypt:X}}),O.payload=N,O})}return O}).then(function(O){var U=m.fragCurrent,j=m.hls,K=m.levels;if(!K)throw new Error("init load aborted, missing levels");var I=K[E.level].details;console.assert(I,"Level details are defined when init segment is loaded");var N=E.stats;m.state=T.IDLE,m.fragLoadError=0,E.data=new Uint8Array(O.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),O.frag===U&&j.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:U,part:null,id:E.type}),m.tick()}).catch(function(O){m.warn(O),m.resetFragmentLoading(E)})},o.fragContextChanged=function(E){var m=this.fragCurrent;return!E||!m||E.level!==m.level||E.sn!==m.sn||E.urlId!==m.urlId},o.fragBufferedComplete=function(E,m){var O=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+E.type+" sn: "+E.sn+(m?" part: "+m.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level+" "+a.default.toString(W.BufferHelper.getBuffered(O))),this.state=T.IDLE,this.tick()},o._handleFragmentLoadComplete=function(E){var m=this.transmuxer;if(!m)return;var O=E.frag,U=E.part,j=E.partsLoaded,K=!j||j.length===0||j.some(function(N){return!N}),I=new p.ChunkMetadata(O.level,O.sn,O.stats.chunkCount+1,0,U?U.index:-1,!K);m.flush(I)},o._handleFragmentLoadProgress=function(E){},o._doFragLoad=function(E,m,O,U){var j=this;if(O===void 0&&(O=null),!this.levels)throw new Error("frag load aborted, missing levels");if(O=Math.max(E.start,O||0),this.config.lowLatencyMode&&m){var K=m.partList;if(K&&U){O>E.end&&m.fragmentHint&&(E=m.fragmentHint);var I=this.getNextPart(K,E,O);if(I>-1){var N=K[I];return this.log("Loading part sn: "+E.sn+" p: "+N.index+" cc: "+E.cc+" of playlist ["+m.startSN+"-"+m.endSN+"] parts [0-"+I+"-"+(K.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(O.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:E,part:K[I],targetBufferTime:O}),this.doFragPartsLoad(E,K,I,U).catch(function(X){return j.handleFragLoadError(X)})}else if(!E.url||this.loadedEndOfParts(K,O))return Promise.resolve(null)}}return this.log("Loading fragment "+E.sn+" cc: "+E.cc+" "+(m?"of ["+m.startSN+"-"+m.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(O.toFixed(3))),Object(Y.isFiniteNumber)(E.sn)&&!this.bitrateTest&&(this.nextLoadPosition=E.start+E.duration),this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:E,targetBufferTime:O}),this.fragmentLoader.load(E,U).catch(function(X){return j.handleFragLoadError(X)})},o.doFragPartsLoad=function(E,m,O,U){var j=this;return new Promise(function(K,I){var N=[],X=function q(ae){var he=m[ae];j.fragmentLoader.loadPart(E,he,U).then(function(Ae){N[he.index]=Ae;var be=Ae.part;j.hls.trigger(P.Events.FRAG_LOADED,Ae);var Te=m[ae+1];if(Te&&Te.fragment===E)q(ae+1);else return K({frag:E,part:be,partsLoaded:N})}).catch(I)};X(O)})},o.handleFragLoadError=function(E){var m=E.data;return m&&m.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(m.frag,m.part):this.hls.trigger(P.Events.ERROR,m),null},o._handleTransmuxerFlush=function(E){var m=this.getCurrentContext(E);if(!m||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var O=m.frag,U=m.part,j=m.level,K=self.performance.now();O.stats.parsing.end=K,U&&(U.stats.parsing.end=K),this.updateLevelTiming(O,U,j,E.partial)},o.getCurrentContext=function(E){var m=this.levels,O=E.level,U=E.sn,j=E.part;if(!m||!m[O])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+O+". The current chunk will not be buffered."),null;var K=m[O],I=j>-1?Object(S.getPartWith)(K,U,j):null,N=I?I.fragment:Object(S.getFragmentWithSN)(K,U,this.fragCurrent);return N?{frag:N,part:I,level:K}:null},o.bufferFragmentData=function(E,m,O,U){if(!E||this.state!==T.PARSING)return;var j=E.data1,K=E.data2,I=j;if(j&&K&&(I=Object(b.appendUint8Array)(j,K)),!I||!I.length)return;var N={type:E.type,frag:m,part:O,chunkMeta:U,parent:m.type,data:I};this.hls.trigger(P.Events.BUFFER_APPENDING,N),E.dropped&&E.independent&&!O&&this.flushBufferGap(m)},o.flushBufferGap=function(E){var m=this.media;if(!m)return;if(!W.BufferHelper.isBuffered(m,m.currentTime)){this.flushMainBuffer(0,E.start);return}var O=m.currentTime,U=W.BufferHelper.bufferInfo(m,O,0),j=E.duration,K=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),I=Math.max(Math.min(E.start-K,U.end-K),O+K);E.start-I>K&&this.flushMainBuffer(I,E.start)},o.getFwdBufferInfo=function(E,m){var O=this.config,U=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(U))return null;var j=W.BufferHelper.bufferInfo(E,U,O.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var K=this.fragmentTracker.getBufferedFrag(U,m);if(K&&j.nextStart<K.end)return W.BufferHelper.bufferInfo(E,U,Math.max(j.nextStart,O.maxBufferHole))}return j},o.getMaxBufferLength=function(E){var m=this.config,O;return E?O=Math.max(8*m.maxBufferSize/E,m.maxBufferLength):O=m.maxBufferLength,Math.min(O,m.maxMaxBufferLength)},o.reduceMaxBufferLength=function(E){var m=this.config,O=E||m.maxBufferLength;return m.maxMaxBufferLength>=O?(m.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+m.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(E,m){var O,U,j=m.fragments,K=j.length;if(!K)return null;var I=this.config,N=j[0].start,X;if(m.live){var q=I.initialLiveManifestSize;if(K<q)return this.warn("Not enough fragments to start playback (have: "+K+", need: "+q+")"),null;!m.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(m,j),this.startPosition=X?this.hls.liveSyncPosition||X.start:E)}else E<=N&&(X=j[0]);if(!X){var ae=I.lowLatencyMode?m.partEnd:m.fragmentEnd;X=this.getFragmentAtPosition(E,ae,m)}return(O=X)!==null&&O!==void 0&&O.initSegment&&!((U=X)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(E,m,O){for(var U=-1,j=!1,K=!0,I=0,N=E.length;I<N;I++){var X=E[I];if(K=K&&!X.independent,U>-1&&O<X.start)break;var q=X.loaded;!q&&(j||X.independent||K)&&X.fragment===m&&(U=I),j=q}return U},o.loadedEndOfParts=function(E,m){var O=E[E.length-1];return O&&m>O.start&&O.loaded},o.getInitialLiveFragment=function(E,m){var O=this.fragPrevious,U=null;if(O){if(E.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+O.programDateTime),U=Object(A.findFragmentByPDT)(m,O.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=O.sn+1;if(j>=E.startSN&&j<=E.endSN){var K=m[j-E.startSN];O.cc===K.cc&&(U=K,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(A.findFragWithCC)(m,O.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(U=this.getFragmentAtPosition(I,this.bitrateTest?E.fragmentEnd:E.edge,E))}return U},o.getFragmentAtPosition=function(E,m,O){var U=this.config,j=this.fragPrevious,K=O.fragments,I=O.endSN,N=O.fragmentHint,X=U.maxFragLookUpTolerance,q=!!(U.lowLatencyMode&&O.partList&&N);q&&N&&!this.bitrateTest&&(K=K.concat(N),I=N.sn);var ae;if(E<m){var he=E>m-X?0:X;ae=Object(A.findFragmentByPTS)(j,K,E,he)}else ae=K[K.length-1];if(ae){var Ae=ae.sn-O.startSN,be=j&&ae.level===j.level,Te=K[Ae+1],Ce=this.fragmentTracker.getState(ae);if(Ce===R.FragmentState.BACKTRACKED){ae=null;for(var Se=Ae;K[Se]&&this.fragmentTracker.getState(K[Se])===R.FragmentState.BACKTRACKED;)j?ae=K[Se--]:ae=K[--Se];ae||(ae=Te)}else j&&ae.sn===j.sn&&!q&&(be&&(ae.sn<I&&this.fragmentTracker.getState(Te)!==R.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+Te.sn),ae=Te):ae=null))}return ae},o.synchronizeToLiveEdge=function(E){var m=this.config,O=this.media;if(!O)return;var U=this.hls.liveSyncPosition,j=O.currentTime,K=E.fragments[0].start,I=E.edge,N=j>=K-m.maxFragLookUpTolerance&&j<=I;if(U!==null&&O.duration>U&&(j<U||!N)){var X=m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:m.liveMaxLatencyDurationCount*E.targetduration;(!N&&O.readyState<4||j<I-X)&&(this.loadedmetadata||(this.nextLoadPosition=U),O.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+U.toFixed(3)),O.currentTime=U))}},o.alignPlaylists=function(E,m){var O=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,K=U!==null?O[U]:null,I=E.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var N=E.fragments[0].start,X=!m,q=E.alignedSliding&&Object(Y.isFiniteNumber)(N);if(X||!q&&!N){Object(M.alignStream)(j,K,E);var ae=E.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(m?m.startSN:"na")+"->"+E.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+I),ae}return N},o.waitForCdnTuneIn=function(E){var m=3;return E.live&&E.canBlockReload&&E.tuneInGoal>Math.max(E.partHoldBack,E.partTarget*m)},o.setStartPosition=function(E,m){var O=this.startPosition;if(O<m&&(O=-1),O===-1||this.lastCurrentTime===-1){var U=E.startTimeOffset;Object(Y.isFiniteNumber)(U)?(O=m+U,U<0&&(O+=E.totalduration),O=Math.min(Math.max(m,O),m+E.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+O),this.startPosition=O):E.live?O=this.hls.liveSyncPosition||m:this.startPosition=O=0,this.lastCurrentTime=O}this.nextLoadPosition=O},o.getLoadPosition=function(){var E=this.media,m=0;return this.loadedmetadata&&E?m=E.currentTime:this.nextLoadPosition&&(m=this.nextLoadPosition),m},o.handleFragLoadAborted=function(E,m){this.transmuxer&&E.sn!=="initSegment"&&E.stats.aborted&&(this.warn("Fragment "+E.sn+(m?" part"+m.index:"")+" of level "+E.level+" was aborted"),this.resetFragmentLoading(E))},o.resetFragmentLoading=function(E){(!this.fragCurrent||!this.fragContextChanged(E))&&(this.state=T.IDLE)},o.onFragmentOrKeyLoadError=function(E,m){if(m.fatal)return;var O=m.frag;if(!O||O.type!==E)return;var U=this.fragCurrent;console.assert(U&&O.sn===U.sn&&O.level===U.level&&O.urlId===U.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(O.level))return;var K=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+O.sn+" of "+E+" "+O.level+" failed to load, retrying in "+K+"ms"),this.retryDate=self.performance.now()+K,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else m.levelRetry?(E===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(B.logger.error(m.details+" reaches max retry, redispatch as fatal ..."),m.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},o.afterBufferFlushed=function(E,m,O){if(!E)return;var U=W.BufferHelper.getBuffered(E);this.fragmentTracker.detectEvictedFragments(m,U,O),this.state===T.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},o.resetLiveStartWhenNotLoaded=function(E){if(!this.loadedmetadata){this.startFragRequested=!1;var m=this.levels?this.levels[E].details:null;if(m!=null&&m.live)return this.startPosition=-1,this.setStartPosition(m,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(E,m,O,U){var j=this,K=O.details;console.assert(!!K,"level.details must be defined");var I=Object.keys(E.elementaryStreams).reduce(function(N,X){var q=E.elementaryStreams[X];if(q){var ae=q.endPTS-q.startPTS;if(ae<=0)return j.warn("Could not parse fragment "+E.sn+" "+X+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var he=U?0:Object(S.updateFragPTSDTS)(K,E,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return j.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:K,level:O,drift:he,type:X,frag:E,start:q.startPTS,end:q.endPTS}),!0}return N},!1);I?(this.state=T.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:E,part:m})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(h,[{key:"state",get:function(){return this._state},set:function(E){var m=this._state;m!==E&&(this._state=E,this.log(m+"->"+E))}}]),h}(F.default)},"./src/controller/buffer-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A});var Y=k("./src/polyfills/number.ts"),F=k("./src/events.ts"),R=k("./src/utils/logger.ts"),W=k("./src/errors.ts"),B=k("./src/utils/buffer-helper.ts"),P=k("./src/utils/mediasource-helper.ts"),w=k("./src/loader/fragment.ts"),p=k("./src/controller/buffer-operation-queue.ts"),b=Object(P.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function S(d){var a=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=a.hls,u=a.media,L=a.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),u&&(a.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:u})),L&&L.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var x=S.prototype;return x.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},x.destroy=function(){this.unregisterListeners(),this.details=null},x.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(F.Events.BUFFER_RESET,this.onBufferReset,this),a.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(F.Events.BUFFER_EOS,this.onBufferEos,this),a.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(F.Events.FRAG_PARSED,this.onFragParsed,this),a.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},x.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(F.Events.BUFFER_RESET,this.onBufferReset,this),a.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(F.Events.BUFFER_EOS,this.onBufferEos,this),a.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(F.Events.FRAG_PARSED,this.onFragParsed,this),a.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},x._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new p.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},x.onManifestParsed=function(a,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.onMediaAttaching=function(a,s){var u=this.media=s.media;if(u&&b){var L=this.mediaSource=new b;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(L),this._objectUrl=u.src}},x.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(L){R.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(u&&self.URL.revokeObjectURL(u),a.src===u?(a.removeAttribute("src"),a.load()):R.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)},x.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var u=a.sourceBuffer[s];try{u&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(u),a.sourceBuffer[s]=void 0)}catch(L){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",L)}}),this._initSourceBuffer()},x.onBufferCodecs=function(a,s){var u=this,L=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(L){var v=u.tracks[f];if(v&&typeof v.buffer.changeType=="function"){var D=s[f],T=D.codec,g=D.levelCodec,c=D.container,h=(v.levelCodec||v.codec).replace(M,"$1"),o=(g||T).replace(M,"$1");if(h!==o){var C=c+";codecs="+(g||T);u.appendChangeType(f,C)}}}else u.pendingTracks[f]=s[f]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},x.appendChangeType=function(a,s){var u=this,L=this.operationQueue,f={execute:function(){var D=u.sourceBuffer[a];D&&(R.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),D.changeType(s)),L.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){R.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};L.append(f,a)},x.onBufferAppending=function(a,s){var u=this,L=this.hls,f=this.operationQueue,v=this.tracks,D=s.data,T=s.type,g=s.frag,c=s.part,h=s.chunkMeta,o=h.buffering[T],C=self.performance.now();o.start=C;var E=g.stats.buffering,m=c?c.stats.buffering:null;E.start===0&&(E.start=C),m&&m.start===0&&(m.start=C);var O=v.audio,U=T==="audio"&&h.id===1&&(O==null?void 0:O.container)==="audio/mpeg",j={execute:function(){if(o.executeStart=self.performance.now(),U){var I=u.sourceBuffer[T];if(I){var N=g.start-I.timestampOffset;Math.abs(N)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+N+") sn: "+g.sn+")"),I.timestampOffset=g.start)}}u.appendExecutor(D,T)},onStart:function(){},onComplete:function(){var I=self.performance.now();o.executeEnd=o.end=I,E.first===0&&(E.first=I),m&&m.first===0&&(m.first=I);var N=u.sourceBuffer,X={};for(var q in N)X[q]=B.BufferHelper.getBuffered(N[q]);u.appendError=0,u.hls.trigger(F.Events.BUFFER_APPENDED,{type:T,frag:g,part:c,chunkMeta:h,parent:g.type,timeRanges:X})},onError:function(I){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",I);var N={type:W.ErrorTypes.MEDIA_ERROR,parent:g.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=W.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,N.details=W.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>L.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),L.trigger(F.Events.ERROR,N)}};f.append(j,T)},x.onBufferFlushing=function(a,s){var u=this,L=this.operationQueue,f=function(D){return{execute:u.removeExecutor.bind(u,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(F.Events.BUFFER_FLUSHED,{type:D})},onError:function(g){R.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",g)}}};s.type?L.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){L.append(f(v),v)})},x.onFragParsed=function(a,s){var u=this,L=s.frag,f=s.part,v=[],D=f?f.elementaryStreams:L.elementaryStreams;D[w.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(D[w.ElementaryStreamTypes.AUDIO]&&v.push("audio"),D[w.ElementaryStreamTypes.VIDEO]&&v.push("video"));var T=function(){var c=self.performance.now();L.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var h=f?f.stats:L.stats;u.hls.trigger(F.Events.FRAG_BUFFERED,{frag:L,part:f,stats:h,id:L.type})};v.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(T,v)},x.onFragChanged=function(a,s){this.flushBackBuffer()},x.onBufferEos=function(a,s){var u=this,L=this.getSourceBufferTypes().reduce(function(f,v){var D=u.sourceBuffer[v];return(!s.type||s.type===v)&&(D&&!D.ended&&(D.ended=!0,R.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),f&&!!(!D||D.ended)},!0);L&&this.blockBuffers(function(){var f=u.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},x.onLevelUpdated=function(a,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},x.flushBackBuffer=function(){var a=this.hls,s=this.details,u=this.media,L=this.sourceBuffer;if(!u||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var v=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Y.isFiniteNumber)(v)||v<0)return;var D=u.currentTime,T=s.levelTargetDuration,g=Math.max(v,T),c=Math.floor(D/T)*T-g;f.forEach(function(h){var o=L[h];if(o){var C=B.BufferHelper.getBuffered(o);C.length>0&&c>C.start(0)&&(a.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&a.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),a.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:h}))}})},x.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,u=this.media,L=this.mediaSource,f=a.fragments[0].start+a.totalduration,v=u.duration,D=Object(Y.isFiniteNumber)(L.duration)?L.duration:0;a.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(a)):(f>D&&f>v||!Object(Y.isFiniteNumber)(v))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),L.duration=f)},x.updateSeekableRange=function(a){var s=this.mediaSource,u=a.fragments,L=u.length;if(L&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,u[0].start),v=Math.max(f,f+a.totalduration);s.setLiveSeekableRange(f,v)}},x.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,L=Object.keys(u).length;if(L&&!a||L===2){this.createSourceBuffers(u),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.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}f.forEach(function(v){s.executeNext(v)})}},x.createSourceBuffers=function(a){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var f in a)if(!s[f]){var v=a[f];if(!v)throw Error("source buffer exists for track "+f+", however track does not");var D=v.levelCodec||v.codec,T=v.container+";codecs="+D;R.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var g=s[f]=u.addSourceBuffer(T),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:g,codec:D,container:v.container,levelCodec:v.levelCodec,id:v.id},L++}catch(h){R.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:T})}}L&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},x._onSBUpdateStart=function(a){var s=this.operationQueue,u=s.current(a);u.onStart()},x._onSBUpdateEnd=function(a){var s=this.operationQueue,u=s.current(a);u.onComplete(),s.shiftAndExecuteNext(a)},x._onSBUpdateError=function(a,s){R.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(a);u&&u.onError(s)},x.removeExecutor=function(a,s,u){var L=this.media,f=this.mediaSource,v=this.operationQueue,D=this.sourceBuffer,T=D[a];if(!L||!f||!T){R.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(a);return}var g=Object(Y.isFiniteNumber)(L.duration)?L.duration:Infinity,c=Object(Y.isFiniteNumber)(f.duration)?f.duration:Infinity,h=Math.max(0,s),o=Math.min(u,g,c);o>h?(R.logger.log("[buffer-controller]: Removing ["+h+","+o+"] from the "+a+" SourceBuffer"),console.assert(!T.updating,a+" sourceBuffer must not be updating"),T.remove(h,o)):v.shiftAndExecuteNext(a)},x.appendExecutor=function(a,s){var u=this.operationQueue,L=this.sourceBuffer,f=L[s];if(!f){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(a)},x.blockBuffers=function(a,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var L=this.operationQueue,f=s.map(function(v){return L.appendBlocker(v)});Promise.all(f).then(function(){a(),s.forEach(function(v){var D=u.sourceBuffer[v];(!D||!D.updating)&&L.shiftAndExecuteNext(v)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.addBufferListener=function(a,s,u){var L=this.sourceBuffer[a];if(!L)return;var f=u.bind(this,a);this.listeners[a].push({event:s,listener:f}),L.addEventListener(s,f)},x.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(u){s.removeEventListener(u.event,u.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return F});var Y=k("./src/utils/logger.ts"),F=function(){function R(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var W=R.prototype;return W.append=function(P,w){var p=this.queues[w];p.push(P),p.length===1&&this.buffers[w]&&this.executeNext(w)},W.insertAbort=function(P,w){var p=this.queues[w];p.unshift(P),this.executeNext(w)},W.appendBlocker=function(P){var w,p=new Promise(function(M){w=M}),b={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,P),p},W.executeNext=function(P){var w=this.buffers,p=this.queues,b=w[P],M=p[P];if(M.length){var A=M[0];try{A.execute()}catch(S){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(S),(!b||!b.updating)&&(M.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},R}()},"./src/controller/cap-level-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/events.ts");function F(B,P){for(var w=0;w<P.length;w++){var p=P[w];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(B,p.key,p)}}function R(B,P,w){return P&&F(B.prototype,P),w&&F(B,w),B}var W=function(){function B(w){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=w,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=B.prototype;return P.setStreamController=function(p){this.streamController=p},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var p=this.hls;p.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),p.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),p.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var p=this.hls;p.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),p.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),p.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(p,b){B.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},P.onMediaAttaching=function(p,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},P.onManifestParsed=function(p,b){var M=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,M.config.capLevelToPlayerSize&&b.video&&this.startCapping()},P.onBufferCodecs=function(p,b){var M=this.hls;M.config.capLevelToPlayerSize&&b.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var p=this.hls.levels;if(p.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(p.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},P.getMaxLevel=function(p){var b=this,M=this.hls.levels;if(!M.length)return-1;var A=M.filter(function(S,x){return B.isLevelAllowed(x,b.restrictedLevels)&&x<=p});return this.clientRect=null,B.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},P.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var p=this.media,b={width:0,height:0};if(p){var M=p.getBoundingClientRect();b.width=M.width,b.height=M.height,!b.width&&!b.height&&(b.width=M.right-M.left||p.width||0,b.height=M.bottom-M.top||p.height||0)}return this.clientRect=b,b},B.isLevelAllowed=function(p,b){return b===void 0&&(b=[]),b.indexOf(p)===-1},B.getMaxLevelByMediaSize=function(p,b,M){if(!p||!p.length)return-1;for(var A=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},S=p.length-1,x=0;x<p.length;x+=1){var d=p[x];if((d.width>=b||d.height>=M)&&A(d,p[x+1])){S=x;break}}return S},R(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var p=1;try{p=self.devicePixelRatio}catch(b){}return p}}]),B}();$.default=W},"./src/controller/cmcd-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A});var Y=k("./src/events.ts"),F=k("./src/types/cmcd.ts"),R=k("./src/utils/buffer-helper.ts"),W=k("./src/utils/logger.ts");function B(S,x){for(var d=0;d<x.length;d++){var a=x[d];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(S,a.key,a)}}function P(S,x,d){return x&&B(S.prototype,x),d&&B(S,d),S}function w(S,x){var d=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(d)return(d=d.call(S)).next.bind(d);if(Array.isArray(S)||(d=p(S))||x&&S&&typeof S.length=="number"){d&&(S=d);var a=0;return function(){return a>=S.length?{done:!0}:{done:!1,value:S[a++]}}}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 p(S,x){if(!S)return;if(typeof S=="string")return b(S,x);var d=Object.prototype.toString.call(S).slice(8,-1);if(d==="Object"&&S.constructor&&(d=S.constructor.name),d==="Map"||d==="Set")return Array.from(S);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return b(S,x)}function b(S,x){(x==null||x>S.length)&&(x=S.length);for(var d=0,a=new Array(x);d<x;d++)a[d]=S[d];return a}function M(){return M=Object.assign||function(S){for(var x=1;x<arguments.length;x++){var d=arguments[x];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(S[a]=d[a])}return S},M.apply(this,arguments)}var A=function(){function S(d){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(L){try{a.apply(L,{ot:F.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(f){W.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(L){try{var f=L.frag,v=a.hls.levels[f.level],D=a.getObjectType(f),T={d:f.duration*1e3,ot:D};(D===F.CMCDObjectType.VIDEO||D===F.CMCDObjectType.AUDIO||D==F.CMCDObjectType.MUXED)&&(T.br=v.bitrate/1e3,T.tb=a.getTopBandwidth(D),T.bl=a.getBufferLength(D)),a.apply(L,T)}catch(g){W.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||S.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var x=S.prototype;return x.registerListeners=function(){var a=this.hls;a.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},x.unregisterListeners=function(){var a=this.hls;a.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},x.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},x.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},x.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},x.onBufferCreated=function(a,s){var u,L;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(L=s.tracks.video)===null||L===void 0?void 0:L.buffer},x.createData=function(){var a;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},x.apply=function(a,s){s===void 0&&(s={}),M(s,this.createData());var u=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var L=S.toHeaders(s);if(!Object.keys(L).length)return;a.headers||(a.headers={}),M(a.headers,L)}else{var f=S.toQuery(s);if(!f)return;a.url=S.appendQueryToUri(a.url,f)}},x.getObjectType=function(a){var s=a.type;return s==="subtitle"?F.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?F.CMCDObjectType.INIT:s==="audio"?F.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},x.getTopBandwidth=function(a){for(var s=0,u=a===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=w(u),f;!(f=L()).done;){var v=f.value;v.bitrate>s&&(s=v.bitrate)}return s>0?s:NaN},x.getBufferLength=function(a){var s=this.hls.media,u=a===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var L=R.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return L.len*1e3},x.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,u=a||this.config.loader;return function(){function L(v){this.loader=void 0,this.loader=new u(v)}var f=L.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,T,g){s(D),this.loader.load(D,T,g)},P(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},x.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,u=a||this.config.loader;return function(){function L(v){this.loader=void 0,this.loader=new u(v)}var f=L.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,T,g){s(D),this.loader.load(D,T,g)},P(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},S.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},S.serialize=function(a){for(var s=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},L=function(U){return Math.round(U)},f=function(U){return L(U/100)*100},v=function(U){return encodeURIComponent(U)},D={br:L,d:L,bl:f,dl:f,mtp:f,nor:v,rtp:f,tb:L},T=Object.keys(a||{}).sort(),g=w(T),c;!(c=g()).done;){var h=c.value,o=a[h];if(!u(o))continue;if(h==="v"&&o===1)continue;if(h=="pr"&&o===1)continue;var C=D[h];C&&(o=C(o));var E=typeof o,m=void 0;h==="ot"||h==="sf"||h==="st"?m=h+"="+o:E==="boolean"?m=h:E==="number"?m=h+"="+o:m=h+"="+JSON.stringify(o),s.push(m)}return s.join(",")},S.toHeaders=function(a){for(var s=Object.keys(a),u={},L=["Object","Request","Session","Status"],f=[{},{},{},{}],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},D=0,T=s;D<T.length;D++){var g=T[D],c=v[g]!=null?v[g]:1;f[c][g]=a[g]}for(var h=0;h<f.length;h++){var o=S.serialize(f[h]);o&&(u["CMCD-"+L[h]]=o)}return u},S.toQuery=function(a){return"CMCD="+encodeURIComponent(S.serialize(a))},S.appendQueryToUri=function(a,s){if(!s)return a;var u=a.includes("?")?"&":"?";return""+a+u+s},S}()},"./src/controller/eme-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/events.ts"),F=k("./src/errors.ts"),R=k("./src/utils/logger.ts"),W=k("./src/utils/mediakeys-helper.ts");function B(A,S){for(var x=0;x<S.length;x++){var d=S[x];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function P(A,S,x){return S&&B(A.prototype,S),x&&B(A,x),A}var w=3,p=function(S,x,d){var a={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),x.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[a]},b=function(S,x,d,a){switch(S){case W.KeySystems.WIDEVINE:return p(x,d,a);default:throw new Error("Unknown key-system: "+S)}},M=function(){function A(x){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=x,this._config=x.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 S=A.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(d){switch(d){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},S._attemptKeySystemAccess=function(d,a,s){var u=this,L=b(d,a,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,L);this.mediaKeysPromise=f.then(function(v){return u._onMediaKeySystemAccessObtained(d,v)}),f.catch(function(v){R.logger.error('Failed to obtain key-system "'+d+'" access:',v)})},S._onMediaKeySystemAccessObtained=function(d,a){var s=this;R.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var L=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(f){return u.mediaKeys=f,R.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),f});return L.catch(function(f){R.logger.error("Failed to create media-keys:",f)}),L},S._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),d._onNewMediaKeySession(a.mediaKeysSession))})},S._onNewMediaKeySession=function(d){var a=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){a._onKeySessionMessage(d,s.message)},!1)},S._onKeySessionMessage=function(d,a){R.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},S.onMediaEncrypted=function(d){var a=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(L){if(!a._media)return;a._attemptSetMediaKeys(L),a._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},S._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(d,a){var s=this,u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var L=u.mediaKeysSession;if(!L){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,L.generateRequest(d,a).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(f){R.logger.error("Error generating key-session request:",f),s.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(d,a,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,a,s);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,u,d),L=void 0}catch(f){R.logger.error(f)}try{u.readyState||u.open("POST",d,!0),L&&L.call(this.hls,u,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return u},S._onLicenseRequestReadyStageChange=function(d,a,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var L=d.response,f=this._licenseResponseCallback;if(f)try{L=f.call(this.hls,d,a)}catch(D){R.logger.error(D)}u(L)}else{if(R.logger.error("License Request XHR failed ("+a+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=w-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,u)}break}},S._generateLicenseRequestChallenge=function(d,a){switch(d.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},S._requestLicense=function(d,a){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),L=this._createLicenseXhr(u,d,a);R.logger.log("Sending license request to URL: "+u);var f=this._generateLicenseRequestChallenge(s,d);L.send(f)}catch(v){R.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(d,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var d=this._media,a=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(d,a){if(!this._emeEnabled)return;var s=a.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),u=a.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,u)},P(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();$.default=M},"./src/controller/fps-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/events.ts"),F=k("./src/utils/logger.ts"),R=function(){function W(P){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=P,this.registerListeners()}var B=W.prototype;return B.setStreamController=function(w){this.streamController=w},B.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(w,p){var b=this.hls.config;if(b.capLevelOnFPSDrop){var M=p.media instanceof self.HTMLVideoElement?p.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(w,p,b){var M=performance.now();if(p){if(this.lastTime){var A=M-this.lastTime,S=b-this.lastDroppedFrames,x=p-this.lastDecodedFrames,d=1e3*S/A,a=this.hls;if(a.trigger(Y.Events.FPS_DROP,{currentDropped:S,currentDecoded:x,totalDroppedFrames:b}),d>0&&S>a.config.fpsDroppedMonitoringThreshold*x){var s=a.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=b,this.lastDecodedFrames=p}},B.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var p=w.getVideoPlaybackQuality();this.checkFPS(w,p.totalVideoFrames,p.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},W}();$.default=R},"./src/controller/fragment-finders.ts":function(ne,$,k){"use strict";k.r($),k.d($,"findFragmentByPDT",function(){return R}),k.d($,"findFragmentByPTS",function(){return W}),k.d($,"fragmentWithinToleranceTest",function(){return B}),k.d($,"pdtWithinToleranceTest",function(){return P}),k.d($,"findFragWithCC",function(){return w});var Y=k("./src/polyfills/number.ts"),F=k("./src/utils/binary-search.ts");function R(p,b,M){if(b===null||!Array.isArray(p)||!p.length||!Object(Y.isFiniteNumber)(b))return null;var A=p[0].programDateTime;if(b<(A||0))return null;var S=p[p.length-1].endProgramDateTime;if(b>=(S||0))return null;M=M||0;for(var x=0;x<p.length;++x){var d=p[x];if(P(b,M,d))return d}return null}function W(p,b,M,A){M===void 0&&(M=0),A===void 0&&(A=0);var S=null;if(p?S=b[p.sn-b[0].sn+1]||null:M===0&&b[0].start===0&&(S=b[0]),S&&B(M,A,S)===0)return S;var x=F.default.search(b,B.bind(null,M,A));return x||S}function B(p,b,M){p===void 0&&(p=0),b===void 0&&(b=0);var A=Math.min(b,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-A<=p?1:M.start-A>p&&M.start?-1:0}function P(p,b,M){var A=Math.min(b,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,S=M.endProgramDateTime||0;return S-A>p}function w(p,b){return F.default.search(p,function(M){return M.cc<b?1:M.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,$,k){"use strict";k.r($),k.d($,"FragmentState",function(){return R}),k.d($,"FragmentTracker",function(){return W});var Y=k("./src/events.ts"),F=k("./src/types/loader.ts"),R;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(R||(R={}));var W=function(){function w(b){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=b,this._registerListeners()}var p=w.prototype;return p._registerListeners=function(){var M=this.hls;M.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},p._unregisterListeners=function(){var M=this.hls;M.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},p.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},p.getAppendedFrag=function(M,A){if(A===F.PlaylistLevelType.MAIN){var S=this.activeFragment,x=this.activeParts;if(!S)return null;if(x)for(var d=x.length;d--;){var a=x[d],s=a?a.end:S.appendedPTS;if(a.start<=M&&s!==void 0&&M<=s)return d>9&&(this.activeParts=x.slice(d-9)),a}else if(S.start<=M&&S.appendedPTS!==void 0&&M<=S.appendedPTS)return S}return this.getBufferedFrag(M,A)},p.getBufferedFrag=function(M,A){for(var S=this.fragments,x=Object.keys(S),d=x.length;d--;){var a=S[x[d]];if((a==null?void 0:a.body.type)===A&&a.buffered){var s=a.body;if(s.start<=M&&M<=s.end)return s}}return null},p.detectEvictedFragments=function(M,A,S){var x=this;Object.keys(this.fragments).forEach(function(d){var a=x.fragments[d];if(!a)return;if(!a.buffered){a.body.type===S&&x.removeFragment(a.body);return}var s=a.range[M];if(!s)return;s.time.some(function(u){var L=!x.isTimeBuffered(u.startPTS,u.endPTS,A);return L&&x.removeFragment(a.body),L})})},p.detectPartialFragments=function(M){var A=this,S=this.timeRanges,x=M.frag,d=M.part;if(!S||x.sn==="initSegment")return;var a=P(x),s=this.fragments[a];if(!s)return;Object.keys(S).forEach(function(u){var L=x.elementaryStreams[u];if(!L)return;var f=S[u],v=d!==null||L.partial===!0;s.range[u]=A.getBufferedTimes(x,d,v,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},p.fragBuffered=function(M){var A=P(M),S=this.fragments[A];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},p.getBufferedTimes=function(M,A,S,x){for(var d={time:[],partial:S},a=A?A.start:M.start,s=A?A.end:M.end,u=M.minEndPTS||s,L=M.maxStartPTS||a,f=0;f<x.length;f++){var v=x.start(f)-this.bufferPadding,D=x.end(f)+this.bufferPadding;if(L>=v&&u<=D){d.time.push({startPTS:Math.max(a,x.start(f)),endPTS:Math.min(s,x.end(f))});break}else if(a<D&&s>v)d.partial=!0,d.time.push({startPTS:Math.max(a,x.start(f)),endPTS:Math.min(s,x.end(f))});else if(s<=v)break}return d},p.getPartialFragment=function(M){var A=null,S,x,d,a=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(L){var f=u[L];if(!f)return;B(f)&&(x=f.body.start-s,d=f.body.end+s,M>=x&&M<=d&&(S=Math.min(M-x,d-M),a<=S&&(A=f.body,a=S)))}),A},p.getState=function(M){var A=P(M),S=this.fragments[A];return S?S.buffered?B(S)?R.PARTIAL:R.OK:S.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},p.backtrack=function(M,A){var S=P(M),x=this.fragments[S];if(!x||x.backtrack)return null;var d=x.backtrack=A||x.loaded;return x.loaded=null,d},p.getBacktrackData=function(M){var A=P(M),S=this.fragments[A];if(S){var x,d=S.backtrack;if(d!=null&&(x=d.payload)!==null&&x!==void 0&&x.byteLength)return d;this.removeFragment(M)}return null},p.isTimeBuffered=function(M,A,S){for(var x,d,a=0;a<S.length;a++){if(x=S.start(a)-this.bufferPadding,d=S.end(a)+this.bufferPadding,M>=x&&A<=d)return!0;if(A<=x)return!1}return!1},p.onFragLoaded=function(M,A){var S=A.frag,x=A.part;if(S.sn==="initSegment"||S.bitrateTest||x)return;var d=P(S);this.fragments[d]={body:S,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},p.onBufferAppended=function(M,A){var S=this,x=A.frag,d=A.part,a=A.timeRanges;if(x.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=x,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(u){var L=a[u];if(S.detectEvictedFragments(u,L),!d)for(var f=0;f<L.length;f++)x.appendedPTS=Math.max(L.end(f),x.appendedPTS||0)})},p.onFragBuffered=function(M,A){this.detectPartialFragments(A)},p.hasFragment=function(M){var A=P(M);return!!this.fragments[A]},p.removeFragmentsInRange=function(M,A,S){var x=this;Object.keys(this.fragments).forEach(function(d){var a=x.fragments[d];if(!a)return;if(a.buffered){var s=a.body;s.type===S&&s.start<A&&s.end>M&&x.removeFragment(s)}})},p.removeFragment=function(M){var A=P(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[A]},p.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function B(w){var p,b;return w.buffered&&(((p=w.range.video)===null||p===void 0?void 0:p.partial)||((b=w.range.audio)===null||b===void 0?void 0:b.partial))}function P(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"STALL_MINIMUM_DURATION_MS",function(){return B}),k.d($,"MAX_START_GAP_JUMP",function(){return P}),k.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),k.d($,"SKIP_BUFFER_RANGE_START",function(){return p}),k.d($,"default",function(){return b});var Y=k("./src/utils/buffer-helper.ts"),F=k("./src/errors.ts"),R=k("./src/events.ts"),W=k("./src/utils/logger.ts"),B=250,P=2,w=.1,p=.05,b=function(){function M(S,x,d,a){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=S,this.media=x,this.fragmentTracker=d,this.hls=a}var A=M.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(x){var d=this.config,a=this.media,s=this.stalled,u=a.currentTime,L=a.seeking,f=this.seeking&&!L,v=!this.seeking&&L;if(this.seeking=L,u!==x){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||f)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Y.BufferHelper.getBuffered(a).length)return;var T=Y.BufferHelper.bufferInfo(a,u,0),g=T.len>0,c=T.nextStart||0;if(!g&&!c)return;if(L){var h=T.len>P,o=!c||c-u>P&&!this.fragmentTracker.getPartialFragment(u);if(h||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var C,E=Math.max(c,T.start||0)-u,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,O=m==null||((C=m.details)===null||C===void 0)?void 0:C.live,U=O?m.details.targetduration*2:P;if(E>0&&E<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var K=j-s;!L&&K>=B&&this._reportStall(T.len);var I=Y.BufferHelper.bufferInfo(a,u,d.maxBufferHole);this._tryFixBufferStall(I,K)},A._tryFixBufferStall=function(x,d){var a=this.config,s=this.fragmentTracker,u=this.media,L=u.currentTime,f=s.getPartialFragment(L);if(f){var v=this._trySkipBufferHole(f);if(v)return}x.len>a.maxBufferHole&&d>a.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(x){var d=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+x+")"),d.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},A._trySkipBufferHole=function(x){for(var d=this.config,a=this.hls,s=this.media,u=s.currentTime,L=0,f=Y.BufferHelper.getBuffered(s),v=0;v<f.length;v++){var D=f.start(v);if(u+d.maxBufferHole>=L&&u<D){var T=Math.max(D+p,s.currentTime+w);return W.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+T),this.moved=!0,this.stalled=null,s.currentTime=T,x&&a.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+T,frag:x}),T}L=f.end(v)}return 0},A._tryNudgeBuffer=function(){var x=this.config,d=this.hls,a=this.media,s=a.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<x.nudgeMaxRetry){var L=s+u*x.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+L),a.currentTime=L,d.trigger(R.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 "+x.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/events.ts"),F=k("./src/utils/texttrack-utils.ts"),R=k("./src/demux/id3.ts"),W=.25,B=function(){function P(p){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=p,this._registerListeners()}var w=P.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var b=this.hls;b.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var b=this.hls;b.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(b,M){this.media=M.media},w.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},w.getID3Track=function(b){if(!this.media)return;for(var M=0;M<b.length;M++){var A=b[M];if(A.kind==="metadata"&&A.label==="id3")return Object(F.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},w.onFragParsingMetadata=function(b,M){if(!this.media)return;var A=M.frag,S=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var x=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<S.length;d++){var a=R.getID3Frames(S[d].data);if(a){var s=S[d].pts,u=d<S.length-1?S[d+1].pts:A.end,L=u-s;L<=0&&(u=s+W);for(var f=0;f<a.length;f++){var v=a[f];if(!R.isTimeStampFrame(v)){var D=new x(s,u,"");D.value=v,this.id3Track.addCue(D)}}}}},w.onBufferFlushing=function(b,M){var A=M.startOffset,S=M.endOffset,x=M.type;if(!x||x==="audio"){var d=this.id3Track;d&&Object(F.removeCuesInRange)(d,A,S)}},P}();$.default=B},"./src/controller/latency-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return P});var Y=k("./src/errors.ts"),F=k("./src/events.ts"),R=k("./src/utils/logger.ts");function W(w,p){for(var b=0;b<p.length;b++){var M=p[b];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(w,M.key,M)}}function B(w,p,b){return p&&W(w.prototype,p),b&&W(w,b),w}var P=function(){function w(b){var M=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return M.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var p=w.prototype;return p.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},p.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)},p.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)},p.onMediaAttached=function(M,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},p.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},p.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},p.onLevelUpdated=function(M,A){var S=A.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},p.onError=function(M,A){if(A.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},p.timeupdate=function(){var M=this.media,A=this.levelDetails;if(!M||!A)return;this.currentTime=M.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var x=this.config,d=x.lowLatencyMode,a=x.maxLiveSyncPlaybackRate;if(!d||a===1)return;var s=this.targetLatency;if(s===null)return;var u=S-s,L=Math.min(this.maxLatency,s+A.targetduration),f=u<L;if(A.live&&f&&u>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;M.playbackRate=Math.min(v,Math.max(1,D))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},p.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},p.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},B(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,A=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:A?M.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var A=M.holdBack,S=M.partHoldBack,x=M.targetduration,d=this.config,a=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,L=this.hls.userConfig,f=u&&S||A;(L.liveSyncDuration||L.liveSyncDurationCount||f===0)&&(f=a!==void 0?a:s*x);var v=x,D=1;return f+Math.min(this.stallCount*D,v)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),A=this.targetLatency,S=this.levelDetails;if(M===null||A===null||S===null)return null;var x=S.edge,d=M-A-this.edgeStalled,a=x-S.totalduration,s=x-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(a,d),s)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var A=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-A,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,A=this.levelDetails;if(!M||!A)return 0;var S=M.buffered.length;return S?M.buffered.end(S-1):A.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return d});var Y=k("./src/types/level.ts"),F=k("./src/events.ts"),R=k("./src/errors.ts"),W=k("./src/utils/codecs.ts"),B=k("./src/controller/level-helper.ts"),P=k("./src/controller/base-playlist-controller.ts"),w=k("./src/types/loader.ts");function p(){return p=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var L in u)Object.prototype.hasOwnProperty.call(u,L)&&(a[L]=u[L])}return a},p.apply(this,arguments)}function b(a,s){for(var u=0;u<s.length;u++){var L=s[u];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function M(a,s,u){return s&&b(a.prototype,s),u&&b(a,u),a}function A(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,S(a,s)}function S(a,s){return S=Object.setPrototypeOf||function(L,f){return L.__proto__=f,L},S(a,s)}var x=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(a){A(s,a);function s(L){var f;return f=a.call(this,L,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var u=s.prototype;return u._registerListeners=function(){var f=this.hls;f.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(F.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var f=this.hls;f.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(F.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},u.startLoad=function(){var f=this._levels;f.forEach(function(v){v.loadError=0}),a.prototype.startLoad.call(this)},u.onManifestLoaded=function(f,v){var D=[],T=[],g=[],c,h={},o,C=!1,E=!1,m=!1;if(v.levels.forEach(function(K){var I=K.attrs;C=C||!!(K.width&&K.height),E=E||!!K.videoCodec,m=m||!!K.audioCodec,x&&K.audioCodec&&K.audioCodec.indexOf("mp4a.40.34")!==-1&&(K.audioCodec=void 0);var N=K.bitrate+"-"+K.attrs.RESOLUTION+"-"+K.attrs.CODECS;o=h[N],o?o.url.push(K.url):(o=new Y.Level(K),h[N]=o,D.push(o)),I&&(I.AUDIO&&Object(B.addGroupId)(o,"audio",I.AUDIO),I.SUBTITLES&&Object(B.addGroupId)(o,"text",I.SUBTITLES))}),(C||E)&&m&&(D=D.filter(function(K){var I=K.videoCodec,N=K.width,X=K.height;return!!I||!!(N&&X)})),D=D.filter(function(K){var I=K.audioCodec,N=K.videoCodec;return(!I||Object(W.isCodecSupportedInMp4)(I,"audio"))&&(!N||Object(W.isCodecSupportedInMp4)(N,"video"))}),v.audioTracks&&(T=v.audioTracks.filter(function(K){return!K.audioCodec||Object(W.isCodecSupportedInMp4)(K.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(T)),v.subtitles&&(g=v.subtitles,Object(B.assignTrackIdsByGroup)(g)),D.length>0){c=D[0].bitrate,D.sort(function(K,I){return K.bitrate-I.bitrate}),this._levels=D;for(var O=0;O<D.length;O++)if(D[O].bitrate===c){this._firstLevel=O,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+c);break}var U=m&&!E,j={levels:D,audioTracks:T,subtitleTracks:g,firstLevel:this._firstLevel,stats:v.stats,audio:m,video:E,altAudio:!U&&T.some(function(K){return!!K.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:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(f,v){if(a.prototype.onError.call(this,f,v),v.fatal)return;var D=v.context,T=this._levels[this.currentLevelIndex];if(D&&(D.type===w.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&D.groupId===T.audioGroupIds[T.urlId]||D.type===w.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&D.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,c=!0,h;switch(v.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(v.frag){var o=this._levels[v.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=v.frag.level)):h=v.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(c=!1),h=D.level),g=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:h=v.level,g=!0;break}h!==void 0&&this.recoverLevel(v,h,g,c)},u.recoverLevel=function(f,v,D,T){var g=f.details,c=this._levels[v];if(c.loadError++,D){var h=this.retryLoadingOrFail(f);if(h)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var o=c.url.length;if(o>1&&c.loadError<o)f.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var C=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==C&&this._levels[C].loadError===0&&(this.warn(g+": switch to "+C),f.levelRetry=!0,this.hls.nextAutoLevel=C)}}},u.redundantFailover=function(f){var v=this._levels[f],D=v.url.length;if(D>1){var T=(v.urlId+1)%D;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(g){g.urlId=T}),this.level=f}},u.onFragLoaded=function(f,v){var D=v.frag;if(D!==void 0&&D.type===w.PlaylistLevelType.MAIN){var T=this._levels[D.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},u.onLevelLoaded=function(f,v){var D,T=v.level,g=v.details,c=this._levels[T];if(!c){var h;this.warn("Invalid level index "+T),(h=v.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(g.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,v,c.details)):(D=v.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(g.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(f,v){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var T=-1,g=this.hls.audioTracks[v.id].groupId,c=0;c<D.audioGroupIds.length;c++)if(D.audioGroupIds[c]===g){T=c;break}T!==D.urlId&&(D.urlId=T,this.startLoad())}},u.loadPlaylist=function(f){var v=this.currentLevelIndex,D=this._levels[v];if(this.canLoad&&D&&D.url.length>0){var T=D.urlId,g=D.url[T];if(f)try{g=f.addDirectives(g)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+v+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+T+" "+g),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:g,level:v,id:T,deliveryDirectives:f||null})}},u.removeLevel=function(f,v){var D=function(c,h){return h!==v},T=this._levels.filter(function(g,c){return c!==f?!0:g.url.length>1&&v!==void 0?(g.url=g.url.filter(D),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(D)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(D)),g.urlId=0,!0):!1}).map(function(g,c){var h=g.details;return h!=null&&h.fragments&&h.fragments.forEach(function(o){o.level=c}),g});this._levels=T,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:T})},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var v,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===f&&(v=D[f])!==null&&v!==void 0&&v.details)return;if(f<0||f>=D.length){var T=f<0;if(this.hls.trigger(F.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:T,reason:"invalid level idx"}),T)return;f=Math.min(f,D.length-1)}this.clearTimer();var g=this.currentLevelIndex,c=D[g],h=D[f];this.log("switching to level "+f+" from "+g),this.currentLevelIndex=f;var o=p({},h,{level:f,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete o._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,o);var C=h.details;if(!C||C.live){var E=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(E)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"addGroupId",function(){return R}),k.d($,"assignTrackIdsByGroup",function(){return W}),k.d($,"updatePTS",function(){return B}),k.d($,"updateFragPTSDTS",function(){return w}),k.d($,"mergeDetails",function(){return p}),k.d($,"mapPartIntersection",function(){return b}),k.d($,"mapFragmentIntersection",function(){return M}),k.d($,"adjustSliding",function(){return A}),k.d($,"addSliding",function(){return S}),k.d($,"computeReloadInterval",function(){return x}),k.d($,"getFragmentWithSN",function(){return d}),k.d($,"getPartWith",function(){return a});var Y=k("./src/polyfills/number.ts"),F=k("./src/utils/logger.ts");function R(s,u,L){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(L);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(L);break}}function W(s){var u={};s.forEach(function(L){var f=L.groupId||"";L.id=u[f]=u[f]||0,u[f]++})}function B(s,u,L){var f=s[u],v=s[L];P(f,v)}function P(s,u){var L=u.startPTS;if(Object(Y.isFiniteNumber)(L)){var f=0,v;u.sn>s.sn?(f=L-s.start,v=s):(f=s.start-L,v=u),v.duration!==f&&(v.duration=f)}else if(u.sn>s.sn){var D=s.cc===u.cc;D&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function w(s,u,L,f,v,D){var T=f-L;T<=0&&(F.logger.warn("Fragment should have a positive duration",u),f=L+u.duration,D=v+u.duration);var g=L,c=f,h=u.startPTS,o=u.endPTS;if(Object(Y.isFiniteNumber)(h)){var C=Math.abs(h-L);Object(Y.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(C,u.deltaPTS):u.deltaPTS=C,g=Math.max(L,h),L=Math.min(L,h),v=Math.min(v,u.startDTS),c=Math.min(f,o),f=Math.max(f,o),D=Math.max(D,u.endDTS)}u.duration=f-L;var E=L-u.start;u.appendedPTS=f,u.start=u.startPTS=L,u.maxStartPTS=g,u.startDTS=v,u.endPTS=f,u.minEndPTS=c,u.endDTS=D;var m=u.sn;if(!s||m<s.startSN||m>s.endSN)return 0;var O,U=m-s.startSN,j=s.fragments;for(j[U]=u,O=U;O>0;O--)P(j[O],j[O-1]);for(O=U;O<j.length-1;O++)P(j[O],j[O+1]);return s.fragmentHint&&P(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,E}function p(s,u){for(var L=null,f=s.fragments,v=f.length-1;v>=0;v--){var D=f[v].initSegment;if(D){L=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var T=0,g;if(M(s,u,function(O,U){O.relurl&&(T=O.cc-U.cc),Object(Y.isFiniteNumber)(O.startPTS)&&Object(Y.isFiniteNumber)(O.endPTS)&&(U.start=U.startPTS=O.startPTS,U.startDTS=O.startDTS,U.appendedPTS=O.appendedPTS,U.maxStartPTS=O.maxStartPTS,U.endPTS=O.endPTS,U.endDTS=O.endDTS,U.minEndPTS=O.minEndPTS,U.duration=O.endPTS-O.startPTS,U.duration&&(g=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=O.elementaryStreams,U.loader=O.loader,U.stats=O.stats,U.urlId=O.urlId,O.initSegment&&(U.initSegment=O.initSegment,L=O.initSegment)}),L){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(O){var U;(!O.initSegment||O.initSegment.relurl===((U=L)===null||U===void 0?void 0:U.relurl))&&(O.initSegment=L)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(O){return!O}),u.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=u.skippedSegments;h--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var o=u.fragments;if(T){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var C=0;C<o.length;C++)o[C].cc+=T}u.skippedSegments&&(u.startCC=u.fragments[0].cc),b(s.partList,u.partList,function(O,U){U.elementaryStreams=O.elementaryStreams,U.stats=O.stats}),g?w(u,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):A(s,u),o.length&&(u.totalduration=u.edge-o[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var E=u.advancedDateTime;if(u.advanced&&E){var m=u.edge;u.driftStart||(u.driftStartTime=E,u.driftStart=m),u.driftEndTime=E,u.driftEnd=m}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function b(s,u,L){if(s&&u)for(var f=0,v=0,D=s.length;v<=D;v++){var T=s[v],g=u[v+f];T&&g&&T.index===g.index&&T.fragment.sn===g.fragment.sn?L(T,g):f--}}function M(s,u,L){for(var f=u.skippedSegments,v=Math.max(s.startSN,u.startSN)-u.startSN,D=(s.fragmentHint?1:0)+(f?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,T=u.startSN-s.startSN,g=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,h=v;h<=D;h++){var o=c[T+h],C=g[h];f&&!C&&h<f&&(C=u.fragments[h]=o),o&&C&&L(o,C)}}function A(s,u){var L=u.startSN+u.skippedSegments-s.startSN,f=s.fragments;if(L<0||L>=f.length)return;S(u,f[L].start)}function S(s,u){if(u){for(var L=s.fragments,f=s.skippedSegments;f<L.length;f++)L[f].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function x(s,u){var L=1e3*s.levelTargetDuration,f=L/2,v=s.age,D=v>0&&v<L*3,T=u.loading.end-u.loading.start,g,c=s.availabilityDelay;if(s.updated===!1)if(D){var h=333*s.misses;g=Math.max(Math.min(f,T*2),h),s.availabilityDelay=(s.availabilityDelay||0)+g}else g=f;else D?(c=Math.min(c||L/2,v),s.availabilityDelay=c,g=c+L-v):g=L-T;return Math.round(g)}function d(s,u,L){if(!s||!s.details)return null;var f=s.details,v=f.fragments[u-f.startSN];return v||(v=f.fragmentHint,v&&v.sn===u?v:u<f.startSN&&L&&L.sn===u?L:null)}function a(s,u,L){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var v=f.length;v--;){var D=f[v];if(D.index===L&&D.fragment.sn===u)return D}return null}},"./src/controller/stream-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return f});var Y=k("./src/polyfills/number.ts"),F=k("./src/controller/base-stream-controller.ts"),R=k("./src/is-supported.ts"),W=k("./src/events.ts"),B=k("./src/utils/buffer-helper.ts"),P=k("./src/controller/fragment-tracker.ts"),w=k("./src/types/loader.ts"),p=k("./src/loader/fragment.ts"),b=k("./src/demux/transmuxer-interface.ts"),M=k("./src/types/transmuxer.ts"),A=k("./src/controller/gap-controller.ts"),S=k("./src/errors.ts"),x=k("./src/utils/logger.ts");function d(v,D){for(var T=0;T<D.length;T++){var g=D[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(v,g.key,g)}}function a(v,D,T){return D&&d(v.prototype,D),T&&d(v,T),v}function s(v,D){v.prototype=Object.create(D.prototype),v.prototype.constructor=v,u(v,D)}function u(v,D){return u=Object.setPrototypeOf||function(g,c){return g.__proto__=c,g},u(v,D)}var L=100,f=function(v){s(D,v);function D(g,c){var h;return h=v.call(this,g,c,"[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 T=D.prototype;return T._registerListeners=function(){var c=this.hls;c.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(W.Events.ERROR,this.onError,this),c.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var c=this.hls;c.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(W.Events.ERROR,this.onError,this),c.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(c){if(this.levels){var h=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var C=o.startLevel;C===-1&&(o.config.testBandwidth?(C=0,this.bitrateTest=!0):C=o.nextAutoLevel),this.level=o.nextLoadLevel=C,this.loadedmetadata=!1}h>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),c=h),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var c,h=this.levels,o=this.level,C=h==null||((c=h[o])===null||c===void 0)?void 0:c.details;if(C&&(!C.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(C))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var E,m=self.performance.now(),O=this.retryDate;(!O||m>=O||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,h,o=this.hls,C=this.levelLastLoaded,E=this.levels,m=this.media,O=o.config,U=o.nextLoadLevel;if(C===null||!m&&(this.startFragRequested||!O.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!E||!E[U])return;var j=E[U];this.level=o.nextLoadLevel=U;var K=j.details;if(!K||this.state===F.State.WAITING_LEVEL||K.live&&this.levelLastLoaded!==U){this.state=F.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:m,w.PlaylistLevelType.MAIN);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(j.maxBitrate);if(N>=X)return;if(this._streamEnded(I,K)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,q),this.state=F.State.ENDED;return}var ae=I.end,he=this.getNextFragment(ae,K);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var Ae=he.sn-K.startSN;Ae>1&&(he=K.fragments[Ae-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===P.FragmentState.OK&&this.nextLoadPosition>ae){var be=this.audioOnly&&!this.altAudio?p.ElementaryStreamTypes.AUDIO:p.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(m,be,w.PlaylistLevelType.MAIN),he=this.getNextFragment(this.nextLoadPosition,K)}if(!he)return;he.initSegment&&!he.initSegment.data&&!this.bitrateTest&&(he=he.initSegment),((c=he.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((h=he.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(he,K):this.loadFragment(he,K,ae)},T.loadFragment=function(c,h,o){var C,E=this.fragmentTracker.getState(c);if(this.fragCurrent=c,E===P.FragmentState.BACKTRACKED){var m=this.fragmentTracker.getBacktrackData(c);if(m){this._handleFragmentLoadProgress(m),this._handleFragmentLoadComplete(m);return}else E=P.FragmentState.NOT_LOADED}E===P.FragmentState.NOT_LOADED||E===P.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,c,h,o)):E===P.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((C=this.media)===null||C===void 0?void 0:C.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var h=this.fragmentTracker.getAppendedFrag(c,w.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,w.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,h=this.media;if(h!=null&&h.readyState){var o,C=this.getAppendedFrag(h.currentTime);if(C&&C.start>1&&this.flushMainBuffer(0,C.start-1),!h.paused&&c){var E=this.hls.nextLoadLevel,m=c[E],O=this.fragLastKbps;O&&this.fragCurrent?o=this.fragCurrent.duration*m.maxBitrate/(1e3*O)+1:o=0}else o=0;var U=this.getBufferedFrag(h.currentTime+o);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var K=j.maxStartPTS?j.maxStartPTS:j.start,I=j.duration,N=Math.max(U.end,K+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(c,h){v.prototype.flushMainBuffer.call(this,c,h,this.altAudio?"video":null)},T.onMediaAttached=function(c,h){v.prototype.onMediaAttached.call(this,c,h);var o=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,o,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,h=c?c.currentTime:null;Object(Y.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},T.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},T.onManifestParsed=function(c,h){var o=!1,C=!1,E;h.levels.forEach(function(m){E=m.audioCodec,E&&(E.indexOf("mp4a.40.2")!==-1&&(o=!0),E.indexOf("mp4a.40.5")!==-1&&(C=!0))}),this.audioCodecSwitch=o&&C&&!Object(R.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},T.onLevelLoading=function(c,h){var o=this.levels;if(!o||this.state!==F.State.IDLE)return;var C=o[h.level];(!C.details||C.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(C.details))&&(this.state=F.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,h){var o,C=this.levels,E=h.level,m=h.details,O=m.totalduration;if(!C){this.warn("Levels were reset while loading level "+E);return}this.log("Level "+E+" loaded ["+m.startSN+","+m.endSN+"], cc ["+m.startCC+", "+m.endCC+"] duration:"+O);var U=this.fragCurrent;U&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==h.level&&U.loader&&(this.state=F.State.IDLE,U.loader.abort()));var j=C[E],K=0;if(m.live||(o=j.details)!==null&&o!==void 0&&o.live){if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed)return;K=this.alignPlaylists(m,j.details)}if(j.details=m,this.levelLastLoaded=E,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:m,level:E}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(m))return;this.state=F.State.IDLE}this.startFragRequested?m.live&&this.synchronizeToLiveEdge(m):this.setStartPosition(m,K),this.tick()},T._handleFragmentLoadProgress=function(c){var h,o=c.frag,C=c.part,E=c.payload,m=this.levels;if(!m){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var O=m[o.level],U=O.details;if(!U){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var j=O.videoCodec,K=U.PTSKnown||!U.live,I=(h=o.initSegment)===null||h===void 0?void 0:h.data,N=this._getAudioCodec(O),X=this.transmuxer=this.transmuxer||new b.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=C?C.index:-1,ae=q!==-1,he=new M.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,E.byteLength,q,ae),Ae=this.initPTS[o.cc];X.push(E,I,N,j,o,C,U.totalduration,K,he,Ae)},T.onAudioTrackSwitching=function(c,h){var o=this.altAudio,C=!!h.url,E=h.id;if(!C){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var m=this.fragCurrent;m!=null&&m.loader&&(this.log("Switching to main audio track, cancel main fragment load"),m.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var O=this.hls;o&&O.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),O.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:E})}},T.onAudioTrackSwitched=function(c,h){var o=h.id,C=!!this.hls.audioTracks[o].url;if(C){var E=this.videoBuffer;E&&this.mediaBuffer!==E&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=E)}this.altAudio=C,this.tick()},T.onBufferCreated=function(c,h){var o=h.tracks,C,E,m=!1;for(var O in o){var U=o[O];if(U.id==="main"){if(E=O,C=U,O==="video"){var j=o[O];j&&(this.videoBuffer=j.buffer)}}else m=!0}m&&C?(this.log("Alternate track found, use "+E+".buffered to schedule main fragment loading"),this.mediaBuffer=C.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,h){var o=h.frag,C=h.part;if(o&&o.type!==w.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(C?" p: "+C.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var E=C?C.stats:o.stats;this.fragLastKbps=Math.round(8*E.total/(E.buffering.end-E.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,C)},T.onError=function(c,h){switch(h.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,h);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.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 S.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var o=!0,C=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);C&&C.len>.5&&(o=!this.reduceMaxBufferLength(C.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,h=this.gapController;if(!c||!h||!c.readyState)return;var o=B.BufferHelper.getBuffered(c);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,h){var o=h.type;if(o!==p.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var C=(o===p.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(C,o,w.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,h){this.levels=h.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,h=c.currentTime,o=this.startPosition;if(o>=0&&h<o){if(c.seeking){x.logger.log("could not seek to "+o+", already seeking at "+h);return}var C=B.BufferHelper.getBuffered(c),E=C.length?C.start(0):0,m=E-o;m>0&&(m<this.config.maxBufferHole||m<this.config.maxFragLookUpTolerance)&&(x.logger.log("adjusting start position by "+m+" to match buffer start"),o+=m,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+h),c.currentTime=o}},T._getAudioCodec=function(c){var h=this.config.defaultAudioCodec||c.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},T._loadBitrateTestFrag=function(c){var h=this;this._doFragLoad(c).then(function(o){var C=h.hls;if(!o||C.nextLoadLevel||h.fragContextChanged(c))return;h.fragLoadError=0,h.state=F.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var E=c.stats;E.parsing.start=E.parsing.end=E.buffering.start=E.buffering.end=self.performance.now(),C.trigger(W.Events.FRAG_LOADED,o)})},T._handleTransmuxComplete=function(c){var h,o="main",C=this.hls,E=c.remuxResult,m=c.chunkMeta,O=this.getCurrentContext(m);if(!O){this.warn("The loading context changed while buffering fragment "+m.sn+" of level "+m.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(m.level);return}var U=O.frag,j=O.part,K=O.level,I=E.video,N=E.text,X=E.id3,q=E.initSegment,ae=this.altAudio?void 0:E.audio;if(this.fragContextChanged(U))return;if(this.state=F.State.PARSING,q){q.tracks&&(this._bufferInitSegment(K,q.tracks,U,m),C.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:o,tracks:q.tracks}));var he=q.initPTS,Ae=q.timescale;Object(Y.isFiniteNumber)(he)&&(this.initPTS[U.cc]=he,C.trigger(W.Events.INIT_PTS_FOUND,{frag:U,id:o,initPTS:he,timescale:Ae}))}if(I&&E.independent!==!1){if(K.details){var be=I.startPTS,Te=I.endPTS,Ce=I.startDTS,Se=I.endDTS;if(j)j.elementaryStreams[I.type]={startPTS:be,endPTS:Te,startDTS:Ce,endDTS:Se};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<be){this.backtrack(U);return}U.setElementaryStreamInfo(I.type,U.start,Te,U.start,Se,!0)}U.setElementaryStreamInfo(I.type,be,Te,Ce,Se),this.bufferFragmentData(I,U,j,m)}}else if(E.independent===!1){this.backtrack(U);return}if(ae){var ue=ae.startPTS,te=ae.endPTS,fe=ae.startDTS,se=ae.endDTS;j&&(j.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:fe,endDTS:se}),U.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,ue,te,fe,se),this.bufferFragmentData(ae,U,j,m)}if(X!=null&&(h=X.samples)!==null&&h!==void 0&&h.length){var _e={frag:U,id:o,samples:X.samples};C.trigger(W.Events.FRAG_PARSING_METADATA,_e)}if(N){var Oe={frag:U,id:o,samples:N.samples};C.trigger(W.Events.FRAG_PARSING_USERDATA,Oe)}},T._bufferInitSegment=function(c,h,o,C){var E=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var m=h.audio,O=h.video,U=h.audiovideo;if(m){var j=c.audioCodec,K=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),m.metadata.channelCount!==1&&K.indexOf("firefox")===-1&&(j="mp4a.40.5")),K.indexOf("android")!==-1&&m.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),m.levelCodec=j,m.id="main",this.log("Init audio buffer, container:"+m.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+m.codec+"]")}O&&(O.levelCodec=c.videoCodec,O.id="main",this.log("Init video buffer, container:"+O.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+O.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(I){var N=h[I],X=N.initSegment;X!=null&&X.byteLength&&E.hls.trigger(W.Events.BUFFER_APPENDING,{type:I,data:X,frag:o,part:null,chunkMeta:C,parent:o.type})}),this.tick()},T.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var h=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,h?this.resetFragmentLoading(c):this.state=F.State.BACKTRACKING},T.checkFragmentChanged=function(){var c=this.media,h=null;if(c&&c.readyState>1&&c.seeking===!1){var o=c.currentTime;if(B.BufferHelper.isBuffered(c,o)?h=this.getAppendedFrag(o):B.BufferHelper.isBuffered(c,o+.1)&&(h=this.getAppendedFrag(o+.1)),h){var C=this.fragPlaying,E=h.level;(!C||h.sn!==C.sn||C.level!==E||h.urlId!==C.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:h}),(!C||C.level!==E)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:E}),this.fragPlaying=h)}}},a(D,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var h=this.getAppendedFrag(c.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var h=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"SubtitleStreamController",function(){return s});var Y=k("./src/events.ts"),F=k("./src/utils/logger.ts"),R=k("./src/utils/buffer-helper.ts"),W=k("./src/controller/fragment-finders.ts"),B=k("./src/utils/discontinuities.ts"),P=k("./src/controller/level-helper.ts"),w=k("./src/controller/fragment-tracker.ts"),p=k("./src/controller/base-stream-controller.ts"),b=k("./src/types/loader.ts"),M=k("./src/types/level.ts");function A(u,L){for(var f=0;f<L.length;f++){var v=L[f];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(u,v.key,v)}}function S(u,L,f){return L&&A(u.prototype,L),f&&A(u,f),u}function x(u,L){u.prototype=Object.create(L.prototype),u.prototype.constructor=u,d(u,L)}function d(u,L){return d=Object.setPrototypeOf||function(v,D){return v.__proto__=D,v},d(u,L)}var a=500,s=function(u){x(L,u);function L(v,D){var T;return T=u.call(this,v,D,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var f=L.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var D=this.hls;D.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(Y.Events.ERROR,this.onError,this),D.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var D=this.hls;D.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(Y.Events.ERROR,this.onError,this),D.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=p.State.IDLE,this.setInterval(a),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(D,T){this.mainDetails=T.details},f.onSubtitleFragProcessed=function(D,T){var g=T.frag,c=T.success;if(this.fragPrevious=g,this.state=p.State.IDLE,!c)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var o,C=g.start,E=0;E<h.length;E++)if(C>=h[E].start&&C<=h[E].end){o=h[E];break}var m=g.start+g.duration;o?o.end=m:(o={start:C,end:m},h.push(o)),this.fragmentTracker.fragBuffered(g)},f.onBufferFlushing=function(D,T){var g=T.startOffset,c=T.endOffset;if(g===0&&c!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,o=this.levels;if(!o.length||!o[h]||!o[h].details)return;var C=o[h].details,E=C.targetduration,m=c-E;if(m<=0)return;T.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(O){for(var U=0;U<O.length;){if(O[U].end<=m){O.shift();continue}else if(O[U].start<m)O[U].start=m;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(g,m,b.PlaylistLevelType.SUBTITLE)}},f.onError=function(D,T){var g,c=T.frag;if(!c||c.type!==b.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=p.State.IDLE},f.onSubtitleTracksUpdated=function(D,T){var g=this,c=T.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(h){return new M.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){g.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(D,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(a)},f.onSubtitleTrackLoaded=function(D,T){var g,c=T.details,h=T.id,o=this.currentTrackId,C=this.levels;if(!C.length)return;var E=C[o];if(h>=C.length||h!==o||!E)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(g=E.details)!==null&&g!==void 0&&g.live){var m=this.mainDetails;if(c.deltaUpdateFailed||!m)return;var O=m.fragments[0];if(!E.details)c.hasProgramDateTime&&m.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(c,m):O&&Object(P.addSliding)(c,O.start);else{var U=this.alignPlaylists(c,E.details);U===0&&O&&Object(P.addSliding)(c,O.start)}}if(E.details=c,this.levelLastLoaded=h,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===p.State.IDLE){var j=Object(W.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),E.details=void 0)}},f._handleFragmentLoadComplete=function(D){var T=D.frag,g=D.payload,c=T.decryptdata,h=this.hls;if(this.fragContextChanged(T))return;if(g&&g.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),c.key.buffer,c.iv.buffer).then(function(C){var E=performance.now();h.trigger(Y.Events.FRAG_DECRYPTED,{frag:T,payload:C,stats:{tstart:o,tdecrypt:E}})})}},f.doTick=function(){if(!this.media){this.state=p.State.IDLE;return}if(this.state===p.State.IDLE){var D,T=this.currentTrackId,g=this.levels;if(!g.length||!g[T]||!g[T].details)return;var c=g[T].details,h=c.targetduration,o=this.config,C=this.media,E=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,C.currentTime-h,o.maxBufferHole),m=E.end,O=E.len,U=this.getMaxBufferLength()+h;if(O>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,K=j.length,I=c.edge,N,X=this.fragPrevious;if(m<I){var q=o.maxFragLookUpTolerance;X&&c.hasProgramDateTime&&(N=Object(W.findFragmentByPDT)(j,X.endProgramDateTime,q)),N||(N=Object(W.findFragmentByPTS)(X,j,m,q),!N&&X&&X.start<j[0].start&&(N=j[0]))}else N=j[K-1];(D=N)!==null&&D!==void 0&&D.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=p.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===w.FragmentState.NOT_LOADED&&this.loadFragment(N,c,m)}},f.loadFragment=function(D,T,g){this.fragCurrent=D,u.prototype.loadFragment.call(this,D,T,g)},S(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(p.default)},"./src/controller/subtitle-track-controller.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/events.ts"),F=k("./src/utils/texttrack-utils.ts"),R=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function B(A,S){for(var x=0;x<S.length;x++){var d=S[x];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(A,d.key,d)}}function P(A,S,x){return S&&B(A.prototype,S),x&&B(A,x),A}function w(A,S){A.prototype=Object.create(S.prototype),A.prototype.constructor=A,p(A,S)}function p(A,S){return p=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},p(A,S)}var b=function(A){w(S,A);function S(d){var a;return a=A.call(this,d,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var x=S.prototype;return x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},x.registerListeners=function(){var a=this.hls;a.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Y.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var a=this.hls;a.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Y.Events.ERROR,this.onError,this)},x.onMediaAttached=function(a,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)},x.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},x.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 a=M(this.media.textTracks);a.forEach(function(s){Object(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},x.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},x.onSubtitleTrackLoaded=function(a,s){var u=s.id,L=s.details,f=this.trackId,v=this.tracksInGroup[f];if(!v){this.warn("Invalid subtitle track id "+u);return}var D=v.details;v.details=s.details,this.log("subtitle track "+u+" loaded ["+L.startSN+"-"+L.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,D))},x.onLevelLoading=function(a,s){this.switchLevel(s.level)},x.onLevelSwitching=function(a,s){this.switchLevel(s.level)},x.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(T){return!u||T.groupId===u});this.tracksInGroup=f;var v=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=u;var D={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,D),v!==-1&&this.setSubtitleTrack(v,L)}},x.findTrackId=function(a){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var L=s[u];if((!this.selectDefaultTrack||L.default)&&(!a||a===L.name))return L.id}return-1},x.onError=function(a,s){if(A.prototype.onError.call(this,a,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)},x.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,L=s.groupId,f=s.url;if(a)try{f=a.addDirectives(f)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:f,id:u,groupId:L,deliveryDirectives:a||null})}},x.toggleTrackModes=function(a){var s=this,u=this.media,L=this.subtitleDisplay,f=this.trackId;if(!u)return;var v=M(u.textTracks),D=v.filter(function(c){return c.groupId===s.groupId});if(a===-1)[].slice.call(v).forEach(function(c){c.mode="disabled"});else{var T=D[f];T&&(T.mode="disabled")}var g=D[a];g&&(g.mode=L?"showing":"hidden")},x.setSubtitleTrack=function(a,s){var u,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(u=L[a])!==null&&u!==void 0&&u.details)||a<-1||a>=L.length)return;this.clearTimer();var f=L[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,f){var v=f.id,D=f.groupId,T=D===void 0?"":D,g=f.name,c=f.type,h=f.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:T,name:g,type:c,url:h});var o=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:a})},x.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=M(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")a=u;else if(s[u].mode==="showing"){a=u;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},P(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),S}(R.default);function M(A){for(var S=[],x=0;x<A.length;x++){var d=A[x];d.kind==="subtitles"&&d.label&&S.push(A[x])}return S}$.default=b},"./src/controller/timeline-controller.ts":function(ne,$,k){"use strict";k.r($),k.d($,"TimelineController",function(){return M});var Y=k("./src/polyfills/number.ts"),F=k("./src/events.ts"),R=k("./src/utils/cea-608-parser.ts"),W=k("./src/utils/output-filter.ts"),B=k("./src/utils/webvtt-parser.ts"),P=k("./src/utils/texttrack-utils.ts"),w=k("./src/utils/imsc1-ttml-parser.ts"),p=k("./src/types/loader.ts"),b=k("./src/utils/logger.ts"),M=function(){function d(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=x(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new W.default(this,"textTrack1"),L=new W.default(this,"textTrack2"),f=new W.default(this,"textTrack3"),v=new W.default(this,"textTrack4");this.cea608Parser1=new R.default(1,u,L),this.cea608Parser2=new R.default(3,f,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 a=d.prototype;return a.destroy=function(){var u=this.hls;u.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(F.Events.FRAG_LOADING,this.onFragLoading,this),u.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(u,L,f,v,D){for(var T=!1,g=D.length;g--;){var c=D[g],h=S(c[0],c[1],L,f);if(h>=0&&(c[0]=Math.min(c[0],L),c[1]=Math.max(c[1],f),T=!0,h/(f-L)>.5))return}if(T||D.push([L,f]),this.config.renderTextTracksNatively){var o=this.captionsTracks[u];this.Cues.newCue(o,L,f,v)}else{var C=this.Cues.newCue(null,L,f,v);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:C,track:u})}},a.onInitPtsFound=function(u,L){var f=this,v=L.frag,D=L.id,T=L.initPTS,g=L.timescale,c=this.unparsedVttFrags;D==="main"&&(this.initPTS[v.cc]=T,this.timescale[v.cc]=g),c.length&&(this.unparsedVttFrags=[],c.forEach(function(h){f.onFragLoaded(F.Events.FRAG_LOADED,h)}))},a.getExistingTrack=function(u){var L=this.media;if(L)for(var f=0;f<L.textTracks.length;f++){var v=L.textTracks[f];if(v[u])return v}return null},a.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},a.createNativeTrack=function(u){if(this.captionsTracks[u])return;var L=this.captionsProperties,f=this.captionsTracks,v=this.media,D=L[u],T=D.label,g=D.languageCode,c=this.getExistingTrack(u);if(c)f[u]=c,Object(P.clearCurrentCues)(f[u]),Object(P.sendAddTrackEvent)(f[u],v);else{var h=this.createTextTrack("captions",T,g);h&&(h[u]=!0,f[u]=h)}},a.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var L=this.captionsProperties[u];if(!L)return;var f=L.label,v={_id:u,label:f,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[u]=v,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},a.createTextTrack=function(u,L,f){var v=this.media;return v?v.addTextTrack(u,L,f):void 0},a.onMediaAttaching=function(u,L){this.media=L.media,this._cleanTracks()},a.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(L){Object(P.clearCurrentCues)(u[L]),delete u[L]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=x(),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())},a._cleanTracks=function(){var u=this.media;if(!u)return;var L=u.textTracks;if(L)for(var f=0;f<L.length;f++)Object(P.clearCurrentCues)(L[f])},a.onSubtitleTracksUpdated=function(u,L){var f=this;this.textTracks=[];var v=L.subtitleTracks||[],D=v.some(function(h){return h.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var T=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,o){var C;if(o<g.length){for(var E=null,m=0;m<g.length;m++)if(A(g[m],h)){E=g[m];break}E&&(C=E)}C?Object(P.clearCurrentCues)(C):(C=f.createTextTrack("subtitles",h.name,h.lang),C&&(C.mode="disabled")),C&&(C.groupId=h.groupId,f.textTracks.push(C))})}else if(!T&&this.tracks&&this.tracks.length){var c=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:c})}}},a.onManifestLoaded=function(u,L){var f=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(v){var D=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!D)return;var T="textTrack"+D[1],g=f.captionsProperties[T];if(!g)return;g.label=v.name,v.lang&&(g.languageCode=v.lang),g.media=v})},a.onFragLoading=function(u,L){var f=this.cea608Parser1,v=this.cea608Parser2,D=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(f&&v))return;if(L.frag.type===p.PlaylistLevelType.MAIN){var g,c,h=L.frag.sn,o=(g=L==null||((c=L.part)===null||c===void 0)?void 0:c.index)!=null?g:-1;h===D+1||h===D&&o===T+1||(f.reset(),v.reset()),this.lastSn=h,this.lastPartIndex=o}},a.onFragLoaded=function(u,L){var f=L.frag,v=L.payload,D=this.initPTS,T=this.unparsedVttFrags;if(f.type===p.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(Y.isFiniteNumber)(D[f.cc])){T.push(L),D.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var g=f.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var c=this.tracks[f.level],h=this.vttCCs;h[f.cc]||(h[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===w.IMSC1_CODEC?this._parseIMSC1(f,v):this._parseVTTs(f,v,h)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(u,L){var f=this,v=this.hls;Object(w.parseIMSC1)(L,this.initPTS[u.cc],this.timescale[u.cc],function(D){f._appendCues(D,u.level),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(D){b.logger.log("Failed to parse IMSC1: "+D),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:D})})},a._parseVTTs=function(u,L,f){var v=this,D=this.hls;Object(B.parseWebVTT)(L,this.initPTS[u.cc],this.timescale[u.cc],f,u.cc,u.start,function(T){v._appendCues(T,u.level),D.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(T){v._fallbackToIMSC1(u,L),b.logger.log("Failed to parse VTT cue: "+T),D.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:T})})},a._fallbackToIMSC1=function(u,L){var f=this,v=this.tracks[u.level];v.textCodec||Object(w.parseIMSC1)(L,this.initPTS[u.cc],this.timescale[u.cc],function(){v.textCodec=w.IMSC1_CODEC,f._parseIMSC1(u,L)},function(){v.textCodec="wvtt"})},a._appendCues=function(u,L){var f=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[L];if(v.mode==="disabled")return;u.forEach(function(g){return Object(P.addCueToTrack)(v,g)})}else{var D=this.tracks[L],T=D.default?"default":"subtitles"+L;f.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:u,track:T})}},a.onFragDecrypted=function(u,L){var f=L.frag;if(f.type===p.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(F.Events.FRAG_LOADED,L)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(u,L){var f=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(f&&v))return;for(var D=0;D<L.samples.length;D++){var T=L.samples[D].bytes;if(T){var g=this.extractCea608Data(T);f.addData(L.samples[D].pts,g[0]),v.addData(L.samples[D].pts,g[1])}}},a.onBufferFlushing=function(u,L){var f=L.startOffset,v=L.endOffset,D=L.endOffsetSubtitles,T=L.type,g=this.media;if(!g||g.currentTime<v)return;if(!T||T==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(o){return Object(P.removeCuesInRange)(c[o],f,v)})}if(this.config.renderTextTracksNatively&&(f===0&&D!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(o){return Object(P.removeCuesInRange)(h[o],f,D)})}},a.extractCea608Data=function(u){for(var L=u[0]&31,f=2,v=[[],[]],D=0;D<L;D++){var T=u[f++],g=127&u[f++],c=127&u[f++],h=(4&T)!==0,o=3&T;if(g===0&&c===0)continue;h&&((o===0||o===1)&&(v[o].push(g),v[o].push(c)))}return v},d}();function A(d,a){return d&&d.label===a.name&&!(d.textTrack1||d.textTrack2)}function S(d,a,s,u){return Math.min(a,u)-Math.max(d,s)}function x(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return Y});var Y=function(){function F(W,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=B}var R=F.prototype;return R.decrypt=function(B,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,B)},F}()},"./src/crypt/aes-decryptor.ts":function(ne,$,k){"use strict";k.r($),k.d($,"removePadding",function(){return F}),k.d($,"default",function(){return R});var Y=k("./src/utils/typed-array.ts");function F(W){var B=W.byteLength,P=B&&new DataView(W.buffer).getUint8(B-1);return P?Object(Y.sliceUint8)(W,0,B-P):W}var R=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 B=W.prototype;return B.uint8ArrayToUint32Array_=function(w){for(var p=new DataView(w),b=new Uint32Array(4),M=0;M<4;M++)b[M]=p.getUint32(M*4);return b},B.initTable=function(){var w=this.sBox,p=this.invSBox,b=this.subMix,M=b[0],A=b[1],S=b[2],x=b[3],d=this.invSubMix,a=d[0],s=d[1],u=d[2],L=d[3],f=new Uint32Array(256),v=0,D=0,T=0;for(T=0;T<256;T++)T<128?f[T]=T<<1:f[T]=T<<1^283;for(T=0;T<256;T++){var g=D^D<<1^D<<2^D<<3^D<<4;g=g>>>8^g&255^99,w[v]=g,p[g]=v;var c=f[v],h=f[c],o=f[h],C=f[g]*257^g*16843008;M[v]=C<<24|C>>>8,A[v]=C<<16|C>>>16,S[v]=C<<8|C>>>24,x[v]=C,C=o*16843009^h*65537^c*257^v*16843008,a[g]=C<<24|C>>>8,s[g]=C<<16|C>>>16,u[g]=C<<8|C>>>24,L[g]=C,v?(v=c^f[f[f[o^c]]],D^=f[f[D]]):v=D=1}},B.expandKey=function(w){for(var p=this.uint8ArrayToUint32Array_(w),b=!0,M=0;M<p.length&&b;)b=p[M]===this.key[M],M++;if(b)return;this.key=p;var A=this.keySize=p.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var S=this.ksRows=(A+6+1)*4,x,d,a=this.keySchedule=new Uint32Array(S),s=this.invKeySchedule=new Uint32Array(S),u=this.sBox,L=this.rcon,f=this.invSubMix,v=f[0],D=f[1],T=f[2],g=f[3],c,h;for(x=0;x<S;x++){if(x<A){c=a[x]=p[x];continue}h=c,x%A===0?(h=h<<8|h>>>24,h=u[h>>>24]<<24|u[h>>>16&255]<<16|u[h>>>8&255]<<8|u[h&255],h^=L[x/A|0]<<24):A>6&&x%A===4&&(h=u[h>>>24]<<24|u[h>>>16&255]<<16|u[h>>>8&255]<<8|u[h&255]),a[x]=c=(a[x-A]^h)>>>0}for(d=0;d<S;d++)x=S-d,d&3?h=a[x]:h=a[x-4],d<4||x<=4?s[d]=h:s[d]=v[u[h>>>24]]^D[u[h>>>16&255]]^T[u[h>>>8&255]]^g[u[h&255]],s[d]=s[d]>>>0},B.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},B.decrypt=function(w,p,b){for(var M=this.keySize+6,A=this.invKeySchedule,S=this.invSBox,x=this.invSubMix,d=x[0],a=x[1],s=x[2],u=x[3],L=this.uint8ArrayToUint32Array_(b),f=L[0],v=L[1],D=L[2],T=L[3],g=new Int32Array(w),c=new Int32Array(g.length),h,o,C,E,m,O,U,j,K,I,N,X,q,ae,he=this.networkToHostOrderSwap;p<g.length;){for(K=he(g[p]),I=he(g[p+1]),N=he(g[p+2]),X=he(g[p+3]),m=K^A[0],O=X^A[1],U=N^A[2],j=I^A[3],q=4,ae=1;ae<M;ae++)h=d[m>>>24]^a[O>>16&255]^s[U>>8&255]^u[j&255]^A[q],o=d[O>>>24]^a[U>>16&255]^s[j>>8&255]^u[m&255]^A[q+1],C=d[U>>>24]^a[j>>16&255]^s[m>>8&255]^u[O&255]^A[q+2],E=d[j>>>24]^a[m>>16&255]^s[O>>8&255]^u[U&255]^A[q+3],m=h,O=o,U=C,j=E,q=q+4;h=S[m>>>24]<<24^S[O>>16&255]<<16^S[U>>8&255]<<8^S[j&255]^A[q],o=S[O>>>24]<<24^S[U>>16&255]<<16^S[j>>8&255]<<8^S[m&255]^A[q+1],C=S[U>>>24]<<24^S[j>>16&255]<<16^S[m>>8&255]<<8^S[O&255]^A[q+2],E=S[j>>>24]<<24^S[m>>16&255]<<16^S[O>>8&255]<<8^S[U&255]^A[q+3],c[p]=he(h^f),c[p+1]=he(E^v),c[p+2]=he(C^D),c[p+3]=he(o^T),f=K,v=I,D=N,T=X,p=p+4}return c.buffer},W}()},"./src/crypt/decrypter.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return p});var Y=k("./src/crypt/aes-crypto.ts"),F=k("./src/crypt/fast-aes-key.ts"),R=k("./src/crypt/aes-decryptor.ts"),W=k("./src/utils/logger.ts"),B=k("./src/utils/mp4-tools.ts"),P=k("./src/utils/typed-array.ts"),w=16,p=function(){function b(A,S,x){var d=x===void 0?{}:x,a=d.removePKCS7Padding,s=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=A,this.config=S,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=b.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var x=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(x):x},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(S,x,d,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),x,d);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),x,d).then(a)},M.softwareDecrypt=function(S,x,d){var a=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(S=Object(B.appendUint8Array)(u,S),this.remainderData=null);var L=this.getValidChunk(S);if(!L.length)return null;a&&(d=a);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new R.default),f.expandKey(x);var v=s;return this.currentResult=f.decrypt(L.buffer,0,d),this.currentIV=Object(P.sliceUint8)(L,-16).buffer,v||null},M.webCryptoDecrypt=function(S,x,d){var a=this,s=this.subtle;return(this.key!==x||!this.fastAesKey)&&(this.key=x,this.fastAesKey=new F.default(s,x)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var L=new Y.default(s,d);return L.decrypt(S.buffer,u)}).catch(function(u){return a.onWebCryptoError(u,S,x,d)})},M.onWebCryptoError=function(S,x,d,a){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(x,d,a)},M.getValidChunk=function(S){var x=S,d=S.length-S.length%w;return d!==S.length&&(x=Object(P.sliceUint8)(S,0,d),this.remainderData=Object(P.sliceUint8)(S,d)),x},M.logOnce=function(S){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return Y});var Y=function(){function F(W,B){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=B}var R=F.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/demux/base-audio-demuxer.ts"),F=k("./src/demux/adts.ts"),R=k("./src/utils/logger.ts"),W=k("./src/demux/id3.ts");function B(p,b){p.prototype=Object.create(b.prototype),p.prototype.constructor=p,P(p,b)}function P(p,b){return P=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},P(p,b)}var w=function(p){B(b,p);function b(A,S){var x;return x=p.call(this)||this,x.observer=void 0,x.config=void 0,x.observer=A,x.config=S,x}var M=b.prototype;return M.resetInitSegment=function(S,x,d){p.prototype.resetInitSegment.call(this,S,x,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(S){if(!S)return!1;for(var x=W.getID3Data(S,0)||[],d=x.length,a=S.length;d<a;d++)if(F.probe(S,d))return R.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(S,x){return F.canParse(S,x)},M.appendFrame=function(S,x,d){F.initTrackConfig(S,this.observer,x,d,S.manifestCodec);var a=F.appendFrame(S,x,d,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},b}(Y.default);w.minProbeByteLength=9,$.default=w},"./src/demux/adts.ts":function(ne,$,k){"use strict";k.r($),k.d($,"getAudioConfig",function(){return W}),k.d($,"isHeaderPattern",function(){return B}),k.d($,"getHeaderLength",function(){return P}),k.d($,"getFullFrameLength",function(){return w}),k.d($,"canGetFrameLength",function(){return p}),k.d($,"isHeader",function(){return b}),k.d($,"canParse",function(){return M}),k.d($,"probe",function(){return A}),k.d($,"initTrackConfig",function(){return S}),k.d($,"getFrameDuration",function(){return x}),k.d($,"parseFrameHeader",function(){return d}),k.d($,"appendFrame",function(){return a});var Y=k("./src/utils/logger.ts"),F=k("./src/errors.ts"),R=k("./src/events.ts");function W(s,u,L,f){var v,D,T,g,c=navigator.userAgent.toLowerCase(),h=f,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((u[L+2]&192)>>>6)+1;var C=(u[L+2]&60)>>>2;if(C>o.length-1){s.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+C});return}return T=(u[L+2]&1)<<2,T|=(u[L+3]&192)>>>6,Y.logger.log("manifest codec:"+f+", ADTS type:"+v+", samplingIndex:"+C),/firefox/i.test(c)?C>=6?(v=5,g=new Array(4),D=C-3):(v=2,g=new Array(2),D=C):c.indexOf("android")!==-1?(v=2,g=new Array(2),D=C):(v=5,g=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&C>=6?D=C-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(C>=6&&T===1||/vivaldi/i.test(c))||!f&&T===1)&&(v=2,g=new Array(2)),D=C)),g[0]=v<<3,g[0]|=(C&14)>>1,g[1]|=(C&1)<<7,g[1]|=T<<3,v===5&&(g[1]|=(D&14)>>1,g[2]=(D&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:o[C],channelCount:T,codec:"mp4a.40."+v,manifestCodec:h}}function B(s,u){return s[u]===255&&(s[u+1]&246)===240}function P(s,u){return s[u+1]&1?7:9}function w(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function p(s,u){return u+5<s.length}function b(s,u){return u+1<s.length&&B(s,u)}function M(s,u){return p(s,u)&&B(s,u)&&w(s,u)<=s.length-u}function A(s,u){if(b(s,u)){var L=P(s,u);if(u+L>=s.length)return!1;var f=w(s,u);if(f<=L)return!1;var v=u+f;return v===s.length||b(s,v)}return!1}function S(s,u,L,f,v){if(!s.samplerate){var D=W(u,L,f,v);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,Y.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function x(s){return 1024*9e4/s}function d(s,u,L,f,v){var D=P(s,u),T=w(s,u);if(T-=D,T>0){var g=L+f*v;return{headerLength:D,frameLength:T,stamp:g}}}function a(s,u,L,f,v){var D=x(s.samplerate),T=d(u,L,f,v,D);if(T){var g=T.frameLength,c=T.headerLength,h=T.stamp,o=c+g,C=Math.max(0,L+o-u.length),E;C?(E=new Uint8Array(o-c),E.set(u.subarray(L+c,u.length),0)):E=u.subarray(L+c,L+o);var m={unit:E,pts:h};return C||s.samples.push(m),{sample:m,length:o,missing:C}}}},"./src/demux/base-audio-demuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"initPTSFn",function(){return w});var Y=k("./src/polyfills/number.ts"),F=k("./src/demux/id3.ts"),R=k("./src/demux/dummy-demuxed-track.ts"),W=k("./src/utils/mp4-tools.ts"),B=k("./src/utils/typed-array.ts"),P=function(){function p(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=p.prototype;return b.resetInitSegment=function(A,S,x){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(A,S){return!1},b.appendFrame=function(A,S,x){},b.demux=function(A,S){this.cachedData&&(A=Object(W.appendUint8Array)(this.cachedData,A),this.cachedData=null);var x=F.getID3Data(A,0),d=x?x.length:0,a,s,u=this._audioTrack,L=this._id3Track,f=x?F.getTimeStamp(x):void 0,v=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(f,S)),x&&x.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),s=this.initPTS;d<v;){if(this.canParse(A,d)){var D=this.appendFrame(u,A,d);D?(this.frameIndex++,s=D.sample.pts,d+=D.length,a=d):d=v}else F.canParse(A,d)?(x=F.getID3Data(A,d),L.samples.push({pts:s,dts:s,data:x}),d+=x.length,a=d):d++;if(d===v&&a!==v){var T=Object(B.sliceUint8)(A,a);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:u,avcTrack:Object(R.dummyTrack)(),id3Track:L,textTrack:Object(R.dummyTrack)()}},b.demuxSampleAes=function(A,S,x){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(A){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},b.destroy=function(){},p}(),w=function(b,M){return Object(Y.isFiniteNumber)(b)?b*90:M*9e4};$.default=P},"./src/demux/chunk-cache.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return Y});var Y=function(){function R(){this.chunks=[],this.dataLength=0}var W=R.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,w=this.dataLength,p;if(P.length)P.length===1?p=P[0]:p=F(P,w);else return new Uint8Array(0);return this.reset(),p},W.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function F(R,W){for(var B=new Uint8Array(W),P=0,w=0;w<R.length;w++){var p=R[w];B.set(p,P),P+=p.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ne,$,k){"use strict";k.r($),k.d($,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/utils/logger.ts"),F=function(){function R(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var W=R.prototype;return W.loadWord=function(){var P=this.data,w=this.bytesAvailable,p=P.byteLength-w,b=new Uint8Array(4),M=Math.min(4,w);if(M===0)throw new Error("no bytes available");b.set(P.subarray(p,p+M)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},W.skipBits=function(P){var w;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,w=P>>3,P-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var w=Math.min(this.bitsAvailable,P),p=this.word>>>32-w;return P>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=w,this.bitsAvailable>0?this.word<<=w:this.bytesAvailable>0&&this.loadWord(),w=P-w,w>0&&this.bitsAvailable?p<<w|this.readBits(w):p},W.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>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(P){for(var w=8,p=8,b,M=0;M<P;M++)p!==0&&(b=this.readEG(),p=(w+b+256)%256),w=p===0?w:p},W.readSPS=function(){var P=0,w=0,p=0,b=0,M,A,S,x=this.readUByte.bind(this),d=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),L=this.skipEG.bind(this),f=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);x();var D=x();if(d(5),u(3),x(),f(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var T=a();if(T===3&&u(1),f(),f(),u(1),s())for(A=T!==3?8:12,S=0;S<A;S++)s()&&(S<6?v(16):v(64))}f();var g=a();if(g===0)a();else if(g===1)for(u(1),L(),L(),M=a(),S=0;S<M;S++)L();f(),u(1);var c=a(),h=a(),o=d(1);o===0&&u(1),u(1),s()&&(P=a(),w=a(),p=a(),b=a());var C=[1,1];if(s()&&s()){var E=x();switch(E){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[x()<<8|x(),x()<<8|x()];break}}}return{width:Math.ceil((c+1)*16-P*2-w*2),height:(2-o)*(h+1)*16-(o?2:4)*(p+b),pixelRatio:C}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();$.default=F},"./src/demux/id3.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isHeader",function(){return Y}),k.d($,"isFooter",function(){return F}),k.d($,"getID3Data",function(){return R}),k.d($,"canParse",function(){return B}),k.d($,"getTimeStamp",function(){return P}),k.d($,"isTimeStampFrame",function(){return w}),k.d($,"getID3Frames",function(){return b}),k.d($,"decodeFrame",function(){return M}),k.d($,"utf8ArrayToStr",function(){return a}),k.d($,"testables",function(){return s});var Y=function(v,D){return D+10<=v.length&&(v[D]===73&&v[D+1]===68&&v[D+2]===51&&(v[D+3]<255&&v[D+4]<255&&(v[D+6]<128&&v[D+7]<128&&v[D+8]<128&&v[D+9]<128)))},F=function(v,D){return D+10<=v.length&&(v[D]===51&&v[D+1]===68&&v[D+2]===73&&(v[D+3]<255&&v[D+4]<255&&(v[D+6]<128&&v[D+7]<128&&v[D+8]<128&&v[D+9]<128)))},R=function(v,D){for(var T=D,g=0;Y(v,D);){g+=10;var c=W(v,D+6);g+=c,F(v,D+10)&&(g+=10),D+=g}return g>0?v.subarray(T,T+g):void 0},W=function(v,D){var T=0;return T=(v[D]&127)<<21,T|=(v[D+1]&127)<<14,T|=(v[D+2]&127)<<7,T|=v[D+3]&127,T},B=function(v,D){return Y(v,D)&&W(v,D+6)+10<=v.length-D},P=function(v){for(var D=b(v),T=0;T<D.length;T++){var g=D[T];if(w(g))return d(g)}return},w=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},p=function(v){var D=String.fromCharCode(v[0],v[1],v[2],v[3]),T=W(v,4),g=10;return{type:D,size:T,data:v.subarray(g,g+T)}},b=function(v){for(var D=0,T=[];Y(v,D);){var g=W(v,D+6);D+=10;for(var c=D+g;D+8<c;){var h=p(v.subarray(D)),o=M(h);o&&T.push(o),D+=h.size+10}F(v,D)&&(D+=10)}return T},M=function(v){return v.type==="PRIV"?A(v):v.type[0]==="W"?x(v):S(v)},A=function(v){if(v.size<2)return;var D=a(v.data,!0),T=new Uint8Array(v.data.subarray(D.length+1));return{key:v.type,info:D,data:T.buffer}},S=function(v){if(v.size<2)return;if(v.type==="TXXX"){var D=1,T=a(v.data.subarray(D),!0);D+=T.length+1;var g=a(v.data.subarray(D));return{key:v.type,info:T,data:g}}var c=a(v.data.subarray(1));return{key:v.type,data:c}},x=function(v){if(v.type==="WXXX"){if(v.size<2)return;var D=1,T=a(v.data.subarray(D),!0);D+=T.length+1;var g=a(v.data.subarray(D));return{key:v.type,info:T,data:g}}var c=a(v.data);return{key:v.type,data:c}},d=function(v){if(v.data.byteLength===8){var D=new Uint8Array(v.data),T=D[3]&1,g=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return g/=45,T&&(g+=4772185884e-2),Math.round(g)}return},a=function(v,D){D===void 0&&(D=!1);var T=L();if(T){var g=T.decode(v);if(D){var c=g.indexOf("\0");return c!==-1?g.substring(0,c):g}return g.replace(/\0/g,"")}for(var h=v.length,o,C,E,m="",O=0;O<h;){if(o=v[O++],o===0&&D)return m;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:m+=String.fromCharCode(o);break;case 12:case 13:C=v[O++],m+=String.fromCharCode((o&31)<<6|C&63);break;case 14:C=v[O++],E=v[O++],m+=String.fromCharCode((o&15)<<12|(C&63)<<6|(E&63)<<0);break;default:}}return m},s={decodeTextFrame:S},u;function L(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/demux/base-audio-demuxer.ts"),F=k("./src/demux/id3.ts"),R=k("./src/utils/logger.ts"),W=k("./src/demux/mpegaudio.ts");function B(p,b){p.prototype=Object.create(b.prototype),p.prototype.constructor=p,P(p,b)}function P(p,b){return P=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},P(p,b)}var w=function(p){B(b,p);function b(){return p.apply(this,arguments)||this}var M=b.prototype;return M.resetInitSegment=function(S,x,d){p.prototype.resetInitSegment.call(this,S,x,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(S){if(!S)return!1;for(var x=F.getID3Data(S,0)||[],d=x.length,a=S.length;d<a;d++)if(W.probe(S,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(S,x){return W.canParse(S,x)},M.appendFrame=function(S,x,d){return this.initPTS===null?void 0:W.appendFrame(S,x,d,this.initPTS,this.frameIndex)},b}(Y.default);w.minProbeByteLength=4,$.default=w},"./src/demux/mp4demuxer.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/utils/mp4-tools.ts"),F=k("./src/demux/dummy-demuxed-track.ts"),R=function(){function W(P,w){this.remainderData=null,this.config=void 0,this.config=w}var B=W.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},W.probe=function(w){return Object(Y.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},B.demux=function(w){var p=w,b=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(p=Object(Y.appendUint8Array)(this.remainderData,w));var M=Object(Y.segmentValidRange)(p);this.remainderData=M.remainder,b.samples=M.valid||new Uint8Array}else b.samples=p;return{audioTrack:Object(F.dummyTrack)(),avcTrack:b,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.flush=function(){var w=Object(F.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:w,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.demuxSampleAes=function(w,p,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},W}();R.minProbeByteLength=1024,$.default=R},"./src/demux/mpegaudio.ts":function(ne,$,k){"use strict";k.r($),k.d($,"appendFrame",function(){return P}),k.d($,"parseHeader",function(){return w}),k.d($,"isHeaderPattern",function(){return p}),k.d($,"isHeader",function(){return b}),k.d($,"canParse",function(){return M}),k.d($,"probe",function(){return A});var Y=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],R=[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]],B=[0,1,1,4];function P(S,x,d,a,s){if(d+24>x.length)return;var u=w(x,d);if(u&&d+u.frameLength<=x.length){var L=u.samplesPerFrame*9e4/u.sampleRate,f=a+s*L,v={unit:x.subarray(d,d+u.frameLength),pts:f,dts:f};return S.config=[],S.channelCount=u.channelCount,S.samplerate=u.sampleRate,S.samples.push(v),{sample:v,length:u.frameLength,missing:0}}}function w(S,x){var d=S[x+1]>>3&3,a=S[x+1]>>1&3,s=S[x+2]>>4&15,u=S[x+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var L=S[x+2]>>1&1,f=S[x+3]>>6,v=d===3?3-a:a===3?3:4,D=F[v*14+s-1]*1e3,T=d===3?0:d===2?1:2,g=R[T*3+u],c=f===3?1:2,h=W[d][a],o=B[a],C=h*8*o,E=Math.floor(h*D/g+L)*o;if(Y===null){var m=navigator.userAgent||"",O=m.match(/Chrome\/(\d+)/i);Y=O?parseInt(O[1]):0}var U=!!Y&&Y<=87;return U&&a===2&&D>=224e3&&f===0&&(S[x+3]=S[x+3]|128),{sampleRate:g,channelCount:c,frameLength:E,samplesPerFrame:C}}}function p(S,x){return S[x]===255&&(S[x+1]&224)===224&&(S[x+1]&6)!==0}function b(S,x){return x+1<S.length&&p(S,x)}function M(S,x){var d=4;return p(S,x)&&d<=S.length-x}function A(S,x){if(x+1<S.length&&p(S,x)){var d=4,a=w(S,x),s=d;a!=null&&a.frameLength&&(s=a.frameLength);var u=x+s;return u===S.length||b(S,u)}return!1}},"./src/demux/sample-aes.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/crypt/decrypter.ts"),F=k("./src/demux/tsdemuxer.ts"),R=function(){function W(P,w,p){this.keyData=void 0,this.decrypter=void 0,this.keyData=p,this.decrypter=new Y.default(P,w,{removePKCS7Padding:!1})}var B=W.prototype;return B.decryptBuffer=function(w,p){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,p)},B.decryptAacSample=function(w,p,b,M){var A=w[p].unit,S=A.subarray(16,A.length-A.length%16),x=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),d=this;this.decryptBuffer(x,function(a){var s=new Uint8Array(a);A.set(s,16),M||d.decryptAacSamples(w,p+1,b)})},B.decryptAacSamples=function(w,p,b){for(;;p++){if(p>=w.length){b();return}if(w[p].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(w,p,b,M),!M)return}},B.getAvcEncryptedData=function(w){for(var p=Math.floor((w.length-48)/160)*16+16,b=new Int8Array(p),M=0,A=32;A<=w.length-16;A+=160,M+=16)b.set(w.subarray(A,A+16),M);return b},B.getAvcDecryptedUnit=function(w,p){for(var b=new Uint8Array(p),M=0,A=32;A<=w.length-16;A+=160,M+=16)w.set(b.subarray(M,M+16),A);return w},B.decryptAvcSample=function(w,p,b,M,A,S){var x=Object(F.discardEPB)(A.data),d=this.getAvcEncryptedData(x),a=this;this.decryptBuffer(d.buffer,function(s){A.data=a.getAvcDecryptedUnit(x,s),S||a.decryptAvcSamples(w,p,b+1,M)})},B.decryptAvcSamples=function(w,p,b,M){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;p++,b=0){if(p>=w.length){M();return}for(var A=w[p].units;!(b>=A.length);b++){var S=A[b];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(w,p,b,M,S,x),!x)return}}},W}();$.default=R},"./src/demux/transmuxer-interface.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A});var Y=k("./node_modules/webworkify-webpack/index.js"),F=k.n(Y),R=k("./src/events.ts"),W=k("./src/demux/transmuxer.ts"),B=k("./src/utils/logger.ts"),P=k("./src/errors.ts"),w=k("./src/utils/mediasource-helper.ts"),p=k("./node_modules/eventemitter3/index.js"),b=k.n(p),M=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function S(d,a,s,u){var L=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=d,this.id=a,this.onTransmuxComplete=s,this.onFlush=u;var f=d.config,v=function(h,o){o=o||{},o.frag=L.frag,o.id=L.id,d.trigger(h,o)};this.observer=new p.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,v),this.observer.on(R.Events.ERROR,v);var D={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var g;try{g=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(c){d.trigger(R.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},g.postMessage({cmd:"init",typeSupported:D,vendor:T,id:a,config:JSON.stringify(f)})}catch(c){B.logger.warn("Error in worker:",c),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new W.default(this.observer,D,f,T,a),this.worker=null}}else this.transmuxer=new W.default(this.observer,D,f,T,a)}var x=S.prototype;return x.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},x.push=function(a,s,u,L,f,v,D,T,g,c){var h=this;g.transmuxing.start=self.performance.now();var o=this.transmuxer,C=this.worker,E=v?v.start:f.start,m=f.decryptdata,O=this.frag,U=!(O&&f.cc===O.cc),j=!(O&&g.level===O.level),K=O?g.sn-O.sn:-1,I=this.part?g.part-this.part.index:1,N=!j&&(K===1||K===0&&I===1),X=self.performance.now();(j||K||f.stats.parsing.start===0)&&(f.stats.parsing.start=X),v&&(I||!N)&&(v.stats.parsing.start=X);var q=new W.TransmuxState(U,N,T,j,E);if(!N||U){B.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
discontinuity: `+U+`
trackSwitch: `+j+`
contiguous: `+N+`
accurateTimeOffset: `+T+`
timeOffset: `+E);var ae=new W.TransmuxConfig(u,L,s,D,c);this.configureTransmuxer(ae)}if(this.frag=f,this.part=v,C)C.postMessage({cmd:"demux",data:a,decryptdata:m,chunkMeta:g,state:q},a instanceof ArrayBuffer?[a]:[]);else if(o){var he=o.push(a,m,g,q);Object(W.isPromise)(he)?he.then(function(Ae){h.handleTransmuxComplete(Ae)}):this.handleTransmuxComplete(he)}},x.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var u=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:a});else if(u){var f=u.flush(a);Object(W.isPromise)(f)?f.then(function(v){s.handleFlushResult(v,a)}):this.handleFlushResult(f,a)}},x.handleFlushResult=function(a,s){var u=this;a.forEach(function(L){u.handleTransmuxComplete(L)}),this.onFlush(s)},x.onWorkerMessage=function(a){var s=a.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},x.configureTransmuxer=function(a){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):u&&u.configure(a)},x.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},S}()},"./src/demux/transmuxer-worker.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return P});var Y=k("./src/demux/transmuxer.ts"),F=k("./src/events.ts"),R=k("./src/utils/logger.ts"),W=k("./node_modules/eventemitter3/index.js"),B=k.n(W);function P(A){var S=new W.EventEmitter,x=function(a,s){A.postMessage({event:a,data:s})};S.on(F.Events.FRAG_DECRYPTED,x),S.on(F.Events.ERROR,x),A.addEventListener("message",function(d){var a=d.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);A.transmuxer=new Y.default(S,a.typeSupported,s,a.vendor,a.id),Object(R.enableLogs)(s.debug),x("init",null);break}case"configure":{A.transmuxer.configure(a.config);break}case"demux":{var u=A.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Y.isPromise)(u)?u.then(function(v){w(A,v)}):w(A,u);break}case"flush":{var L=a.chunkMeta,f=A.transmuxer.flush(L);Object(Y.isPromise)(f)?f.then(function(v){b(A,v,L)}):b(A,f,L);break}default:break}})}function w(A,S){if(M(S.remuxResult))return;var x=[],d=S.remuxResult,a=d.audio,s=d.video;a&&p(x,a),s&&p(x,s),A.postMessage({event:"transmuxComplete",data:S},x)}function p(A,S){S.data1&&A.push(S.data1.buffer),S.data2&&A.push(S.data2.buffer)}function b(A,S,x){S.forEach(function(d){w(A,d)}),A.postMessage({event:"flush",data:x})}function M(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return s}),k.d($,"isPromise",function(){return f}),k.d($,"TransmuxConfig",function(){return v}),k.d($,"TransmuxState",function(){return D});var Y=k("./src/events.ts"),F=k("./src/errors.ts"),R=k("./src/crypt/decrypter.ts"),W=k("./src/demux/aacdemuxer.ts"),B=k("./src/demux/mp4demuxer.ts"),P=k("./src/demux/tsdemuxer.ts"),w=k("./src/demux/mp3demuxer.ts"),p=k("./src/remux/mp4-remuxer.ts"),b=k("./src/remux/passthrough-remuxer.ts"),M=k("./src/demux/chunk-cache.ts"),A=k("./src/utils/mp4-tools.ts"),S=k("./src/utils/logger.ts"),x;try{x=self.performance.now.bind(self.performance)}catch(T){S.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var d=[{demux:P.default,remux:p.default},{demux:B.default,remux:b.default},{demux:W.default,remux:p.default},{demux:w.default,remux:p.default}],a=1024;d.forEach(function(T){var g=T.demux;a=Math.max(a,g.minProbeByteLength)});var s=function(){function T(c,h,o,C,E){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new M.default,this.observer=c,this.typeSupported=h,this.config=o,this.vendor=C,this.id=E}var g=T.prototype;return g.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},g.push=function(h,o,C,E){var m=this,O=C.transmuxing;O.executeStart=x();var U=new Uint8Array(h),j=this.cache,K=this.config,I=this.currentTransmuxState,N=this.transmuxConfig;E&&(this.currentTransmuxState=E);var X=u(U,o);if(X&&X.method==="AES-128"){var q=this.getDecrypter();if(K.enableSoftwareAES){var ae=q.softwareDecrypt(U,X.key.buffer,X.iv.buffer);if(!ae)return O.executeEnd=x(),L(C);U=new Uint8Array(ae)}else return this.decryptionPromise=q.webCryptoDecrypt(U,X.key.buffer,X.iv.buffer).then(function(Pe){var Ne=m.push(Pe,null,C);return m.decryptionPromise=null,Ne}),this.decryptionPromise}var he=E||I,Ae=he.contiguous,be=he.discontinuity,Te=he.trackSwitch,Ce=he.accurateTimeOffset,Se=he.timeOffset,me=N.audioCodec,ue=N.videoCodec,te=N.defaultInitPts,fe=N.duration,se=N.initSegmentData;if((be||Te)&&this.resetInitSegment(se,me,ue,fe),be&&this.resetInitialTimestamp(te),Ae||this.resetContiguity(),this.needsProbing(U,be,Te)){if(j.dataLength){var _e=j.flush();U=Object(A.appendUint8Array)(_e,U)}this.configureTransmuxer(U,N)}var Oe=this.transmux(U,X,Se,Ce,C),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,O.executeEnd=x(),Oe},g.flush=function(h){var o=this,C=h.transmuxing;C.executeStart=x();var E=this.decrypter,m=this.cache,O=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return o.flush(h)});var j=[],K=O.timeOffset;if(E){var I=E.flush();I&&j.push(this.push(I,null,h))}var N=m.dataLength;m.reset();var X=this.demuxer,q=this.remuxer;if(!X||!q)return N>=a&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=x(),[L(h)];var ae=X.flush(K);return f(ae)?ae.then(function(he){return o.flushRemux(j,he,h),j}):(this.flushRemux(j,ae,h),j)},g.flushRemux=function(h,o,C){var E=o.audioTrack,m=o.avcTrack,O=o.id3Track,U=o.textTrack,j=this.currentTransmuxState,K=j.accurateTimeOffset,I=j.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var N=this.remuxer.remux(E,m,O,U,I,K,!0,this.id);h.push({remuxResult:N,chunkMeta:C}),C.transmuxing.executeEnd=x()},g.resetInitialTimestamp=function(h){var o=this.demuxer,C=this.remuxer;if(!o||!C)return;o.resetTimeStamp(h),C.resetTimeStamp(h)},g.resetContiguity=function(){var h=this.demuxer,o=this.remuxer;if(!h||!o)return;h.resetContiguity(),o.resetNextTimestamp()},g.resetInitSegment=function(h,o,C,E){var m=this.demuxer,O=this.remuxer;if(!m||!O)return;m.resetInitSegment(o,C,E),O.resetInitSegment(h,o,C)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(h,o,C,E,m){var O;return o&&o.method==="SAMPLE-AES"?O=this.transmuxSampleAes(h,o,C,E,m):O=this.transmuxUnencrypted(h,C,E,m),O},g.transmuxUnencrypted=function(h,o,C,E){var m=this.demuxer.demux(h,o,!1,!this.config.progressive),O=m.audioTrack,U=m.avcTrack,j=m.id3Track,K=m.textTrack,I=this.remuxer.remux(O,U,j,K,o,C,!1,this.id);return{remuxResult:I,chunkMeta:E}},g.transmuxSampleAes=function(h,o,C,E,m){var O=this;return this.demuxer.demuxSampleAes(h,o,C).then(function(U){var j=O.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,C,E,!1,O.id);return{remuxResult:j,chunkMeta:m}})},g.configureTransmuxer=function(h,o){for(var C=this.config,E=this.observer,m=this.typeSupported,O=this.vendor,U=o.audioCodec,j=o.defaultInitPts,K=o.duration,I=o.initSegmentData,N=o.videoCodec,X,q=0,ae=d.length;q<ae;q++)if(d[q].demux.probe(h)){X=d[q];break}X||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:B.default,remux:b.default});var he=this.demuxer,Ae=this.remuxer,be=X.remux,Te=X.demux;(!Ae||!(Ae instanceof be))&&(this.remuxer=new be(E,C,m,O)),(!he||!(he instanceof Te))&&(this.demuxer=new Te(E,C,m),this.probe=Te.probe),this.resetInitSegment(I,U,N,K),this.resetInitialTimestamp(j)},g.needsProbing=function(h,o,C){return!this.demuxer||!this.remuxer||o||C},g.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new R.default(this.observer,this.config)),h},T}();function u(T,g){var c=null;return T.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(c=g),c}var L=function(g){return{remuxResult:{},chunkMeta:g}};function f(T){return"then"in T&&T.then instanceof Function}var v=function(g,c,h,o,C){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=c,this.initSegmentData=h,this.duration=o,this.defaultInitPts=C},D=function(g,c,h,o,C){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=c,this.accurateTimeOffset=h,this.trackSwitch=o,this.timeOffset=C}},"./src/demux/tsdemuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"discardEPB",function(){return L});var Y=k("./src/demux/adts.ts"),F=k("./src/demux/mpegaudio.ts"),R=k("./src/demux/exp-golomb.ts"),W=k("./src/demux/id3.ts"),B=k("./src/demux/sample-aes.ts"),P=k("./src/events.ts"),w=k("./src/utils/mp4-tools.ts"),p=k("./src/utils/logger.ts"),b=k("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},A=function(){function f(D,T,g){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=D,this.config=T,this.typeSupported=g}f.probe=function(T){var g=f.syncOffset(T);return g<0?!1:(g&&p.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},f.syncOffset=function(T){for(var g=Math.min(1e3,T.length-3*188),c=0;c<g;){if(T[c]===71&&T[c+188]===71&&T[c+2*188]===71)return c;c++}return-1},f.createTrack=function(T,g){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:M[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?g:void 0}};var v=f.prototype;return v.resetInitSegment=function(T,g,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=g,this._duration=c},v.resetTimeStamp=function(){},v.resetContiguity=function(){var T=this._audioTrack,g=this._avcTrack,c=this._id3Track;T&&(T.pesData=null),g&&(g.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(T,g,c,h){c===void 0&&(c=!1),h===void 0&&(h=!1),c||(this.sampleAes=null);var o,C=this._avcTrack,E=this._audioTrack,m=this._id3Track,O=C.pid,U=C.pesData,j=E.pid,K=m.pid,I=E.pesData,N=m.pesData,X=!1,q=this.pmtParsed,ae=this._pmtId,he=T.length;if(this.remainderData&&(T=Object(w.appendUint8Array)(this.remainderData,T),he=T.length,this.remainderData=null),he<188&&!h)return this.remainderData=T,{audioTrack:E,avcTrack:C,id3Track:m,textTrack:this._txtTrack};var Ae=Math.max(0,f.syncOffset(T));he-=(he+Ae)%188,he<T.byteLength&&!h&&(this.remainderData=new Uint8Array(T.buffer,he,T.buffer.byteLength-he));for(var be=Ae;be<he;be+=188)if(T[be]===71){var Te=!!(T[be+1]&64),Ce=((T[be+1]&31)<<8)+T[be+2],Se=(T[be+3]&48)>>4,me=void 0;if(Se>1){if(me=be+5+T[be+4],me===be+188)continue}else me=be+4;switch(Ce){case O:Te&&(U&&(o=a(U))&&this.parseAVCPES(o,!1),U={data:[],size:0}),U&&(U.data.push(T.subarray(me,be+188)),U.size+=be+188-me);break;case j:Te&&(I&&(o=a(I))&&(E.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),I={data:[],size:0}),I&&(I.data.push(T.subarray(me,be+188)),I.size+=be+188-me);break;case K:Te&&(N&&(o=a(N))&&this.parseID3PES(o),N={data:[],size:0}),N&&(N.data.push(T.subarray(me,be+188)),N.size+=be+188-me);break;case 0:Te&&(me+=T[me]+1),ae=this._pmtId=x(T,me);break;case ae:{Te&&(me+=T[me]+1);var ue=d(T,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);O=ue.avc,O>0&&(C.pid=O),j=ue.audio,j>0&&(E.pid=j,E.isAAC=ue.isAAC),K=ue.id3,K>0&&(m.pid=K),X&&!q&&(p.logger.log("reparse from beginning"),X=!1,be=Ae-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});C.pesData=U,E.pesData=I,m.pesData=N;var te={audioTrack:E,avcTrack:C,id3Track:m,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(te),te},v.flush=function(){var T=this.remainderData;this.remainderData=null;var g;return T?g=this.demux(T,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},v.extractRemainingSamples=function(T){var g=T.audioTrack,c=T.avcTrack,h=T.id3Track,o=c.pesData,C=g.pesData,E=h.pesData,m;o&&(m=a(o))?(this.parseAVCPES(m,!0),c.pesData=null):c.pesData=o,C&&(m=a(C))?(g.isAAC?this.parseAACPES(m):this.parseMPEGPES(m),g.pesData=null):(C!=null&&C.size&&p.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=C),E&&(m=a(E))?(this.parseID3PES(m),h.pesData=null):h.pesData=E},v.demuxSampleAes=function(T,g,c){var h=this.demux(T,c,!0,!this.config.progressive),o=this.sampleAes=new B.default(this.observer,this.config,g);return this.decrypt(h,o)},v.decrypt=function(T,g){return new Promise(function(c){var h=T.audioTrack,o=T.avcTrack;h.samples&&h.isAAC?g.decryptAacSamples(h.samples,0,function(){o.samples?g.decryptAvcSamples(o.samples,0,0,function(){c(T)}):c(T)}):o.samples&&g.decryptAvcSamples(o.samples,0,0,function(){c(T)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(T,g){var c=this,h=this._avcTrack,o=this.parseAVCNALu(T.data),C=!1,E=this.avcSample,m,O=!1;T.data=null,E&&o.length&&!h.audFound&&(s(E,h),E=this.avcSample=S(!1,T.pts,T.dts,"")),o.forEach(function(U){switch(U.type){case 1:{m=!0,E||(E=c.avcSample=S(!0,T.pts,T.dts,"")),C&&(E.debug+="NDR "),E.frame=!0;var j=U.data;if(O&&j.length>4){var K=new R.default(j).readSliceType();(K===2||K===4||K===7||K===9)&&(E.key=!0)}break}case 5:m=!0,E||(E=c.avcSample=S(!0,T.pts,T.dts,"")),C&&(E.debug+="IDR "),E.key=!0,E.frame=!0;break;case 6:{m=!0,C&&E&&(E.debug+="SEI ");var I=new R.default(L(U.data));I.readUByte();for(var N=0,X=0,q=!1,ae=0;!q&&I.bytesAvailable>1;){N=0;do ae=I.readUByte(),N+=ae;while(ae===255);X=0;do ae=I.readUByte(),X+=ae;while(ae===255);if(N===4&&I.bytesAvailable!==0){q=!0;var he=I.readUByte();if(he===181){var Ae=I.readUShort();if(Ae===49){var be=I.readUInt();if(be===1195456820){var Te=I.readUByte();if(Te===3){for(var Ce=I.readUByte(),Se=I.readUByte(),me=31&Ce,ue=[Ce,Se],te=0;te<me;te++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());u(c._txtTrack.samples,{type:3,pts:T.pts,bytes:ue})}}}}}else if(N===5&&I.bytesAvailable!==0){if(q=!0,X>16){for(var fe=[],se=0;se<16;se++)fe.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&fe.push("-");for(var _e=X-16,Oe=new Uint8Array(_e),xe=0;xe<_e;xe++)Oe[xe]=I.readUByte();u(c._txtTrack.samples,{pts:T.pts,payloadType:N,uuid:fe.join(""),userData:Object(W.utf8ArrayToStr)(Oe),userDataBytes:Oe})}}else if(X<I.bytesAvailable)for(var Pe=0;Pe<X;Pe++)I.readUByte()}break}case 7:if(m=!0,O=!0,C&&E&&(E.debug+="SPS "),!h.sps){var Ne=new R.default(U.data),Be=Ne.readSPS();h.width=Be.width,h.height=Be.height,h.pixelRatio=Be.pixelRatio,h.sps=[U.data],h.duration=c._duration;for(var We=U.data.subarray(1,4),Ue="avc1.",Fe=0;Fe<3;Fe++){var at=We[Fe].toString(16);at.length<2&&(at="0"+at),Ue+=at}h.codec=Ue}break;case 8:m=!0,C&&E&&(E.debug+="PPS "),h.pps||(h.pps=[U.data]);break;case 9:m=!1,h.audFound=!0,E&&s(E,h),E=c.avcSample=S(!1,T.pts,T.dts,C?"AUD ":"");break;case 12:m=!1;break;default:m=!1,E&&(E.debug+="unknown NAL "+U.type+" ");break}if(E&&m){var it=E.units;it.push(U)}}),g&&E&&(s(E,h),this.avcSample=null)},v.getLastNalUnit=function(){var T,g=this.avcSample,c;if(!g||g.units.length===0){var h=this._avcTrack.samples;g=h[h.length-1]}if((T=g)!==null&&T!==void 0&&T.units){var o=g.units;c=o[o.length-1]}return c},v.parseAVCNALu=function(T){var g=T.byteLength,c=this._avcTrack,h=c.naluState||0,o=h,C=[],E=0,m,O,U,j=-1,K=0;for(h===-1&&(j=0,K=T[0]&31,h=0,E=1);E<g;){if(m=T[E++],!h){h=m?0:1;continue}if(h===1){h=m?0:2;continue}if(!m)h=3;else if(m===1){if(j>=0){var I={data:T.subarray(j,E-h-1),type:K};C.push(I)}else{var N=this.getLastNalUnit();if(N&&(o&&E<=4-o&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-o))),O=E-h-1,O>0)){var X=new Uint8Array(N.data.byteLength+O);X.set(N.data,0),X.set(T.subarray(0,O),N.data.byteLength),N.data=X,N.state=0}}E<g?(U=T[E]&31,j=E,K=U,h=0):h=-1}else h=0}if(j>=0&&h>=0){var q={data:T.subarray(j,g),type:K,state:h};C.push(q)}if(C.length===0){var ae=this.getLastNalUnit();if(ae){var he=new Uint8Array(ae.data.byteLength+T.byteLength);he.set(ae.data,0),he.set(T,ae.data.byteLength),ae.data=he}}return c.naluState=h,C},v.parseAACPES=function(T){var g=0,c=this._audioTrack,h=this.aacOverFlow,o=T.data;if(h){this.aacOverFlow=null;var C=h.sample.unit.byteLength,E=Math.min(h.missing,C),m=C-E;h.sample.unit.set(o.subarray(0,E),m),c.samples.push(h.sample),g=h.missing}var O,U;for(O=g,U=o.length;O<U-1&&!Y.isHeader(o,O);O++);if(O!==g){var j,K;if(O<U-1?(j="AAC PES did not start with ADTS header,offset:"+O,K=!1):(j="no ADTS header found in AAC PES",K=!0),p.logger.warn("parsing error:"+j),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:K,reason:j}),K)return}Y.initTrackConfig(c,this.observer,o,O,this.audioCodec);var I;if(T.pts!==void 0)I=T.pts;else if(h){var N=Y.getFrameDuration(c.samplerate);I=h.sample.pts+N}else{p.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;O<U;)if(Y.isHeader(o,O)){if(O+5<U){var q=Y.appendFrame(c,o,O,I,X);if(q)if(q.missing)this.aacOverFlow=q;else{O+=q.length,X++;continue}}break}else O++},v.parseMPEGPES=function(T){var g=T.data,c=g.length,h=0,o=0,C=T.pts;if(C===void 0){p.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<c;)if(F.isHeader(g,o)){var E=F.appendFrame(this._audioTrack,g,o,C,h);if(E)o+=E.length,h++;else break}else o++},v.parseID3PES=function(T){if(T.pts===void 0){p.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},f}();A.minProbeByteLength=188;function S(f,v,D,T){return{key:f,frame:!1,pts:v,dts:D,units:[],debug:T,length:0}}function x(f,v){return(f[v+10]&31)<<8|f[v+11]}function d(f,v,D,T){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[v+1]&15)<<8|f[v+2],h=v+3+c-4,o=(f[v+10]&15)<<8|f[v+11];for(v+=12+o;v<h;){var C=(f[v+1]&31)<<8|f[v+2];switch(f[v]){case 207:if(!T){p.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=C);break;case 21:g.id3===-1&&(g.id3=C);break;case 219:if(!T){p.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=C);break;case 3:case 4:D?g.audio===-1&&(g.audio=C,g.isAAC=!1):p.logger.log("MPEG audio found, not supported in this browser");break;case 36:p.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((f[v+3]&15)<<8|f[v+4])+5}return g}function a(f){var v=0,D,T,g,c,h,o=f.data;if(!f||f.size===0)return null;for(;o[0].length<19&&o.length>1;){var C=new Uint8Array(o[0].length+o[1].length);C.set(o[0]),C.set(o[1],o[0].length),o[0]=C,o.splice(1,1)}D=o[0];var E=(D[0]<<16)+(D[1]<<8)+D[2];if(E===1){if(T=(D[4]<<8)+D[5],T&&T>f.size-6)return null;var m=D[7];m&192&&(c=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,m&64?(h=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,c-h>60*9e4&&(p.logger.warn(Math.round((c-h)/9e4)+"s delta between PTS and DTS, align them"),c=h)):h=c),g=D[8];var O=g+9;if(f.size<=O)return null;f.size-=O;for(var U=new Uint8Array(f.size),j=0,K=o.length;j<K;j++){D=o[j];var I=D.byteLength;if(O)if(O>I){O-=I;continue}else D=D.subarray(O),I-=O,O=0;U.set(D,v),v+=I}return T&&(T-=g+3),{data:U,pts:c,dts:h,len:T}}return null}function s(f,v){if(f.units.length&&f.frame){if(f.pts===void 0){var D=v.samples,T=D.length;if(T){var g=D[T-1];f.pts=g.pts,f.dts=g.dts}else{v.dropped++;return}}v.samples.push(f)}f.debug.length&&p.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function u(f,v){var D=f.length;if(D>0){if(v.pts>=f[D-1].pts)f.push(v);else for(var T=D-1;T>=0;T--)if(v.pts<f[T].pts){f.splice(T,0,v);break}}else f.push(v)}function L(f){for(var v=f.byteLength,D=[],T=1;T<v-2;)f[T]===0&&f[T+1]===0&&f[T+2]===3?(D.push(T+2),T+=2):T++;if(D.length===0)return f;var g=v-D.length,c=new Uint8Array(g),h=0;for(T=0;T<g;h++,T++)h===D[0]&&(h++,D.shift()),c[T]=f[h];return c}$.default=A},"./src/errors.ts":function(ne,$,k){"use strict";k.r($),k.d($,"ErrorTypes",function(){return Y}),k.d($,"ErrorDetails",function(){return F});var Y;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(Y||(Y={}));var F;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(ne,$,k){"use strict";k.r($),k.d($,"Events",function(){return Y});var Y;(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"})(Y||(Y={}))},"./src/hls.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return f});var Y=k("./node_modules/url-toolkit/src/url-toolkit.js"),F=k.n(Y),R=k("./src/loader/playlist-loader.ts"),W=k("./src/loader/key-loader.ts"),B=k("./src/controller/id3-track-controller.ts"),P=k("./src/controller/latency-controller.ts"),w=k("./src/controller/level-controller.ts"),p=k("./src/controller/fragment-tracker.ts"),b=k("./src/controller/stream-controller.ts"),M=k("./src/is-supported.ts"),A=k("./src/utils/logger.ts"),S=k("./src/config.ts"),x=k("./node_modules/eventemitter3/index.js"),d=k.n(x),a=k("./src/events.ts"),s=k("./src/errors.ts");function u(v,D){for(var T=0;T<D.length;T++){var g=D[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(v,g.key,g)}}function L(v,D,T){return D&&u(v.prototype,D),T&&u(v,T),v}var f=function(){v.isSupported=function(){return Object(M.isSupported)()};function v(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new x.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 g=this.config=Object(S.mergeConfig)(v.DefaultConfig,T);this.userConfig=T,Object(A.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(S.enableStreamingMode)(g);var c=g.abrController,h=g.bufferController,o=g.capLevelController,C=g.fpsController,E=this.abrController=new c(this),m=this.bufferController=new h(this),O=this.capLevelController=new o(this),U=new C(this),j=new R.default(this),K=new W.default(this),I=new B.default(this),N=this.levelController=new w.default(this),X=new p.FragmentTracker(this),q=this.streamController=new b.default(this,X);O.setStreamController(q),U.setStreamController(q);var ae=[N,q];this.networkControllers=ae;var he=[j,K,E,m,O,U,I,X];this.audioTrackController=this.createController(g.audioTrackController,null,ae),this.createController(g.audioStreamController,X,ae),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,ae),this.createController(g.subtitleStreamController,X,ae),this.createController(g.timelineController,null,he),this.emeController=this.createController(g.emeController,null,he),this.cmcdController=this.createController(g.cmcdController,null,he),this.latencyController=this.createController(P.default,null,he),this.coreComponents=he}var D=v.prototype;return D.createController=function(g,c,h){if(g){var o=c?new g(this,c):new g(this);return h&&h.push(o),o}return null},D.on=function(g,c,h){h===void 0&&(h=this),this._emitter.on(g,c,h)},D.once=function(g,c,h){h===void 0&&(h=this),this._emitter.once(g,c,h)},D.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},D.off=function(g,c,h,o){h===void 0&&(h=this),this._emitter.off(g,c,h,o)},D.listeners=function(g){return this._emitter.listeners(g)},D.emit=function(g,c,h){return this._emitter.emit(g,c,h)},D.trigger=function(g,c){if(this.config.debug)return this.emit(g,g,c);try{return this.emit(g,g,c)}catch(h){A.logger.error("An internal error happened while handling event "+g+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:h})}return!1},D.listenerCount=function(g){return this._emitter.listenerCount(g)},D.destroy=function(){A.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},D.attachMedia=function(g){A.logger.log("attachMedia"),this._media=g,this.trigger(a.Events.MEDIA_ATTACHING,{media:g})},D.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(g){this.stopLoad();var c=this.media,h=this.url,o=this.url=Y.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});A.logger.log("loadSource:"+o),c&&h&&h!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(a.Events.MANIFEST_LOADING,{url:g})},D.startLoad=function(g){g===void 0&&(g=-1),A.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(c){c.startLoad(g)})},D.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},D.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){A.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},D.removeLevel=function(g,c){c===void 0&&(c=0),this.levelController.removeLevel(g,c)},L(v,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){A.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){A.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){A.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){A.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){A.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var c=!!g;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(g){this._autoLevelCapping!==g&&(A.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,c=this.config.minAutoBitrate;if(!g)return 0;for(var h=g.length,o=0;o<h;o++)if(g[o].maxBitrate>c)return o;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,c=this.autoLevelCapping,h;return c===-1&&g&&g.length?h=g.length-1:h=c,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var c=this.audioTrackController;c&&(c.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{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 a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:S.hlsDefaultConfig},set:function(g){v.defaultConfig=g}}]),v}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isSupported",function(){return R}),k.d($,"changeTypeSupported",function(){return W});var Y=k("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var B=Object(Y.getMediaSource)();if(!B)return!1;var P=F(),w=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),p=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!w&&!!p}function W(){var B,P=F();return typeof(P==null||((B=P.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return A}),k.d($,"LoadError",function(){return x});var Y=k("./src/polyfills/number.ts"),F=k("./src/errors.ts");function R(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,p(d,a)}function W(d){var a=typeof Map=="function"?new Map:void 0;return W=function(u){if(u===null||!w(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(u))return a.get(u);a.set(u,L)}function L(){return B(u,arguments,b(this).constructor)}return L.prototype=Object.create(u.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),p(L,u)},W(d)}function B(d,a,s){return P()?B=Reflect.construct:B=function(L,f,v){var D=[null];D.push.apply(D,f);var T=Function.bind.apply(L,D),g=new T;return v&&p(g,v.prototype),g},B.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function w(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function p(d,a){return p=Object.setPrototypeOf||function(u,L){return u.__proto__=L,u},p(d,a)}function b(d){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},b(d)}var M=Math.pow(2,17),A=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=d.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(u,L){var f=this,v=u.url;if(!v)return Promise.reject(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var D=this.config,T=D.fLoader,g=D.loader;return new Promise(function(c,h){f.loader&&f.loader.destroy();var o=f.loader=u.loader=T?new T(D):new g(D),C=S(u),E={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};u.stats=o.stats,o.load(C,E,{onSuccess:function(O,U,j,K){f.resetLoader(u,o),c({frag:u,part:null,payload:O.data,networkDetails:K})},onError:function(O,U,j){f.resetLoader(u,o),h(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:O,networkDetails:j}))},onAbort:function(O,U,j){f.resetLoader(u,o),h(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(O,U,j){f.resetLoader(u,o),h(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(O,U,j,K){L&&L({frag:u,part:null,payload:j,networkDetails:K})}})})},a.loadPart=function(u,L,f){var v=this;this.abort();var D=this.config,T=D.fLoader,g=D.loader;return new Promise(function(c,h){v.loader&&v.loader.destroy();var o=v.loader=u.loader=T?new T(D):new g(D),C=S(u,L),E={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};L.stats=o.stats,o.load(C,E,{onSuccess:function(O,U,j,K){v.resetLoader(u,o),v.updateStatsFromPart(u,L);var I={frag:u,part:L,payload:O.data,networkDetails:K};f(I),c(I)},onError:function(O,U,j){v.resetLoader(u,o),h(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:L,response:O,networkDetails:j}))},onAbort:function(O,U,j){u.stats.aborted=L.stats.aborted,v.resetLoader(u,o),h(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:L,networkDetails:j}))},onTimeout:function(O,U,j){v.resetLoader(u,o),h(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:L,networkDetails:j}))}})})},a.updateStatsFromPart=function(u,L){var f=u.stats,v=L.stats,D=v.total;if(f.loaded+=v.loaded,D){var T=Math.round(u.duration/L.duration),g=Math.min(Math.round(f.loaded/D),T),c=T-g,h=c*Math.round(f.loaded/g);f.total=f.loaded+h}else f.total=Math.max(f.loaded,f.total);var o=f.loading,C=v.loading;o.start?o.first+=C.first-C.start:(o.start=C.start,o.first=C.first),o.end=C.end},a.resetLoader=function(u,L){u.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},d}();function S(d,a){a===void 0&&(a=null);var s=a||d,u={frag:d,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},L=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(Y.isFiniteNumber)(L)&&Object(Y.isFiniteNumber)(f)&&(u.rangeStart=L,u.rangeEnd=f),u}var x=function(d){R(a,d);function a(s){for(var u,L=arguments.length,f=new Array(L>1?L-1:0),v=1;v<L;v++)f[v-1]=arguments[v];return u=d.call.apply(d,[this].concat(f))||this,u.data=void 0,u.data=s,u}return a}(W(Error))},"./src/loader/fragment.ts":function(ne,$,k){"use strict";k.r($),k.d($,"ElementaryStreamTypes",function(){return A}),k.d($,"BaseSegment",function(){return S}),k.d($,"Fragment",function(){return x}),k.d($,"Part",function(){return d});var Y=k("./src/polyfills/number.ts"),F=k("./node_modules/url-toolkit/src/url-toolkit.js"),R=k.n(F),W=k("./src/utils/logger.ts"),B=k("./src/loader/level-key.ts"),P=k("./src/loader/load-stats.ts");function w(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,p(a,s)}function p(a,s){return p=Object.setPrototypeOf||function(L,f){return L.__proto__=f,L},p(a,s)}function b(a,s){for(var u=0;u<s.length;u++){var L=s[u];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function M(a,s,u){return s&&b(a.prototype,s),u&&b(a,u),a}var A;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(A||(A={}));var S=function(){function a(u){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[A.AUDIO]=null,L[A.VIDEO]=null,L[A.AUDIOVIDEO]=null,L),this.baseurl=u}var s=a.prototype;return s.setByteRange=function(L,f){var v=L.split("@",2),D=[];v.length===1?D[0]=f?f.byteRangeEndOffset:0:D[0]=parseInt(v[1]),D[1]=parseInt(v[0])+D[0],this._byteRange=D},M(a,[{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(L){this._url=L}}]),a}(),x=function(a){w(s,a);function s(L,f){var v;return v=a.call(this,f)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new P.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=L,v}var u=s.prototype;return u.createInitializationVector=function(f){for(var v=new Uint8Array(16),D=12;D<16;D++)v[D]=f>>8*(15-D)&255;return v},u.setDecryptDataFromLevelKey=function(f,v){var D=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(D=B.LevelKey.fromURI(f.uri),D.method=f.method,D.iv=this.createInitializationVector(v),D.keyFormat="identity"),D},u.setElementaryStreamInfo=function(f,v,D,T,g,c){c===void 0&&(c=!1);var h=this.elementaryStreams,o=h[f];if(!o){h[f]={startPTS:v,endPTS:D,startDTS:T,endDTS:g,partial:c};return}o.startPTS=Math.min(o.startPTS,v),o.endPTS=Math.max(o.endPTS,D),o.startDTS=Math.min(o.startDTS,T),o.endDTS=Math.max(o.endDTS,g)},u.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[A.AUDIO]=null,f[A.VIDEO]=null,f[A.AUDIOVIDEO]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="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'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var f=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(S),d=function(a){w(s,a);function s(u,L,f,v,D){var T;T=a.call(this,f)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new P.LoadStats,T.duration=u.decimalFloatingPoint("DURATION"),T.gap=u.bool("GAP"),T.independent=u.bool("INDEPENDENT"),T.relurl=u.enumeratedString("URI"),T.fragment=L,T.index=v;var g=u.enumeratedString("BYTERANGE");return g&&T.setByteRange(g,D),D&&(T.fragOffset=D.fragOffset+D.duration),T}return M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),s}(S)},"./src/loader/key-loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return W});var Y=k("./src/events.ts"),F=k("./src/errors.ts"),R=k("./src/utils/logger.ts"),W=function(){function B(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var P=B.prototype;return P._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var p in this.loaders){var b=this.loaders[p];b&&b.destroy()}this.loaders={}},P.onKeyLoading=function(p,b){var M=b.frag,A=M.type,S=this.loaders[A];if(!M.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=M.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(S&&(R.logger.warn("abort previous key loader for type:"+A),S.abort()),!x){R.logger.warn("key uri is falsy");return}var a=d.loader,s=M.loader=this.loaders[A]=new a(d);this.decrypturl=x,this.decryptkey=null;var u={url:x,frag:M,responseType:"arraybuffer"},L={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,L,f)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:M}))},P.loadsuccess=function(p,b,M){var A=M.frag;if(!A.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(p.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:A})},P.loaderror=function(p,b){var M=b.frag,A=M.loader;A&&A.abort(),delete this.loaders[M.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:p})},P.loadtimeout=function(p,b){var M=b.frag,A=M.loader;A&&A.abort(),delete this.loaders[M.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},B}()},"./src/loader/level-details.ts":function(ne,$,k){"use strict";k.r($),k.d($,"LevelDetails",function(){return B});var Y=k("./src/polyfills/number.ts");function F(P,w){for(var p=0;p<w.length;p++){var b=w[p];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function R(P,w,p){return w&&F(P.prototype,w),p&&F(P,p),P}var W=10,B=function(){function P(p){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=p}var w=P.prototype;return w.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-b.lastPartSn,A=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!A||!!M,this.advanced=this.endSN>b.endSN||M>0||M===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},R(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var M=this.driftEnd-this.driftStart;return M*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ne,$,k){"use strict";k.r($),k.d($,"LevelKey",function(){return B});var Y=k("./node_modules/url-toolkit/src/url-toolkit.js"),F=k.n(Y);function R(P,w){for(var p=0;p<w.length;p++){var b=w[p];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function W(P,w,p){return w&&R(P.prototype,w),p&&R(P,p),P}var B=function(){P.fromURL=function(p,b){return new P(p,b)},P.fromURI=function(p){return new P(p)};function P(w,p){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,p?this._uri=Object(Y.buildAbsoluteURL)(w,p,{alwaysNormalize:!0}):this._uri=w}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ne,$,k){"use strict";k.r($),k.d($,"LoadStats",function(){return Y});var Y=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(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return s});var Y=k("./src/polyfills/number.ts"),F=k("./node_modules/url-toolkit/src/url-toolkit.js"),R=k.n(F),W=k("./src/loader/fragment.ts"),B=k("./src/loader/level-details.ts"),P=k("./src/loader/level-key.ts"),w=k("./src/utils/attr-list.ts"),p=k("./src/utils/logger.ts"),b=k("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),x=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function a(D){var T,g;return d.test((T=(g=F.parseURL(D))===null||g===void 0?void 0:g.path)!=null?T:"")}var s=function(){function D(){}return D.findGroup=function(g,c){for(var h=0;h<g.length;h++){var o=g[h];if(o.id===c)return o}},D.convertAVC1ToAVCOTI=function(g){var c=g.split(".");if(c.length>2){var h=c.shift()+".";return h+=parseInt(c.shift()).toString(16),h+=("000"+parseInt(c.shift()).toString(16)).substr(-4),h}return g},D.resolve=function(g,c){return F.buildAbsoluteURL(c,g,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(g,c){var h=[],o={},C=!1;M.lastIndex=0;for(var E;(E=M.exec(g))!=null;)if(E[1]){var m=new w.AttrList(E[1]),O={attrs:m,bitrate:m.decimalInteger("AVERAGE-BANDWIDTH")||m.decimalInteger("BANDWIDTH"),name:m.NAME,url:D.resolve(E[2],c)},U=m.decimalResolution("RESOLUTION");U&&(O.width=U.width,O.height=U.height),u((m.CODECS||"").split(/[ ,]+/).filter(function(K){return K}),O),O.videoCodec&&O.videoCodec.indexOf("avc1")!==-1&&(O.videoCodec=D.convertAVC1ToAVCOTI(O.videoCodec)),h.push(O)}else if(E[3]){var j=new w.AttrList(E[3]);j["DATA-ID"]&&(C=!0,o[j["DATA-ID"]]=j)}return{levels:h,sessionData:C?o:null}},D.parseMasterPlaylistMedia=function(g,c,h,o){o===void 0&&(o=[]);var C,E=[],m=0;for(A.lastIndex=0;(C=A.exec(g))!==null;){var O=new w.AttrList(C[1]);if(O.TYPE===h){var U={attrs:O,bitrate:0,id:m++,groupId:O["GROUP-ID"],instreamId:O["INSTREAM-ID"],name:O.NAME||O.LANGUAGE||"",type:h,default:O.bool("DEFAULT"),autoselect:O.bool("AUTOSELECT"),forced:O.bool("FORCED"),lang:O.LANGUAGE,url:O.URI?D.resolve(O.URI,c):""};if(o.length){var j=D.findGroup(o,U.groupId)||o[0];L(U,j,"audioCodec"),L(U,j,"textCodec")}E.push(U)}}return E},D.parseLevelPlaylist=function(g,c,h,o,C){var E=new B.LevelDetails(c),m=E.fragments,O=null,U=0,j=0,K=0,I=0,N=null,X=new W.Fragment(o,c),q,ae,he,Ae=-1,be=!1;for(S.lastIndex=0,E.m3u8=g;(q=S.exec(g))!==null;){be&&(be=!1,X=new W.Fragment(o,c),X.start=K,X.sn=U,X.cc=I,X.level=h,O&&(X.initSegment=O,X.rawProgramDateTime=O.rawProgramDateTime));var Te=q[1];if(Te){X.duration=parseFloat(Te);var Ce=(" "+q[2]).slice(1);X.title=Ce||null,X.tagList.push(Ce?["INF",Te,Ce]:["INF",Te])}else if(q[3])Object(Y.isFiniteNumber)(X.duration)&&(X.start=K,he&&(X.levelkey=he),X.sn=U,X.level=h,X.cc=I,X.urlId=C,m.push(X),X.relurl=(" "+q[3]).slice(1),v(X,N),N=X,K+=X.duration,U++,j=0,be=!0);else if(q[4]){var Se=(" "+q[4]).slice(1);N?X.setByteRange(Se,N):X.setByteRange(Se)}else if(q[5])X.rawProgramDateTime=(" "+q[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Ae===-1&&(Ae=m.length);else{if(q=q[0].match(x),!q){p.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<q.length&&!(typeof q[ae]!="undefined");ae++);var me=(" "+q[ae]).slice(1),ue=(" "+q[ae+1]).slice(1),te=q[ae+2]?(" "+q[ae+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":E.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":U=E.startSN=parseInt(ue);break;case"SKIP":{var fe=new w.AttrList(ue),se=fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(se)){E.skippedSegments=se;for(var _e=se;_e--;)m.unshift(null);U+=se}var Oe=fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Oe&&(E.recentlyRemovedDateranges=Oe.split(" "));break}case"TARGETDURATION":E.targetduration=parseFloat(ue);break;case"VERSION":E.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":E.live=!1;break;case"#":(ue||te)&&X.tagList.push(te?[ue,te]:[ue]);break;case"DIS":I++;case"GAP":X.tagList.push([me]);break;case"BITRATE":X.tagList.push([me,ue]);break;case"DISCONTINUITY-SEQ":I=parseInt(ue);break;case"KEY":{var xe,Pe=new w.AttrList(ue),Ne=Pe.enumeratedString("METHOD"),Be=Pe.URI,We=Pe.hexadecimalInteger("IV"),Ue=Pe.enumeratedString("KEYFORMATVERSIONS"),Fe=Pe.enumeratedString("KEYID"),at=(xe=Pe.enumeratedString("KEYFORMAT"))!=null?xe:"identity",it=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(it.indexOf(at)>-1){p.logger.warn("Keyformat "+at+" is not supported from the manifest");continue}else if(at!=="identity")continue;Ne&&(he=P.LevelKey.fromURL(c,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ne)>=0&&(he.method=Ne,he.keyFormat=at,Fe&&(he.keyID=Fe),Ue&&(he.keyFormatVersions=Ue),he.iv=We));break}case"START":{var et=new w.AttrList(ue),Ze=et.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Ze)&&(E.startTimeOffset=Ze);break}case"MAP":{var ut=new w.AttrList(ue);X.relurl=ut.URI,ut.BYTERANGE&&X.setByteRange(ut.BYTERANGE),X.level=h,X.sn="initSegment",he&&(X.levelkey=he),X.initSegment=null,O=X,be=!0;break}case"SERVER-CONTROL":{var Je=new w.AttrList(ue);E.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),E.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),E.canSkipDateRanges=E.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),E.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),E.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var st=new w.AttrList(ue);E.partTarget=st.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=E.partList;ke||(ke=E.partList=[]);var nt=j>0?ke[ke.length-1]:void 0,qe=j++,Ie=new W.Part(new w.AttrList(ue),X,c,qe,nt);ke.push(Ie),X.duration+=Ie.duration;break}case"PRELOAD-HINT":{var He=new w.AttrList(ue);E.preloadHint=He;break}case"RENDITION-REPORT":{var Ee=new w.AttrList(ue);E.renditionReports=E.renditionReports||[],E.renditionReports.push(Ee);break}default:p.logger.warn("line parsed but not handled: "+q);break}}}N&&!N.relurl?(m.pop(),K-=N.duration,E.partList&&(E.fragmentHint=N)):E.partList&&(v(X,N),X.cc=I,E.fragmentHint=X);var pe=m.length,ye=m[0],re=m[pe-1];if(K+=E.skippedSegments*E.targetduration,K>0&&pe&&re){E.averagetargetduration=K/pe;var oe=re.sn;E.endSN=oe!=="initSegment"?oe:0,ye&&(E.startCC=ye.cc,ye.initSegment||E.fragments.every(function(le){return le.relurl&&a(le.relurl)})&&(p.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new W.Fragment(o,c),X.relurl=re.relurl,X.level=h,X.sn="initSegment",ye.initSegment=X,E.needSidxRanges=!0))}else E.endSN=0,E.startCC=0;return E.fragmentHint&&(K+=E.fragmentHint.duration),E.totalduration=K,E.endCC=I,Ae>0&&f(m,Ae),E},D}();function u(D,T){["video","audio","text"].forEach(function(g){var c=D.filter(function(o){return Object(b.isCodecType)(o,g)});if(c.length){var h=c.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});T[g+"Codec"]=h.length>0?h[0]:c[0],D=D.filter(function(o){return c.indexOf(o)===-1})}}),T.unknownCodecs=D}function L(D,T,g){var c=T[g];c&&(D[g]=c)}function f(D,T){for(var g=D[T],c=T;c--;){var h=D[c];if(!h)return;h.programDateTime=g.programDateTime-h.duration*1e3,g=h}}function v(D,T){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):T!=null&&T.programDateTime&&(D.programDateTime=T.endProgramDateTime),Object(Y.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/polyfills/number.ts"),F=k("./src/events.ts"),R=k("./src/errors.ts"),W=k("./src/utils/logger.ts"),B=k("./src/utils/mp4-tools.ts"),P=k("./src/loader/m3u8-parser.ts"),w=k("./src/types/loader.ts"),p=k("./src/utils/attr-list.ts");function b(S){var x=S.type;switch(x){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function M(S,x){var d=S.url;return(d===void 0||d.indexOf("data:")===0)&&(d=x.url),d}var A=function(){function S(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var x=S.prototype;return x.registerListeners=function(){var a=this.hls;a.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.createInternalLoader=function(a){var s=this.hls.config,u=s.pLoader,L=s.loader,f=u||L,v=new f(s);return a.loader=v,this.loaders[a.type]=v,v},x.getInternalLoader=function(a){return this.loaders[a.type]},x.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},x.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},x.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},x.onManifestLoading=function(a,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},x.onLevelLoading=function(a,s){var u=s.id,L=s.level,f=s.url,v=s.deliveryDirectives;this.load({id:u,groupId:null,level:L,responseType:"text",type:w.PlaylistContextType.LEVEL,url:f,deliveryDirectives:v})},x.onAudioTrackLoading=function(a,s){var u=s.id,L=s.groupId,f=s.url,v=s.deliveryDirectives;this.load({id:u,groupId:L,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:v})},x.onSubtitleTrackLoading=function(a,s){var u=s.id,L=s.groupId,f=s.url,v=s.deliveryDirectives;this.load({id:u,groupId:L,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:v})},x.load=function(a){var s,u=this.hls.config,L=this.getInternalLoader(a);if(L){var f=L.context;if(f&&f.url===a.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),L.abort()}var v,D,T,g;switch(a.type){case w.PlaylistContextType.MANIFEST:v=u.manifestLoadingMaxRetry,D=u.manifestLoadingTimeOut,T=u.manifestLoadingRetryDelay,g=u.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:v=0,D=u.levelLoadingTimeOut;break;default:v=u.levelLoadingMaxRetry,D=u.levelLoadingTimeOut,T=u.levelLoadingRetryDelay,g=u.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(a.type===w.PlaylistContextType.LEVEL&&a.level!==null?c=this.hls.levels[a.level].details:a.type===w.PlaylistContextType.AUDIO_TRACK&&a.id!==null?c=this.hls.audioTracks[a.id].details:a.type===w.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(c=this.hls.subtitleTracks[a.id].details),c){var h=c.partTarget,o=c.targetduration;h&&o&&(D=Math.min(Math.max(h*3,o*.8)*1e3,D))}}var C={timeout:D,maxRetry:v,retryDelay:T,maxRetryDelay:g,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(a,C,E)},x.loadsuccess=function(a,s,u,L){if(L===void 0&&(L=null),u.isSidxRequest){this.handleSidxRequest(a,u),this.handlePlaylistLoaded(a,s,u,L);return}this.resetInternalLoader(u.type);var f=a.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,u,"no EXTM3U delimiter",L);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,u,L):this.handleMasterPlaylist(a,s,u,L)},x.loaderror=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,a)},x.loadtimeout=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},x.handleMasterPlaylist=function(a,s,u,L){var f=this.hls,v=a.data,D=M(a,u),T=P.default.parseMasterPlaylist(v,D),g=T.levels,c=T.sessionData;if(!g.length){this.handleManifestParsingError(a,u,"no level found in manifest",L);return}var h=g.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),o=g.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),C=P.default.parseMasterPlaylistMedia(v,D,"AUDIO",h),E=P.default.parseMasterPlaylistMedia(v,D,"SUBTITLES",o),m=P.default.parseMasterPlaylistMedia(v,D,"CLOSED-CAPTIONS");if(C.length){var O=C.some(function(U){return!U.url});!O&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),C.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new p.AttrList({}),bitrate:0,url:""}))}f.trigger(F.Events.MANIFEST_LOADED,{levels:g,audioTracks:C,subtitles:E,captions:m,url:D,stats:s,networkDetails:L,sessionData:c})},x.handleTrackOrLevelPlaylist=function(a,s,u,L){var f=this.hls,v=u.id,D=u.level,T=u.type,g=M(a,u),c=Object(Y.isFiniteNumber)(v)?v:0,h=Object(Y.isFiniteNumber)(D)?D:c,o=b(u),C=P.default.parseLevelPlaylist(a.data,g,h,o,c);if(!C.fragments.length){f.trigger(F.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(T===w.PlaylistContextType.MANIFEST){var E={attrs:new p.AttrList({}),bitrate:0,details:C,name:"",url:g};f.trigger(F.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:g,stats:s,networkDetails:L,sessionData:null})}if(s.parsing.end=performance.now(),C.needSidxRanges){var m,O=(m=C.fragments[0].initSegment)===null||m===void 0?void 0:m.url;this.load({url:O,isSidxRequest:!0,type:T,level:D,levelDetails:C,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=C,this.handlePlaylistLoaded(a,s,u,L)},x.handleSidxRequest=function(a,s){var u=Object(B.parseSegmentIndex)(new Uint8Array(a.data));if(!u)return;var L=u.references,f=s.levelDetails;L.forEach(function(v,D){var T=v.info,g=f.fragments[D];g.byteRange.length===0&&g.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),g.initSegment&&g.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},x.handleManifestParsingError=function(a,s,u,L){this.hls.trigger(F.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===w.PlaylistContextType.MANIFEST,url:a.url,reason:u,response:a,context:s,networkDetails:L})},x.handleNetworkError=function(a,s,u,L){u===void 0&&(u=!1),W.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var f=R.ErrorDetails.UNKNOWN,v=!1,D=this.getInternalLoader(a);switch(a.type){case w.PlaylistContextType.MANIFEST:f=u?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case w.PlaylistContextType.LEVEL:f=u?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case w.PlaylistContextType.AUDIO_TRACK:f=u?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:f=u?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}D&&this.resetInternalLoader(a.type);var T={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:v,url:a.url,loader:D,context:a,networkDetails:s};L&&(T.response=L),this.hls.trigger(F.Events.ERROR,T)},x.handlePlaylistLoaded=function(a,s,u,L){var f=u.type,v=u.level,D=u.id,T=u.groupId,g=u.loader,c=u.levelDetails,h=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(a,u,"invalid target duration",L);return}if(!g)return;c.live&&(g.getCacheAge&&(c.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:c,level:v||0,id:D||0,stats:s,networkDetails:L,deliveryDirectives:h});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:s,networkDetails:L,deliveryDirectives:h});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:s,networkDetails:L,deliveryDirectives:h});break}},S}();$.default=A},"./src/polyfills/number.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isFiniteNumber",function(){return Y}),k.d($,"MAX_SAFE_INTEGER",function(){return F});var Y=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,$,k){"use strict";k.r($);var Y=function(){function F(){}return F.getSilentFrame=function(W,B){switch(W){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===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}();$.default=Y},"./src/remux/mp4-generator.ts":function(ne,$,k){"use strict";k.r($);var Y=Math.pow(2,32)-1,F=function(){function R(){}return R.init=function(){R.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 B;for(B in R.types)R.types.hasOwnProperty(B)&&(R.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),w=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]);R.HDLR_TYPES={video:P,audio:w};var p=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=b,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,M,S,M,A),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,p))},R.box=function(B){for(var P=8,w=arguments.length,p=new Array(w>1?w-1:0),b=1;b<w;b++)p[b-1]=arguments[b];for(var M=p.length,A=M;M--;)P+=p[M].byteLength;var S=new Uint8Array(P);for(S[0]=P>>24&255,S[1]=P>>16&255,S[2]=P>>8&255,S[3]=P&255,S.set(B,4),M=0,P=8;M<A;M++)S.set(p[M],P),P+=p[M].byteLength;return S},R.hdlr=function(B){return R.box(R.types.hdlr,R.HDLR_TYPES[B])},R.mdat=function(B){return R.box(R.types.mdat,B)},R.mdhd=function(B,P){P*=B;var w=Math.floor(P/(Y+1)),p=Math.floor(P%(Y+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,w>>24,w>>16&255,w>>8&255,w&255,p>>24,p>>16&255,p>>8&255,p&255,85,196,0,0]))},R.mdia=function(B){return R.box(R.types.mdia,R.mdhd(B.timescale,B.duration),R.hdlr(B.type),R.minf(B))},R.mfhd=function(B){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},R.minf=function(B){return B.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(B)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(B))},R.moof=function(B,P,w){return R.box(R.types.moof,R.mfhd(B),R.traf(w,P))},R.moov=function(B){for(var P=B.length,w=[];P--;)w[P]=R.trak(B[P]);return R.box.apply(null,[R.types.moov,R.mvhd(B[0].timescale,B[0].duration)].concat(w).concat(R.mvex(B)))},R.mvex=function(B){for(var P=B.length,w=[];P--;)w[P]=R.trex(B[P]);return R.box.apply(null,[R.types.mvex].concat(w))},R.mvhd=function(B,P){P*=B;var w=Math.floor(P/(Y+1)),p=Math.floor(P%(Y+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,w>>24,w>>16&255,w>>8&255,w&255,p>>24,p>>16&255,p>>8&255,p&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 R.box(R.types.mvhd,b)},R.sdtp=function(B){var P=B.samples||[],w=new Uint8Array(4+P.length),p,b;for(p=0;p<P.length;p++)b=P[p].flags,w[p+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return R.box(R.types.sdtp,w)},R.stbl=function(B){return R.box(R.types.stbl,R.stsd(B),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(B){var P=[],w=[],p,b,M;for(p=0;p<B.sps.length;p++)b=B.sps[p],M=b.byteLength,P.push(M>>>8&255),P.push(M&255),P=P.concat(Array.prototype.slice.call(b));for(p=0;p<B.pps.length;p++)b=B.pps[p],M=b.byteLength,w.push(M>>>8&255),w.push(M&255),w=w.concat(Array.prototype.slice.call(b));var A=R.box(R.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|B.sps.length].concat(P).concat([B.pps.length]).concat(w))),S=B.width,x=B.height,d=B.pixelRatio[0],a=B.pixelRatio[1];return R.box(R.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,S>>8&255,S&255,x>>8&255,x&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,a>>24,a>>16&255,a>>8&255,a&255])))},R.esds=function(B){var P=B.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(B.config).concat([6,1,2]))},R.mp4a=function(B){var P=B.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),R.box(R.types.esds,R.esds(B)))},R.mp3=function(B){var P=B.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},R.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(B)):R.box(R.types.stsd,R.STSD,R.mp4a(B)):R.box(R.types.stsd,R.STSD,R.avc1(B))},R.tkhd=function(B){var P=B.id,w=B.duration*B.timescale,p=B.width,b=B.height,M=Math.floor(w/(Y+1)),A=Math.floor(w%(Y+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,p>>8&255,p&255,0,0,b>>8&255,b&255,0,0]))},R.traf=function(B,P){var w=R.sdtp(B),p=B.id,b=Math.floor(P/(Y+1)),M=Math.floor(P%(Y+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,M>>24,M>>16&255,M>>8&255,M&255])),R.trun(B,w.length+16+20+8+16+8+8),w)},R.trak=function(B){return B.duration=B.duration||4294967295,R.box(R.types.trak,R.tkhd(B),R.mdia(B))},R.trex=function(B){var P=B.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(B,P){var w=B.samples||[],p=w.length,b=12+16*p,M=new Uint8Array(b),A,S,x,d,a,s;for(P+=8+b,M.set([0,0,15,1,p>>>24&255,p>>>16&255,p>>>8&255,p&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),A=0;A<p;A++)S=w[A],x=S.duration,d=S.size,a=S.flags,s=S.cts,M.set([x>>>24&255,x>>>16&255,x>>>8&255,x&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*A);return R.box(R.types.trun,M)},R.initSegment=function(B){R.types||R.init();var P=R.moov(B),w=new Uint8Array(R.FTYP.byteLength+P.byteLength);return w.set(R.FTYP),w.set(P,R.FTYP.byteLength),w},R}();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,$.default=F},"./src/remux/mp4-remuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return s}),k.d($,"normalizePts",function(){return u});var Y=k("./src/polyfills/number.ts"),F=k("./src/remux/aac-helper.ts"),R=k("./src/remux/mp4-generator.ts"),W=k("./src/events.ts"),B=k("./src/errors.ts"),P=k("./src/utils/logger.ts"),w=k("./src/types/loader.ts"),p=k("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},b.apply(this,arguments)}var M=10*1e3,A=1024,S=1152,x=null,d=null,a=!1,s=function(){function D(g,c,h,o){if(o===void 0&&(o=""),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=g,this.config=c,this.typeSupported=h,this.ISGenerated=!1,x===null){var C=navigator.userAgent||"",E=C.match(/Chrome\/(\d+)/i);x=E?parseInt(E[1]):0}if(d===null){var m=navigator.userAgent.match(/Safari\/(\d+)/i);d=m?parseInt(m[1]):0}a=!!x&&x<75||!!d&&d<600}var T=D.prototype;return T.destroy=function(){},T.resetTimeStamp=function(c){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},T.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(c){var h=!1,o=c.reduce(function(C,E){var m=E.pts-C;return m<-4294967296?(h=!0,u(C,E.pts)):m>0?C:E.pts},c[0].pts);return h&&P.logger.debug("PTS rollover detected"),o},T.remux=function(c,h,o,C,E,m,O,U){var j,K,I,N,X,q,ae=E,he=E,Ae=c.pid>-1,be=h.pid>-1,Te=h.samples.length,Ce=c.samples.length>0,Se=Te>1,me=(!Ae||Ce)&&(!be||Se)||this.ISGenerated||O;if(me){this.ISGenerated||(I=this.generateIS(c,h,E));var ue=this.isVideoContiguous,te=-1;if(Se&&(te=L(h.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,te>0){P.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Te+" video samples due to a missing keyframe");var fe=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(te),h.dropped+=te,he+=(h.samples[0].pts-fe)/(h.timescale||9e4)}else te===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),q=!1);if(this.ISGenerated){if(Ce&&Se){var se=this.getVideoStartPts(h.samples),_e=u(c.samples[0].pts,se)-se,Oe=_e/h.inputTimeScale;ae+=Math.max(0,Oe),he+=Math.max(0,-Oe)}if(Ce){if(c.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(c,h,E)),K=this.remuxAudio(c,ae,this.isAudioContiguous,m,be||Se||U===w.PlaylistLevelType.AUDIO?he:void 0),Se){var xe=K?K.endPTS-K.startPTS:0;h.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(c,h,E)),j=this.remuxVideo(h,he,ue,xe)}}else Se&&(j=this.remuxVideo(h,he,ue,0));j&&(j.firstKeyFrame=te,j.independent=te!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,E)),C.samples.length&&(N=this.remuxText(C,E))),{audio:K,video:j,initSegment:I,independent:q,text:N,id3:X}},T.generateIS=function(c,h,o){var C=c.samples,E=h.samples,m=this.typeSupported,O={},U=!Object(Y.isFiniteNumber)(this._initPTS),j="audio/mp4",K,I,N;if(U&&(K=I=Infinity),c.config&&C.length&&(c.timescale=c.samplerate,c.isAAC||(m.mpeg?(j="audio/mpeg",c.codec=""):m.mp3&&(c.codec="mp3")),O.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&m.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(N=c.inputTimeScale,K=I=C[0].pts-Math.round(N*o))),h.sps&&h.pps&&E.length&&(h.timescale=h.inputTimeScale,O.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:R.default.initSegment([h]),metadata:{width:h.width,height:h.height}},U)){N=h.inputTimeScale;var X=this.getVideoStartPts(E),q=Math.round(N*o);I=Math.min(I,u(E[0].dts,X)-q),K=Math.min(K,X-q)}if(Object.keys(O).length)return this.ISGenerated=!0,U&&(this._initPTS=K,this._initDTS=I),{tracks:O,initPTS:K,timescale:N}},T.remuxVideo=function(c,h,o,C){var E=c.inputTimeScale,m=c.samples,O=[],U=m.length,j=this._initPTS,K=this.nextAvcDts,I=8,N,X,q,ae=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,Ae=0,be=!1;if(!o||K===null){var Te=h*E,Ce=m[0].pts-u(m[0].dts,m[0].pts);K=Te-Ce}for(var Se=0;Se<U;Se++){var me=m[Se];if(me.pts=u(me.pts-j,K),me.dts=u(me.dts-j,K),me.dts>me.pts){var ue=9e4*.2;Ae=Math.max(Math.min(Ae,me.pts-me.dts),-1*ue)}me.dts<m[Se>0?Se-1:Se].dts&&(be=!0)}be&&m.sort(function(xt,mt){var ot=xt.dts-mt.dts,Rt=xt.pts-mt.pts;return ot||Rt}),X=m[0].dts,q=m[m.length-1].dts;var te=Math.round((q-X)/(U-1));if(Ae<0){if(Ae<te*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(p.toMsFromMpegTsClock)(-te,!0)+" ms");for(var fe=Ae,se=0;se<U;se++)m[se].dts=fe=Math.max(fe,m[se].pts-te),m[se].pts=Math.max(fe,m[se].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(p.toMsFromMpegTsClock)(Ae,!0)+" ms to overcome this issue");for(var _e=0;_e<U;_e++)m[_e].dts=m[_e].dts+Ae}X=m[0].dts}if(o){var Oe=X-K,xe=Oe>te,Pe=Oe<-1;if(xe||Pe){xe?P.logger.warn("AVC: "+Object(p.toMsFromMpegTsClock)(Oe,!0)+" ms ("+Oe+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(p.toMsFromMpegTsClock)(-Oe,!0)+" ms ("+Oe+"dts) overlapping between fragments detected"),X=K;var Ne=m[0].pts-Oe;m[0].dts=X,m[0].pts=Ne,P.logger.log("Video: First PTS/DTS adjusted: "+Object(p.toMsFromMpegTsClock)(Ne,!0)+"/"+Object(p.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(p.toMsFromMpegTsClock)(Oe,!0)+" ms")}}a&&(X=Math.max(0,X));for(var Be=0,We=0,Ue=0;Ue<U;Ue++){for(var Fe=m[Ue],at=Fe.units,it=at.length,et=0,Ze=0;Ze<it;Ze++)et+=at[Ze].data.length;We+=et,Be+=it,Fe.length=et,Fe.dts=Math.max(Fe.dts,X),Fe.pts=Math.max(Fe.pts,Fe.dts,0),ae=Math.min(Fe.pts,ae),he=Math.max(Fe.pts,he)}q=m[U-1].dts;var ut=We+4*Be+8,Je;try{Je=new Uint8Array(ut)}catch(xt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ut,reason:"fail allocating video mdat "+ut});return}var st=new DataView(Je.buffer);st.setUint32(0,ut),Je.set(R.default.types.mdat,4);for(var ke=0;ke<U;ke++){for(var nt=m[ke],qe=nt.units,Ie=0,He=0,Ee=qe.length;He<Ee;He++){var pe=qe[He],ye=pe.data,re=pe.data.byteLength;st.setUint32(I,re),I+=4,Je.set(ye,I),I+=re,Ie+=4+re}if(ke<U-1)N=m[ke+1].dts-nt.dts;else{var oe=this.config,le=nt.dts-m[ke>0?ke-1:ke].dts;if(oe.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(oe.maxBufferHole*E),Le=(C?ae+C*E:this.nextAudioPts)-nt.pts;Le>de?(N=Le-le,N<0&&(N=le),P.logger.log("[mp4-remuxer]: It is approximately "+Le/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=le}else N=le}var Me=Math.round(nt.pts-nt.dts);O.push(new f(nt.key,N,Ie,Me))}if(O.length&&x&&x<70){var Ye=O[0].flags;Ye.dependsOn=2,Ye.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=K=q+N,this.isVideoContiguous=!0;var yt=R.default.moof(c.sequenceNumber++,X,b({},c,{samples:O})),At="video",Ke={data1:yt,data2:Je,startPTS:ae/E,endPTS:(he+N)/E,startDTS:X/E,endDTS:K/E,type:At,hasAudio:!1,hasVideo:!0,nb:O.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Ke},T.remuxAudio=function(c,h,o,C,E){var m=c.inputTimeScale,O=c.samplerate?c.samplerate:m,U=m/O,j=c.isAAC?A:S,K=j*U,I=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,X=[],q=c.samples,ae=N?0:8,he=this.nextAudioPts||-1,Ae=h*m;if(this.isAudioContiguous=o=o||q.length&&he>0&&(C&&Math.abs(Ae-he)<9e3||Math.abs(u(q[0].pts-I,Ae)-he)<20*K),q.forEach(function(ye){ye.pts=u(ye.pts-I,Ae)}),!o||he<0){if(q=q.filter(function(ye){return ye.pts>=0}),!q.length)return;E===0?he=0:C?he=Math.max(0,Ae):he=q[0].pts}if(c.isAAC)for(var be=E!==void 0,Te=this.config.maxAudioFramesDrift,Ce=0,Se=he;Ce<q.length;Ce++){var me=q[Ce],ue=me.pts,te=ue-Se,fe=Math.abs(1e3*te/m);if(te<=-Te*K&&be)Ce===0&&(P.logger.warn("Audio frame @ "+(ue/m).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/m)+" ms."),this.nextAudioPts=he=Se=ue);else if(te>=Te*K&&fe<M&&be){var se=Math.round(te/K);Se=ue-se*K,Se<0&&(se--,Se+=K),Ce===0&&(this.nextAudioPts=he=Se),P.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(Se/m).toFixed(3)+"s due to "+Math.round(1e3*te/m)+" ms gap.");for(var _e=0;_e<se;_e++){var Oe=Math.max(Se,0),xe=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);xe||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=me.unit.subarray()),q.splice(Ce,0,{unit:xe,pts:Oe}),Se+=K,Ce++}}me.pts=Se,Se+=K}for(var Pe=null,Ne=null,Be,We=0,Ue=q.length;Ue--;)We+=q[Ue].unit.byteLength;for(var Fe=0,at=q.length;Fe<at;Fe++){var it=q[Fe],et=it.unit,Ze=it.pts;if(Ne!==null){var ut=X[Fe-1];ut.duration=Math.round((Ze-Ne)/U)}else if(o&&c.isAAC&&(Ze=he),Pe=Ze,We>0){We+=ae;try{Be=new Uint8Array(We)}catch(ye){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!N){var Je=new DataView(Be.buffer);Je.setUint32(0,We),Be.set(R.default.types.mdat,4)}}else return;Be.set(et,ae);var st=et.byteLength;ae+=st,X.push(new f(!0,j,st,0)),Ne=Ze}var ke=X.length;if(!ke)return;var nt=X[X.length-1];this.nextAudioPts=he=Ne+U*nt.duration;var qe=N?new Uint8Array(0):R.default.moof(c.sequenceNumber++,Pe/U,b({},c,{samples:X}));c.samples=[];var Ie=Pe/m,He=he/m,Ee="audio",pe={data1:qe,data2:Be,startPTS:Ie,endPTS:He,startDTS:Ie,endDTS:He,type:Ee,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),pe},T.remuxEmptyAudio=function(c,h,o,C){var E=c.inputTimeScale,m=c.samplerate?c.samplerate:E,O=E/m,U=this.nextAudioPts,j=(U!==null?U:C.startDTS*E)+this._initDTS,K=C.endDTS*E+this._initDTS,I=O*A,N=Math.ceil((K-j)/I),X=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],ae=0;ae<N;ae++){var he=j+ae*I;q.push({unit:X,pts:he,dts:he})}return c.samples=q,this.remuxAudio(c,h,o,!1)},T.remuxID3=function(c,h){var o=c.samples.length;if(!o)return;for(var C=c.inputTimeScale,E=this._initPTS,m=this._initDTS,O=0;O<o;O++){var U=c.samples[O];U.pts=u(U.pts-E,h*C)/C,U.dts=u(U.dts-m,h*C)/C}var j=c.samples;return c.samples=[],{samples:j}},T.remuxText=function(c,h){var o=c.samples.length;if(!o)return;for(var C=c.inputTimeScale,E=this._initPTS,m=0;m<o;m++){var O=c.samples[m];O.pts=u(O.pts-E,h*C)/C}c.samples.sort(function(j,K){return j.pts-K.pts});var U=c.samples;return c.samples=[],{samples:U}},D}();function u(D,T){var g;if(T===null)return D;for(T<D?g=-8589934592:g=8589934592;Math.abs(D-T)>4294967296;)D+=g;return D}function L(D){for(var T=0;T<D.length;T++)if(D[T].key)return T;return-1}var f=function(T,g,c,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=c,this.cts=h,this.flags=new v(T)},v=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/polyfills/number.ts"),F=k("./src/utils/mp4-tools.ts"),R=k("./src/loader/fragment.ts"),W=k("./src/utils/logger.ts"),B=function(){function p(){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 b=p.prototype;return b.destroy=function(){},b.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(A,S,x){this.audioCodec=S,this.videoCodec=x,this.generateInitSegment(A),this.emitInitSegment=!0},b.generateInitSegment=function(A){var S=this.audioCodec,x=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(F.parseInitSegment)(A);S||(S=w(d.audio,R.ElementaryStreamTypes.AUDIO)),x||(x=w(d.video,R.ElementaryStreamTypes.VIDEO));var a={};d.audio&&d.video?a.audiovideo={container:"video/mp4",codec:S+","+x,initSegment:A,id:"main"}:d.audio?a.audio={container:"audio/mp4",codec:S,initSegment:A,id:"audio"}:d.video?a.video={container:"video/mp4",codec:x,initSegment:A,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},b.remux=function(A,S,x,d,a){var s=this.initPTS,u=this.lastEndDTS,L={audio:void 0,video:void 0,text:d,id3:x,initSegment:void 0};Object(Y.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var f=S.samples;if(!f||!f.length)return L;var v={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(f),D=this.initData),!D||!D.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=P(D,f,u));var T=Object(F.getDuration)(f,D),g=u,c=T+g;Object(F.offsetStartDTS)(D,f,s),T>0?this.lastEndDTS=c:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!D.audio,o=!!D.video,C="";h&&(C+="audio"),o&&(C+="video");var E={data1:f,startPTS:g,startDTS:g,endPTS:c,endDTS:c,type:C,hasAudio:h,hasVideo:o,nb:1,dropped:0};return L.audio=E.type==="audio"?E:void 0,L.video=E.type!=="audio"?E:void 0,L.text=d,L.id3=x,L.initSegment=v,L},p}(),P=function(b,M,A){return Object(F.getStartDTS)(b,M)-A};function w(p,b){var M=p==null?void 0:p.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||b===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=B},"./src/task-loop.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return Y});var Y=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=F.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ne,$,k){"use strict";k.r($),k.d($,"CMCDVersion",function(){return Y}),k.d($,"CMCDObjectType",function(){return F}),k.d($,"CMCDStreamingFormat",function(){return R}),k.d($,"CMCDStreamType",function(){return W});var Y=1,F;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(F||(F={}));var R;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(R||(R={}));var W;(function(B){B.VOD="v",B.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ne,$,k){"use strict";k.r($),k.d($,"HlsSkip",function(){return R}),k.d($,"getSkipValue",function(){return W}),k.d($,"HlsUrlParameters",function(){return B}),k.d($,"Level",function(){return P});function Y(w,p){for(var b=0;b<p.length;b++){var M=p[b];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(w,M.key,M)}}function F(w,p,b){return p&&Y(w.prototype,p),b&&Y(w,b),w}var R;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(R||(R={}));function W(w,p){var b=w.canSkipUntil,M=w.canSkipDateRanges,A=w.endSN,S=p!==void 0?p-A:0;return b&&S<b?M?R.v2:R.Yes:R.No}var B=function(){function w(b,M,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=M,this.skip=A}var p=w.prototype;return p.addDirectives=function(M){var A=new self.URL(M);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},w}(),P=function(){function w(p){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=[p.url],this.attrs=p.attrs,this.bitrate=p.bitrate,p.details&&(this.details=p.details),this.id=p.id||0,this.name=p.name,this.width=p.width||0,this.height=p.height||0,this.audioCodec=p.audioCodec,this.videoCodec=p.videoCodec,this.unknownCodecs=p.unknownCodecs,this.codecSet=[p.videoCodec,p.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return F(w,[{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(b){var M=b%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),w}()},"./src/types/loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"PlaylistContextType",function(){return Y}),k.d($,"PlaylistLevelType",function(){return F});var Y;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var F;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ne,$,k){"use strict";k.r($),k.d($,"ChunkMetadata",function(){return Y});var Y=function(W,B,P,w,p,b){w===void 0&&(w=0),p===void 0&&(p=-1),b===void 0&&(b=!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=B,this.id=P,this.size=w,this.part=p,this.partial=b};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,$,k){"use strict";k.r($),k.d($,"AttrList",function(){return R});var Y=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var w in P)P.hasOwnProperty(w)&&(this[w]=P[w])}var B=W.prototype;return B.decimalInteger=function(w){var p=parseInt(this[w],10);return p>Number.MAX_SAFE_INTEGER?Infinity:p},B.hexadecimalInteger=function(w){if(this[w]){var p=(this[w]||"0x").slice(2);p=(p.length&1?"0":"")+p;for(var b=new Uint8Array(p.length/2),M=0;M<p.length/2;M++)b[M]=parseInt(p.slice(M*2,M*2+2),16);return b}else return null},B.hexadecimalIntegerAsNumber=function(w){var p=parseInt(this[w],16);return p>Number.MAX_SAFE_INTEGER?Infinity:p},B.decimalFloatingPoint=function(w){return parseFloat(this[w])},B.optionalFloat=function(w,p){var b=this[w];return b?parseFloat(b):p},B.enumeratedString=function(w){return this[w]},B.bool=function(w){return this[w]==="YES"},B.decimalResolution=function(w){var p=Y.exec(this[w]);return p===null?void 0:{width:parseInt(p[1],10),height:parseInt(p[2],10)}},W.parseAttrList=function(w){var p,b={},M='"';for(F.lastIndex=0;(p=F.exec(w))!==null;){var A=p[2];A.indexOf(M)===0&&A.lastIndexOf(M)===A.length-1&&(A=A.slice(1,-1)),b[p[1]]=A}return b},W}()},"./src/utils/binary-search.ts":function(ne,$,k){"use strict";k.r($);var Y={search:function(R,W){for(var B=0,P=R.length-1,w=null,p=null;B<=P;){w=(B+P)/2|0,p=R[w];var b=W(p);if(b>0)B=w+1;else if(b<0)P=w-1;else return p}return null}};$.default=Y},"./src/utils/buffer-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"BufferHelper",function(){return R});var Y=k("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function W(){}return W.isBuffered=function(P,w){try{if(P){for(var p=W.getBuffered(P),b=0;b<p.length;b++)if(w>=p.start(b)&&w<=p.end(b))return!0}}catch(M){}return!1},W.bufferInfo=function(P,w,p){try{if(P){var b=W.getBuffered(P),M=[],A;for(A=0;A<b.length;A++)M.push({start:b.start(A),end:b.end(A)});return this.bufferedInfo(M,w,p)}}catch(S){}return{len:0,start:w,end:w,nextStart:void 0}},W.bufferedInfo=function(P,w,p){w=Math.max(0,w),P.sort(function(v,D){var T=v.start-D.start;return T||D.end-v.end});var b=[];if(p)for(var M=0;M<P.length;M++){var A=b.length;if(A){var S=b[A-1].end;P[M].start-S<p?P[M].end>S&&(b[A-1].end=P[M].end):b.push(P[M])}else b.push(P[M])}else b=P;for(var x=0,d,a=w,s=w,u=0;u<b.length;u++){var L=b[u].start,f=b[u].end;if(w+p>=L&&w<f)a=L,s=f,x=s-w;else if(w+p<L){d=L;break}}return{len:x,start:a||0,end:s||0,nextStart:d}},W.getBuffered=function(P){try{return P.buffered}catch(w){return Y.logger.log("failed to get media.buffered",w),F}},W}()},"./src/utils/cea-608-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"Row",function(){return s}),k.d($,"CaptionScreen",function(){return u});var Y=k("./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},R=function(c){var h=c;return F.hasOwnProperty(c)&&(h=F[c]),String.fromCharCode(h)},W=15,B=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},w={17:2,18:4,21:6,22:8,23:10,19:13,20:15},p={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(A||(A={}));var S=function(){function g(){this.time=null,this.verboseLevel=A.ERROR}var c=g.prototype;return c.log=function(o,C){this.verboseLevel>=o&&Y.logger.log(this.time+" ["+o+"] "+C)},g}(),x=function(c){for(var h=[],o=0;o<c.length;o++)h.push(c[o].toString(16));return h},d=function(){function g(h,o,C,E,m){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=o||!1,this.italics=C||!1,this.background=E||"black",this.flash=m||!1}var c=g.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(o){for(var C=["foreground","underline","italics","background","flash"],E=0;E<C.length;E++){var m=C[E];o.hasOwnProperty(m)&&(this[m]=o[m])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},c.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),a=function(){function g(h,o,C,E,m,O){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new d(o,C,E,m,O)}var c=g.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(o,C){this.uchar=o,this.penState.copy(C)},c.setPenState=function(o){this.penState.copy(o)},c.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},c.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),s=function(){function g(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 o=0;o<B;o++)this.chars.push(new a);this.logger=h,this.pos=0,this.currPenState=new d}var c=g.prototype;return c.equals=function(o){for(var C=!0,E=0;E<B;E++)if(!this.chars[E].equals(o.chars[E])){C=!1;break}return C},c.copy=function(o){for(var C=0;C<B;C++)this.chars[C].copy(o.chars[C])},c.isEmpty=function(){for(var o=!0,C=0;C<B;C++)if(!this.chars[C].isEmpty()){o=!1;break}return o},c.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},c.moveCursor=function(o){var C=this.pos+o;if(o>1)for(var E=this.pos+1;E<C+1;E++)this.chars[E].setPenState(this.currPenState);this.setCursor(C)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(o){o>=144&&this.backSpace();var C=R(o);if(this.pos>=B){this.logger.log(A.ERROR,"Cannot insert "+o.toString(16)+" ("+C+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(C,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(o){var C;for(C=o;C<B;C++)this.chars[C].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var o=[],C=!0,E=0;E<B;E++){var m=this.chars[E].uchar;m!==" "&&(C=!1),o.push(m)}return C?"":o.join("")},c.setPenStyles=function(o){this.currPenState.setStyles(o);var C=this.chars[this.pos];C.setPenState(this.currPenState)},g}(),u=function(){function g(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 o=0;o<W;o++)this.rows.push(new s(h));this.logger=h,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=g.prototype;return c.reset=function(){for(var o=0;o<W;o++)this.rows[o].clear();this.currRow=W-1},c.equals=function(o){for(var C=!0,E=0;E<W;E++)if(!this.rows[E].equals(o.rows[E])){C=!1;break}return C},c.copy=function(o){for(var C=0;C<W;C++)this.rows[C].copy(o.rows[C])},c.isEmpty=function(){for(var o=!0,C=0;C<W;C++)if(!this.rows[C].isEmpty()){o=!1;break}return o},c.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},c.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},c.insertChar=function(o){var C=this.rows[this.currRow];C.insertChar(o)},c.setPen=function(o){var C=this.rows[this.currRow];C.setPenStyles(o)},c.moveCursor=function(o){var C=this.rows[this.currRow];C.moveCursor(o)},c.setCursor=function(o){this.logger.log(A.INFO,"setCursor: "+o);var C=this.rows[this.currRow];C.setCursor(o)},c.setPAC=function(o){this.logger.log(A.INFO,"pacData = "+JSON.stringify(o));var C=o.row-1;if(this.nrRollUpRows&&C<this.nrRollUpRows-1&&(C=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==C){for(var E=0;E<W;E++)this.rows[E].clear();var m=this.currRow+1-this.nrRollUpRows,O=this.lastOutputScreen;if(O){var U=O.rows[m].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var K=0;K<this.nrRollUpRows;K++)this.rows[C-this.nrRollUpRows+K+1].copy(O.rows[m+K])}}this.currRow=C;var I=this.rows[this.currRow];if(o.indent!==null){var N=o.indent,X=Math.max(N-1,0);I.setCursor(o.indent),o.color=I.chars[X].penState.foreground}var q={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(q)},c.setBkgData=function(o){this.logger.log(A.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},c.setRollUpRows=function(o){this.nrRollUpRows=o},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,C=this.rows.splice(o,1)[0];C.clear(),this.rows.splice(this.currRow,0,C),this.logger.log(A.INFO,"Rolling up")},c.getDisplayText=function(o){o=o||!1;for(var C=[],E="",m=-1,O=0;O<W;O++){var U=this.rows[O].getTextString();U&&(m=O+1,o?C.push("Row "+m+": '"+U+"'"):C.push(U.trim()))}return C.length>0&&(o?E="["+C.join(" | ")+"]":E=C.join(`
`)),E},c.getTextAndFormat=function(){return this.rows},g}(),L=function(){function g(h,o,C){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=o,this.mode=null,this.verbose=0,this.displayedMemory=new u(C),this.nonDisplayedMemory=new u(C),this.lastOutputScreen=new u(C),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=C}var c=g.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(o){this.outputFilter=o},c.setPAC=function(o){this.writeScreen.setPAC(o)},c.setBkgData=function(o){this.writeScreen.setBkgData(o)},c.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(A.INFO,"MODE="+o),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=o},c.insertChars=function(o){for(var C=0;C<o.length;C++)this.writeScreen.insertChar(o[C]);var E=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,E+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(A.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(o){this.logger.log(A.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},c.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(A.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(o){this.logger.log(A.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},c.ccMIDROW=function(o){var C={flash:!1};if(C.underline=o%2===1,C.italics=o>=46,C.italics)C.foreground="white";else{var E=Math.floor(o/2)-16,m=["white","green","blue","cyan","red","yellow","magenta"];C.foreground=m[E]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(C)),this.writeScreen.setPen(C)},c.outputDataUpdate=function(o){o===void 0&&(o=!1);var C=this.logger.time;if(C===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=C:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,C,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:C),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},g}(),f=function(){function g(h,o,C){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var E=new S;this.channels=[null,new L(h,o,E),new L(h+1,C,E)],this.cmdHistory=T(),this.logger=E}var c=g.prototype;return c.getHandler=function(o){return this.channels[o].getHandler()},c.setHandler=function(o,C){this.channels[o].setHandler(C)},c.addData=function(o,C){var E,m,O,U=!1;this.logger.time=o;for(var j=0;j<C.length;j+=2){if(m=C[j]&127,O=C[j+1]&127,m===0&&O===0)continue;if(this.logger.log(A.DATA,"["+x([C[j],C[j+1]])+"] -> ("+x([m,O])+")"),E=this.parseCmd(m,O),E||(E=this.parseMidrow(m,O)),E||(E=this.parsePAC(m,O)),E||(E=this.parseBackgroundAttributes(m,O)),!E&&(U=this.parseChars(m,O),U)){var K=this.currentChannel;if(K&&K>0){var I=this.channels[K];I.insertChars(U)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!E&&!U&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+x([m,O])+" orig: "+x([C[j],C[j+1]]))}},c.parseCmd=function(o,C){var E=this.cmdHistory,m=(o===20||o===28||o===21||o===29)&&C>=32&&C<=47,O=(o===23||o===31)&&C>=33&&C<=35;if(!(m||O))return!1;if(D(o,C,E))return v(null,null,E),this.logger.log(A.DEBUG,"Repeated command ("+x([o,C])+") is dropped"),!0;var U=o===20||o===21||o===23?1:2,j=this.channels[U];return o===20||o===21||o===28||o===29?C===32?j.ccRCL():C===33?j.ccBS():C===34?j.ccAOF():C===35?j.ccAON():C===36?j.ccDER():C===37?j.ccRU(2):C===38?j.ccRU(3):C===39?j.ccRU(4):C===40?j.ccFON():C===41?j.ccRDC():C===42?j.ccTR():C===43?j.ccRTD():C===44?j.ccEDM():C===45?j.ccCR():C===46?j.ccENM():C===47&&j.ccEOC():j.ccTO(C-32),v(o,C,E),this.currentChannel=U,!0},c.parseMidrow=function(o,C){var E=0;if((o===17||o===25)&&C>=32&&C<=47){if(o===17?E=1:E=2,E!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var m=this.channels[E];return m?(m.ccMIDROW(C),this.logger.log(A.DEBUG,"MIDROW ("+x([o,C])+")"),!0):!1}return!1},c.parsePAC=function(o,C){var E,m=this.cmdHistory,O=(o>=17&&o<=23||o>=25&&o<=31)&&C>=64&&C<=127,U=(o===16||o===24)&&C>=64&&C<=95;if(!(O||U))return!1;if(D(o,C,m))return v(null,null,m),!0;var j=o<=23?1:2;C>=64&&C<=95?E=j===1?P[o]:p[o]:E=j===1?w[o]:b[o];var K=this.channels[j];return K?(K.setPAC(this.interpretPAC(E,C)),v(o,C,m),this.currentChannel=j,!0):!1},c.interpretPAC=function(o,C){var E,m={color:null,italics:!1,indent:null,underline:!1,row:o};return C>95?E=C-96:E=C-64,m.underline=(E&1)===1,E<=13?m.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(E/2)]:E<=15?(m.italics=!0,m.color="white"):m.indent=Math.floor((E-16)/2)*4,m},c.parseChars=function(o,C){var E,m=null,O=null;if(o>=25?(E=2,O=o-8):(E=1,O=o),O>=17&&O<=19){var U;O===17?U=C+80:O===18?U=C+112:U=C+144,this.logger.log(A.INFO,"Special char '"+R(U)+"' in channel "+E),m=[U]}else o>=32&&o<=127&&(m=C===0?[o]:[o,C]);if(m){var j=x(m);this.logger.log(A.DEBUG,"Char codes = "+j.join(",")),v(o,C,this.cmdHistory)}return m},c.parseBackgroundAttributes=function(o,C){var E=(o===16||o===24)&&C>=32&&C<=47,m=(o===23||o===31)&&C>=45&&C<=47;if(!(E||m))return!1;var O,U={};o===16||o===24?(O=Math.floor((C-32)/2),U.background=M[O],C%2===1&&(U.background=U.background+"_semi")):C===45?U.background="transparent":(U.foreground="black",C===47&&(U.underline=!0));var j=o<=23?1:2,K=this.channels[j];return K.setBkgData(U),v(o,C,this.cmdHistory),!0},c.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var C=this.channels[o];C&&C.reset()}this.cmdHistory=T()},c.cueSplitAtTime=function(o){for(var C=0;C<this.channels.length;C++){var E=this.channels[C];E&&E.cueSplitAtTime(o)}},g}();function v(g,c,h){h.a=g,h.b=c}function D(g,c,h){return h.a===g&&h.b===c}function T(){return{a:null,b:null}}$.default=f},"./src/utils/codecs.ts":function(ne,$,k){"use strict";k.r($),k.d($,"isCodecType",function(){return F}),k.d($,"isCodecSupportedInMp4",function(){return R});var Y={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,B){var P=Y[B];return!!P&&P[W.slice(0,4)]===!0}function R(W,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/utils/vttparser.ts"),F=k("./src/utils/webvtt-parser.ts"),R=k("./src/utils/texttrack-utils.ts"),W=/\s/,B={newCue:function(w,p,b,M){for(var A=[],S,x,d,a,s,u=self.VTTCue||self.TextTrackCue,L=0;L<M.rows.length;L++)if(S=M.rows[L],d=!0,a=0,s="",!S.isEmpty()){for(var f=0;f<S.chars.length;f++)W.test(S.chars[f].uchar)&&d?a++:(s+=S.chars[f].uchar,d=!1);S.cueStartTime=p,p===b&&(b+=1e-4),a>=16?a--:a++;var v=Object(Y.fixLineBreaks)(s.trim()),D=Object(F.generateCueId)(p,b,v);(!w||!w.cues||!w.cues.getCueById(D))&&(x=new u(p,b,v),x.id=D,x.line=L+1,x.align="left",x.position=10+Math.min(80,Math.floor(a*8/32)*10),A.push(x))}return w&&A.length&&(A.sort(function(T,g){return T.line==="auto"||g.line==="auto"?0:T.line>8&&g.line>8?g.line-T.line:T.line-g.line}),A.forEach(function(T){return Object(R.addCueToTrack)(w,T)})),A}};$.default=B},"./src/utils/discontinuities.ts":function(ne,$,k){"use strict";k.r($),k.d($,"findFirstFragWithCC",function(){return W}),k.d($,"shouldAlignOnDiscontinuities",function(){return B}),k.d($,"findDiscontinuousReferenceFrag",function(){return P}),k.d($,"adjustSlidingStart",function(){return p}),k.d($,"alignStream",function(){return b}),k.d($,"alignPDT",function(){return A}),k.d($,"alignFragmentByPDTDelta",function(){return S}),k.d($,"alignMediaPlaylistByPDT",function(){return x});var Y=k("./src/polyfills/number.ts"),F=k("./src/utils/logger.ts"),R=k("./src/controller/level-helper.ts");function W(d,a){for(var s=null,u=0,L=d.length;u<L;u++){var f=d[u];if(f&&f.cc===a){s=f;break}}return s}function B(d,a,s){return!!(a.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function P(d,a){var s=d.fragments,u=a.fragments;if(!u.length||!s.length){F.logger.log("No fragments to align");return}var L=W(s,u[0].cc);if(!L||L&&!L.startPTS){F.logger.log("No frag in previous level to align on");return}return L}function w(d,a){if(d){var s=d.start+a;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function p(d,a){for(var s=a.fragments,u=0,L=s.length;u<L;u++)w(s[u],d);a.fragmentHint&&w(a.fragmentHint,d),a.alignedSliding=!0}function b(d,a,s){if(!a)return;M(d,s,a),!s.alignedSliding&&a.details&&A(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(R.adjustSliding)(a.details,s)}function M(d,a,s){if(B(d,s,a)){var u=P(s.details,a);u&&Object(Y.isFiniteNumber)(u.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),p(u.start,a))}}function A(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=d.fragments[0].programDateTime,L=(u-s)/1e3+a.fragments[0].start;L&&Object(Y.isFiniteNumber)(L)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+L.toFixed(3)+" "+d.url+" "),p(L,d))}function S(d,a){var s=d.programDateTime;if(!s)return;var u=(s-a)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function x(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=a.fragments[0].start,L=s-u*1e3;d.fragments.forEach(function(f){S(f,L)}),d.fragmentHint&&S(d.fragmentHint,L),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/utils/ewma.ts"),F=function(){function R(B,P,w){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=w,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(B),this.fast_=new Y.default(P)}var W=R.prototype;return W.update=function(P,w){var p=this.slow_,b=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new Y.default(P,p.getEstimate(),p.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new Y.default(w,b.getEstimate(),b.getTotalWeight()))},W.sample=function(P,w){P=Math.max(P,this.minDelayMs_);var p=8*w,b=P/1e3,M=p/b;this.fast_.sample(b,M),this.slow_.sample(b,M)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},R}();$.default=F},"./src/utils/ewma.ts":function(ne,$,k){"use strict";k.r($);var Y=function(){function F(W,B,P){B===void 0&&(B=0),P===void 0&&(P=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_=B,this.totalWeight_=P}var R=F.prototype;return R.sample=function(B,P){var w=Math.pow(this.alpha_,B);this.estimate_=P*(1-w)+w*this.estimate_,this.totalWeight_+=B},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},F}();$.default=Y},"./src/utils/fetch-loader.ts":function(ne,$,k){"use strict";k.r($),k.d($,"fetchSupported",function(){return S});var Y=k("./src/polyfills/number.ts"),F=k("./src/loader/load-stats.ts"),R=k("./src/demux/chunk-cache.ts");function W(u,L){u.prototype=Object.create(L.prototype),u.prototype.constructor=u,b(u,L)}function B(u){var L=typeof Map=="function"?new Map:void 0;return B=function(v){if(v===null||!p(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(v))return L.get(v);L.set(v,D)}function D(){return P(v,arguments,M(this).constructor)}return D.prototype=Object.create(v.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),b(D,v)},B(u)}function P(u,L,f){return w()?P=Reflect.construct:P=function(D,T,g){var c=[null];c.push.apply(c,T);var h=Function.bind.apply(D,c),o=new h;return g&&b(o,g.prototype),o},P.apply(null,arguments)}function w(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function p(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function b(u,L){return b=Object.setPrototypeOf||function(v,D){return v.__proto__=D,v},b(u,L)}function M(u){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},M(u)}function A(){return A=Object.assign||function(u){for(var L=1;L<arguments.length;L++){var f=arguments[L];for(var v in f)Object.prototype.hasOwnProperty.call(f,v)&&(u[v]=f[v])}return u},A.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var x=function(){function u(f){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=f.fetchSetup||a,this.controller=new self.AbortController,this.stats=new F.LoadStats}var L=u.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(v,D,T){var g=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var h=d(v,this.controller.signal),o=T.onProgress,C=v.responseType==="arraybuffer",E=C?"byteLength":"length";this.context=v,this.config=D,this.callbacks=T,this.request=this.fetchSetup(v,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),T.onTimeout(c,v,g.response)},D.timeout),self.fetch(this.request).then(function(m){if(g.response=g.loader=m,!m.ok){var O=m.status,U=m.statusText;throw new s(U||"fetch, bad network response",O,m)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(m.headers.get("Content-Length")||"0"),o&&Object(Y.isFiniteNumber)(D.highWaterMark)?g.loadProgressively(m,c,v,D.highWaterMark,o):C?m.arrayBuffer():m.text()}).then(function(m){var O=g.response;self.clearTimeout(g.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=m[E];var U={url:O.url,data:m};o&&!Object(Y.isFiniteNumber)(D.highWaterMark)&&o(c,v,m,O),T.onSuccess(U,c,v,O)}).catch(function(m){if(self.clearTimeout(g.requestTimeout),c.aborted)return;var O=m.code||0;T.onError({code:O,text:m.message},v,m.details)})},L.getCacheAge=function(){var v=null;if(this.response){var D=this.response.headers.get("age");v=D?parseFloat(D):null}return v},L.loadProgressively=function(v,D,T,g,c){g===void 0&&(g=0);var h=new R.default,o=v.body.getReader(),C=function E(){return o.read().then(function(m){if(m.done)return h.dataLength&&c(D,T,h.flush(),v),Promise.resolve(new ArrayBuffer(0));var O=m.value,U=O.length;return D.loaded+=U,U<g||h.dataLength?(h.push(O),h.dataLength>=g&&c(D,T,h.flush(),v)):c(D,T,O,v),E()}).catch(function(){return Promise.reject()})};return C()},u}();function d(u,L){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(A({},u.headers))};return u.rangeEnd&&f.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),f}function a(u,L){return new self.Request(u.url,L)}var s=function(u){W(L,u);function L(f,v,D){var T;return T=u.call(this,f)||this,T.code=void 0,T.details=void 0,T.code=v,T.details=D,T}return L}(B(Error));$.default=x},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"IMSC1_CODEC",function(){return p}),k.d($,"parseIMSC1",function(){return S});var Y=k("./src/utils/mp4-tools.ts"),F=k("./src/utils/vttparser.ts"),R=k("./src/utils/vttcue.ts"),W=k("./src/demux/id3.ts"),B=k("./src/utils/timescale-conversion.ts"),P=k("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(g){for(var c=1;c<arguments.length;c++){var h=arguments[c];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(g[o]=h[o])}return g},w.apply(this,arguments)}var p="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(g,c,h,o,C){var E=Object(Y.findBox)(new Uint8Array(g),["mdat"]);if(E.length===0){C(new Error("Could not parse IMSC1 mdat"));return}var m=E[0],O=Object(W.utf8ArrayToStr)(new Uint8Array(g,m.start,m.end-m.start)),U=Object(B.toTimescaleFromScale)(c,1,h);try{o(x(O,U))}catch(j){C(j)}}function x(g,c){var h=new DOMParser,o=h.parseFromString(g,"text/xml"),C=o.getElementsByTagName("tt")[0];if(!C)throw new Error("Invalid ttml");var E={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(E).reduce(function(I,N){return I[N]=C.getAttribute("ttp:"+N)||E[N],I},{}),O=C.getAttribute("xml:space")!=="preserve",U=a(d(C,"styling","style")),j=a(d(C,"layout","region")),K=d(C,"body","[begin]");return[].map.call(K,function(I){var N=s(I,O);if(!N||!I.hasAttribute("begin"))return null;var X=v(I.getAttribute("begin"),m),q=v(I.getAttribute("dur"),m),ae=v(I.getAttribute("end"),m);if(X===null)throw f(I);if(ae===null){if(q===null)throw f(I);ae=X+q}var he=new R.default(X-c,ae-c,N);he.id=Object(P.generateCueId)(he.startTime,he.endTime,he.text);var Ae=j[I.getAttribute("region")],be=U[I.getAttribute("style")];he.position=10,he.size=80;var Te=u(Ae,be),Ce=Te.textAlign;if(Ce){var Se=A[Ce];Se&&(he.lineAlign=Se),he.align=Ce}return w(he,Te),he}).filter(function(I){return I!==null})}function d(g,c,h){var o=g.getElementsByTagName(c)[0];return o?[].slice.call(o.querySelectorAll(h)):[]}function a(g){return g.reduce(function(c,h){var o=h.getAttribute("xml:id");return o&&(c[o]=h),c},{})}function s(g,c){return[].slice.call(g.childNodes).reduce(function(h,o,C){var E;return o.nodeName==="br"&&C?h+`
`:(E=o.childNodes)!==null&&E!==void 0&&E.length?s(o,c):c?h+o.textContent.trim().replace(/\s+/g," "):h+o.textContent},"")}function u(g,c){var h="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(C,E){var m=L(c,h,E)||L(g,h,E);return m&&(C[E]=m),C},{})}function L(g,c,h){return g.hasAttributeNS(c,h)?g.getAttributeNS(c,h):null}function f(g){return new Error("Could not parse ttml timestamp "+g)}function v(g,c){if(!g)return null;var h=Object(F.parseTimeStamp)(g);return h===null&&(b.test(g)?h=D(g,c):M.test(g)&&(h=T(g,c))),h}function D(g,c){var h=b.exec(g),o=(h[4]|0)+(h[5]|0)/c.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+o/c.frameRate}function T(g,c){var h=M.exec(g),o=Number(h[1]),C=h[2];switch(C){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/c.frameRate;case"t":return o/c.tickRate}return o}},"./src/utils/logger.ts":function(ne,$,k){"use strict";k.r($),k.d($,"enableLogs",function(){return P}),k.d($,"logger",function(){return w});var Y=function(){},F={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},R=F;function W(p){var b=self.console[p];return b?b.bind(self.console,"["+p+"] >"):Y}function B(p){for(var b=arguments.length,M=new Array(b>1?b-1:0),A=1;A<b;A++)M[A-1]=arguments[A];M.forEach(function(S){R[S]=p[S]?p[S].bind(p):W(S)})}function P(p){if(self.console&&p===!0||typeof p=="object"){B(p,"debug","log","info","warn","error");try{R.log()}catch(b){R=F}}else R=F}var w=R},"./src/utils/mediakeys-helper.ts":function(ne,$,k){"use strict";k.r($),k.d($,"KeySystems",function(){return Y}),k.d($,"requestMediaKeySystemAccess",function(){return F});var Y;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));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(ne,$,k){"use strict";k.r($),k.d($,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,$,k){"use strict";k.r($),k.d($,"bin2str",function(){return B}),k.d($,"readUint16",function(){return P}),k.d($,"readUint32",function(){return w}),k.d($,"writeUint32",function(){return p}),k.d($,"findBox",function(){return b}),k.d($,"parseSegmentIndex",function(){return M}),k.d($,"parseInitSegment",function(){return A}),k.d($,"getStartDTS",function(){return S}),k.d($,"getDuration",function(){return x}),k.d($,"computeRawDurationFromSamples",function(){return d}),k.d($,"offsetStartDTS",function(){return a}),k.d($,"segmentValidRange",function(){return s}),k.d($,"appendUint8Array",function(){return u});var Y=k("./src/utils/typed-array.ts"),F=k("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,W=[].push;function B(L){return String.fromCharCode.apply(null,L)}function P(L,f){"data"in L&&(f+=L.start,L=L.data);var v=L[f]<<8|L[f+1];return v<0?65536+v:v}function w(L,f){"data"in L&&(f+=L.start,L=L.data);var v=L[f]<<24|L[f+1]<<16|L[f+2]<<8|L[f+3];return v<0?4294967296+v:v}function p(L,f,v){"data"in L&&(f+=L.start,L=L.data),L[f]=v>>24,L[f+1]=v>>16&255,L[f+2]=v>>8&255,L[f+3]=v&255}function b(L,f){var v=[];if(!f.length)return v;var D,T,g;"data"in L?(D=L.data,T=L.start,g=L.end):(D=L,T=0,g=D.byteLength);for(var c=T;c<g;){var h=w(D,c),o=B(D.subarray(c+4,c+8)),C=h>1?c+h:g;if(o===f[0])if(f.length===1)v.push({data:D,start:c+8,end:C});else{var E=b({data:D,start:c+8,end:C},f.slice(1));E.length&&W.apply(v,E)}c=C}return v}function M(L){var f=b(L,["moov"]),v=f[0],D=v?v.end:null,T=b(L,["sidx"]);if(!T||!T[0])return null;var g=[],c=T[0],h=c.data[0],o=h===0?8:16,C=w(c,o);o+=4;var E=0,m=0;h===0?o+=8:o+=16,o+=2;var O=c.end+m,U=P(c,o);o+=2;for(var j=0;j<U;j++){var K=o,I=w(c,K);K+=4;var N=I&2147483647,X=(I&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=w(c,K);K+=4,g.push({referenceSize:N,subsegmentDuration:q,info:{duration:q/C,start:O,end:O+N-1}}),O+=N,K+=4,o=K}return{earliestPresentationTime:E,timescale:C,version:h,referencesCount:U,references:g,moovEndOffset:D}}function A(L){for(var f=[],v=b(L,["moov","trak"]),D=0;D<v.length;D++){var T=v[D],g=b(T,["tkhd"])[0];if(g){var c=g.data[g.start],h=c===0?12:20,o=w(g,h),C=b(T,["mdia","mdhd"])[0];if(C){c=C.data[C.start],h=c===0?12:20;var E=w(C,h),m=b(T,["mdia","hdlr"])[0];if(m){var O=B(m.data.subarray(m.start+8,m.start+12)),U={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[O];if(U){var j=b(T,["mdia","minf","stbl","stsd"])[0],K=void 0;j&&(K=B(j.data.subarray(j.start+12,j.start+16))),f[o]={timescale:E,type:U},f[U]={timescale:E,id:o,codec:K}}}}}}var I=b(L,["moov","mvex","trex"]);return I.forEach(function(N){var X=w(N,4),q=f[X];q&&(q.default={duration:w(N,12),flags:w(N,20)})}),f}function S(L,f){return b(f,["moof","traf"]).reduce(function(v,D){var T=b(D,["tfdt"])[0],g=T.data[T.start],c=b(D,["tfhd"]).reduce(function(h,o){var C=w(o,4),E=L[C];if(E){var m=w(T,4);g===1&&(m*=Math.pow(2,32),m+=w(T,8));var O=E.timescale||9e4,U=m/O;if(isFinite(U)&&(h===null||U<h))return U}return h},null);return c!==null&&isFinite(c)&&(v===null||c<v)?c:v},null)||0}function x(L,f){for(var v=0,D=0,T=0,g=b(L,["moof","traf"]),c=0;c<g.length;c++){var h=g[c],o=b(h,["tfhd"])[0],C=w(o,4),E=f[C];if(!E)continue;var m=E.default,O=w(o,0)|(m==null?void 0:m.flags),U=m==null?void 0:m.duration;O&8&&(O&2?U=w(o,12):U=w(o,8));for(var j=E.timescale||9e4,K=b(h,["trun"]),I=0;I<K.length;I++){if(U){var N=w(K[I],4);v=U*N}else v=d(K[I]);E.type===F.ElementaryStreamTypes.VIDEO?D+=v/j:E.type===F.ElementaryStreamTypes.AUDIO&&(T+=v/j)}}if(D===0&&T===0){var X=M(L);if(X!=null&&X.references)return X.references.reduce(function(q,ae){return q+ae.info.duration||0},0)}return D||T}function d(L){var f=w(L,0),v=8;f&1&&(v+=4),f&4&&(v+=4);for(var D=0,T=w(L,4),g=0;g<T;g++){if(f&256){var c=w(L,v);D+=c,v+=4}f&512&&(v+=4),f&1024&&(v+=4),f&2048&&(v+=4)}return D}function a(L,f,v){b(f,["moof","traf"]).forEach(function(D){b(D,["tfhd"]).forEach(function(T){var g=w(T,4),c=L[g];if(!c)return;var h=c.timescale||9e4;b(D,["tfdt"]).forEach(function(o){var C=o.data[o.start],E=w(o,4);if(C===0)p(o,4,E-v*h);else{E*=Math.pow(2,32),E+=w(o,8),E-=v*h,E=Math.max(E,0);var m=Math.floor(E/(R+1)),O=Math.floor(E%(R+1));p(o,4,m),p(o,8,O)}})})})}function s(L){var f={valid:null,remainder:null},v=b(L,["moof"]);if(v){if(v.length<2)return f.remainder=L,f}else return f;var D=v[v.length-1];return f.valid=Object(Y.sliceUint8)(L,0,D.start-8),f.remainder=Object(Y.sliceUint8)(L,D.start-8),f}function u(L,f){var v=new Uint8Array(L.length+f.length);return v.set(L),v.set(f,L.length),v}},"./src/utils/output-filter.ts":function(ne,$,k){"use strict";k.r($),k.d($,"default",function(){return Y});var Y=function(){function F(W,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=B}var R=F.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(B,P,w){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=P,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ne,$,k){"use strict";k.r($),k.d($,"sendAddTrackEvent",function(){return F}),k.d($,"addCueToTrack",function(){return R}),k.d($,"clearCurrentCues",function(){return W}),k.d($,"removeCuesInRange",function(){return B}),k.d($,"getCuesInRange",function(){return w});var Y=k("./src/utils/logger.ts");function F(p,b){var M;try{M=new Event("addtrack")}catch(A){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=p,b.dispatchEvent(M)}function R(p,b){var M=p.mode;if(M==="disabled"&&(p.mode="hidden"),p.cues&&!p.cues.getCueById(b.id))try{if(p.addCue(b),!p.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(S){Y.logger.debug("[texttrack-utils]: "+S);var A=new self.TextTrackCue(b.startTime,b.endTime,b.text);A.id=b.id,p.addCue(A)}M==="disabled"&&(p.mode=M)}function W(p){var b=p.mode;if(b==="disabled"&&(p.mode="hidden"),p.cues)for(var M=p.cues.length;M--;)p.removeCue(p.cues[M]);b==="disabled"&&(p.mode=b)}function B(p,b,M){var A=p.mode;if(A==="disabled"&&(p.mode="hidden"),p.cues&&p.cues.length>0)for(var S=w(p.cues,b,M),x=0;x<S.length;x++)p.removeCue(S[x]);A==="disabled"&&(p.mode=A)}function P(p,b){if(b<p[0].startTime)return 0;var M=p.length-1;if(b>p[M].endTime)return-1;for(var A=0,S=M;A<=S;){var x=Math.floor((S+A)/2);if(b<p[x].startTime)S=x-1;else if(b>p[x].startTime&&A<M)A=x+1;else return x}return p[A].startTime-b<b-p[S].startTime?A:S}function w(p,b,M){var A=[],S=P(p,b);if(S>-1)for(var x=S,d=p.length;x<d;x++){var a=p[x];if(a.startTime>=b&&a.endTime<=M)A.push(a);else if(a.startTime>M)return A}return A}},"./src/utils/time-ranges.ts":function(ne,$,k){"use strict";k.r($);var Y={toString:function(R){for(var W="",B=R.length,P=0;P<B;P++)W+="["+R.start(P).toFixed(3)+","+R.end(P).toFixed(3)+"]";return W}};$.default=Y},"./src/utils/timescale-conversion.ts":function(ne,$,k){"use strict";k.r($),k.d($,"toTimescaleFromBase",function(){return F}),k.d($,"toTimescaleFromScale",function(){return R}),k.d($,"toMsFromMpegTsClock",function(){return W}),k.d($,"toMpegTsClockFromTimescale",function(){return B});var Y=9e4;function F(P,w,p,b){p===void 0&&(p=1),b===void 0&&(b=!1);var M=P*w*p;return b?Math.round(M):M}function R(P,w,p,b){return p===void 0&&(p=1),b===void 0&&(b=!1),F(P,w,1/p,b)}function W(P,w){return w===void 0&&(w=!1),F(P,1e3,1/Y,w)}function B(P,w){return w===void 0&&(w=1),F(P,Y,1/w)}},"./src/utils/typed-array.ts":function(ne,$,k){"use strict";k.r($),k.d($,"sliceUint8",function(){return Y});function Y(F,R,W){return Uint8Array.prototype.slice?F.slice(R,W):new Uint8Array(Array.prototype.slice.call(F,R,W))}},"./src/utils/vttcue.ts":function(ne,$,k){"use strict";k.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],F=["start","middle","end","left","right"];function R(p,b){if(typeof b!="string")return!1;if(!Array.isArray(p))return!1;var M=b.toLowerCase();return~p.indexOf(M)?M:!1}function W(p){return R(Y,p)}function B(p){return R(F,p)}function P(p){for(var b=arguments.length,M=new Array(b>1?b-1:0),A=1;A<b;A++)M[A-1]=arguments[A];for(var S=1;S<arguments.length;S++){var x=arguments[S];for(var d in x)p[d]=x[d]}return p}function w(p,b,M){var A=this,S={enumerable:!0};A.hasBeenReset=!1;var x="",d=!1,a=p,s=b,u=M,L=null,f="",v=!0,D="auto",T="start",g=50,c="middle",h=50,o="middle";Object.defineProperty(A,"id",P({},S,{get:function(){return x},set:function(E){x=""+E}})),Object.defineProperty(A,"pauseOnExit",P({},S,{get:function(){return d},set:function(E){d=!!E}})),Object.defineProperty(A,"startTime",P({},S,{get:function(){return a},set:function(E){if(typeof E!="number")throw new TypeError("Start time must be set to a number.");a=E,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",P({},S,{get:function(){return s},set:function(E){if(typeof E!="number")throw new TypeError("End time must be set to a number.");s=E,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",P({},S,{get:function(){return u},set:function(E){u=""+E,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",P({},S,{get:function(){return L},set:function(E){L=E,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",P({},S,{get:function(){return f},set:function(E){var m=W(E);if(m===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=m,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",P({},S,{get:function(){return v},set:function(E){v=!!E,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",P({},S,{get:function(){return D},set:function(E){if(typeof E!="number"&&E!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=E,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",P({},S,{get:function(){return T},set:function(E){var m=B(E);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");T=m,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",P({},S,{get:function(){return g},set:function(E){if(E<0||E>100)throw new Error("Position must be between 0 and 100.");g=E,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",P({},S,{get:function(){return c},set:function(E){var m=B(E);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",P({},S,{get:function(){return h},set:function(E){if(E<0||E>100)throw new Error("Size must be between 0 and 100.");h=E,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",P({},S,{get:function(){return o},set:function(E){var m=B(E);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");o=m,this.hasBeenReset=!0}})),A.displayState=void 0}return w.prototype.getCueAsHTML=function(){var p=self.WebVTT;return p.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"parseTimeStamp",function(){return R}),k.d($,"fixLineBreaks",function(){return b}),k.d($,"VTTParser",function(){return M});var Y=k("./src/utils/vttcue.ts"),F=function(){function A(){}var S=A.prototype;return S.decode=function(d,a){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},A}();function R(A){function S(d,a,s,u){return(d|0)*3600+(a|0)*60+(s|0)+parseFloat(u||0)}var x=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?S(x[2],x[3],0,x[4]):S(x[1],x[2],x[3],x[4]):null}var W=function(){function A(){this.values=Object.create(null)}var S=A.prototype;return S.set=function(d,a){!this.get(d)&&a!==""&&(this.values[d]=a)},S.get=function(d,a,s){return s?this.has(d)?this.values[d]:a[s]:this.has(d)?this.values[d]:a},S.has=function(d){return d in this.values},S.alt=function(d,a,s){for(var u=0;u<s.length;++u)if(a===s[u]){this.set(d,a);break}},S.integer=function(d,a){/^-?\d+$/.test(a)&&this.set(d,parseInt(a,10))},S.percent=function(d,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},A}();function B(A,S,x,d){var a=d?A.split(d):[A];for(var s in a){if(typeof a[s]!="string")continue;var u=a[s].split(x);if(u.length!==2)continue;var L=u[0],f=u[1];S(L,f)}}var P=new Y.default(0,0,""),w=P.align==="middle"?"middle":"center";function p(A,S,x){var d=A;function a(){var L=R(A);if(L===null)throw new Error("Malformed timestamp: "+d);return A=A.replace(/^[^\sa-zA-Z-]+/,""),L}function s(L,f){var v=new W;B(L,function(g,c){var h;switch(g){case"region":for(var o=x.length-1;o>=0;o--)if(x[o].id===c){v.set(g,x[o].region);break}break;case"vertical":v.alt(g,c,["rl","lr"]);break;case"line":h=c.split(","),v.integer(g,h[0]),v.percent(g,h[0])&&v.set("snapToLines",!1),v.alt(g,h[0],["auto"]),h.length===2&&v.alt("lineAlign",h[1],["start",w,"end"]);break;case"position":h=c.split(","),v.percent(g,h[0]),h.length===2&&v.alt("positionAlign",h[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":v.percent(g,c);break;case"align":v.alt(g,c,["start",w,"end","left","right"]);break}},/:/,/\s/),f.region=v.get("region",null),f.vertical=v.get("vertical","");var D=v.get("line","auto");D==="auto"&&P.line===-1&&(D=-1),f.line=D,f.lineAlign=v.get("lineAlign","start"),f.snapToLines=v.get("snapToLines",!0),f.size=v.get("size",100),f.align=v.get("align",w);var T=v.get("position","auto");T==="auto"&&P.position===50&&(T=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=T}function u(){A=A.replace(/^\s+/,"")}if(u(),S.startTime=a(),u(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);A=A.substr(3),u(),S.endTime=a(),u(),s(A,S)}function b(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var M=function(){function A(){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 S=A.prototype;return S.parse=function(d){var a=this;d&&(a.buffer+=a.decoder.decode(d,{stream:!0}));function s(){var T=a.buffer,g=0;for(T=b(T);g<T.length&&T[g]!=="\r"&&T[g]!==`
`;)++g;var c=T.substr(0,g);return T[g]==="\r"&&++g,T[g]===`
`&&++g,a.buffer=T.substr(g),c}function u(T){B(T,function(g,c){},/:/)}try{var L="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;L=s();var f=L.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var v=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;v?v=!1:L=s();switch(a.state){case"HEADER":/:/.test(L)?u(L):L||(a.state="ID");continue;case"NOTE":L||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){a.state="NOTE";break}if(!L)continue;if(a.cue=new Y.default(0,0,""),a.state="CUE",L.indexOf("-->")===-1){a.cue.id=L;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{p(L,a.cue,a.regionList)}catch(T){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=L.indexOf("-->")!==-1;if(!L||D&&(v=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=L}continue;case"BADCUE":L||(a.state="ID")}}}catch(T){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){d.onparsingerror&&d.onparsingerror(a)}return d.onflush&&d.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(ne,$,k){"use strict";k.r($),k.d($,"generateCueId",function(){return M}),k.d($,"parseWebVTT",function(){return S});var Y=k("./src/polyfills/number.ts"),F=k("./src/utils/vttparser.ts"),R=k("./src/demux/id3.ts"),W=k("./src/utils/timescale-conversion.ts"),B=k("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,w=function(d,a,s){return s===void 0&&(s=0),d.substr(s,a.length)===a},p=function(d){var a=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),L=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(a)||!Object(Y.isFiniteNumber)(s)||!Object(Y.isFiniteNumber)(u)||!Object(Y.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return a+=1e3*s,a+=60*1e3*u,a+=60*60*1e3*L,a},b=function(d){for(var a=5381,s=d.length;s;)a=a*33^d.charCodeAt(--s);return(a>>>0).toString()};function M(x,d,a){return b(x.toString())+b(d.toString())+b(a)}var A=function(d,a,s){var u=d[a],L=d[u.prevCC];if(!L||!L.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(f=L)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=u.start-L.start,u.new=!1,u=L,L=d[u.prevCC]}d.presentationOffset=s};function S(x,d,a,s,u,L,f,v){var D=new F.VTTParser,T=Object(R.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(P,`
`).split(`
`),g=[],c=Object(W.toMpegTsClockFromTimescale)(d,a),h="00:00.000",o=0,C=0,E,m=!0,O=!1;D.oncue=function(U){var j=s[u],K=s.ccOffset,I=(o-c)/9e4;if(j!=null&&j.new&&(C!==void 0?K=s.ccOffset=j.start:A(s,u,I)),I&&(K=I-s.presentationOffset),O){var N=U.endTime-U.startTime,X=Object(B.normalizePts)((U.startTime+K-C)*9e4,L*9e4)/9e4;U.startTime=X,U.endTime=X+N}var q=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(q)),U.id||(U.id=M(U.startTime,U.endTime,q)),U.endTime>0&&g.push(U)},D.onparsingerror=function(U){E=U},D.onflush=function(){if(E){v(E);return}f(g)},T.forEach(function(U){if(m)if(w(U,"X-TIMESTAMP-MAP=")){m=!1,O=!0,U.substr(16).split(",").forEach(function(j){w(j,"LOCAL:")?h=j.substr(6):w(j,"MPEGTS:")&&(o=parseInt(j.substr(7)))});try{C=p(h)/1e3}catch(j){O=!1,E=j}return}else U===""&&(m=!1);D.parse(U+`
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(ne,$,k){"use strict";k.r($);var Y=k("./src/utils/logger.ts"),F=k("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,W=function(){function B(w){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=w?w.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var P=B.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var p=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),p&&(p.onreadystatechange=null,p.onprogress=null,p.readyState!==4&&(this.stats.aborted=!0,p.abort()))},P.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(p,b,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=p,this.config=b,this.callbacks=M,this.retryDelay=b.retryDelay,this.loadInternal()},P.loadInternal=function(){var p=this.config,b=this.context;if(!p)return;var M=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var S=this.xhrSetup;try{if(S)try{S(M,b.url)}catch(a){M.open("GET",b.url,!0),S(M,b.url)}M.readyState||M.open("GET",b.url,!0);var x=this.context.headers;if(x)for(var d in x)M.setRequestHeader(d,x[d])}catch(a){this.callbacks.onError({code:M.status,text:a.message},b,M);return}b.rangeEnd&&M.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout),M.send()},P.readystatechange=function(){var p=this.context,b=this.loader,M=this.stats;if(!p||!b)return;var A=b.readyState,S=this.config;if(M.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),A===4){b.onreadystatechange=null,b.onprogress=null;var x=b.status;if(x>=200&&x<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var d,a;if(p.responseType==="arraybuffer"?(d=b.response,a=d.byteLength):(d=b.responseText,a=d.length),M.loaded=M.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(M,p,d,b),!this.callbacks)return;var u={url:b.responseURL,data:d};this.callbacks.onSuccess(u,M,p,b)}else M.retry>=S.maxRetry||x>=400&&x<499?(Y.logger.error(x+" while loading "+p.url),this.callbacks.onError({code:x,text:b.statusText},p,b)):(Y.logger.warn(x+" while loading "+p.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,S.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},P.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var p=this.callbacks;p&&(this.abortInternal(),p.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(p){var b=this.stats;b.loaded=p.loaded,p.lengthComputable&&(b.total=p.total)},P.getCacheAge=function(){var p=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");p=b?parseFloat(b):null}return p},B}();$.default=W}}).default})},vHTk:function(lt,$e,ie){lt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(lt,$e){function ie(){this.buffer=new Array,this.length=0}ie.prototype={get:function(ne){var $=Math.floor(ne/8);return(this.buffer[$]>>>7-ne%8&1)==1},put:function(ne,$){for(var k=0;k<$;k++)this.putBit((ne>>>$-k-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(ne){var $=Math.floor(this.length/8);this.buffer.length<=$&&this.buffer.push(0),ne&&(this.buffer[$]|=128>>>this.length%8),this.length++}},lt.exports=ie},wzkS:function(lt,$e,ie){"use strict";ie.d($e,"c",function(){return F}),ie.d($e,"b",function(){return R}),ie.d($e,"d",function(){return W}),ie.d($e,"a",function(){return P}),ie.d($e,"e",function(){return w});var ne=ie("9og8"),$=ie("WmNS"),k=ie.n($),Y=ie("ErOA");function F(p){return Object(Y.c)("libraries/".concat(p,".json"))}function R(){return Object(Y.c)("library_tags.json")}function W(p){return B.apply(this,arguments)}function B(){return B=Object(ne.a)(k.a.mark(function p(b){var M;return k.a.wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,Object(Y.b)("attachments/".concat(b,".json"));case 2:return M=S.sent,S.abrupt("return",M.status===0);case 4:case"end":return S.stop()}},p)})),B.apply(this,arguments)}function P(p){return Object(Y.f)("libraries.json",p)}function w(p,b){return Object(Y.g)("libraries/".concat(p,".json"),b)}},y5JW:function(lt,$e,ie){"use strict";ie.d($e,"c",function(){return x}),ie.d($e,"a",function(){return d});var ne=ie("DZo9"),$=ie("8z0m"),k=ie("+L6B"),Y=ie("2/Rp"),F=ie("9og8"),R=ie("k1fw"),W=ie("oBTY"),B=ie("miYZ"),P=ie("tsqr"),w=ie("WmNS"),p=ie.n(w),b=ie("q1tI"),M=ie.n(b),A=ie("m3rI"),S=ie("wzkS"),x="\u3000\u3000";function d(a){var s=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,u)).toFixed(1)+" "+s[u]}$e.b=function(a){var s=a.value,u=s===void 0?[]:s,L=a.action,f=a.onChange,v=a.className,D=a.maxSize,T=D===void 0?150:D,g=a.title,c=g===void 0?"\u6587\u4EF6\u4E0A\u4F20":g,h=a.accept,o=h===void 0?null:h,C={multiple:!1,fileList:u,accept:o,withCredentials:!0,beforeUpload:function(O){var U=O.size/1024/1024;return U<T?!0:(P.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(T,"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(A.a.API_SERVER,"/api/attachments.json"),onChange:function(O){var U=Object(W.a)(O.fileList);U=U.map(function(j){return j.name.indexOf(x)===-1&&(j.name="".concat(j.name).concat(x).concat(d(j.size))),Object(R.a)({},j)}),f(U)},onRemove:function(){var m=Object(F.a)(p.a.mark(function U(j){var K,I,N;return p.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(K=j.size/1024/1024,!(j.status==="uploading")){q.next=3;break}return q.abrupt("return",!0);case 3:if(K<T){q.next=7;break}return q.abrupt("return",!0);case 7:if(I=j.response?j.response.id:j.uid,!I){q.next=15;break}return q.next=11,Object(S.d)(j.response?j.response.id:j.id);case 11:return N=q.sent,q.abrupt("return",N);case 15:return q.abrupt("return",!0);case 16:case"end":return q.stop()}},U)}));function O(U){return m.apply(this,arguments)}return O}()};function E(m){m.preventDefault(),m.stopPropagation()}return M.a.createElement("div",{className:"single-upload ".concat(v||"")},M.a.createElement($.a,C,M.a.createElement(Y.a,{type:"primary",title:u.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:u.length>0,ghost:!0},c),M.a.createElement("span",{onClick:E,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",T,"M) ")))}}}]);